commit 3e27fc399ae4fbeb2e2344a1a5437cf23e02bc78 Author: huojin\hj <982011> Date: Fri Jul 25 11:22:48 2025 +0800 项目初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..792671a --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ + +.idea/ +youchain-common/target/ +youchain-generator/target/ +youchain-logging/target/ +youchain-system/target/ +youchain-tongyong/target/ +youchain-tools/target/ +application.pid diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca38718 --- /dev/null +++ b/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "{}" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright 2019-2020 Zheng Jie + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4aba1b0 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +新框架基础模板-后端 \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5041db7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,253 @@ + + + 4.0.0 + + com.youchain + youchain + pom + 2.6 + + + youchain-common + youchain-logging + youchain-system + youchain-tools + youchain-generator + youchain-tongyong + + + ELADMIN 后台管理 + https://eladmin.vip + + + org.springframework.boot + spring-boot-starter-parent + 2.5.4 + + + + 2.17.0 + 1.2.9 + UTF-8 + UTF-8 + 1.8 + 1.16 + 2.9.2 + 1.2.83 + 1.2.8 + 2.11.1 + 1.4.2.Final + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + org.springframework.boot + spring-boot-starter-web + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.boot + spring-boot-starter-cache + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + org.apache.commons + commons-pool2 + ${commons-pool2.version} + + + org.apache.commons + commons-lang3 + + + + + org.bgee.log4jdbc-log4j2 + log4jdbc-log4j2-jdbc4.1 + ${log4jdbc.version} + + + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 3.0.3 + + + + + + mysql + mysql-connector-java + runtime + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + + net.dreamlu + mica-ip2region + 2.6.3 + + + + + org.projectlombok + lombok + true + + + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + xerces + xercesImpl + 2.12.2 + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + javax.inject + javax.inject + 1 + + + + + com.github.whvcse + easy-captcha + 1.6.2 + + + + org.apache.commons + commons-text + 1.10.0 + + + + + nl.basjes.parse.useragent + yauaa + 6.11 + + + + + cn.idev.excel + fastexcel + 1.2.0 + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + diff --git a/youchain-common/pom.xml b/youchain-common/pom.xml new file mode 100644 index 0000000..630c999 --- /dev/null +++ b/youchain-common/pom.xml @@ -0,0 +1,26 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + 5.8.21 + + + youchain-common + 公共模块 + + + + + cn.hutool + hutool-all + ${hutool.version} + + + \ No newline at end of file diff --git a/youchain-common/src/main/java/com/youchain/annotation/AnonymousAccess.java b/youchain-common/src/main/java/com/youchain/annotation/AnonymousAccess.java new file mode 100644 index 0000000..2936886 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/AnonymousAccess.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.annotation; + +import java.lang.annotation.*; + +/** + * @author jacky + * 用于标记匿名访问方法 + */ +@Inherited +@Documented +@Target({ElementType.METHOD,ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface AnonymousAccess { + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/DataPermission.java b/youchain-common/src/main/java/com/youchain/annotation/DataPermission.java new file mode 100644 index 0000000..f99c6c0 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/DataPermission.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + *

+ * 用于判断是否过滤数据权限 + * 1、如果没有用到 @OneToOne 这种关联关系,只需要填写 fieldName [参考:DeptQueryCriteria.class] + * 2、如果用到了 @OneToOne ,fieldName 和 joinName 都需要填写,拿UserQueryCriteria.class举例: + * 应该是 @DataPermission(joinName = "dept", fieldName = "id") + *

+ * @author Liu Xue + * @website https://eladmin.vip + * @date 2020-05-07 + **/ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface DataPermission { + + /** + * Entity 中的字段名称 + */ + String fieldName() default ""; + + /** + * Entity 中与部门关联的字段名称 + */ + String joinName() default ""; +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/Limit.java b/youchain-common/src/main/java/com/youchain/annotation/Limit.java new file mode 100644 index 0000000..f44ae97 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/Limit.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.annotation; + +import com.youchain.aspect.LimitType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author jacky + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Limit { + + // 资源名称,用于描述接口功能 + String name() default ""; + + // 资源 key + String key() default ""; + + // key prefix + String prefix() default ""; + + // 时间的,单位秒 + int period(); + + // 限制访问次数 + int count(); + + // 限制类型 + LimitType limitType() default LimitType.CUSTOMER; + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/Query.java b/youchain-common/src/main/java/com/youchain/annotation/Query.java new file mode 100644 index 0000000..9701cb2 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/Query.java @@ -0,0 +1,104 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Liu Xue + * @date 2019-6-4 13:52:30 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Query { + + // Dong ZhaoYang 2017/8/7 基本对象的属性名 + String propName() default ""; + // Dong ZhaoYang 2017/8/7 查询方式 + Type type() default Type.EQUAL; + + /** + * 连接查询的属性名,如User类中的dept + */ + String joinName() default ""; + + /** + * 默认左连接 + */ + Join join() default Join.LEFT; + + /** + * 多字段模糊搜索,仅支持String类型字段,多个用逗号隔开, 如@Query(blurry = "email,username") + */ + String blurry() default ""; + + enum Type { + // jie 2019/6/4 相等 + EQUAL + // Dong ZhaoYang 2017/8/7 大于等于 + , GREATER_THAN + // Dong ZhaoYang 2017/8/7 小于等于 + , LESS_THAN + // Dong ZhaoYang 2017/8/7 大于 + , GREATER_THAN_NQ + // Dong ZhaoYang 2017/8/7 中模糊查询 + , INNER_LIKE + // Dong ZhaoYang 2017/8/7 左模糊查询 + , LEFT_LIKE + // Dong ZhaoYang 2017/8/7 右模糊查询 + , RIGHT_LIKE + // Dong ZhaoYang 2017/8/7 小于 + , LESS_THAN_NQ + // jie 2019/6/4 包含 + , IN + // 不包含 + , NOT_IN + // 不等于 + ,NOT_EQUAL + // between + ,BETWEEN + // 不为空 + ,NOT_NULL + // 为空 + ,IS_NULL + //两个属性 相等 + ,EQUAL_2 + // 两个属性 大于等于 + , GREATER_THAN_2 + // 两个属性 小于等于 + , LESS_THAN_2 + // 两个属性 大于等于 + , GREATER_THAN_NQ_2 + // 两个属性 小于等于 + , LESS_THAN_NQ_2 + // 两个属性 不相等等于 + , NOT_EQUAL_2 + } + + /** + * @author Liu Xue + * 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询 + */ + enum Join { + /** jie 2019-6-4 13:18:30 */ + LEFT, RIGHT, INNER + } + +} + diff --git a/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousDeleteMapping.java b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousDeleteMapping.java new file mode 100644 index 0000000..b4ad330 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousDeleteMapping.java @@ -0,0 +1,91 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.annotation.rest; + +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; + +import com.youchain.annotation.AnonymousAccess; +import org.springframework.core.annotation.AliasFor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Annotation for mapping HTTP {@code DELETE} requests onto specific handler + * methods. + * 支持匿名访问 DeleteMapping + * + * @author liaojinlong + * @see AnonymousGetMapping + * @see AnonymousPostMapping + * @see AnonymousPutMapping + * @see AnonymousPatchMapping + * @see RequestMapping + */ +@AnonymousAccess +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@RequestMapping(method = RequestMethod.DELETE) +public @interface AnonymousDeleteMapping { + + /** + * Alias for {@link RequestMapping#name}. + */ + @AliasFor(annotation = RequestMapping.class) + String name() default ""; + + /** + * Alias for {@link RequestMapping#value}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] value() default {}; + + /** + * Alias for {@link RequestMapping#path}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] path() default {}; + + /** + * Alias for {@link RequestMapping#params}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] params() default {}; + + /** + * Alias for {@link RequestMapping#headers}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] headers() default {}; + + /** + * Alias for {@link RequestMapping#consumes}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] consumes() default {}; + + /** + * Alias for {@link RequestMapping#produces}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] produces() default {}; + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousGetMapping.java b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousGetMapping.java new file mode 100644 index 0000000..32f1e25 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousGetMapping.java @@ -0,0 +1,90 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.annotation.rest; + +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; + +import com.youchain.annotation.AnonymousAccess; +import org.springframework.core.annotation.AliasFor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Annotation for mapping HTTP {@code GET} requests onto specific handler + * methods. + *

+ * 支持匿名访问 GetMapping + * + * @author liaojinlong + * @see RequestMapping + */ +@AnonymousAccess +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@RequestMapping(method = RequestMethod.GET) +public @interface AnonymousGetMapping { + + /** + * Alias for {@link RequestMapping#name}. + */ + @AliasFor(annotation = RequestMapping.class) + String name() default ""; + + /** + * Alias for {@link RequestMapping#value}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] value() default {}; + + /** + * Alias for {@link RequestMapping#path}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] path() default {}; + + /** + * Alias for {@link RequestMapping#params}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] params() default {}; + + /** + * Alias for {@link RequestMapping#headers}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] headers() default {}; + + /** + * Alias for {@link RequestMapping#consumes}. + * + * @since 4.3.5 + */ + @AliasFor(annotation = RequestMapping.class) + String[] consumes() default {}; + + /** + * Alias for {@link RequestMapping#produces}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] produces() default {}; + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPatchMapping.java b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPatchMapping.java new file mode 100644 index 0000000..40cdba1 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPatchMapping.java @@ -0,0 +1,91 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.annotation.rest; + +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; + +import com.youchain.annotation.AnonymousAccess; +import org.springframework.core.annotation.AliasFor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Annotation for mapping HTTP {@code PATCH} requests onto specific handler + * methods. + * * 支持匿名访问 PatchMapping + * + * @author liaojinlong + * @see AnonymousGetMapping + * @see AnonymousPostMapping + * @see AnonymousPutMapping + * @see AnonymousDeleteMapping + * @see RequestMapping + */ +@AnonymousAccess +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@RequestMapping(method = RequestMethod.PATCH) +public @interface AnonymousPatchMapping { + + /** + * Alias for {@link RequestMapping#name}. + */ + @AliasFor(annotation = RequestMapping.class) + String name() default ""; + + /** + * Alias for {@link RequestMapping#value}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] value() default {}; + + /** + * Alias for {@link RequestMapping#path}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] path() default {}; + + /** + * Alias for {@link RequestMapping#params}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] params() default {}; + + /** + * Alias for {@link RequestMapping#headers}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] headers() default {}; + + /** + * Alias for {@link RequestMapping#consumes}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] consumes() default {}; + + /** + * Alias for {@link RequestMapping#produces}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] produces() default {}; + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPostMapping.java b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPostMapping.java new file mode 100644 index 0000000..c92ed1f --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPostMapping.java @@ -0,0 +1,91 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.annotation.rest; + +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; + +import com.youchain.annotation.AnonymousAccess; +import org.springframework.core.annotation.AliasFor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Annotation for mapping HTTP {@code POST} requests onto specific handler + * methods. + * 支持匿名访问 PostMapping + * + * @author liaojinlong + * @see AnonymousGetMapping + * @see AnonymousPostMapping + * @see AnonymousPutMapping + * @see AnonymousDeleteMapping + * @see RequestMapping + */ +@AnonymousAccess +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@RequestMapping(method = RequestMethod.POST) +public @interface AnonymousPostMapping { + + /** + * Alias for {@link RequestMapping#name}. + */ + @AliasFor(annotation = RequestMapping.class) + String name() default ""; + + /** + * Alias for {@link RequestMapping#value}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] value() default {}; + + /** + * Alias for {@link RequestMapping#path}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] path() default {}; + + /** + * Alias for {@link RequestMapping#params}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] params() default {}; + + /** + * Alias for {@link RequestMapping#headers}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] headers() default {}; + + /** + * Alias for {@link RequestMapping#consumes}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] consumes() default {}; + + /** + * Alias for {@link RequestMapping#produces}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] produces() default {}; + +} diff --git a/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPutMapping.java b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPutMapping.java new file mode 100644 index 0000000..6ff1827 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/annotation/rest/AnonymousPutMapping.java @@ -0,0 +1,91 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.annotation.rest; + +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; + +import com.youchain.annotation.AnonymousAccess; +import org.springframework.core.annotation.AliasFor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Annotation for mapping HTTP {@code PUT} requests onto specific handler + * methods. + * * 支持匿名访问 PutMapping + * + * @author liaojinlong + * @see AnonymousGetMapping + * @see AnonymousPostMapping + * @see AnonymousPutMapping + * @see AnonymousDeleteMapping + * @see RequestMapping + */ +@AnonymousAccess +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@RequestMapping(method = RequestMethod.PUT) +public @interface AnonymousPutMapping { + + /** + * Alias for {@link RequestMapping#name}. + */ + @AliasFor(annotation = RequestMapping.class) + String name() default ""; + + /** + * Alias for {@link RequestMapping#value}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] value() default {}; + + /** + * Alias for {@link RequestMapping#path}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] path() default {}; + + /** + * Alias for {@link RequestMapping#params}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] params() default {}; + + /** + * Alias for {@link RequestMapping#headers}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] headers() default {}; + + /** + * Alias for {@link RequestMapping#consumes}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] consumes() default {}; + + /** + * Alias for {@link RequestMapping#produces}. + */ + @AliasFor(annotation = RequestMapping.class) + String[] produces() default {}; + +} diff --git a/youchain-common/src/main/java/com/youchain/aspect/LimitAspect.java b/youchain-common/src/main/java/com/youchain/aspect/LimitAspect.java new file mode 100644 index 0000000..ca21871 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/aspect/LimitAspect.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.aspect; + +import com.google.common.collect.ImmutableList; +import com.youchain.utils.RequestHolder; +import com.youchain.utils.StringUtils; +import com.youchain.annotation.Limit; +import com.youchain.exception.BadRequestException; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.core.script.RedisScript; +import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; + +/** + * @author / + */ +@Aspect +@Component +public class LimitAspect { + + private final RedisTemplate redisTemplate; + private static final Logger logger = LoggerFactory.getLogger(LimitAspect.class); + + public LimitAspect(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + @Pointcut("@annotation(com.youchain.annotation.Limit)") + public void pointcut() { + } + + @Around("pointcut()") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method signatureMethod = signature.getMethod(); + Limit limit = signatureMethod.getAnnotation(Limit.class); + LimitType limitType = limit.limitType(); + String key = limit.key(); + if (StringUtils.isEmpty(key)) { + if (limitType == LimitType.IP) { + key = StringUtils.getIp(request); + } else { + key = signatureMethod.getName(); + } + } + + ImmutableList keys = ImmutableList.of(StringUtils.join(limit.prefix(), "_", key, "_", request.getRequestURI().replace("/","_"))); + + String luaScript = buildLuaScript(); + RedisScript redisScript = new DefaultRedisScript<>(luaScript, Number.class); + Number count = redisTemplate.execute(redisScript, keys, limit.count(), limit.period()); + if (null != count && count.intValue() <= limit.count()) { + logger.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name()); + return joinPoint.proceed(); + } else { + throw new BadRequestException("访问次数受限制"); + } + } + + /** + * 限流脚本 + */ + private String buildLuaScript() { + return "local c" + + "\nc = redis.call('get',KEYS[1])" + + "\nif c and tonumber(c) > tonumber(ARGV[1]) then" + + "\nreturn c;" + + "\nend" + + "\nc = redis.call('incr',KEYS[1])" + + "\nif tonumber(c) == 1 then" + + "\nredis.call('expire',KEYS[1],ARGV[2])" + + "\nend" + + "\nreturn c;"; + } +} diff --git a/youchain-common/src/main/java/com/youchain/aspect/LimitType.java b/youchain-common/src/main/java/com/youchain/aspect/LimitType.java new file mode 100644 index 0000000..4ac17eb --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/aspect/LimitType.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.aspect; + +/** + * 限流枚举 + * @author / + */ +public enum LimitType { + // 默认 + CUSTOMER, + // by ip addr + IP +} diff --git a/youchain-common/src/main/java/com/youchain/base/BaseDTO.java b/youchain-common/src/main/java/com/youchain/base/BaseDTO.java new file mode 100644 index 0000000..fd2f5a1 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/base/BaseDTO.java @@ -0,0 +1,40 @@ +package com.youchain.base; + +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +/** + * @author Liu Xue + * @date 2019年10月24日20:48:53 + */ +@Getter +@Setter +public class BaseDTO implements Serializable { + + private String createBy; + + private String updateBy; + + private Timestamp createTime; + + private Timestamp updateTime; + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + Field[] fields = this.getClass().getDeclaredFields(); + try { + for (Field f : fields) { + f.setAccessible(true); + builder.append(f.getName(), f.get(this)).append("\n"); + } + } catch (Exception e) { + builder.append("toString builder encounter an error"); + } + return builder.toString(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/base/BaseEntity.java b/youchain-common/src/main/java/com/youchain/base/BaseEntity.java new file mode 100644 index 0000000..8dc15ad --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/base/BaseEntity.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.base; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +/** + * 通用字段, is_del 根据需求自行添加 + * @author Liu Xue + * @Date 2019年10月24日20:46:32 + */ +@Getter +@Setter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public class BaseEntity implements Serializable { + + @CreatedBy + @Column(name = "create_by", updatable = false) + @ApiModelProperty(value = "创建人", hidden = true) + private String createBy; + + @LastModifiedBy + @Column(name = "update_by") + @ApiModelProperty(value = "更新人", hidden = true) + private String updateBy; + + @CreationTimestamp + @Column(name = "create_time", updatable = false) + @ApiModelProperty(value = "创建时间", hidden = true) + private Timestamp createTime; + + @UpdateTimestamp + @Column(name = "update_time") + @ApiModelProperty(value = "更新时间", hidden = true) + private Timestamp updateTime; + + /* 分组校验 */ + public @interface Create {} + + /* 分组校验 */ + public @interface Update {} + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + Field[] fields = this.getClass().getDeclaredFields(); + try { + for (Field f : fields) { + f.setAccessible(true); + builder.append(f.getName(), f.get(this)).append("\n"); + } + } catch (Exception e) { + builder.append("toString builder encounter an error"); + } + return builder.toString(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/base/BaseMapper.java b/youchain-common/src/main/java/com/youchain/base/BaseMapper.java new file mode 100644 index 0000000..6ab4c35 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/base/BaseMapper.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.base; + +import java.util.List; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +public interface BaseMapper { + + /** + * DTO转Entity + * @param dto / + * @return / + */ + E toEntity(D dto); + + /** + * Entity转DTO + * @param entity / + * @return / + */ + D toDto(E entity); + + /** + * DTO集合转Entity集合 + * @param dtoList / + * @return / + */ + List toEntity(List dtoList); + + /** + * Entity集合转DTO集合 + * @param entityList / + * @return / + */ + List toDto(List entityList); +} diff --git a/youchain-common/src/main/java/com/youchain/config/AuditorConfig.java b/youchain-common/src/main/java/com/youchain/config/AuditorConfig.java new file mode 100644 index 0000000..4347745 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/AuditorConfig.java @@ -0,0 +1,45 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import com.youchain.utils.SecurityUtils; +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; +import java.util.Optional; + +/** + * @description : 设置审计 + * @author : Dong ZhaoYang + * @date : 2019/10/28 + */ +@Component("auditorAware") +public class AuditorConfig implements AuditorAware { + + /** + * 返回操作员标志信息 + * + * @return / + */ + @Override + public Optional getCurrentAuditor() { + try { + // 这里应根据实际业务情况获取具体信息 + return Optional.of(SecurityUtils.getCurrentUsername()); + }catch (Exception ignored){} + // 用户定时任务,或者无Token调用的情况 + return Optional.of("System"); + } +} diff --git a/youchain-common/src/main/java/com/youchain/config/ElAdminProperties.java b/youchain-common/src/main/java/com/youchain/config/ElAdminProperties.java new file mode 100644 index 0000000..a37e4d9 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/ElAdminProperties.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author Liu Xue + * @description + * @date 2021-11-22 + **/ +@Data +@Component +public class ElAdminProperties { + + public static Boolean ipLocal; + + @Value("${ip.local-parsing}") + public void setIpLocal(Boolean ipLocal) { + ElAdminProperties.ipLocal = ipLocal; + } +} diff --git a/youchain-common/src/main/java/com/youchain/config/ElPermissionConfig.java b/youchain-common/src/main/java/com/youchain/config/ElPermissionConfig.java new file mode 100644 index 0000000..372d4da --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/ElPermissionConfig.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import com.youchain.utils.SecurityUtils; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + */ +@Service(value = "el") +public class ElPermissionConfig { + + public Boolean check(String ...permissions){ + // 获取当前用户的所有权限 + List elPermissions = SecurityUtils.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); + // 判断当前用户的所有权限是否包含接口上定义的权限 + return elPermissions.contains("admin") || Arrays.stream(permissions).anyMatch(elPermissions::contains); + } +} diff --git a/youchain-common/src/main/java/com/youchain/config/FileProperties.java b/youchain-common/src/main/java/com/youchain/config/FileProperties.java new file mode 100644 index 0000000..f24b4e1 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/FileProperties.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import com.youchain.utils.ElAdminConstant; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * @author Liu Xue + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "file") +public class FileProperties { + + /** 文件大小限制 */ + private Long maxSize; + + /** 头像大小限制 */ + private Long avatarMaxSize; + + private ElPath mac; + + private ElPath linux; + + private ElPath windows; + + public ElPath getPath(){ + String os = System.getProperty("os.name"); + if(os.toLowerCase().startsWith(ElAdminConstant.WIN)) { + return windows; + } else if(os.toLowerCase().startsWith(ElAdminConstant.MAC)){ + return mac; + } + return linux; + } + + @Data + public static class ElPath{ + + private String path; + + private String avatar; + } +} diff --git a/youchain-common/src/main/java/com/youchain/config/RedisConfig.java b/youchain-common/src/main/java/com/youchain/config/RedisConfig.java new file mode 100644 index 0000000..06f454e --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/RedisConfig.java @@ -0,0 +1,229 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import cn.hutool.core.lang.Assert; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.Cache; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.CacheErrorHandler; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.RedisSerializer; +import reactor.util.annotation.Nullable; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; + + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Slf4j +@Configuration +@EnableCaching +@ConditionalOnClass(RedisOperations.class) +@EnableConfigurationProperties(RedisProperties.class) +public class RedisConfig extends CachingConfigurerSupport { + + /** + * 设置 redis 数据默认过期时间,默认2小时 + * 设置@cacheable 序列化方式 + */ + @Bean + public RedisCacheConfiguration redisCacheConfiguration(){ + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); + RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig(); + configuration = configuration.serializeValuesWith(RedisSerializationContext. + SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofHours(2)); + return configuration; + } + + @SuppressWarnings("all") + @Bean(name = "redisTemplate") + @ConditionalOnMissingBean(name = "redisTemplate") + public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate template = new RedisTemplate<>(); + //序列化 + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); + // value值的序列化采用fastJsonRedisSerializer + template.setValueSerializer(fastJsonRedisSerializer); + template.setHashValueSerializer(fastJsonRedisSerializer); + // fastjson 升级到 1.2.83 后需要指定序列化白名单 + ParserConfig.getGlobalInstance().addAccept("com.youchain.domain"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.service.dto"); + ParserConfig.getGlobalInstance().addAccept("com.youchain"); + + + // 模块内的实体类 + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.mnt.domain"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.quartz.domain"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.system.domain"); + // 模块内的 Dto + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.mnt.service.dto"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.quartz.service.dto"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.security.service.dto"); + ParserConfig.getGlobalInstance().addAccept("com.youchain.modules.system.service.dto"); + // key的序列化采用StringRedisSerializer + template.setKeySerializer(new StringRedisSerializer()); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setConnectionFactory(redisConnectionFactory); + return template; + } + + /** + * 自定义缓存key生成策略,默认将使用该策略 + */ + @Bean + @Override + public KeyGenerator keyGenerator() { + return (target, method, params) -> { + Map container = new HashMap<>(8); + Class targetClassClass = target.getClass(); + // 类地址 + container.put("class",targetClassClass.toGenericString()); + // 方法名称 + container.put("methodName",method.getName()); + // 包名称 + container.put("package",targetClassClass.getPackage()); + // 参数列表 + for (int i = 0; i < params.length; i++) { + container.put(String.valueOf(i),params[i]); + } + // 转为JSON字符串 + String jsonString = JSON.toJSONString(container); + // 做SHA256 Hash计算,得到一个SHA256摘要作为Key + return DigestUtils.sha256Hex(jsonString); + }; + } + + @Bean + @Override + public CacheErrorHandler errorHandler() { + // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 + log.info("初始化 -> [{}]", "Redis CacheErrorHandler"); + return new CacheErrorHandler() { + @Override + public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { + log.error("Redis occur handleCacheGetError:key -> [{}]", key, e); + } + + @Override + public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { + log.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e); + } + + @Override + public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { + log.error("Redis occur handleCacheEvictError:key -> [{}]", key, e); + } + + @Override + public void handleCacheClearError(RuntimeException e, Cache cache) { + log.error("Redis occur handleCacheClearError:", e); + } + }; + } + +} + +/** + * Value 序列化 + * + * @author / + * @param + */ +@Slf4j + class FastJsonRedisSerializer implements RedisSerializer { + + private final Class clazz; + + FastJsonRedisSerializer(Class clazz) { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) { + if (t == null) { + return new byte[0]; + } + return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(StandardCharsets.UTF_8); + } + + @Override + public T deserialize(byte[] bytes) { + if (bytes == null || bytes.length <= 0) { + return null; + } + String str = new String(bytes, StandardCharsets.UTF_8); + return JSON.parseObject(str, clazz); + } + +} + +/** + * 重写序列化器 + * + * @author / + */ +class StringRedisSerializer implements RedisSerializer { + + private final Charset charset; + + StringRedisSerializer() { + this(StandardCharsets.UTF_8); + } + + private StringRedisSerializer(Charset charset) { + Assert.notNull(charset, "Charset must not be null!"); + this.charset = charset; + } + + @Override + public String deserialize(byte[] bytes) { + return (bytes == null ? null : new String(bytes, charset)); + } + + @Override + public @Nullable byte[] serialize(Object object) { + String string = JSON.toJSONString(object); + + if (org.apache.commons.lang3.StringUtils.isBlank(string)) { + return null; + } + string = string.replace("\"", ""); + return string.getBytes(charset); + } +} diff --git a/youchain-common/src/main/java/com/youchain/config/RsaProperties.java b/youchain-common/src/main/java/com/youchain/config/RsaProperties.java new file mode 100644 index 0000000..2b8c27e --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/RsaProperties.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author Liu Xue + * @website https://eladmin.vip + * @description + * @date 2020-05-18 + **/ +@Data +@Component +public class RsaProperties { + public static String licenseKey; + public static String privateKey; + + @Value("${rsa.private_key}") + public void setPrivateKey(String privateKey) { + RsaProperties.privateKey = privateKey; + } + + @Value("${rsa.licenseKey}") + public void setLicenseKey(String privateKey) { + RsaProperties.licenseKey = privateKey; + } +} \ No newline at end of file diff --git a/youchain-common/src/main/java/com/youchain/config/SwaggerConfig.java b/youchain-common/src/main/java/com/youchain/config/SwaggerConfig.java new file mode 100644 index 0000000..0240bdb --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/config/SwaggerConfig.java @@ -0,0 +1,152 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import cn.hutool.core.collection.CollUtil; +import com.fasterxml.classmate.TypeResolver; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.data.domain.Pageable; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.schema.AlternateTypeRule; +import springfox.documentation.schema.AlternateTypeRuleConvention; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; +import static springfox.documentation.schema.AlternateTypeRules.newRule; + +/** + * api页面 /doc.html + * @author Liu Xue + * @date 2018-11-23 + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + + @Value("${jwt.header}") + private String tokenHeader; + + @Value("${swagger.enabled}") + private Boolean enabled; + + @Bean + @SuppressWarnings("all") + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .enable(enabled) + .pathMapping("/") + .apiInfo(apiInfo()) + .select() + .paths(PathSelectors.regex("^(?!/error).*")) + .paths(PathSelectors.any()) + .build() + //添加登陆认证 + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .description("后台管理") + .title("接口文档") + .version("2.6") + .build(); + } + + private List securitySchemes() { + //设置请求头信息 + List securitySchemes = new ArrayList<>(); + ApiKey apiKey = new ApiKey(tokenHeader, tokenHeader, "header"); + securitySchemes.add(apiKey); + return securitySchemes; + } + + private List securityContexts() { + //设置需要登录认证的路径 + List securityContexts = new ArrayList<>(); + // ^(?!auth).*$ 表示所有包含auth的接口不需要使用securitySchemes即不需要带token + // ^标识开始 ()里是一子表达式 ?!/auth表示匹配不是/auth的位置,匹配上则添加请求头,注意路径已/开头 .表示任意字符 *表示前面的字符匹配多次 $标识结束 + securityContexts.add(getContextByPath()); + return securityContexts; + } + + private SecurityContext getContextByPath() { + return SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o->o.requestMappingPattern().matches("^(?!/auth).*$")) + .build(); + } + + private List defaultAuth() { + List securityReferences = new ArrayList<>(); + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + securityReferences.add(new SecurityReference(tokenHeader, authorizationScopes)); + return securityReferences; + } +} + +/** + * 将Pageable转换展示在swagger中 + */ +@Configuration +class SwaggerDataConfig { + + @Bean + public AlternateTypeRuleConvention pageableConvention(final TypeResolver resolver) { + return new AlternateTypeRuleConvention() { + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + + @Override + public List rules() { + return CollUtil.newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class))); + } + }; + } + + @ApiModel + @Data + private static class Page { + @ApiModelProperty("页码 (0..N)") + private Integer page; + + @ApiModelProperty("每页显示的数目") + private Integer size; + + @ApiModelProperty("以下列格式排序标准:property[,asc | desc]。 默认排序顺序为升序。 支持多种排序条件:如:id,asc") + private List sort; + } +} diff --git a/youchain-common/src/main/java/com/youchain/exception/BadConfigurationException.java b/youchain-common/src/main/java/com/youchain/exception/BadConfigurationException.java new file mode 100644 index 0000000..08fb74a --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/BadConfigurationException.java @@ -0,0 +1,98 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception; + +/** + * 统一关于错误配置信息 异常 + * + * @author: liaojinlong + * @date: 2020/6/10 18:06 + */ +public class BadConfigurationException extends RuntimeException { + /** + * Constructs a new runtime exception with {@code null} as its + * detail message. The cause is not initialized, and may subsequently be + * initialized by a call to {@link #initCause}. + */ + public BadConfigurationException() { + super(); + } + + /** + * Constructs a new runtime exception with the specified detail message. + * The cause is not initialized, and may subsequently be initialized by a + * call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public BadConfigurationException(String message) { + super(message); + } + + /** + * Constructs a new runtime exception with the specified detail message and + * cause.

Note that the detail message associated with + * {@code cause} is not automatically incorporated in + * this runtime exception's detail message. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public BadConfigurationException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new runtime exception with the specified cause and a + * detail message of {@code (cause==null ? null : cause.toString())} + * (which typically contains the class and detail message of + * {@code cause}). This constructor is useful for runtime exceptions + * that are little more than wrappers for other throwables. + * + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public BadConfigurationException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new runtime exception with the specified detail + * message, cause, suppression enabled or disabled, and writable + * stack trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * @since 1.7 + */ + protected BadConfigurationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/youchain-common/src/main/java/com/youchain/exception/BadRequestException.java b/youchain-common/src/main/java/com/youchain/exception/BadRequestException.java new file mode 100644 index 0000000..686b504 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/BadRequestException.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception; + +import lombok.Getter; +import org.springframework.http.HttpStatus; +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author Liu Xue + * @date 2018-11-23 + * 统一异常处理 + */ +@Getter +public class BadRequestException extends RuntimeException{ + + private Integer status = BAD_REQUEST.value(); + + public BadRequestException(String msg){ + super(msg); + } + + public BadRequestException(HttpStatus status,String msg){ + super(msg); + this.status = status.value(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/exception/EntityExistException.java b/youchain-common/src/main/java/com/youchain/exception/EntityExistException.java new file mode 100644 index 0000000..0975358 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/EntityExistException.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception; + +import org.springframework.util.StringUtils; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +public class EntityExistException extends RuntimeException { + + public EntityExistException(Class clazz, String field, String val) { + super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val)); + } + + private static String generateMessage(String entity, String field, String val) { + return StringUtils.capitalize(entity) + + " with " + field + " "+ val + " existed"; + } +} \ No newline at end of file diff --git a/youchain-common/src/main/java/com/youchain/exception/EntityNotFoundException.java b/youchain-common/src/main/java/com/youchain/exception/EntityNotFoundException.java new file mode 100644 index 0000000..1e7bad8 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/EntityNotFoundException.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception; + +import org.springframework.util.StringUtils; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +public class EntityNotFoundException extends RuntimeException { + + public EntityNotFoundException(Class clazz, String field, String val) { + super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val)); + } + + private static String generateMessage(String entity, String field, String val) { + return StringUtils.capitalize(entity) + + " with " + field + " "+ val + " does not exist"; + } +} \ No newline at end of file diff --git a/youchain-common/src/main/java/com/youchain/exception/handler/ApiError.java b/youchain-common/src/main/java/com/youchain/exception/handler/ApiError.java new file mode 100644 index 0000000..3756b2a --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/handler/ApiError.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception.handler; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import java.time.LocalDateTime; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Data +public class ApiError { + + private Integer status = 400; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime timestamp; + private String message; + + public ApiError() { + timestamp = LocalDateTime.now(); + } + + public static ApiError error(String message){ + ApiError apiError = new ApiError(); + apiError.setMessage(message); + return apiError; + } + + public static ApiError error(Integer status, String message){ + ApiError apiError = new ApiError(); + apiError.setStatus(status); + apiError.setMessage(message); + return apiError; + } + + public static ApiError errorJosn(Integer status, String message){ + ApiError apiError = new ApiError(); + apiError.setStatus(status); + apiError.setMessage(message); + apiError.setTimestamp(LocalDateTime.now()); + return apiError; + } +} + + diff --git a/youchain-common/src/main/java/com/youchain/exception/handler/ApiResult.java b/youchain-common/src/main/java/com/youchain/exception/handler/ApiResult.java new file mode 100644 index 0000000..21e2e31 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/handler/ApiResult.java @@ -0,0 +1,43 @@ +package com.youchain.exception.handler; + +import lombok.Data; + +@Data +public class ApiResult { + private Object data;//数据 + private String message;//内容 + private int status;//编码 + + public static ApiResult fail() { + + return result(400, "操作失败!", null); + } + + public static ApiResult fail(int code, String msg, Object data) { + return result(code, msg, data); + } + + public static ApiResult success() { + return result(200, "操作成功!", null); + } + + public static ApiResult success(Object data) { + return result(200, "操作成功!", data); + } + + public static ApiResult success(String msg, Object data) { + return result(200, msg, data); + } + + public static ApiResult success(int status, String msg, Object data) { + return result(status, msg, data); + } + + public static ApiResult result(int status, String message, Object data) { + ApiResult rs = new ApiResult(); + rs.setStatus(status); + rs.setMessage(message); + rs.setData(data); + return rs; + } +} diff --git a/youchain-common/src/main/java/com/youchain/exception/handler/GlobalExceptionHandler.java b/youchain-common/src/main/java/com/youchain/exception/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..a8957ff --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/exception/handler/GlobalExceptionHandler.java @@ -0,0 +1,113 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.exception.handler; + +import com.youchain.exception.BadRequestException; +import com.youchain.exception.EntityExistException; +import com.youchain.exception.EntityNotFoundException; +import com.youchain.utils.ThrowableUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.validation.FieldError; +import org.springframework.validation.ObjectError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import static org.springframework.http.HttpStatus.*; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + + /** + * 处理所有不可知的异常 + */ + @ExceptionHandler(Throwable.class) + public ResponseEntity handleException(Throwable e){ + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getMessage())); + } + + /** + * BadCredentialsException + */ + @ExceptionHandler(BadCredentialsException.class) + public ResponseEntity badCredentialsException(BadCredentialsException e){ + // 打印堆栈信息 + String message = "坏的凭证".equals(e.getMessage()) ? "用户名或密码不正确" : e.getMessage(); + log.error(message); + return buildResponseEntity(ApiError.error(message)); + } + + /** + * 处理自定义异常 + */ + @ExceptionHandler(value = BadRequestException.class) + public ResponseEntity badRequestException(BadRequestException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getStatus(),e.getMessage())); + } + + /** + * 处理 EntityExist + */ + @ExceptionHandler(value = EntityExistException.class) + public ResponseEntity entityExistException(EntityExistException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(e.getMessage())); + } + + /** + * 处理 EntityNotFound + */ + @ExceptionHandler(value = EntityNotFoundException.class) + public ResponseEntity entityNotFoundException(EntityNotFoundException e) { + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + return buildResponseEntity(ApiError.error(NOT_FOUND.value(),e.getMessage())); + } + + /** + * 处理所有接口数据验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity handleMethodArgumentNotValidException(MethodArgumentNotValidException e){ + // 打印堆栈信息 + log.error(ThrowableUtil.getStackTrace(e)); + ObjectError objectError = e.getBindingResult().getAllErrors().get(0); + String message = objectError.getDefaultMessage(); + if (objectError instanceof FieldError) { + message = ((FieldError) objectError).getField() + ": " + message; + } + return buildResponseEntity(ApiError.error(message)); + } + + /** + * 统一返回 + */ + private ResponseEntity buildResponseEntity(ApiError apiError) { + return new ResponseEntity<>(apiError, HttpStatus.valueOf(apiError.getStatus())); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/CacheKey.java b/youchain-common/src/main/java/com/youchain/utils/CacheKey.java new file mode 100644 index 0000000..b3caf41 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/CacheKey.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +/** + * @author: liaojinlong + * @date: 2020/6/11 15:49 + * @apiNote: 关于缓存的Key集合 + */ +public interface CacheKey { + + /** + * 用户 + */ + String USER_ID = "user::id:"; + /** + * 数据 + */ + String DATA_USER = "data::user:"; + /** + * 菜单 + */ + String MENU_ID = "menu::id:"; + String MENU_USER = "menu::user:"; + /** + * 角色授权 + */ + String ROLE_AUTH = "role::auth:"; + /** + * 角色信息 + */ + String ROLE_ID = "role::id:"; + /** + * 部门 + */ + String DEPT_ID = "dept::id:"; + /** + * 岗位 + */ + String JOB_ID = "job::id:"; + /** + * 数据字典 + */ + String DICT_NAME = "dict::name:"; + + String BOM_ACCOUNT_NAME = "bomAccount::id:"; +} diff --git a/youchain-common/src/main/java/com/youchain/utils/CallBack.java b/youchain-common/src/main/java/com/youchain/utils/CallBack.java new file mode 100644 index 0000000..2c093bb --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/CallBack.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.utils; + +/** + * @author: liaojinlong + * @date: 2020/6/9 17:02 + * @since: 1.0 + * @see {@link SpringContextHolder} + * 针对某些初始化方法,在SpringContextHolder 初始化前时,
+ * 可提交一个 提交回调任务。
+ * 在SpringContextHolder 初始化后,进行回调使用 + */ + +public interface CallBack { + /** + * 回调执行方法 + */ + void executor(); + + /** + * 本回调任务名称 + * @return / + */ + default String getCallBackName() { + return Thread.currentThread().getId() + ":" + this.getClass().getName(); + } +} + diff --git a/youchain-common/src/main/java/com/youchain/utils/CloseUtil.java b/youchain-common/src/main/java/com/youchain/utils/CloseUtil.java new file mode 100644 index 0000000..a4e014b --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/CloseUtil.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import java.io.Closeable; + +/** + * @author Liu Xue + * @website https://eladmin.vip + * @description 用于关闭各种连接,缺啥补啥 + * @date 2021-03-05 + **/ +public class CloseUtil { + + public static void close(Closeable closeable) { + if (null != closeable) { + try { + closeable.close(); + } catch (Exception e) { + // 静默关闭 + } + } + } + + public static void close(AutoCloseable closeable) { + if (null != closeable) { + try { + closeable.close(); + } catch (Exception e) { + // 静默关闭 + } + } + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/CodeForYmYtil.java b/youchain-common/src/main/java/com/youchain/utils/CodeForYmYtil.java new file mode 100644 index 0000000..1b77da6 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/CodeForYmYtil.java @@ -0,0 +1,91 @@ +package com.youchain.utils; + +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; + +import java.text.SimpleDateFormat; +import java.util.Calendar; + +public class CodeForYmYtil { + private static String key_time_type="yyMMdd"; + public void ce(){ + new Thread(()->{ + CodeForYmYtil codeForYmYtil=new CodeForYmYtil(); + for (int i = 0; i < 100; i++) { + String code = codeForYmYtil.CodeForYmYtil("ce",5); + } + }).start(); + new Thread(()->{ + CodeForYmYtil codeForYmYtil=new CodeForYmYtil(); + for (int i = 0; i < 100; i++) { + String code = codeForYmYtil.CodeForYmYtil("ce",5); + } + }).start(); + new Thread(()->{ + CodeForYmYtil codeForYmYtil=new CodeForYmYtil(); + for (int i = 0; i < 100; i++) { + String code = codeForYmYtil.CodeForYmYtil("ce",5); + } + }).start(); + new Thread(()->{ + CodeForYmYtil codeForYmYtil=new CodeForYmYtil(); + for (int i = 0; i < 100; i++) { + String code = codeForYmYtil.CodeForYmYtil("ce",5); + } + }).start(); + } + public static synchronized String CodeForYmYtil(String key_code, int len){ + String code=""; + String key_time = new SimpleDateFormat(key_time_type).format(Calendar.getInstance().getTime()); + String key=key_code+key_time; + String redisHost = "127.0.0.1"; + int redisPort = 6379; + RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(redisHost, redisPort); + LettuceConnectionFactory factory = new LettuceConnectionFactory(config); + factory.afterPropertiesSet(); + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(factory); + redisTemplate.afterPropertiesSet(); + + ValueOperations ops = redisTemplate.opsForValue(); + String value; +// value = ops.get(key).toString(); + + if (ops.get(key)==null||ops.get(key).equals("")){ + ops.set(key, "0"); + } + value = (Integer.valueOf(ops.get(key).toString())+1)+""; + ops.set(key, value); + while (value.length()(); + redisTemplate.setConnectionFactory(factory); + redisTemplate.afterPropertiesSet(); + ValueOperations ops = redisTemplate.opsForValue(); + + String value = ops.get("pd")+""; + System.out.println(":"+value); + factory.destroy(); + System.out.println("poiuytrew");*/ + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/DateUtil.java b/youchain-common/src/main/java/com/youchain/utils/DateUtil.java new file mode 100644 index 0000000..bebfdf8 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/DateUtil.java @@ -0,0 +1,266 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.youchain.utils; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +import java.util.Date; + +/** + * @author: liaojinlong + * @date: 2020/6/11 16:28 + * @apiNote: JDK 8 新日期类 格式化与字符串转换 工具类 + */ +public class DateUtil { + + public static final DateTimeFormatter DFY_MD_HMS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + public static final DateTimeFormatter DFY_MD = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + public static final DateTimeFormatter DFY_MD_HM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH"); + + private static SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd"); + + /** + * LocalDateTime 转时间戳 + * + * @param localDateTime / + * @return / + */ + public static Long getTimeStamp(LocalDateTime localDateTime) { + return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond(); + } + + /** + * 时间戳转LocalDateTime + * + * @param timeStamp / + * @return / + */ + public static LocalDateTime fromTimeStamp(Long timeStamp) { + return LocalDateTime.ofEpochSecond(timeStamp, 0, OffsetDateTime.now().getOffset()); + } + + /** + * LocalDateTime 转 Date + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param localDateTime / + * @return / + */ + public static Date toDate(LocalDateTime localDateTime) { + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + } + + /** + * LocalDate 转 Date + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param localDate / + * @return / + */ + public static Date toDate(LocalDate localDate) { + return toDate(localDate.atTime(LocalTime.now(ZoneId.systemDefault()))); + } + + + /** + * Date转 LocalDateTime + * Jdk8 后 不推荐使用 {@link Date} Date + * + * @param date / + * @return / + */ + public static LocalDateTime toLocalDateTime(Date date) { + return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); + } + + /** + * 日期 格式化 + * + * @param localDateTime / + * @param patten / + * @return / + */ + public static String localDateTimeFormat(LocalDateTime localDateTime, String patten) { + DateTimeFormatter df = DateTimeFormatter.ofPattern(patten); + return df.format(localDateTime); + } + + /** + * 日期 格式化 + * + * @param localDateTime / + * @param df / + * @return / + */ + public static String localDateTimeFormat(LocalDateTime localDateTime, DateTimeFormatter df) { + return df.format(localDateTime); + } + + /** + * 日期格式化 yyyy-MM-dd HH:mm:ss + * + * @param localDateTime / + * @return / + */ + public static String localDateTimeFormatyMdHms(LocalDateTime localDateTime) { + return DFY_MD_HMS.format(localDateTime); + } + + + public static Date ymd_date(String fomart) { + try { + return ymd.parse(fomart); + } catch (ParseException e) { + return null; + } + } + /** + * 日期格式化 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public static String localDateTimeFormatyMd(LocalDateTime localDateTime) { + + return DFY_MD.format(localDateTime); + } + + public static String dateYmd(Date date) { + return ymd.format(date); + } + + //按周天生成批次 + public static String dateYmdz() { + Calendar calendar = Calendar.getInstance(); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; + int day = calendar.get(Calendar.DAY_OF_MONTH); + String z="01-07"; + if(day<=7){ + z="01-07"; + }else if(day>7 && day<=14){ + z="08-14"; + }else if(day>14 && day<=21){ + z="15-21"; + }else if(day>21 && day<=28){ + z="22-28"; + }else if(day>28){ + z="29-31"; + } + return year+"-"+month+"-"+z; + } + + public static String formatChageDay(Date date, String type, int value) { + Calendar cal = new java.util.GregorianCalendar(); + cal.setTime(date); + if (type.equals("DAY")) { + cal.add(Calendar.DATE , value); + } + if (type.equals("HOUR")) { + cal.add(Calendar.HOUR, value); + } + if (type.equals("MINUTE")) { + cal.add(Calendar.MINUTE, value); + } + if (type.equals("SECOND")) { + cal.add(Calendar.SECOND, value); + } + return ymd.format(cal.getTime()); + } + + public static Timestamp getBatchTime(int value,Date date) { + Calendar cal = new java.util.GregorianCalendar(); + cal.setTime(date); + cal.set(Calendar.HOUR_OF_DAY,8); + cal.set(Calendar.MINUTE,30); + cal.set(Calendar.MILLISECOND,0); + cal.add(Calendar.MINUTE, value); + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minute = cal.get(Calendar.MINUTE); + //11:30-12:30休息 + if(hour>11||(hour==11&&minute>=30)){ + cal.add(Calendar.HOUR, 1); + } +// //17:30-18:30休息 +// hour = cal.get(Calendar.HOUR_OF_DAY); +// if(hour>17||(hour==17&&minute>=30)){ +// cal.add(Calendar.HOUR, 1); +// } + return new Timestamp(cal.getTime().getTime()); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, String pattern) { + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern); + return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormat(String localDateTime, DateTimeFormatter dateTimeFormatter) { + return LocalDateTime.from(dateTimeFormatter.parse(localDateTime)); + } + + /** + * 字符串转 LocalDateTime ,字符串格式 yyyy-MM-dd HH:mm:ss + * + * @param localDateTime / + * @return / + */ + public static LocalDateTime parseLocalDateTimeFormatyMdHms(String localDateTime) { + return LocalDateTime.from(DFY_MD_HMS.parse(localDateTime)); + } + + /** + *获取两个字符串计算出小时 + * @param + * @return + */ + public static long hoursBetween(String startDateTimeStr,String endDateTimeStr) { + // 解析日期时间字符串为 LocalDateTime 对象 + LocalDateTime startDateTime = LocalDateTime.parse(startDateTimeStr, DFY_MD_HM); + LocalDateTime endDateTime = LocalDateTime.parse(endDateTimeStr, DFY_MD_HM); + // 计算时间差 + Duration duration = Duration.between(startDateTime, endDateTime); + long hours = duration.toHours(); // 将时间差转换为小时 + return hours; + } + + /** + *比较两个日期大小 + * @param + * @return + */ + public static int dateComparison (Date date1,Date date2) { + int comparison = date1.compareTo(date2); + return comparison; + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/ElAdminConstant.java b/youchain-common/src/main/java/com/youchain/utils/ElAdminConstant.java new file mode 100644 index 0000000..9508000 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/ElAdminConstant.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +/** + * 常用静态常量 + * + * @author Liu Xue + * @date 2018-12-26 + */ +public class ElAdminConstant { + + /** + * 用于IP定位转换 + */ + public static final String REGION = "内网IP|内网IP"; + /** + * win 系统 + */ + public static final String WIN = "win"; + + /** + * mac 系统 + */ + public static final String MAC = "mac"; + + /** + * 常用接口 + */ + public static class Url { + // IP归属地查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"; + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/EncryptUtils.java b/youchain-common/src/main/java/com/youchain/utils/EncryptUtils.java new file mode 100644 index 0000000..f765c50 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/EncryptUtils.java @@ -0,0 +1,100 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.DESKeySpec; +import javax.crypto.spec.IvParameterSpec; +import java.nio.charset.StandardCharsets; + +/** + * 加密 + * @author Liu Xue + * @date 2018-11-23 + */ + +public class EncryptUtils { + + private static final String STR_PARAM = "Passw0rd"; + + private static Cipher cipher; + + private static final IvParameterSpec IV = new IvParameterSpec(STR_PARAM.getBytes(StandardCharsets.UTF_8)); + + private static DESKeySpec getDesKeySpec(String source) throws Exception { + if (source == null || source.length() == 0){ + return null; + } + cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); + String strKey = "Passw0rd"; + return new DESKeySpec(strKey.getBytes(StandardCharsets.UTF_8)); + } + + /** + * 对称加密 + */ + public static String desEncrypt(String source) throws Exception { + DESKeySpec desKeySpec = getDesKeySpec(source); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); + SecretKey secretKey = keyFactory.generateSecret(desKeySpec); + cipher.init(Cipher.ENCRYPT_MODE, secretKey, IV); + return byte2hex( + cipher.doFinal(source.getBytes(StandardCharsets.UTF_8))).toUpperCase(); + } + + /** + * 对称解密 + */ + public static String desDecrypt(String source) throws Exception { + byte[] src = hex2byte(source.getBytes(StandardCharsets.UTF_8)); + DESKeySpec desKeySpec = getDesKeySpec(source); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); + SecretKey secretKey = keyFactory.generateSecret(desKeySpec); + cipher.init(Cipher.DECRYPT_MODE, secretKey, IV); + byte[] retByte = cipher.doFinal(src); + return new String(retByte); + } + + private static String byte2hex(byte[] inStr) { + String stmp; + StringBuilder out = new StringBuilder(inStr.length * 2); + for (byte b : inStr) { + stmp = Integer.toHexString(b & 0xFF); + if (stmp.length() == 1) { + // 如果是0至F的单位字符串,则添加0 + out.append("0").append(stmp); + } else { + out.append(stmp); + } + } + return out.toString(); + } + + private static byte[] hex2byte(byte[] b) { + int size = 2; + if ((b.length % size) != 0){ + throw new IllegalArgumentException("长度不是偶数"); + } + byte[] b2 = new byte[b.length / 2]; + for (int n = 0; n < b.length; n += size) { + String item = new String(b, n, 2); + b2[n / 2] = (byte) Integer.parseInt(item, 16); + } + return b2; + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/FileUtil.java b/youchain-common/src/main/java/com/youchain/utils/FileUtil.java new file mode 100644 index 0000000..8e4e434 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/FileUtil.java @@ -0,0 +1,376 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import org.apache.poi.util.IOUtils; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.security.MessageDigest; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * File工具类,扩展 hutool 工具包 + * + * @author Liu Xue + * @date 2018-12-27 + */ +public class FileUtil extends cn.hutool.core.io.FileUtil { + + private static final Logger log = LoggerFactory.getLogger(FileUtil.class); + + /** + * 系统临时目录 + *
+ * windows 包含路径分割符,但Linux 不包含, + * 在windows \\==\ 前提下, + * 为安全起见 同意拼装 路径分割符, + *

+     *       java.io.tmpdir
+     *       windows : C:\Users/xxx\AppData\Local\Temp\
+     *       linux: /temp
+     * 
+ */ + public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator; + /** + * 定义GB的计算常量 + */ + private static final int GB = 1024 * 1024 * 1024; + /** + * 定义MB的计算常量 + */ + private static final int MB = 1024 * 1024; + /** + * 定义KB的计算常量 + */ + private static final int KB = 1024; + + /** + * 格式化小数 + */ + private static final DecimalFormat DF = new DecimalFormat("0.00"); + + public static final String IMAGE = "图片"; + public static final String TXT = "文档"; + public static final String MUSIC = "音乐"; + public static final String VIDEO = "视频"; + public static final String APK = "APK"; + public static final String ZIP = "ZIP"; + public static final String OTHER = "其他"; + + + /** + * MultipartFile转File + */ + public static File toFile(MultipartFile multipartFile) { + // 获取文件名 + String fileName = multipartFile.getOriginalFilename(); + // 获取文件后缀 + String prefix = "." + getExtensionName(fileName); + File file = null; + try { + // 用uuid作为文件名,防止生成的临时文件重复 + file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix); + // MultipartFile to File + multipartFile.transferTo(file); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return file; + } + + /** + * 获取文件扩展名,不带 . + */ + public static String getExtensionName(String filename) { + if ((filename != null) && (filename.length() > 0)) { + int dot = filename.lastIndexOf('.'); + if ((dot > -1) && (dot < (filename.length() - 1))) { + return filename.substring(dot + 1); + } + } + return filename; + } + + /** + * Java文件操作 获取不带扩展名的文件名 + */ + public static String getFileNameNoEx(String filename) { + if ((filename != null) && (filename.length() > 0)) { + int dot = filename.lastIndexOf('.'); + if ((dot > -1) && (dot < (filename.length()))) { + return filename.substring(0, dot); + } + } + return filename; + } + + /** + * 文件大小转换 + */ + public static String getSize(long size) { + String resultSize; + if (size / GB >= 1) { + //如果当前Byte的值大于等于1GB + resultSize = DF.format(size / (float) GB) + "GB "; + } else if (size / MB >= 1) { + //如果当前Byte的值大于等于1MB + resultSize = DF.format(size / (float) MB) + "MB "; + } else if (size / KB >= 1) { + //如果当前Byte的值大于等于1KB + resultSize = DF.format(size / (float) KB) + "KB "; + } else { + resultSize = size + "B "; + } + return resultSize; + } + + /** + * inputStream 转 File + */ + static File inputStreamToFile(InputStream ins, String name){ + File file = new File(SYS_TEM_DIR + name); + if (file.exists()) { + return file; + } + OutputStream os = null; + try { + os = new FileOutputStream(file); + int bytesRead; + int len = 8192; + byte[] buffer = new byte[len]; + while ((bytesRead = ins.read(buffer, 0, len)) != -1) { + os.write(buffer, 0, bytesRead); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + CloseUtil.close(os); + CloseUtil.close(ins); + } + return file; + } + + /** + * 将文件名解析成文件的上传路径 + */ + public static File upload(MultipartFile file, String filePath) { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS"); + String name = getFileNameNoEx(file.getOriginalFilename()); + String suffix = getExtensionName(file.getOriginalFilename()); + String nowStr = "-" +SecurityUtils.getCurrentUsername()+ "-" + format.format(date); + try { + String fileName = name + nowStr + "." + suffix; + String path = filePath + fileName; + // getCanonicalFile 可解析正确各种路径 + File dest = new File(path).getCanonicalFile(); + // 检测是否存在目录 + if (!dest.getParentFile().exists()) { + if (!dest.getParentFile().mkdirs()) { + System.out.println("was not successful."); + } + } + // 文件写入 + file.transferTo(dest); + return dest; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + + /** + * 导出excel + */ + public static void downloadExcel(List> list, HttpServletResponse response) throws Exception { + log.error("list:"+list.size()); + if(list.size()>0){ + if(list.get(0).keySet().size()<=0){ + throw new BadRequestException("请先保存配置"); + } + }else{ + throw new BadRequestException("导出数据长度为0"); + } + + FileProperties properties=SpringContextHolder.getBean(FileProperties.class); + String tempPath=properties.getPath().getPath()+"downexcel\\"+IdUtil.fastSimpleUUID() + ".xlsx"; + File file = new File(tempPath); + log.error(tempPath); + + //BigExcelWriter writer = ExcelUtil.getBigWriter(file); + MyExcelWriter writer =MyExcelWriter.getBigWriter(file); + // 一次性写出内容,使用默认样式,强制输出标题 + writer.write(list, true); + //列宽自适应 + writer.autoSizeColumnAll(); + //response为HttpServletResponse对象 + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 + response.setHeader("Content-Disposition","attachment;filename=file.xls"); + ServletOutputStream out = response.getOutputStream(); + // 终止后删除临时文件 + file.deleteOnExit(); + writer.flush(out, true); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + + public static String getFileType(String type) { + String documents = "txt doc pdf ppt pps xlsx xls docx"; + String music = "mp3 wav wma mpa ram ra aac aif m4a"; + String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg"; + String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg"; + String apk = "apk"; + String zip = "zip rar 7z"; + if (apk.contains(type)) { + return APK; + }else if (zip.contains(type)) { + return ZIP; + }else if (image.contains(type)) { + return IMAGE; + } else if (documents.contains(type)) { + return TXT; + } else if (music.contains(type)) { + return MUSIC; + } else if (video.contains(type)) { + return VIDEO; + } else { + return OTHER; + } + } + + public static void checkSize(long maxSize, long size) { + // 1M + int len = 1024 * 1024; + if (size > (maxSize * len)) { + throw new BadRequestException("文件超出规定大小:" + maxSize + "MB"); + } + } + + /** + * 判断两个文件是否相同 + */ + public static boolean check(File file1, File file2) { + String img1Md5 = getMd5(file1); + String img2Md5 = getMd5(file2); + if(img1Md5 != null){ + return img1Md5.equals(img2Md5); + } + return false; + } + + /** + * 判断两个文件是否相同 + */ + public static boolean check(String file1Md5, String file2Md5) { + return file1Md5.equals(file2Md5); + } + + private static byte[] getByte(File file) { + // 得到文件长度 + byte[] b = new byte[(int) file.length()]; + InputStream in = null; + try { + in = new FileInputStream(file); + try { + System.out.println(in.read(b)); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + return null; + } finally { + CloseUtil.close(in); + } + return b; + } + + private static String getMd5(byte[] bytes) { + // 16进制字符 + char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + try { + MessageDigest mdTemp = MessageDigest.getInstance("MD5"); + mdTemp.update(bytes); + byte[] md = mdTemp.digest(); + int j = md.length; + char[] str = new char[j * 2]; + int k = 0; + // 移位 输出字符串 + for (byte byte0 : md) { + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + return new String(str); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + /** + * 下载文件 + * + * @param request / + * @param response / + * @param file / + */ + public static void downloadFile(HttpServletRequest request, HttpServletResponse response, File file, boolean deleteOnExit) { + response.setCharacterEncoding(request.getCharacterEncoding()); + response.setContentType("application/octet-stream"); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + response.setHeader("Content-Disposition", "attachment; filename=" + file.getName()); + IOUtils.copy(fis, response.getOutputStream()); + response.flushBuffer(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + if (fis != null) { + try { + fis.close(); + if (deleteOnExit) { + file.deleteOnExit(); + } + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + } + } + + public static String getMd5(File file) { + return getMd5(getByte(file)); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/HttpPostUtil.java b/youchain-common/src/main/java/com/youchain/utils/HttpPostUtil.java new file mode 100644 index 0000000..c58914c --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/HttpPostUtil.java @@ -0,0 +1,49 @@ +package com.youchain.utils; + +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import org.apache.commons.compress.utils.IOUtils; + +import java.io.DataOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; + +public class HttpPostUtil { + public static String sendPostReq(String api_url, String request){ + InputStream instr = null; + String str = ""; + try { + URL url = new URL(api_url); + URLConnection urlCon = url.openConnection(); + urlCon.setConnectTimeout(3000); + byte[] xmlData = request.getBytes(); + urlCon.setDoOutput(true); + urlCon.setDoInput(true); + urlCon.setUseCaches(false); + urlCon.setRequestProperty("content-Type", "application/json"); + urlCon.setRequestProperty("charset", "UTF-8"); + urlCon.setRequestProperty("Content-length", String.valueOf(xmlData.length)); + DataOutputStream printout = new DataOutputStream(urlCon.getOutputStream()); + printout.write(xmlData); + printout.flush(); + printout.close(); + instr = urlCon.getInputStream(); + byte[] bis = IOUtils.toByteArray(instr); + String ResponseString = new String(bis, "UTF-8"); + if ((ResponseString == null) || ("".equals(ResponseString.trim()))) { + System.out.println("返回空"); + } + str = ResponseString; + }catch (Exception e){ + throw new Error(e.getMessage()); + } + /*JSONObject jsonObject=new JSONObject(); + jsonObject.accumulate("code", "0"); + jsonObject.accumulate("message", ""); + jsonObject.accumulate("success", true); + jsonObject.accumulate("data", ""); + str= JSONUtil.toJsonStr(jsonObject.toString());*/ + return str; + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/MyExcelWriter.java b/youchain-common/src/main/java/com/youchain/utils/MyExcelWriter.java new file mode 100644 index 0000000..2b51de8 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/MyExcelWriter.java @@ -0,0 +1,42 @@ +package com.youchain.utils; + +import cn.hutool.core.exceptions.DependencyException; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import org.apache.poi.xssf.streaming.SXSSFSheet; + +import java.io.File; + +public class MyExcelWriter extends BigExcelWriter { + public static MyExcelWriter getBigWriter(File file) { + try { + return new MyExcelWriter(file); + } catch (NoClassDefFoundError var1) { + throw new DependencyException((Throwable) ObjectUtil.defaultIfNull(var1.getCause(), var1), "You need to add dependency of 'poi-ooxml' to your project, and version >= 4.1.2", new Object[0]); + } + } + + public MyExcelWriter(File file){ + super(file); + } + + @Override + public BigExcelWriter autoSizeColumnAll() { + final SXSSFSheet sheet = (SXSSFSheet)this.sheet; + sheet.trackAllColumnsForAutoSizing(); + super.autoSizeColumnAll(); + for (int i = 0; i list.size()){ + return new ArrayList(); + } else if(toIndex >= list.size()) { + return list.subList(fromIndex,list.size()); + } else { + return list.subList(fromIndex,toIndex); + } + } + + /** + * Page 数据处理,预防redis反序列化报错 + */ + public static Map toPage(Page page) { + Map map = new LinkedHashMap<>(2); + map.put("content",page.getContent()); + map.put("totalElements",page.getTotalElements()); + return map; + } + + /** + * 自定义分页 + */ + public static Map toPage(Object object, Object totalElements) { + Map map = new LinkedHashMap<>(2); + map.put("content",object); + map.put("totalElements",totalElements); + return map; + } + +} diff --git a/youchain-common/src/main/java/com/youchain/utils/QueryHelp.java b/youchain-common/src/main/java/com/youchain/utils/QueryHelp.java new file mode 100644 index 0000000..0321d49 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/QueryHelp.java @@ -0,0 +1,233 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import lombok.extern.slf4j.Slf4j; +import com.youchain.annotation.DataPermission; +import com.youchain.annotation.Query; +import javax.persistence.criteria.*; +import java.lang.reflect.Field; +import java.util.*; + +/** + * @author Liu Xue + * @date 2019-6-4 14:59:48 + */ +@Slf4j +@SuppressWarnings({"unchecked","all"}) +public class QueryHelp { + + public static Predicate getPredicate(Root root, Q query, CriteriaBuilder cb) { + List list = new ArrayList<>(); + if(query == null){ + return cb.and(list.toArray(new Predicate[0])); + } + // 数据权限验证 + DataPermission permission = query.getClass().getAnnotation(DataPermission.class); + if(permission != null){ + // 获取数据权限 + List dataScopes = SecurityUtils.getCurrentUserDataScope(); + if(CollectionUtil.isNotEmpty(dataScopes)){ + if(StringUtils.isNotBlank(permission.joinName()) && StringUtils.isNotBlank(permission.fieldName())) { + Join join = root.join(permission.joinName(), JoinType.LEFT); + list.add(getExpression(permission.fieldName(),join, root).in(dataScopes)); + } else if (StringUtils.isBlank(permission.joinName()) && StringUtils.isNotBlank(permission.fieldName())) { + list.add(getExpression(permission.fieldName(),null, root).in(dataScopes)); + } + } + } + try { + List fields = getAllFields(query.getClass(), new ArrayList<>()); + for (Field field : fields) { + boolean accessible = field.isAccessible(); + // 设置对象的访问权限,保证对private的属性的访 + field.setAccessible(true); + Query q = field.getAnnotation(Query.class); + if (q != null) { + String propName = q.propName(); + String joinName = q.joinName(); + String blurry = q.blurry(); + String attributeName = isBlank(propName) ? field.getName() : propName; + Class fieldType = field.getType(); + Object val = field.get(query); + if (ObjectUtil.isNull(val) || "".equals(val)) { + continue; + } + Join join = null; + // 模糊多字段 + if (ObjectUtil.isNotEmpty(blurry)) { + String[] blurrys = blurry.split(","); + List orPredicate = new ArrayList<>(); + for (String s : blurrys) { + orPredicate.add(cb.like(root.get(s) + .as(String.class), "%" + val.toString() + "%")); + } + Predicate[] p = new Predicate[orPredicate.size()]; + list.add(cb.or(orPredicate.toArray(p))); + continue; + } + if (ObjectUtil.isNotEmpty(joinName)) { + String[] joinNames = joinName.split(">"); + for (String name : joinNames) { + switch (q.join()) { + case LEFT: + if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ + join = join.join(name, JoinType.LEFT); + } else { + join = root.join(name, JoinType.LEFT); + } + break; + case RIGHT: + if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ + join = join.join(name, JoinType.RIGHT); + } else { + join = root.join(name, JoinType.RIGHT); + } + break; + case INNER: + if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){ + join = join.join(name, JoinType.INNER); + } else { + join = root.join(name, JoinType.INNER); + } + break; + default: break; + } + } + } + switch (q.type()) { + case EQUAL: + list.add(cb.equal(getExpression(attributeName,join,root) + .as((Class) fieldType),val)); + break; + case GREATER_THAN: + list.add(cb.greaterThanOrEqualTo(getExpression(attributeName,join,root) + .as((Class) fieldType), (Comparable) val)); + break; + case GREATER_THAN_NQ: + list.add(cb.greaterThan(getExpression(attributeName,join,root) + .as((Class) fieldType), (Comparable) val)); + break; + case LESS_THAN: + list.add(cb.lessThanOrEqualTo(getExpression(attributeName,join,root) + .as((Class) fieldType), (Comparable) val)); + break; + case LESS_THAN_NQ: + list.add(cb.lessThan(getExpression(attributeName,join,root) + .as((Class) fieldType), (Comparable) val)); + break; + case INNER_LIKE: + list.add(cb.like(getExpression(attributeName,join,root) + .as(String.class), "%" + val.toString() + "%")); + break; + case LEFT_LIKE: + list.add(cb.like(getExpression(attributeName,join,root) + .as(String.class), "%" + val.toString())); + break; + case RIGHT_LIKE: + list.add(cb.like(getExpression(attributeName,join,root) + .as(String.class), val.toString() + "%")); + break; + case IN: + if (CollUtil.isNotEmpty((Collection)val)) { + list.add(getExpression(attributeName,join,root).in((Collection) val)); + } + break; + case NOT_IN: + if (CollUtil.isNotEmpty((Collection)val)) { + list.add(getExpression(attributeName,join,root).in((Collection) val).not()); + } + break; + case NOT_EQUAL: + list.add(cb.notEqual(getExpression(attributeName,join,root), val)); + break; + case NOT_NULL: + list.add(cb.isNotNull(getExpression(attributeName,join,root))); + break; + case IS_NULL: + list.add(cb.isNull(getExpression(attributeName,join,root))); + break; + case BETWEEN: + List between = new ArrayList<>((List)val); + if(between.size() == 2){ + list.add(cb.between(getExpression(attributeName, join, root).as((Class) between.get(0).getClass()), + (Comparable) between.get(0), (Comparable) between.get(1))); + } + break; + case GREATER_THAN_2: + list.add(cb.greaterThanOrEqualTo(root.get(attributeName), root.get((String)val))); + break; + case LESS_THAN_2:_THAN_2: + list.add(cb.lessThanOrEqualTo(root.get(attributeName), root.get((String)val))); + break; + case GREATER_THAN_NQ_2: + list.add(cb.greaterThan(root.get(attributeName), root.get((String)val))); + break; + case LESS_THAN_NQ_2: + list.add(cb.lessThan(root.get(attributeName), root.get((String)val))); + break; + case EQUAL_2: + list.add(cb.equal(root.get(attributeName), root.get((String)val))); + break; + case NOT_EQUAL_2: + list.add(cb.notEqual(root.get(attributeName), root.get((String)val))); + break; + + default: break; + } + } + field.setAccessible(accessible); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + int size = list.size(); + return cb.and(list.toArray(new Predicate[size])); + } + + @SuppressWarnings("unchecked") + private static Expression getExpression(String attributeName, Join join, Root root) { + if (ObjectUtil.isNotEmpty(join)) { + return join.get(attributeName); + } else { + return root.get(attributeName); + } + } + + private static boolean isBlank(final CharSequence cs) { + int strLen; + if (cs == null || (strLen = cs.length()) == 0) { + return true; + } + for (int i = 0; i < strLen; i++) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } + } + return true; + } + + public static List getAllFields(Class clazz, List fields) { + if (clazz != null) { + fields.addAll(Arrays.asList(clazz.getDeclaredFields())); + getAllFields(clazz.getSuperclass(), fields); + } + return fields; + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/RedisUtils.java b/youchain-common/src/main/java/com/youchain/utils/RedisUtils.java new file mode 100644 index 0000000..4af9a59 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/RedisUtils.java @@ -0,0 +1,741 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.*; +import org.springframework.data.redis.serializer.StringRedisSerializer; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @author / + */ +@Component +@SuppressWarnings({"unchecked", "all"}) +public class RedisUtils { + private static final Logger log = LoggerFactory.getLogger(RedisUtils.class); + private RedisTemplate redisTemplate; + @Value("${jwt.online-key}") + private String onlineKey; + + public RedisUtils(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + this.redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + this.redisTemplate.setKeySerializer(new StringRedisSerializer()); + this.redisTemplate.setStringSerializer(new StringRedisSerializer()); + } + + /** + * 指定缓存失效时间 + * + * @param key 键 + * @param time 时间(秒) + */ + public boolean expire(String key, long time) { + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + return true; + } + + /** + * 指定缓存失效时间 + * + * @param key 键 + * @param time 时间(秒) + * @param timeUnit 单位 + */ + public boolean expire(String key, long time, TimeUnit timeUnit) { + try { + if (time > 0) { + redisTemplate.expire(key, time, timeUnit); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + return true; + } + + /** + * 根据 key 获取过期时间 + * + * @param key 键 不能为null + * @return 时间(秒) 返回0代表为永久有效 + */ + public long getExpire(Object key) { + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + /** + * 查找匹配key + * + * @param pattern key + * @return / + */ + public List scan(String pattern) { + ScanOptions options = ScanOptions.scanOptions().match(pattern).build(); + RedisConnectionFactory factory = redisTemplate.getConnectionFactory(); + RedisConnection rc = Objects.requireNonNull(factory).getConnection(); + Cursor cursor = rc.scan(options); + List result = new ArrayList<>(); + while (cursor.hasNext()) { + result.add(new String(cursor.next())); + } + try { + RedisConnectionUtils.releaseConnection(rc, factory); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 分页查询 key + * + * @param patternKey key + * @param page 页码 + * @param size 每页数目 + * @return / + */ + public List findKeysForPage(String patternKey, int page, int size) { + ScanOptions options = ScanOptions.scanOptions().match(patternKey).build(); + RedisConnectionFactory factory = redisTemplate.getConnectionFactory(); + RedisConnection rc = Objects.requireNonNull(factory).getConnection(); + Cursor cursor = rc.scan(options); + List result = new ArrayList<>(size); + int tmpIndex = 0; + int fromIndex = page * size; + int toIndex = page * size + size; + while (cursor.hasNext()) { + if (tmpIndex >= fromIndex && tmpIndex < toIndex) { + result.add(new String(cursor.next())); + tmpIndex++; + continue; + } + // 获取到满足条件的数据后,就可以退出了 + if (tmpIndex >= toIndex) { + break; + } + tmpIndex++; + cursor.next(); + } + try { + RedisConnectionUtils.releaseConnection(rc, factory); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return result; + } + + /** + * 判断key是否存在 + * + * @param key 键 + * @return true 存在 false不存在 + */ + public boolean hasKey(String key) { + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 删除缓存 + * + * @param key 可以传一个值 或多个 + */ + public void del(String... keys) { + if (keys != null && keys.length > 0) { + if (keys.length == 1) { + boolean result = redisTemplate.delete(keys[0]); + log.debug("--------------------------------------------"); + log.debug(new StringBuilder("删除缓存:").append(keys[0]).append(",结果:").append(result).toString()); + log.debug("--------------------------------------------"); + } else { + Set keySet = new HashSet<>(); + for (String key : keys) { + if (redisTemplate.hasKey(key)) + keySet.add(key); + } + long count = redisTemplate.delete(keySet); + log.debug("--------------------------------------------"); + log.debug("成功删除缓存:" + keySet.toString()); + log.debug("缓存删除数量:" + count + "个"); + log.debug("--------------------------------------------"); + } + } + } + + // ============================String============================= + + /** + * 普通缓存获取 + * + * @param key 键 + * @return 值 + */ + public Object get(String key) { + try{ + Object value=redisTemplate.opsForValue().get(key); + return value == null ? null :value ; + }catch (Exception e){ + return null; + } + + } + + public Object get(String key,Object def) { + try{ + Object value=redisTemplate.opsForValue().get(key); + return value == null ? def :value ; + }catch (Exception e){ + return def; + } + + } + + /** + * 批量获取 + * + * @param keys + * @return + */ + public List multiGet(List keys) { + List list = redisTemplate.opsForValue().multiGet(Sets.newHashSet(keys)); + List resultList = Lists.newArrayList(); + Optional.ofNullable(list).ifPresent(e-> list.forEach(ele-> Optional.ofNullable(ele).ifPresent(resultList::add))); + return resultList; + } + + /** + * 普通缓存放入 + * + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + public boolean set(String key, Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 普通缓存放入并设置时间 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + public boolean set(String key, Object value, long time) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 普通缓存放入并设置时间 + * + * @param key 键 + * @param value 值 + * @param time 时间 + * @param timeUnit 类型 + * @return true成功 false 失败 + */ + public boolean set(String key, Object value, long time, TimeUnit timeUnit) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, timeUnit); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + // ================================Map================================= + + /** + * HashGet + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return 值 + */ + public Object hget(String key, String item) { + return redisTemplate.opsForHash().get(key, item); + } + + public Object hget(String key, String item,Object def) { + try { + Object value = redisTemplate.opsForHash().get(key, item); + return value == null ? def:value; + }catch (Exception e){ + return def; + } + } + + /** + * 获取hashKey对应的所有键值 + * + * @param key 键 + * @return 对应的多个键值 + */ + public Map hmget(String key) { + return redisTemplate.opsForHash().entries(key); + } + + /** + * HashSet + * + * @param key 键 + * @param map 对应多个键值 + * @return true 成功 false 失败 + */ + public boolean hmset(String key, Map map) { + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * HashSet 并设置时间 + * + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public boolean hmset(String key, Map map, long time) { + try { + redisTemplate.opsForHash().putAll(key, map); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value, long time) { + try { + redisTemplate.opsForHash().put(key, item, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 删除hash表中的值 + * + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public void hdel(String key, Object... item) { + redisTemplate.opsForHash().delete(key, item); + } + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public boolean hHasKey(String key, String item) { + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * @param item 项 + * @param by 要增加几(大于0) + * @return + */ + public double hincr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, by); + } + + /** + * hash递减 + * + * @param key 键 + * @param item 项 + * @param by 要减少记(小于0) + * @return + */ + public double hdecr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, -by); + } + + // ============================set============================= + + /** + * 根据key获取Set中的所有值 + * + * @param key 键 + * @return + */ + public Set sGet(String key) { + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + log.error(e.getMessage(), e); + return null; + } + } + + /** + * 根据value从一个set中查询,是否存在 + * + * @param key 键 + * @param value 值 + * @return true 存在 false不存在 + */ + public boolean sHasKey(String key, Object value) { + try { + return redisTemplate.opsForSet().isMember(key, value); + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 将数据放入set缓存 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSet(String key, Object... values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + /** + * 将set数据放入缓存 + * + * @param key 键 + * @param time 时间(秒) + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSetAndTime(String key, long time, Object... values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if (time > 0) { + expire(key, time); + } + return count; + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + /** + * 获取set缓存的长度 + * + * @param key 键 + * @return + */ + public long sGetSetSize(String key) { + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + /** + * 移除值为value的 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 移除的个数 + */ + public long setRemove(String key, Object... values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + // ===============================list================================= + + /** + * 获取list缓存的内容 + * + * @param key 键 + * @param start 开始 + * @param end 结束 0 到 -1代表所有值 + * @return + */ + public List lGet(String key, long start, long end) { + try { + return redisTemplate.opsForList().range(key, start, end); + } catch (Exception e) { + log.error(e.getMessage(), e); + return null; + } + } + + /** + * 获取list缓存的长度 + * + * @param key 键 + * @return + */ + public long lGetListSize(String key) { + try { + return redisTemplate.opsForList().size(key); + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + /** + * 通过索引 获取list中的值 + * + * @param key 键 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + * @return + */ + public Object lGetIndex(String key, long index) { + try { + return redisTemplate.opsForList().index(key, index); + } catch (Exception e) { + log.error(e.getMessage(), e); + return null; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, Object value) { + try { + redisTemplate.opsForList().rightPush(key, value); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, Object value, long time) { + try { + redisTemplate.opsForList().rightPush(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, List value) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, List value, long time) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 根据索引修改list中的某条数据 + * + * @param key 键 + * @param index 索引 + * @param value 值 + * @return / + */ + public boolean lUpdateIndex(String key, long index, Object value) { + try { + redisTemplate.opsForList().set(key, index, value); + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + return false; + } + } + + /** + * 移除N个值为value + * + * @param key 键 + * @param count 移除多少个 + * @param value 值 + * @return 移除的个数 + */ + public long lRemove(String key, long count, Object value) { + try { + return redisTemplate.opsForList().remove(key, count, value); + } catch (Exception e) { + log.error(e.getMessage(), e); + return 0; + } + } + + /** + * @param prefix 前缀 + * @param ids id + */ + public void delByKeys(String prefix, Set ids) { + Set keys = new HashSet<>(); + for (Long id : ids) { + keys.addAll(redisTemplate.keys(new StringBuffer(prefix).append(id).toString())); + } + long count = redisTemplate.delete(keys); + // 此处提示可自行删除 + log.debug("--------------------------------------------"); + log.debug("成功删除缓存:" + keys.toString()); + log.debug("缓存删除数量:" + count + "个"); + log.debug("--------------------------------------------"); + } + + public Set getAllKey(String pattern){ + return redisTemplate.keys(pattern); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/RequestHolder.java b/youchain-common/src/main/java/com/youchain/utils/RequestHolder.java new file mode 100644 index 0000000..0ed1fc4 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/RequestHolder.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +/** + * 获取 HttpServletRequest + * @author Liu Xue + * @date 2018-11-24 + */ +public class RequestHolder { + + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/RsaUtils.java b/youchain-common/src/main/java/com/youchain/utils/RsaUtils.java new file mode 100644 index 0000000..4782a7c --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/RsaUtils.java @@ -0,0 +1,198 @@ +package com.youchain.utils; + +import org.apache.commons.codec.binary.Base64; +import javax.crypto.Cipher; +import java.io.ByteArrayOutputStream; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + * @author https://www.cnblogs.com/nihaorz/p/10690643.html + * @description Rsa 工具类,公钥私钥生成,加解密 + * @date 2020-05-18 + **/ +public class RsaUtils { + + private static final String SRC = "123456"; + + public static void main(String[] args) throws Exception { + System.out.println("\n"); + RsaKeyPair keyPair = generateKeyPair(); + System.out.println("公钥:" + keyPair.getPublicKey()); + System.out.println("私钥:" + keyPair.getPrivateKey()); + System.out.println("\n"); + test1(keyPair); + System.out.println("\n"); + test2(keyPair); + System.out.println("\n"); + } + + /** + * 公钥加密私钥解密 + */ + private static void test1(RsaKeyPair keyPair) throws Exception { + System.out.println("***************** 公钥加密私钥解密开始 *****************"); + String text1 = encryptByPublicKey(keyPair.getPublicKey(), RsaUtils.SRC); + String text2 = decryptByPrivateKey(keyPair.getPrivateKey(), text1); + System.out.println("加密前:" + RsaUtils.SRC); + System.out.println("加密后:" + text1); + System.out.println("解密后:" + text2); + if (RsaUtils.SRC.equals(text2)) { + System.out.println("解密字符串和原始字符串一致,解密成功"); + } else { + System.out.println("解密字符串和原始字符串不一致,解密失败"); + } + System.out.println("***************** 公钥加密私钥解密结束 *****************"); + } + + /** + * 私钥加密公钥解密 + * @throws Exception / + */ + private static void test2(RsaKeyPair keyPair) throws Exception { + System.out.println("***************** 私钥加密公钥解密开始 *****************"); + String text1 = encryptByPrivateKey(keyPair.getPrivateKey(), RsaUtils.SRC); + String text2 = decryptByPublicKey(keyPair.getPublicKey(), text1); + System.out.println("加密前:" + RsaUtils.SRC); + System.out.println("加密后:" + text1); + System.out.println("解密后:" + text2); + if (RsaUtils.SRC.equals(text2)) { + System.out.println("解密字符串和原始字符串一致,解密成功"); + } else { + System.out.println("解密字符串和原始字符串不一致,解密失败"); + } + System.out.println("***************** 私钥加密公钥解密结束 *****************"); + } + + /** + * 公钥解密 + * + * @param publicKeyText 公钥 + * @param text 待解密的信息 + * @return / + * @throws Exception / + */ + public static String decryptByPublicKey(String publicKeyText, String text) throws Exception { + X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, publicKey); + byte[] result = doLongerCipherFinal(Cipher.DECRYPT_MODE, cipher, Base64.decodeBase64(text)); + return new String(result); + } + + /** + * 私钥加密 + * + * @param privateKeyText 私钥 + * @param text 待加密的信息 + * @return / + * @throws Exception / + */ + public static String encryptByPrivateKey(String privateKeyText, String text) throws Exception { + PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyText.trim())); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + byte[] result = doLongerCipherFinal(Cipher.ENCRYPT_MODE, cipher, text.getBytes()); + return Base64.encodeBase64String(result); + } + + /** + * 私钥解密 + * + * @param privateKeyText 私钥 + * @param text 待解密的文本 + * @return / + * @throws Exception / + */ + public static String decryptByPrivateKey(String privateKeyText, String text) throws Exception { + PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyText)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + byte[] result = doLongerCipherFinal(Cipher.DECRYPT_MODE, cipher, Base64.decodeBase64(text)); + return new String(result); + } + + /** + * 公钥加密 + * + * @param publicKeyText 公钥 + * @param text 待加密的文本 + * @return / + */ + public static String encryptByPublicKey(String publicKeyText, String text) throws Exception { + X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + byte[] result = doLongerCipherFinal(Cipher.ENCRYPT_MODE, cipher, text.getBytes()); + return Base64.encodeBase64String(result); + } + + private static byte[] doLongerCipherFinal(int opMode,Cipher cipher, byte[] source) throws Exception { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + if (opMode == Cipher.DECRYPT_MODE) { + out.write(cipher.doFinal(source)); + } else { + int offset = 0; + int totalSize = source.length; + while (totalSize - offset > 0) { + int size = Math.min(cipher.getOutputSize(0) - 11, totalSize - offset); + out.write(cipher.doFinal(source, offset, size)); + offset += size; + } + } + out.close(); + return out.toByteArray(); + } + + /** + * 构建RSA密钥对 + * + * @return / + * @throws NoSuchAlgorithmException / + */ + public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException { + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); + keyPairGenerator.initialize(1024); + KeyPair keyPair = keyPairGenerator.generateKeyPair(); + RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic(); + RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate(); + String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded()); + String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded()); + return new RsaKeyPair(publicKeyString, privateKeyString); + } + + + /** + * RSA密钥对对象 + */ + public static class RsaKeyPair { + + private final String publicKey; + private final String privateKey; + + public RsaKeyPair(String publicKey, String privateKey) { + this.publicKey = publicKey; + this.privateKey = privateKey; + } + + public String getPublicKey() { + return publicKey; + } + + public String getPrivateKey() { + return privateKey; + } + + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/SecurityUtils.java b/youchain-common/src/main/java/com/youchain/utils/SecurityUtils.java new file mode 100644 index 0000000..8f8bd86 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/SecurityUtils.java @@ -0,0 +1,105 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import lombok.extern.slf4j.Slf4j; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.enums.DataScopeEnum; +import org.springframework.http.HttpStatus; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import java.util.List; + +/** + * 获取当前登录的用户 + * @author Liu Xue + * @date 2019-01-17 + */ +@Slf4j +public class SecurityUtils { + + /** + * 获取当前登录的用户 + * @return UserDetails + */ + public static UserDetails getCurrentUser() { + UserDetailsService userDetailsService = SpringContextHolder.getBean(UserDetailsService.class); + return userDetailsService.loadUserByUsername(getCurrentUsername()); + } + + /** + * 获取系统用户名称 + * + * @return 系统用户名称 + */ + public static String getCurrentUsername() { + final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); + } + if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails userDetails = (UserDetails) authentication.getPrincipal(); + return userDetails.getUsername(); + } + throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); + } + + /** + * 获取系统用户ID + * @return 系统用户ID + */ + public static Long getCurrentUserId() { + UserDetails userDetails = getCurrentUser(); + return new JSONObject(new JSONObject(userDetails).get("user")).get("id", Long.class); + } + + /** + * 获取当前用户的数据权限 + * @return / + */ + public static List getCurrentUserDataScope(){ + UserDetails userDetails = getCurrentUser(); + //log.error("-------------------"); + String str_json=JSONUtil.toJsonStr(userDetails); + // log.error(str_json); + JSONObject obj=new JSONObject(str_json); + JSONArray array=obj.getJSONArray("dataScopes"); + //JSONArray array = JSONUtil.parseArray(new JSONObject(userDetails).get("dataScopes")); + //log.error(array.toString()); + //log.error(array.size()+""); + return JSONUtil.toList(array,Long.class); + } + + + + + /** + * 获取数据权限级别 + * @return 级别 + */ + public static String getDataScopeType() { + List dataScopes = getCurrentUserDataScope(); + if(dataScopes.size() != 0){ + return ""; + } + return DataScopeEnum.ALL.getValue(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/SpringContextHolder.java b/youchain-common/src/main/java/com/youchain/utils/SpringContextHolder.java new file mode 100644 index 0000000..ad883b8 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/SpringContextHolder.java @@ -0,0 +1,156 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author Jie + * @date 2019-01-07 + */ +@Slf4j +public class SpringContextHolder implements ApplicationContextAware, DisposableBean { + + private static ApplicationContext applicationContext = null; + private static final List CALL_BACKS = new ArrayList<>(); + private static boolean addCallback = true; + + /** + * 针对 某些初始化方法,在SpringContextHolder 未初始化时 提交回调方法。 + * 在SpringContextHolder 初始化后,进行回调使用 + * + * @param callBack 回调函数 + */ + public synchronized static void addCallBacks(CallBack callBack) { + if (addCallback) { + SpringContextHolder.CALL_BACKS.add(callBack); + } else { + log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName()); + callBack.executor(); + } + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) { + assertContextInjected(); + return (T) applicationContext.getBean(name); + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + public static T getBean(Class requiredType) { + assertContextInjected(); + return applicationContext.getBean(requiredType); + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @param defaultValue 默认值 + * @param requiredType 返回类型 + * @return / + */ + public static T getProperties(String property, T defaultValue, Class requiredType) { + T result = defaultValue; + try { + result = getBean(Environment.class).getProperty(property, requiredType); + } catch (Exception ignored) {} + return result; + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @return / + */ + public static String getProperties(String property) { + return getProperties(property, null, String.class); + } + + /** + * 获取SpringBoot 配置信息 + * + * @param property 属性key + * @param requiredType 返回类型 + * @return / + */ + public static T getProperties(String property, Class requiredType) { + return getProperties(property, null, requiredType); + } + + /** + * 检查ApplicationContext不为空. + */ + private static void assertContextInjected() { + if (applicationContext == null) { + throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" + + ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder."); + } + } + + /** + * 清除SpringContextHolder中的ApplicationContext为Null. + */ + private static void clearHolder() { + log.debug("清除SpringContextHolder中的ApplicationContext:" + + applicationContext); + applicationContext = null; + } + + @Override + public void destroy() { + SpringContextHolder.clearHolder(); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if (SpringContextHolder.applicationContext != null) { + log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext); + } + SpringContextHolder.applicationContext = applicationContext; + if (addCallback) { + for (CallBack callBack : SpringContextHolder.CALL_BACKS) { + callBack.executor(); + } + CALL_BACKS.clear(); + } + SpringContextHolder.addCallback = false; + } + + /** + * 获取 @Service 的所有 bean 名称 + * @return / + */ + public static List getAllServiceBeanName() { + return new ArrayList<>(Arrays.asList(applicationContext + .getBeanNamesForAnnotation(Service.class))); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/StringUtils.java b/youchain-common/src/main/java/com/youchain/utils/StringUtils.java new file mode 100644 index 0000000..93b9850 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/StringUtils.java @@ -0,0 +1,264 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import lombok.extern.slf4j.Slf4j; +import com.youchain.config.ElAdminProperties; +import net.dreamlu.mica.ip2region.core.Ip2regionSearcher; +import net.dreamlu.mica.ip2region.core.IpInfo; +import nl.basjes.parse.useragent.UserAgent; +import nl.basjes.parse.useragent.UserAgentAnalyzer; +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.UnknownHostException; +import java.util.Calendar; +import java.util.Date; +import java.util.Enumeration; + +/** + * @author Liu Xue + * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 + */ +@Slf4j +public class StringUtils extends org.apache.commons.lang3.StringUtils { + + private static final char SEPARATOR = '_'; + private static final String UNKNOWN = "unknown"; + + /** + * 注入bean + */ + private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class); + + + private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer + .newBuilder() + .hideMatcherLoadStats() + .withCache(10000) + .withField(UserAgent.AGENT_NAME_VERSION) + .build(); + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCamelCase(String s) { + if (s == null) { + return null; + } + + s = s.toLowerCase(); + + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + if (c == SEPARATOR) { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + + return sb.toString(); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + public static String toCapitalizeCamelCase(String s) { + if (s == null) { + return null; + } + s = toCamelCase(s); + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + + /** + * 驼峰命名法工具 + * + * @return toCamelCase(" hello_world ") == "helloWorld" + * toCapitalizeCamelCase("hello_world") == "HelloWorld" + * toUnderScoreCase("helloWorld") = "hello_world" + */ + static String toUnderScoreCase(String s) { + if (s == null) { + return null; + } + + StringBuilder sb = new StringBuilder(); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + boolean nextUpperCase = true; + + if (i < (s.length() - 1)) { + nextUpperCase = Character.isUpperCase(s.charAt(i + 1)); + } + + if ((i > 0) && Character.isUpperCase(c)) { + if (!upperCase || !nextUpperCase) { + sb.append(SEPARATOR); + } + upperCase = true; + } else { + upperCase = false; + } + + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 获取ip地址 + */ + public static String getIp(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + String comma = ","; + String localhost = "127.0.0.1"; + if (ip.contains(comma)) { + ip = ip.split(",")[0]; + } + if (localhost.equals(ip)) { + // 获取本机真正的ip地址 + try { + ip = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.error(e.getMessage(), e); + } + } + return ip; + } + + /** + * 根据ip获取详细地址 + */ + public static String getCityInfo(String ip) { + if (ElAdminProperties.ipLocal) { + return getLocalCityInfo(ip); + } else { + return getHttpCityInfo(ip); + } + } + + /** + * 根据ip获取详细地址 + */ + public static String getHttpCityInfo(String ip) { + String api = String.format(ElAdminConstant.Url.IP_URL, ip); + JSONObject object = JSONUtil.parseObj(HttpUtil.get(api)); + return object.get("addr", String.class); + } + + /** + * 根据ip获取详细地址 + */ + public static String getLocalCityInfo(String ip) { + IpInfo ipInfo = IP_SEARCHER.memorySearch(ip); + if(ipInfo != null){ + return ipInfo.getAddress(); + } + return null; + + } + + public static String getBrowser(HttpServletRequest request) { + UserAgent.ImmutableUserAgent userAgent = USER_AGENT_ANALYZER.parse(request.getHeader("User-Agent")); + return userAgent.get(UserAgent.AGENT_NAME_VERSION).getValue(); + } + + /** + * 获得当天是周几 + */ + public static String getWeekDay() { + String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + + int w = cal.get(Calendar.DAY_OF_WEEK) - 1; + if (w < 0) { + w = 0; + } + return weekDays[w]; + } + + /** + * 获取当前机器的IP + * + * @return / + */ + public static String getLocalIp() { + try { + InetAddress candidateAddress = null; + // 遍历所有的网络接口 + for (Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();) { + NetworkInterface anInterface = interfaces.nextElement(); + // 在所有的接口下再遍历IP + for (Enumeration inetAddresses = anInterface.getInetAddresses(); inetAddresses.hasMoreElements();) { + InetAddress inetAddr = inetAddresses.nextElement(); + // 排除loopback类型地址 + if (!inetAddr.isLoopbackAddress()) { + if (inetAddr.isSiteLocalAddress()) { + // 如果是site-local地址,就是它了 + return inetAddr.getHostAddress(); + } else if (candidateAddress == null) { + // site-local类型的地址未被发现,先记录候选地址 + candidateAddress = inetAddr; + } + } + } + } + if (candidateAddress != null) { + return candidateAddress.getHostAddress(); + } + // 如果没有发现 non-loopback地址.只能用最次选的方案 + InetAddress jdkSuppliedAddress = InetAddress.getLocalHost(); + if (jdkSuppliedAddress == null) { + return ""; + } + return jdkSuppliedAddress.getHostAddress(); + } catch (Exception e) { + return ""; + } + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/ThrowableUtil.java b/youchain-common/src/main/java/com/youchain/utils/ThrowableUtil.java new file mode 100644 index 0000000..d75fe8a --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/ThrowableUtil.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * 异常工具 2019-01-06 + * @author Liu Xue + */ +public class ThrowableUtil { + + /** + * 获取堆栈信息 + */ + public static String getStackTrace(Throwable throwable){ + StringWriter sw = new StringWriter(); + try (PrintWriter pw = new PrintWriter(sw)) { + throwable.printStackTrace(pw); + return sw.toString(); + } + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/TranslatorUtil.java b/youchain-common/src/main/java/com/youchain/utils/TranslatorUtil.java new file mode 100644 index 0000000..5d75bff --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/TranslatorUtil.java @@ -0,0 +1,66 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.json.JSONArray; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; + +/** + * @author Liu Xue + * 翻译工具类 + */ +public class TranslatorUtil { + + public static String translate(String word){ + try { + String url = "https://translate.googleapis.com/translate_a/single?" + + "client=gtx&" + + "sl=en" + + "&tl=zh-CN" + + "&dt=t&q=" + URLEncoder.encode(word, "UTF-8"); + + URL obj = new URL(url); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); + + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuilder response = new StringBuilder(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + return parseResult(response.toString()); + }catch (Exception e){ + return word; + } + } + + private static String parseResult(String inputJson){ + JSONArray jsonArray2 = (JSONArray) new JSONArray(inputJson).get(0); + StringBuilder result = new StringBuilder(); + for (Object o : jsonArray2) { + result.append(((JSONArray) o).get(0).toString()); + } + return result.toString(); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/ValidationUtil.java b/youchain-common/src/main/java/com/youchain/utils/ValidationUtil.java new file mode 100644 index 0000000..ebc423a --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/ValidationUtil.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.ObjectUtil; +import com.youchain.exception.BadRequestException; + +/** + * 验证工具 + * + * @author Liu Xue + * @date 2018-11-23 + */ +public class ValidationUtil { + + /** + * 验证空 + */ + public static void isNull(Object obj, String entity, String parameter , Object value){ + if(ObjectUtil.isNull(obj)){ + String msg = entity + " 不存在: "+ parameter +" is "+ value; + throw new BadRequestException(msg); + } + } + + /** + * 验证是否为邮箱 + */ + public static boolean isEmail(String email) { + return Validator.isEmail(email); + } +} diff --git a/youchain-common/src/main/java/com/youchain/utils/enums/CodeBiEnum.java b/youchain-common/src/main/java/com/youchain/utils/enums/CodeBiEnum.java new file mode 100644 index 0000000..a03be38 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/enums/CodeBiEnum.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * 验证码业务场景 + *

+ * @author Liu Xue + * @date 2020-05-02 + */ +@Getter +@AllArgsConstructor +public enum CodeBiEnum { + + /* 旧邮箱修改邮箱 */ + ONE(1, "旧邮箱修改邮箱"), + + /* 通过邮箱修改密码 */ + TWO(2, "通过邮箱修改密码"); + + private final Integer code; + private final String description; + + public static CodeBiEnum find(Integer code) { + for (CodeBiEnum value : CodeBiEnum.values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + +} diff --git a/youchain-common/src/main/java/com/youchain/utils/enums/CodeEnum.java b/youchain-common/src/main/java/com/youchain/utils/enums/CodeEnum.java new file mode 100644 index 0000000..9d15e3c --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/enums/CodeEnum.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * 验证码业务场景对应的 Redis 中的 key + *

+ * @author Liu Xue + * @date 2020-05-02 + */ +@Getter +@AllArgsConstructor +public enum CodeEnum { + + /* 通过手机号码重置邮箱 */ + PHONE_RESET_EMAIL_CODE("phone_reset_email_code_", "通过手机号码重置邮箱"), + + /* 通过旧邮箱重置邮箱 */ + EMAIL_RESET_EMAIL_CODE("email_reset_email_code_", "通过旧邮箱重置邮箱"), + + /* 通过手机号码重置密码 */ + PHONE_RESET_PWD_CODE("phone_reset_pwd_code_", "通过手机号码重置密码"), + + /* 通过邮箱重置密码 */ + EMAIL_RESET_PWD_CODE("email_reset_pwd_code_", "通过邮箱重置密码"); + + private final String key; + private final String description; +} diff --git a/youchain-common/src/main/java/com/youchain/utils/enums/DataScopeEnum.java b/youchain-common/src/main/java/com/youchain/utils/enums/DataScopeEnum.java new file mode 100644 index 0000000..9488950 --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/enums/DataScopeEnum.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * 数据权限枚举 + *

+ * @author Liu Xue + * @date 2020-05-07 + */ +@Getter +@AllArgsConstructor +public enum DataScopeEnum { + + /* 全部的数据权限 */ + ALL("全部", "全部的数据权限"), + + /* 自己部门的数据权限 */ + THIS_LEVEL("本级", "自己部门的数据权限"), + + /* 自定义的数据权限 */ + CUSTOMIZE("自定义", "自定义的数据权限"); + + private final String value; + private final String description; + + public static DataScopeEnum find(String val) { + for (DataScopeEnum dataScopeEnum : DataScopeEnum.values()) { + if (dataScopeEnum.getValue().equals(val)) { + return dataScopeEnum; + } + } + return null; + } + +} diff --git a/youchain-common/src/main/java/com/youchain/utils/enums/RequestMethodEnum.java b/youchain-common/src/main/java/com/youchain/utils/enums/RequestMethodEnum.java new file mode 100644 index 0000000..debfc5c --- /dev/null +++ b/youchain-common/src/main/java/com/youchain/utils/enums/RequestMethodEnum.java @@ -0,0 +1,74 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author Liu Xue + * @website https://eladmin.vip + * @description + * @date 2020-06-10 + **/ +@Getter +@AllArgsConstructor +public enum RequestMethodEnum { + + /** + * 搜寻 @AnonymousGetMapping + */ + GET("GET"), + + /** + * 搜寻 @AnonymousPostMapping + */ + POST("POST"), + + /** + * 搜寻 @AnonymousPutMapping + */ + PUT("PUT"), + + /** + * 搜寻 @AnonymousPatchMapping + */ + PATCH("PATCH"), + + /** + * 搜寻 @AnonymousDeleteMapping + */ + DELETE("DELETE"), + + /** + * 否则就是所有 Request 接口都放行 + */ + ALL("All"); + + /** + * Request 类型 + */ + private final String type; + + public static RequestMethodEnum find(String type) { + for (RequestMethodEnum value : RequestMethodEnum.values()) { + if (value.getType().equals(type)) { + return value; + } + } + return ALL; + } +} diff --git a/youchain-common/src/main/java/org/apache/poi/util/XMLHelper.java b/youchain-common/src/main/java/org/apache/poi/util/XMLHelper.java new file mode 100644 index 0000000..8b2530a --- /dev/null +++ b/youchain-common/src/main/java/org/apache/poi/util/XMLHelper.java @@ -0,0 +1,272 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package org.apache.poi.util; + +import java.io.StringReader; +import java.lang.reflect.Method; +import java.util.concurrent.TimeUnit; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.stream.XMLEventFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.validation.SchemaFactory; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; + +@Internal +public final class XMLHelper { + static final String FEATURE_LOAD_DTD_GRAMMAR = "http://apache.org/xml/features/nonvalidating/load-dtd-grammar"; + static final String FEATURE_LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; + static final String FEATURE_DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; + static final String FEATURE_PARAMETER_ENTITIES = "http://xml.org/sax/features/external-parameter-entities"; + static final String FEATURE_EXTERNAL_ENTITIES = "http://xml.org/sax/features/external-general-entities"; + static final String PROPERTY_ENTITY_EXPANSION_LIMIT = "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit"; + static final String PROPERTY_SECURITY_MANAGER = "http://apache.org/xml/properties/security-manager"; + static final String METHOD_ENTITY_EXPANSION_XERCES = "setEntityExpansionLimit"; + static final String[] SECURITY_MANAGERS = new String[]{"org.apache.xerces.util.SecurityManager"}; + private static final Logger LOG = LogManager.getLogger(XMLHelper.class); + private static long lastLog; + private static final DocumentBuilderFactory documentBuilderFactory = getDocumentBuilderFactory(); + private static final SAXParserFactory saxFactory = getSaxParserFactory(); + + private XMLHelper() { + } + + public static DocumentBuilderFactory getDocumentBuilderFactory() { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setExpandEntityReferences(false); + factory.setValidating(false); + trySet(factory::setFeature, "http://javax.xml.XMLConstants/feature/secure-processing", true); + trySet(factory::setAttribute, "http://javax.xml.XMLConstants/property/accessExternalSchema", ""); + trySet(factory::setAttribute, "http://javax.xml.XMLConstants/property/accessExternalDTD", ""); + trySet(factory::setFeature, "http://xml.org/sax/features/external-general-entities", false); + trySet(factory::setFeature, "http://xml.org/sax/features/external-parameter-entities", false); + trySet(factory::setFeature, "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + trySet(factory::setFeature, "http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); + trySet(factory::setFeature, "http://apache.org/xml/features/disallow-doctype-decl", true); + trySet((n, b) -> { + factory.setXIncludeAware(b); + }, "XIncludeAware", false); + Object manager = getXercesSecurityManager(); + if (manager == null || !trySet(factory::setAttribute, "http://apache.org/xml/properties/security-manager", manager)) { + trySet(factory::setAttribute, "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit", 1); + } + + return factory; + } + + public static DocumentBuilder newDocumentBuilder() { + try { + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + documentBuilder.setEntityResolver(XMLHelper::ignoreEntity); + documentBuilder.setErrorHandler(new DocHelperErrorHandler()); + return documentBuilder; + } catch (ParserConfigurationException var1) { + throw new IllegalStateException("cannot create a DocumentBuilder", var1); + } + } + + public static SAXParserFactory getSaxParserFactory() { + try { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setValidating(false); + factory.setNamespaceAware(true); + trySet(factory::setFeature, "http://javax.xml.XMLConstants/feature/secure-processing", true); + trySet(factory::setFeature, "http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); + trySet(factory::setFeature, "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + trySet(factory::setFeature, "http://xml.org/sax/features/external-general-entities", false); + trySet(factory::setFeature, "http://apache.org/xml/features/disallow-doctype-decl", true); + return factory; + } catch (Error | RuntimeException var1) { + logThrowable(var1, "Failed to create SAXParserFactory", "-"); + throw var1; + } catch (Exception var2) { + logThrowable(var2, "Failed to create SAXParserFactory", "-"); + throw new RuntimeException("Failed to create SAXParserFactory", var2); + } + } + + public static XMLReader newXMLReader() throws SAXException, ParserConfigurationException { + XMLReader xmlReader = saxFactory.newSAXParser().getXMLReader(); + xmlReader.setEntityResolver(XMLHelper::ignoreEntity); + trySet(xmlReader::setFeature, "http://javax.xml.XMLConstants/feature/secure-processing", true); + trySet(xmlReader::setFeature, "http://xml.org/sax/features/external-general-entities", false); + Object manager = getXercesSecurityManager(); + if (manager == null || !trySet(xmlReader::setProperty, "http://apache.org/xml/properties/security-manager", manager)) { + trySet(xmlReader::setProperty, "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit", 1); + } + + return xmlReader; + } + + public static XMLInputFactory newXMLInputFactory() { + XMLInputFactory factory = XMLInputFactory.newInstance(); + trySet(factory::setProperty, "javax.xml.stream.isNamespaceAware", true); + trySet(factory::setProperty, "javax.xml.stream.isValidating", false); + trySet(factory::setProperty, "javax.xml.stream.supportDTD", false); + trySet(factory::setProperty, "javax.xml.stream.isSupportingExternalEntities", false); + return factory; + } + + public static XMLOutputFactory newXMLOutputFactory() { + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + trySet(factory::setProperty, "javax.xml.stream.isRepairingNamespaces", true); + return factory; + } + + public static XMLEventFactory newXMLEventFactory() { + return XMLEventFactory.newInstance(); + } + + public static TransformerFactory getTransformerFactory() { + TransformerFactory factory = TransformerFactory.newInstance(); + trySet(factory::setFeature, "http://javax.xml.XMLConstants/feature/secure-processing", true); + quietSet(factory::setAttribute, "http://javax.xml.XMLConstants/property/accessExternalDTD", ""); + trySet(factory::setAttribute, "http://javax.xml.XMLConstants/property/accessExternalStylesheet", ""); + quietSet(factory::setAttribute, "http://javax.xml.XMLConstants/property/accessExternalSchema", ""); + return factory; + } + + public static Transformer newTransformer() throws TransformerConfigurationException { + Transformer serializer = getTransformerFactory().newTransformer(); + serializer.setOutputProperty("encoding", "UTF-8"); + serializer.setOutputProperty("indent", "no"); + serializer.setOutputProperty("method", "xml"); + return serializer; + } + + public static SchemaFactory getSchemaFactory() { + SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); + trySet(factory::setFeature, "http://javax.xml.XMLConstants/feature/secure-processing", true); + trySet(factory::setProperty, "http://javax.xml.XMLConstants/property/accessExternalDTD", ""); + trySet(factory::setProperty, "http://javax.xml.XMLConstants/property/accessExternalStylesheet", ""); + trySet(factory::setProperty, "http://javax.xml.XMLConstants/property/accessExternalSchema", ""); + return factory; + } + + private static Object getXercesSecurityManager() { + String[] var0 = SECURITY_MANAGERS; + int var1 = var0.length; + + for(int var2 = 0; var2 < var1; ++var2) { + String securityManagerClassName = var0[var2]; + + try { + Object mgr = Class.forName(securityManagerClassName).getDeclaredConstructor().newInstance(); + Method setLimit = mgr.getClass().getMethod("setEntityExpansionLimit", Integer.TYPE); + setLimit.invoke(mgr, 1); + return mgr; + } catch (ClassNotFoundException var6) { + } catch (Throwable var7) { + logThrowable(var7, "SAX Feature unsupported", securityManagerClassName); + } + } + + return null; + } + + private static boolean trySet(SecurityFeature feature, String name, boolean value) { + try { + feature.accept(name, value); + return true; + } catch (Exception var4) { + logThrowable(var4, "SAX Feature unsupported", name); + } catch (Error var5) { + logThrowable(var5, "Cannot set SAX feature because outdated XML parser in classpath", name); + } + + return false; + } + + private static boolean trySet(SecurityProperty property, String name, Object value) { + try { + property.accept(name, value); + return true; + } catch (Exception var4) { + logThrowable(var4, "SAX Feature unsupported", name); + } catch (Error var5) { + logThrowable(var5, "Cannot set SAX feature because outdated XML parser in classpath", name); + } + + return false; + } + + private static boolean quietSet(SecurityProperty property, String name, Object value) { + try { + property.accept(name, value); + return true; + } catch (Error | Exception var4) { + return false; + } + } + + private static void logThrowable(Throwable t, String message, String name) { + if (System.currentTimeMillis() > lastLog + TimeUnit.MINUTES.toMillis(5L)) { + //LOG.atWarn().withThrowable(t).log("{} [log suppressed for 5 minutes]{}", message, name); + lastLog = System.currentTimeMillis(); + } + + } + + private static InputSource ignoreEntity(String publicId, String systemId) { + return new InputSource(new StringReader("")); + } + + private static class DocHelperErrorHandler implements ErrorHandler { + private DocHelperErrorHandler() { + } + + public void warning(SAXParseException exception) { + this.printError(Level.WARN, exception); + } + + public void error(SAXParseException exception) { + this.printError(Level.ERROR, exception); + } + + public void fatalError(SAXParseException exception) throws SAXException { + this.printError(Level.FATAL, exception); + throw exception; + } + + private void printError(Level type, SAXParseException ex) { + String systemId = ex.getSystemId(); + if (systemId != null) { + int index = systemId.lastIndexOf(47); + if (index != -1) { + systemId = systemId.substring(index + 1); + } + } + + String message = (systemId == null ? "" : systemId) + ':' + ex.getLineNumber() + ':' + ex.getColumnNumber() + ':' + ex.getMessage(); + XMLHelper.LOG.atLevel(type).withThrowable(ex).log(message); + } + } + + @FunctionalInterface + private interface SecurityProperty { + void accept(String var1, Object var2) throws SAXException; + } + + @FunctionalInterface + private interface SecurityFeature { + void accept(String var1, boolean var2) throws ParserConfigurationException, SAXException, TransformerException; + } +} diff --git a/youchain-common/src/main/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java b/youchain-common/src/main/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java new file mode 100644 index 0000000..25d18f0 --- /dev/null +++ b/youchain-common/src/main/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java @@ -0,0 +1,61 @@ +package org.apache.poi.xssf.streaming; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.poi.common.usermodel.HyperlinkType; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.ExtendedColor; +import org.apache.poi.ss.usermodel.Hyperlink; +import org.apache.poi.ss.util.AreaReference; +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.util.Internal; +import org.apache.poi.xssf.usermodel.XSSFCreationHelper; +import org.apache.poi.xssf.usermodel.XSSFRichTextString; + +public class SXSSFCreationHelper implements CreationHelper { + private static final Logger LOG = LogManager.getLogger(SXSSFCreationHelper.class); + private final SXSSFWorkbook wb; + private final XSSFCreationHelper helper; + + @Internal + public SXSSFCreationHelper(SXSSFWorkbook workbook) { + this.helper = new XSSFCreationHelper(workbook.getXSSFWorkbook()); + this.wb = workbook; + } + + public XSSFRichTextString createRichTextString(String text) { + // LOG.atInfo().log("SXSSF doesn't support Rich Text Strings, any formatting information will be lost"); + return new XSSFRichTextString(text); + } + + public SXSSFFormulaEvaluator createFormulaEvaluator() { + return new SXSSFFormulaEvaluator(this.wb); + } + + public DataFormat createDataFormat() { + return this.helper.createDataFormat(); + } + + public Hyperlink createHyperlink(HyperlinkType type) { + return this.helper.createHyperlink(type); + } + + public ExtendedColor createExtendedColor() { + return this.helper.createExtendedColor(); + } + + public ClientAnchor createClientAnchor() { + return this.helper.createClientAnchor(); + } + + public AreaReference createAreaReference(String reference) { + return new AreaReference(reference, this.wb.getSpreadsheetVersion()); + } + + public AreaReference createAreaReference(CellReference topLeft, CellReference bottomRight) { + return new AreaReference(topLeft, bottomRight, this.wb.getSpreadsheetVersion()); + } +} + diff --git a/youchain-common/src/test/java/com/youchain/utils/DateUtilsTest.java b/youchain-common/src/test/java/com/youchain/utils/DateUtilsTest.java new file mode 100644 index 0000000..b60a0c9 --- /dev/null +++ b/youchain-common/src/test/java/com/youchain/utils/DateUtilsTest.java @@ -0,0 +1,26 @@ +package com.youchain.utils; + +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.util.Date; + +public class DateUtilsTest { + @Test + public void test1() { + long l = System.currentTimeMillis() / 1000; + LocalDateTime localDateTime = DateUtil.fromTimeStamp(l); + System.out.print(DateUtil.localDateTimeFormatyMdHms(localDateTime)); + } + + @Test + public void test2() { + LocalDateTime now = LocalDateTime.now(); + System.out.println(DateUtil.localDateTimeFormatyMdHms(now)); + Date date = DateUtil.toDate(now); + LocalDateTime localDateTime = DateUtil.toLocalDateTime(date); + System.out.println(DateUtil.localDateTimeFormatyMdHms(localDateTime)); + LocalDateTime localDateTime1 = DateUtil.fromTimeStamp(date.getTime() / 1000); + System.out.println(DateUtil.localDateTimeFormatyMdHms(localDateTime1)); + } +} diff --git a/youchain-common/src/test/java/com/youchain/utils/EncryptUtilsTest.java b/youchain-common/src/test/java/com/youchain/utils/EncryptUtilsTest.java new file mode 100644 index 0000000..36bae71 --- /dev/null +++ b/youchain-common/src/test/java/com/youchain/utils/EncryptUtilsTest.java @@ -0,0 +1,33 @@ +package com.youchain.utils; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class EncryptUtilsTest { + + /** + * 对称加密 + */ + @Test + public void testDesEncrypt() { + try { + Assertions.assertEquals("7772841DC6099402", EncryptUtils.desEncrypt("123456")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 对称解密 + */ + @Test + public void testDesDecrypt() { + try { + Assertions.assertEquals("123456", EncryptUtils.desDecrypt("7772841DC6099402")); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/youchain-common/src/test/java/com/youchain/utils/FileUtilTest.java b/youchain-common/src/test/java/com/youchain/utils/FileUtilTest.java new file mode 100644 index 0000000..d11bf17 --- /dev/null +++ b/youchain-common/src/test/java/com/youchain/utils/FileUtilTest.java @@ -0,0 +1,36 @@ +package com.youchain.utils; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.mock.web.MockMultipartFile; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class FileUtilTest { + + @Test + public void testToFile() { + long retval = FileUtil.toFile(new MockMultipartFile("foo", (byte[]) null)).getTotalSpace(); + assertEquals(500695072768L, retval); + } + + @Test + public void testGetExtensionName() { + Assertions.assertEquals("foo", FileUtil.getExtensionName("foo")); + Assertions.assertEquals("exe", FileUtil.getExtensionName("bar.exe")); + } + + @Test + public void testGetFileNameNoEx() { + Assertions.assertEquals("foo", FileUtil.getFileNameNoEx("foo")); + Assertions.assertEquals("bar", FileUtil.getFileNameNoEx("bar.txt")); + } + + @Test + public void testGetSize() { + Assertions.assertEquals("1000B ", FileUtil.getSize(1000)); + Assertions.assertEquals("1.00KB ", FileUtil.getSize(1024)); + Assertions.assertEquals("1.00MB ", FileUtil.getSize(1048576)); + Assertions.assertEquals("1.00GB ", FileUtil.getSize(1073741824)); + } +} diff --git a/youchain-common/src/test/java/com/youchain/utils/StringUtilsTest.java b/youchain-common/src/test/java/com/youchain/utils/StringUtilsTest.java new file mode 100644 index 0000000..8569db3 --- /dev/null +++ b/youchain-common/src/test/java/com/youchain/utils/StringUtilsTest.java @@ -0,0 +1,44 @@ +package com.youchain.utils; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.mock.web.MockHttpServletRequest; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class StringUtilsTest { + + @Test + public void testToCamelCase() { + assertNull(StringUtils.toCamelCase(null)); + } + + @Test + public void testToCapitalizeCamelCase() { + assertNull(StringUtils.toCapitalizeCamelCase(null)); + Assertions.assertEquals("HelloWorld", StringUtils.toCapitalizeCamelCase("hello_world")); + } + + @Test + public void testToUnderScoreCase() { + assertNull(StringUtils.toUnderScoreCase(null)); + Assertions.assertEquals("hello_world", StringUtils.toUnderScoreCase("helloWorld")); + Assertions.assertEquals("\u0000\u0000", StringUtils.toUnderScoreCase("\u0000\u0000")); + Assertions.assertEquals("\u0000_a", StringUtils.toUnderScoreCase("\u0000A")); + } + + @Test + public void testGetWeekDay() { + SimpleDateFormat simpleDateformat = new SimpleDateFormat("E"); + Assertions.assertEquals(simpleDateformat.format(new Date()), StringUtils.getWeekDay()); + } + + @Test + public void testGetIP() { + Assertions.assertEquals("127.0.0.1", StringUtils.getIp(new MockHttpServletRequest())); + } +} diff --git a/youchain-generator/pom.xml b/youchain-generator/pom.xml new file mode 100644 index 0000000..c995405 --- /dev/null +++ b/youchain-generator/pom.xml @@ -0,0 +1,39 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + youchain-generator + 代码生成模块 + + + 1.10 + + + + + com.youchain + youchain-common + 2.6 + + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + + commons-configuration + commons-configuration + ${configuration.version} + + + \ No newline at end of file diff --git a/youchain-generator/src/main/java/com/youchain/domain/ColumnInfo.java b/youchain-generator/src/main/java/com/youchain/domain/ColumnInfo.java new file mode 100644 index 0000000..9133f68 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/domain/ColumnInfo.java @@ -0,0 +1,97 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import com.youchain.utils.GenUtil; +import javax.persistence.*; +import java.io.Serializable; + +/** + * 列的数据信息 + * @author Liu Xue + * @date 2019-01-02 + */ +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "code_column_config") +public class ColumnInfo implements Serializable { + + @Id + @Column(name = "column_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ApiModelProperty(value = "表名") + private String tableName; + + @ApiModelProperty(value = "数据库字段名称") + private String columnName; + + @ApiModelProperty(value = "数据库字段类型") + private String columnType; + + @ApiModelProperty(value = "数据库字段键类型") + private String keyType; + + @ApiModelProperty(value = "字段额外的参数") + private String extra; + + @ApiModelProperty(value = "数据库字段描述") + private String remark; + + @ApiModelProperty(value = "是否必填") + private Boolean notNull; + + @ApiModelProperty(value = "是否在列表显示") + private Boolean listShow; + + @ApiModelProperty(value = "是否表单显示") + private Boolean formShow; + + @ApiModelProperty(value = "表单类型") + private String formType; + + @ApiModelProperty(value = "查询 1:模糊 2:精确") + private String queryType; + + @ApiModelProperty(value = "字典名称") + private String dictName; + + @ApiModelProperty(value = "日期注解") + private String dateAnnotation; + + public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) { + this.tableName = tableName; + this.columnName = columnName; + this.columnType = columnType; + this.keyType = keyType; + this.extra = extra; + this.notNull = notNull; + if(GenUtil.PK.equalsIgnoreCase(keyType) && GenUtil.EXTRA.equalsIgnoreCase(extra)){ + this.notNull = false; + } + this.remark = remark; + this.listShow = true; + this.formShow = true; + } +} diff --git a/youchain-generator/src/main/java/com/youchain/domain/GenConfig.java b/youchain-generator/src/main/java/com/youchain/domain/GenConfig.java new file mode 100644 index 0000000..b7cc80b --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/domain/GenConfig.java @@ -0,0 +1,78 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 代码生成配置 + * @author Liu Xue + * @date 2019-01-03 + */ +@Getter +@Setter +@Entity +@NoArgsConstructor +@Table(name = "code_gen_config") +public class GenConfig implements Serializable { + + public GenConfig(String tableName) { + this.tableName = tableName; + } + + @Id + @Column(name = "config_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotBlank + @ApiModelProperty(value = "表名") + private String tableName; + + @ApiModelProperty(value = "接口名称") + private String apiAlias; + + @NotBlank + @ApiModelProperty(value = "包路径") + private String pack; + + @NotBlank + @ApiModelProperty(value = "模块名") + private String moduleName; + + @NotBlank + @ApiModelProperty(value = "前端文件路径") + private String path; + + @ApiModelProperty(value = "前端文件路径") + private String apiPath; + + @ApiModelProperty(value = "作者") + private String author; + + @ApiModelProperty(value = "表前缀") + private String prefix; + + @ApiModelProperty(value = "是否覆盖") + private Boolean cover = false; +} diff --git a/youchain-generator/src/main/java/com/youchain/domain/vo/TableInfo.java b/youchain-generator/src/main/java/com/youchain/domain/vo/TableInfo.java new file mode 100644 index 0000000..bc6d136 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/domain/vo/TableInfo.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 表的数据信息 + * @author Liu Xue + * @date 2019-01-02 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TableInfo { + + /** 表名称 */ + private Object tableName; + + /** 创建日期 */ + private Object createTime; + + /** 数据库引擎 */ + private Object engine; + + /** 编码集 */ + private Object coding; + + /** 备注 */ + private Object remark; + + +} diff --git a/youchain-generator/src/main/java/com/youchain/repository/ColumnInfoRepository.java b/youchain-generator/src/main/java/com/youchain/repository/ColumnInfoRepository.java new file mode 100644 index 0000000..7137b8f --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/repository/ColumnInfoRepository.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.ColumnInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-01-14 + */ +public interface ColumnInfoRepository extends JpaRepository { + + /** + * 查询表信息 + * @param tableName 表格名 + * @return 表信息 + */ + List findByTableNameOrderByIdAsc(String tableName); +} diff --git a/youchain-generator/src/main/java/com/youchain/repository/GenConfigRepository.java b/youchain-generator/src/main/java/com/youchain/repository/GenConfigRepository.java new file mode 100644 index 0000000..c36a301 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/repository/GenConfigRepository.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.GenConfig; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * @author Liu Xue + * @date 2019-01-14 + */ +public interface GenConfigRepository extends JpaRepository { + + /** + * 查询表配置 + * @param tableName 表名 + * @return / + */ + GenConfig findByTableName(String tableName); +} diff --git a/youchain-generator/src/main/java/com/youchain/rest/GenConfigController.java b/youchain-generator/src/main/java/com/youchain/rest/GenConfigController.java new file mode 100644 index 0000000..6792906 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/rest/GenConfigController.java @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import com.youchain.domain.GenConfig; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.service.GenConfigService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * @author Liu Xue + * @date 2019-01-14 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/genConfig") +@Api(tags = "系统:代码生成器配置管理") +public class GenConfigController { + + private final GenConfigService genConfigService; + + @ApiOperation("查询") + @GetMapping(value = "/{tableName}") + public ResponseEntity queryGenConfig(@PathVariable String tableName){ + return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); + } + + @PutMapping + @ApiOperation("修改") + public ResponseEntity updateGenConfig(@Validated @RequestBody GenConfig genConfig){ + return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK); + } +} diff --git a/youchain-generator/src/main/java/com/youchain/rest/GeneratorController.java b/youchain-generator/src/main/java/com/youchain/rest/GeneratorController.java new file mode 100644 index 0000000..0f025c6 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/rest/GeneratorController.java @@ -0,0 +1,107 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import com.youchain.exception.BadRequestException; +import com.youchain.utils.PageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.domain.ColumnInfo; +import com.youchain.service.GenConfigService; +import com.youchain.service.GeneratorService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-01-02 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/generator") +@Api(tags = "系统:代码生成管理") +public class GeneratorController { + + private final GeneratorService generatorService; + private final GenConfigService genConfigService; + + @Value("${generator.enabled}") + private Boolean generatorEnabled; + + @ApiOperation("查询数据库数据") + @GetMapping(value = "/tables/all") + public ResponseEntity queryAllTables(){ + return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK); + } + + @ApiOperation("查询数据库数据") + @GetMapping(value = "/tables") + public ResponseEntity queryTables(@RequestParam(defaultValue = "") String name, + @RequestParam(defaultValue = "0")Integer page, + @RequestParam(defaultValue = "10")Integer size){ + int[] startEnd = PageUtil.transToStartEnd(page, size); + return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK); + } + + @ApiOperation("查询字段数据") + @GetMapping(value = "/columns") + public ResponseEntity queryColumns(@RequestParam String tableName){ + List columnInfos = generatorService.getColumns(tableName); + return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK); + } + + @ApiOperation("保存字段数据") + @PutMapping + public ResponseEntity saveColumn(@RequestBody List columnInfos){ + generatorService.save(columnInfos); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("同步字段数据") + @PostMapping(value = "sync") + public ResponseEntity syncColumn(@RequestBody List tables){ + for (String table : tables) { + generatorService.sync(generatorService.getColumns(table), generatorService.query(table)); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("生成代码") + @PostMapping(value = "/{tableName}/{type}") + public ResponseEntity generatorCode(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ + if(!generatorEnabled && type == 0){ + throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!"); + } + switch (type){ + // 生成代码 + case 0: generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName)); + break; + // 预览 + case 1: return generatorService.preview(genConfigService.find(tableName), generatorService.getColumns(tableName)); + // 打包 + case 2: generatorService.download(genConfigService.find(tableName), generatorService.getColumns(tableName), request, response); + break; + default: throw new BadRequestException("没有这个选项"); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-generator/src/main/java/com/youchain/service/GenConfigService.java b/youchain-generator/src/main/java/com/youchain/service/GenConfigService.java new file mode 100644 index 0000000..46663e6 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/service/GenConfigService.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.GenConfig; + +/** + * @author Liu Xue + * @date 2019-01-14 + */ +public interface GenConfigService { + + /** + * 查询表配置 + * @param tableName 表名 + * @return 表配置 + */ + GenConfig find(String tableName); + + /** + * 更新表配置 + * @param tableName 表名 + * @param genConfig 表配置 + * @return 表配置 + */ + GenConfig update(String tableName, GenConfig genConfig); +} diff --git a/youchain-generator/src/main/java/com/youchain/service/GeneratorService.java b/youchain-generator/src/main/java/com/youchain/service/GeneratorService.java new file mode 100644 index 0000000..c94585b --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/service/GeneratorService.java @@ -0,0 +1,96 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.ColumnInfo; +import com.youchain.domain.GenConfig; +import org.springframework.http.ResponseEntity; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-01-02 + */ +public interface GeneratorService { + + /** + * 查询数据库元数据 + * @param name 表名 + * @param startEnd 分页参数 + * @return / + */ + Object getTables(String name, int[] startEnd); + + /** + * 得到数据表的元数据 + * @param name 表名 + * @return / + */ + List getColumns(String name); + + /** + * 同步表数据 + * @param columnInfos / + * @param columnInfoList / + */ + void sync(List columnInfos, List columnInfoList); + + /** + * 保持数据 + * @param columnInfos / + */ + void save(List columnInfos); + + /** + * 获取所有table + * @return / + */ + Object getTables(); + + /** + * 代码生成 + * @param genConfig 配置信息 + * @param columns 字段信息 + */ + void generator(GenConfig genConfig, List columns); + + /** + * 预览 + * @param genConfig 配置信息 + * @param columns 字段信息 + * @return / + */ + ResponseEntity preview(GenConfig genConfig, List columns); + + /** + * 打包下载 + * @param genConfig 配置信息 + * @param columns 字段信息 + * @param request / + * @param response / + */ + void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response); + + /** + * 查询数据库的表字段数据数据 + * @param table / + * @return / + */ + List query(String table); +} diff --git a/youchain-generator/src/main/java/com/youchain/service/impl/GenConfigServiceImpl.java b/youchain-generator/src/main/java/com/youchain/service/impl/GenConfigServiceImpl.java new file mode 100644 index 0000000..3a7a614 --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/service/impl/GenConfigServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import com.youchain.domain.GenConfig; +import com.youchain.repository.GenConfigRepository; +import com.youchain.service.GenConfigService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import java.io.File; + +/** + * @author Liu Xue + * @date 2019-01-14 + */ +@Service +@RequiredArgsConstructor +public class GenConfigServiceImpl implements GenConfigService { + + private final GenConfigRepository genConfigRepository; + + @Override + public GenConfig find(String tableName) { + GenConfig genConfig = genConfigRepository.findByTableName(tableName); + if(genConfig == null){ + return new GenConfig(tableName); + } + return genConfig; + } + + @Override + public GenConfig update(String tableName, GenConfig genConfig) { + String separator = File.separator; + String[] paths; + String symbol = "\\"; + if (symbol.equals(separator)) { + paths = genConfig.getPath().split("\\\\"); + } else { + paths = genConfig.getPath().split(File.separator); + } + StringBuilder api = new StringBuilder(); + for (String path : paths) { + api.append(path); + api.append(separator); + if ("src".equals(path)) { + api.append("api"); + break; + } + } + genConfig.setApiPath(api.toString()); + return genConfigRepository.save(genConfig); + } +} diff --git a/youchain-generator/src/main/java/com/youchain/service/impl/GeneratorServiceImpl.java b/youchain-generator/src/main/java/com/youchain/service/impl/GeneratorServiceImpl.java new file mode 100644 index 0000000..1889a4b --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/service/impl/GeneratorServiceImpl.java @@ -0,0 +1,206 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ZipUtil; +import com.youchain.domain.ColumnInfo; +import com.youchain.domain.GenConfig; +import com.youchain.domain.vo.TableInfo; +import com.youchain.exception.BadRequestException; +import com.youchain.repository.ColumnInfoRepository; +import com.youchain.service.GeneratorService; +import com.youchain.utils.FileUtil; +import com.youchain.utils.GenUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2019-01-02 + */ +@Service +@RequiredArgsConstructor +public class GeneratorServiceImpl implements GeneratorService { + private static final Logger log = LoggerFactory.getLogger(GeneratorServiceImpl.class); + @PersistenceContext + private EntityManager em; + + private final ColumnInfoRepository columnInfoRepository; + + private final String CONFIG_MESSAGE = "请先配置生成器"; + @Override + public Object getTables() { + // 使用预编译防止sql注入 + String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " + + "where table_schema = (select database()) " + + "order by create_time desc"; + Query query = em.createNativeQuery(sql); + return query.getResultList(); + } + + @Override + public Object getTables(String name, int[] startEnd) { + // 使用预编译防止sql注入 + String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " + + "where table_schema = (select database()) " + + "and table_name like :table order by create_time desc"; + Query query = em.createNativeQuery(sql); + query.setFirstResult(startEnd[0]); + query.setMaxResults(startEnd[1] - startEnd[0]); + query.setParameter("table", StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%"); + List result = query.getResultList(); + List tableInfos = new ArrayList<>(); + for (Object obj : result) { + Object[] arr = (Object[]) obj; + tableInfos.add(new TableInfo(arr[0], arr[1], arr[2], arr[3], ObjectUtil.isNotEmpty(arr[4]) ? arr[4] : "-")); + } + String countSql = "select count(1) from information_schema.tables " + + "where table_schema = (select database()) and table_name like :table"; + Query queryCount = em.createNativeQuery(countSql); + queryCount.setParameter("table", StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%"); + Object totalElements = queryCount.getSingleResult(); + return PageUtil.toPage(tableInfos, totalElements); + } + + @Override + public List getColumns(String tableName) { + List columnInfos = columnInfoRepository.findByTableNameOrderByIdAsc(tableName); + if (CollectionUtil.isNotEmpty(columnInfos)) { + return columnInfos; + } else { + columnInfos = query(tableName); + return columnInfoRepository.saveAll(columnInfos); + } + } + + @Override + public List query(String tableName) { + // 使用预编译防止sql注入 + String sql = "select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " + + "where table_name = ? and table_schema = (select database()) order by ordinal_position"; + Query query = em.createNativeQuery(sql); + query.setParameter(1, tableName); + List result = query.getResultList(); + List columnInfos = new ArrayList<>(); + for (Object obj : result) { + Object[] arr = (Object[]) obj; + columnInfos.add( + new ColumnInfo( + tableName, + arr[0].toString(), + "NO".equals(arr[1]), + arr[2].toString(), + ObjectUtil.isNotNull(arr[3]) ? arr[3].toString() : null, + ObjectUtil.isNotNull(arr[4]) ? arr[4].toString() : null, + ObjectUtil.isNotNull(arr[5]) ? arr[5].toString() : null) + ); + } + return columnInfos; + } + + @Override + public void sync(List columnInfos, List columnInfoList) { + // 第一种情况,数据库类字段改变或者新增字段 + for (ColumnInfo columnInfo : columnInfoList) { + // 根据字段名称查找 + List columns = columnInfos.stream().filter(c -> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList()); + // 如果能找到,就修改部分可能被字段 + if (CollectionUtil.isNotEmpty(columns)) { + ColumnInfo column = columns.get(0); + column.setColumnType(columnInfo.getColumnType()); + column.setExtra(columnInfo.getExtra()); + column.setKeyType(columnInfo.getKeyType()); + if (StringUtils.isBlank(column.getRemark())) { + column.setRemark(columnInfo.getRemark()); + } + columnInfoRepository.save(column); + } else { + // 如果找不到,则保存新字段信息 + columnInfoRepository.save(columnInfo); + } + } + // 第二种情况,数据库字段删除了 + for (ColumnInfo columnInfo : columnInfos) { + // 根据字段名称查找 + List columns = columnInfoList.stream().filter(c -> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList()); + // 如果找不到,就代表字段被删除了,则需要删除该字段 + if (CollectionUtil.isEmpty(columns)) { + columnInfoRepository.delete(columnInfo); + } + } + } + + @Override + public void save(List columnInfos) { + columnInfoRepository.saveAll(columnInfos); + } + + @Override + public void generator(GenConfig genConfig, List columns) { + if (genConfig.getId() == null) { + throw new BadRequestException(CONFIG_MESSAGE); + } + try { + GenUtil.generatorCode(columns, genConfig); + } catch (IOException e) { + log.error(e.getMessage(), e); + throw new BadRequestException("生成失败,请手动处理已生成的文件"); + } + } + + @Override + public ResponseEntity preview(GenConfig genConfig, List columns) { + if (genConfig.getId() == null) { + throw new BadRequestException(CONFIG_MESSAGE); + } + List> genList = GenUtil.preview(columns, genConfig); + return new ResponseEntity<>(genList, HttpStatus.OK); + } + + @Override + public void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response) { + if (genConfig.getId() == null) { + throw new BadRequestException(CONFIG_MESSAGE); + } + try { + File file = new File(GenUtil.download(columns, genConfig)); + String zipPath = file.getPath() + ".zip"; + ZipUtil.zip(file.getPath(), zipPath); + FileUtil.downloadFile(request, response, new File(zipPath), true); + } catch (IOException e) { + throw new BadRequestException("打包失败"); + } + } +} diff --git a/youchain-generator/src/main/java/com/youchain/utils/ColUtil.java b/youchain-generator/src/main/java/com/youchain/utils/ColUtil.java new file mode 100644 index 0000000..778fc2e --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/utils/ColUtil.java @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import org.apache.commons.configuration.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * sql字段转java + * + * @author Liu Xue + * @date 2019-01-03 + */ +public class ColUtil { + private static final Logger log = LoggerFactory.getLogger(ColUtil.class); + + /** + * 转换mysql数据类型为java数据类型 + * + * @param type 数据库字段类型 + * @return String + */ + static String cloToJava(String type) { + Configuration config = getConfig(); + assert config != null; + return config.getString(type, "unknowType"); + } + + /** + * 获取配置信息 + */ + public static PropertiesConfiguration getConfig() { + try { + return new PropertiesConfiguration("generator.properties"); + } catch (ConfigurationException e) { + log.error(e.getMessage(), e); + } + return null; + } +} diff --git a/youchain-generator/src/main/java/com/youchain/utils/GenUtil.java b/youchain-generator/src/main/java/com/youchain/utils/GenUtil.java new file mode 100644 index 0000000..83d2e5c --- /dev/null +++ b/youchain-generator/src/main/java/com/youchain/utils/GenUtil.java @@ -0,0 +1,420 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.template.*; +import com.youchain.domain.ColumnInfo; +import com.youchain.domain.GenConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.ObjectUtils; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.time.LocalDate; +import java.util.*; + +/** + * 代码生成 + * + * @author Liu Xue + * @date 2019-01-02 + */ +@Slf4j +@SuppressWarnings({"unchecked", "all"}) +public class GenUtil { + + private static final String TIMESTAMP = "Timestamp"; + + private static final String BIGDECIMAL = "BigDecimal"; + + public static final String PK = "PRI"; + + public static final String EXTRA = "auto_increment"; + + /** + * 获取后端代码模板名称 + * + * @return List + */ + private static List getAdminTemplateNames() { + List templateNames = new ArrayList<>(); + templateNames.add("Entity"); + templateNames.add("Dto"); + templateNames.add("Mapper"); + templateNames.add("Controller"); + templateNames.add("QueryCriteria"); + templateNames.add("Service"); + templateNames.add("ServiceImpl"); + templateNames.add("Repository"); + return templateNames; + } + + /** + * 获取前端代码模板名称 + * + * @return List + */ + private static List getFrontTemplateNames() { + List templateNames = new ArrayList<>(); + templateNames.add("index"); + templateNames.add("api"); + return templateNames; + } + + public static List> preview(List columns, GenConfig genConfig) { + Map genMap = getGenMap(columns, genConfig); + List> genList = new ArrayList<>(); + // 获取后端模版 + List templates = getAdminTemplateNames(); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + for (String templateName : templates) { + Map map = new HashMap<>(1); + Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); + map.put("content", template.render(genMap)); + map.put("name", templateName); + genList.add(map); + } + // 获取前端模版 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Map map = new HashMap<>(1); + Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); + map.put(templateName, template.render(genMap)); + map.put("content", template.render(genMap)); + map.put("name", templateName); + genList.add(map); + } + return genList; + } + + public static String download(List columns, GenConfig genConfig) throws IOException { + // 拼接的路径:/tmpeladmin-gen-temp/,这个路径在Linux下需要root用户才有权限创建,非root用户会权限错误而失败,更改为: /tmp/eladmin-gen-temp/ + // String tempPath =SYS_TEM_DIR + "eladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator; + String tempPath = FileUtil.SYS_TEM_DIR + "eladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator; + Map genMap = getGenMap(columns, genConfig); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + // 生成后端代码 + List templates = getAdminTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); + String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), tempPath + "eladmin" + File.separator); + assert filePath != null; + File file = new File(filePath); + // 如果非覆盖生成 + if (!genConfig.getCover() && FileUtil.exist(file)) { + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + // 生成前端代码 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); + String path = tempPath + "eladmin-web" + File.separator; + String apiPath = path + "src" + File.separator + "api" + File.separator; + String srcPath = path + "src" + File.separator + "views" + File.separator + genMap.get("changeClassName").toString() + File.separator; + String filePath = getFrontFilePath(templateName, apiPath, srcPath, genMap.get("changeClassName").toString()); + assert filePath != null; + File file = new File(filePath); + // 如果非覆盖生成 + if (!genConfig.getCover() && FileUtil.exist(file)) { + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + return tempPath; + } + + public static void generatorCode(List columnInfos, GenConfig genConfig) throws IOException { + Map genMap = getGenMap(columnInfos, genConfig); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + // 生成后端代码 + List templates = getAdminTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); + String rootPath = System.getProperty("user.dir"); + String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), rootPath); + + assert filePath != null; + File file = new File(filePath); + + // 如果非覆盖生成 + if (!genConfig.getCover() && FileUtil.exist(file)) { + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + + // 生成前端代码 + templates = getFrontTemplateNames(); + for (String templateName : templates) { + Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); + String filePath = getFrontFilePath(templateName, genConfig.getApiPath(), genConfig.getPath(), genMap.get("changeClassName").toString()); + + assert filePath != null; + File file = new File(filePath); + + // 如果非覆盖生成 + if (!genConfig.getCover() && FileUtil.exist(file)) { + continue; + } + // 生成代码 + genFile(file, template, genMap); + } + } + + // 获取模版数据 + private static Map getGenMap(List columnInfos, GenConfig genConfig) { + // 存储模版字段数据 + Map genMap = new HashMap<>(16); + // 接口别名 + genMap.put("apiAlias", genConfig.getApiAlias()); + // 包名称 + genMap.put("package", genConfig.getPack()); + // 模块名称 + genMap.put("moduleName", genConfig.getModuleName()); + // 作者 + genMap.put("author", genConfig.getAuthor()); + // 创建日期 + genMap.put("date", LocalDate.now().toString()); + // 表名 + genMap.put("tableName", genConfig.getTableName()); + // 大写开头的类名 + String className = StringUtils.toCapitalizeCamelCase(genConfig.getTableName()); + // 小写开头的类名 + String changeClassName = StringUtils.toCamelCase(genConfig.getTableName()); + // 判断是否去除表前缀 + if (StringUtils.isNotEmpty(genConfig.getPrefix())) { + className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix())); + changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix())); + changeClassName = StringUtils.uncapitalize(changeClassName); + } + // 保存类名 + genMap.put("className", className); + // 保存小写开头的类名 + genMap.put("changeClassName", changeClassName); + // 存在 Timestamp 字段 + genMap.put("hasTimestamp", false); + // 查询类中存在 Timestamp 字段 + genMap.put("queryHasTimestamp", false); + // 存在 BigDecimal 字段 + genMap.put("hasBigDecimal", false); + // 查询类中存在 BigDecimal 字段 + genMap.put("queryHasBigDecimal", false); + // 是否需要创建查询 + genMap.put("hasQuery", false); + // 自增主键 + genMap.put("auto", false); + // 存在字典 + genMap.put("hasDict", false); + // 存在日期注解 + genMap.put("hasDateAnnotation", false); + // 保存字段信息 + List> columns = new ArrayList<>(); + // 保存查询字段的信息 + List> queryColumns = new ArrayList<>(); + // 存储字典信息 + List dicts = new ArrayList<>(); + // 存储 between 信息 + List> betweens = new ArrayList<>(); + // 存储不为空的字段信息 + List> isNotNullColumns = new ArrayList<>(); + + for (ColumnInfo column : columnInfos) { + Map listMap = new HashMap<>(16); + // 字段描述 + listMap.put("remark", column.getRemark()); + // 字段类型 + listMap.put("columnKey", column.getKeyType()); + // 主键类型 + String colType = ColUtil.cloToJava(column.getColumnType()); + // 小写开头的字段名 + String changeColumnName = StringUtils.toCamelCase(column.getColumnName()); + // 大写开头的字段名 + String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName()); + if (PK.equals(column.getKeyType())) { + // 存储主键类型 + genMap.put("pkColumnType", colType); + // 存储小写开头的字段名 + genMap.put("pkChangeColName", changeColumnName); + // 存储大写开头的字段名 + genMap.put("pkCapitalColName", capitalColumnName); + } + // 是否存在 Timestamp 类型的字段 + if (TIMESTAMP.equals(colType)) { + genMap.put("hasTimestamp", true); + } + // 是否存在 BigDecimal 类型的字段 + if (BIGDECIMAL.equals(colType)) { + genMap.put("hasBigDecimal", true); + } + // 主键是否自增 + if (EXTRA.equals(column.getExtra())) { + genMap.put("auto", true); + } + // 主键存在字典 + if (StringUtils.isNotBlank(column.getDictName())) { + genMap.put("hasDict", true); + if(!dicts.contains(column.getDictName())) + dicts.add(column.getDictName()); + } + + // 存储字段类型 + listMap.put("columnType", colType); + // 存储字原始段名称 + listMap.put("columnName", column.getColumnName()); + // 不为空 + listMap.put("istNotNull", column.getNotNull()); + // 字段列表显示 + listMap.put("columnShow", column.getListShow()); + // 表单显示 + listMap.put("formShow", column.getFormShow()); + // 表单组件类型 + listMap.put("formType", StringUtils.isNotBlank(column.getFormType()) ? column.getFormType() : "Input"); + // 小写开头的字段名称 + listMap.put("changeColumnName", changeColumnName); + //大写开头的字段名称 + listMap.put("capitalColumnName", capitalColumnName); + // 字典名称 + listMap.put("dictName", column.getDictName()); + // 日期注解 + listMap.put("dateAnnotation", column.getDateAnnotation()); + if (StringUtils.isNotBlank(column.getDateAnnotation())) { + genMap.put("hasDateAnnotation", true); + } + // 添加非空字段信息 + if (column.getNotNull()) { + isNotNullColumns.add(listMap); + } + // 判断是否有查询,如有则把查询的字段set进columnQuery + if (!StringUtils.isBlank(column.getQueryType())) { + // 查询类型 + listMap.put("queryType", column.getQueryType()); + // 是否存在查询 + genMap.put("hasQuery", true); + if (TIMESTAMP.equals(colType)) { + // 查询中存储 Timestamp 类型 + genMap.put("queryHasTimestamp", true); + } + if (BIGDECIMAL.equals(colType)) { + // 查询中存储 BigDecimal 类型 + genMap.put("queryHasBigDecimal", true); + } + if ("between".equalsIgnoreCase(column.getQueryType())) { + betweens.add(listMap); + } else { + // 添加到查询列表中 + queryColumns.add(listMap); + } + } + // 添加到字段列表中 + columns.add(listMap); + } + // 保存字段列表 + genMap.put("columns", columns); + // 保存查询列表 + genMap.put("queryColumns", queryColumns); + // 保存字段列表 + genMap.put("dicts", dicts); + // 保存查询列表 + genMap.put("betweens", betweens); + // 保存非空字段信息 + genMap.put("isNotNullColumns", isNotNullColumns); + return genMap; + } + + /** + * 定义后端文件路径以及名称 + */ + private static String getAdminFilePath(String templateName, GenConfig genConfig, String className, String rootPath) { + String projectPath = rootPath + File.separator + genConfig.getModuleName(); + String packagePath = projectPath + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator; + if (!ObjectUtils.isEmpty(genConfig.getPack())) { + packagePath += genConfig.getPack().replace(".", File.separator) + File.separator; + } + + if ("Entity".equals(templateName)) { + return packagePath + "domain" + File.separator + className + ".java"; + } + + if ("Controller".equals(templateName)) { + return packagePath + "rest" + File.separator + className + "Controller.java"; + } + + if ("Service".equals(templateName)) { + return packagePath + "service" + File.separator + className + "Service.java"; + } + + if ("ServiceImpl".equals(templateName)) { + return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; + } + + if ("Dto".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "Dto.java"; + } + + if ("QueryCriteria".equals(templateName)) { + return packagePath + "service" + File.separator + "dto" + File.separator + className + "QueryCriteria.java"; + } + + if ("Mapper".equals(templateName)) { + return packagePath + "service" + File.separator + "mapstruct" + File.separator + className + "Mapper.java"; + } + + if ("Repository".equals(templateName)) { + return packagePath + "repository" + File.separator + className + "Repository.java"; + } + + return null; + } + + /** + * 定义前端文件路径以及名称 + */ + private static String getFrontFilePath(String templateName, String apiPath, String path, String apiName) { + + if ("api".equals(templateName)) { + return apiPath + File.separator + apiName + ".js"; + } + + if ("index".equals(templateName)) { + return path + File.separator + "index.vue"; + } + + return null; + } + + private static void genFile(File file, Template template, Map map) throws IOException { + // 生成目标文件 + Writer writer = null; + try { + FileUtil.touch(file); + writer = new FileWriter(file); + template.render(map, writer); + } catch (TemplateException | IOException e) { + throw new RuntimeException(e); + } finally { + assert writer != null; + writer.close(); + } + } +} diff --git a/youchain-logging/pom.xml b/youchain-logging/pom.xml new file mode 100644 index 0000000..e0e2bc5 --- /dev/null +++ b/youchain-logging/pom.xml @@ -0,0 +1,22 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + youchain-logging + 日志模块 + + + + com.youchain + youchain-common + 2.6 + + + \ No newline at end of file diff --git a/youchain-logging/src/main/java/com/youchain/annotation/Log.java b/youchain-logging/src/main/java/com/youchain/annotation/Log.java new file mode 100644 index 0000000..2484354 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/annotation/Log.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Log { + String value() default ""; +} diff --git a/youchain-logging/src/main/java/com/youchain/aspect/LogAspect.java b/youchain-logging/src/main/java/com/youchain/aspect/LogAspect.java new file mode 100644 index 0000000..dd8db45 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/aspect/LogAspect.java @@ -0,0 +1,179 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.aspect; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.youchain.utils.RequestHolder; +import com.youchain.utils.SecurityUtils; +import com.youchain.utils.StringUtils; +import com.youchain.utils.ThrowableUtil; +import lombok.extern.slf4j.Slf4j; +import com.youchain.domain.Log; +import com.youchain.service.LogService; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.springframework.security.web.context.HttpRequestResponseHolder; +import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Component +@Aspect +@Slf4j +public class LogAspect { + + private final LogService logService; + + ThreadLocal currentTime = new ThreadLocal<>(); + + public LogAspect(LogService logService) { + this.logService = logService; + } + + /** + * 配置切入点 + */ + @Pointcut("@annotation(com.youchain.annotation.Log)") + public void logPointcut() { + // 该方法无方法体,主要为了让同类中其他方法使用此切入点 + } + + /** + * 配置环绕通知,使用在方法logPointcut()上注册的切入点 + * + * @param joinPoint join point for advice + */ + @Around("logPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Object result; + currentTime.set(System.currentTimeMillis()); + result = joinPoint.proceed(); + String result_data = handlerResult(result); + //log.error("----结束了---"+result_data); + Log log_data = new Log("INFO",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + String url=handlerUrl(request); + String parm=handleParm(request); + if(parm!=null&&parm.length()>0){ + url=url+"?"+parm; + } + + logService.save(url,result_data,getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log_data); + + return result; + } + + private String handleParm( HttpServletRequest request) { + if (request == null) { + return "request为空"; + } + String parm=""; + try { + parm=request.getQueryString(); + } catch (Exception e) { + parm="parm获取失败"; + log.error("parm获取失败", e); + } + return parm; + } + + private String handlerUrl( HttpServletRequest request) { + if (request == null) { + return "request为空"; + } + String url=""; + try { + url=request.getRequestURL().toString(); + } catch (Exception e) { + url="url获取失败"; + log.error("url获取失败", e); + } + return url; + } + + + private String handlerResult(Object result) { + if (result == null) { + return null; + } + String resultStr; + try { + if (result instanceof String) { + resultStr = (String) result; + } else { + resultStr = JSONUtil.toJsonStr(result);// 如果返回结果非String类型,转换成JSON格式的字符串 + } + + if (resultStr.length() > 10000) { + resultStr = resultStr.substring(0, 10000); + } + } catch (Exception e) { + resultStr = result.toString(); + log.error("接口出入参日志打印切面处理返回参数异常", e); + } + return resultStr; + } + + @AfterReturning(returning = "returnValue", pointcut = "logPointcut()") + public void doAfterReturning(JoinPoint joinPoint,Object returnValue) throws Throwable { + // 处理完请求,返回内容 + /* log.info("类名:"+joinPoint.getSignature().getDeclaringTypeName()+ + "、方法名: "+joinPoint.getSignature().getName()+"()、====>@Before:请求参数为:{}", Arrays.toString(joinPoint.getArgs())); +*/ + } + + + + /** + * 配置异常通知 + * + * @param joinPoint join point for advice + * @param e exception + */ + @AfterThrowing(pointcut = "logPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + String errDetail=ThrowableUtil.getStackTrace(e)+""; + log.error("拦截到异常消息", errDetail); + Log log_data = new Log("ERROR",System.currentTimeMillis() - currentTime.get()); + currentTime.remove(); + + log_data.setExceptionDetail(errDetail); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + + String url=handlerUrl(request); + String parm=handleParm(request); + if(parm!=null&&parm.length()>0){ + url=url+"?"+parm; + } + logService.save(url,"",getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log_data); + } + + public String getUsername() { + try { + return SecurityUtils.getCurrentUsername(); + }catch (Exception e){ + return ""; + } + } +} diff --git a/youchain-logging/src/main/java/com/youchain/domain/Log.java b/youchain-logging/src/main/java/com/youchain/domain/Log.java new file mode 100644 index 0000000..938bfa7 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/domain/Log.java @@ -0,0 +1,83 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Entity +@Getter +@Setter +@Table(name = "sys_log") +@NoArgsConstructor +public class Log implements Serializable { + + @Id + @Column(name = "log_id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + /** 操作用户 */ + private String username; + + /** 描述 */ + private String description; + + /** 方法名 */ + private String method; + + /** 参数 */ + private String params; + + /** 返回 */ + private String returnData; + + /** 日志类型 */ + private String logType; + + /** 请求ip */ + private String requestIp; + + /** 地址 */ + private String address; + + /** 浏览器 */ + private String browser; + + /** 请求耗时 */ + private Long time; + + /** 异常详细 */ + private String exceptionDetail; + + /** 创建日期 */ + @CreationTimestamp + private Timestamp createTime; + + public Log(String logType, Long time) { + this.logType = logType; + this.time = time; + } +} diff --git a/youchain-logging/src/main/java/com/youchain/repository/LogRepository.java b/youchain-logging/src/main/java/com/youchain/repository/LogRepository.java new file mode 100644 index 0000000..a4046d8 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/repository/LogRepository.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.Log; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Repository +public interface LogRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据日志类型删除信息 + * @param logType 日志类型 + */ + @Modifying + @Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true) + void deleteByLogType(String logType); +} diff --git a/youchain-logging/src/main/java/com/youchain/rest/LogController.java b/youchain-logging/src/main/java/com/youchain/rest/LogController.java new file mode 100644 index 0000000..b77bc56 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/rest/LogController.java @@ -0,0 +1,109 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import com.youchain.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.service.LogService; +import com.youchain.service.dto.LogQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/logs") +@Api(tags = "系统:日志管理") +public class LogController { + + private final LogService logService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check()") + public void exportLog(HttpServletResponse response, LogQueryCriteria criteria) throws Exception { + criteria.setLogType("INFO"); + logService.download(logService.queryAll(criteria), response); + } + + @Log("导出错误数据") + @ApiOperation("导出错误数据") + @GetMapping(value = "/error/download") + @PreAuthorize("@el.check()") + public void exportErrorLog(HttpServletResponse response, LogQueryCriteria criteria) throws Exception { + criteria.setLogType("ERROR"); + logService.download(logService.queryAll(criteria), response); + } + @GetMapping + @ApiOperation("日志查询") + @PreAuthorize("@el.check()") + public ResponseEntity queryLog(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("INFO"); + return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @GetMapping(value = "/user") + @ApiOperation("用户日志查询") + public ResponseEntity queryUserLog(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("INFO"); + criteria.setUsername(SecurityUtils.getCurrentUsername()); + return new ResponseEntity<>(logService.queryAllByUser(criteria,pageable), HttpStatus.OK); + } + + @GetMapping(value = "/error") + @ApiOperation("错误日志查询") + @PreAuthorize("@el.check()") + public ResponseEntity queryErrorLog(LogQueryCriteria criteria, Pageable pageable){ + criteria.setLogType("ERROR"); + return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @GetMapping(value = "/error/{id}") + @ApiOperation("日志异常详情查询") + @PreAuthorize("@el.check()") + public ResponseEntity queryErrorLogDetail(@PathVariable Long id){ + return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK); + } + @DeleteMapping(value = "/del/error") + @Log("删除所有ERROR日志") + @ApiOperation("删除所有ERROR日志") + @PreAuthorize("@el.check()") + public ResponseEntity delAllErrorLog(){ + logService.delAllByError(); + return new ResponseEntity<>(HttpStatus.OK); + } + + @DeleteMapping(value = "/del/info") + @Log("删除所有INFO日志") + @ApiOperation("删除所有INFO日志") + @PreAuthorize("@el.check()") + public ResponseEntity delAllInfoLog(){ + logService.delAllByInfo(); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-logging/src/main/java/com/youchain/service/LogService.java b/youchain-logging/src/main/java/com/youchain/service/LogService.java new file mode 100644 index 0000000..461ed0b --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/LogService.java @@ -0,0 +1,95 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.service.dto.LogQueryCriteria; +import com.youchain.domain.Log; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +public interface LogService { + + /** + * 分页查询 + * @param criteria 查询条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(LogQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 查询条件 + * @return / + */ + List queryAll(LogQueryCriteria criteria); + + /** + * 查询用户日志 + * @param criteria 查询条件 + * @param pageable 分页参数 + * @return - + */ + Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable); + + /** + * 保存日志数据 + * @param username 用户 + * @param browser 浏览器 + * @param ip 请求IP + * @param joinPoint / + * @param log 日志实体 + */ + + void save(String url,String returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log); + + + void saveLog(Log log); + /** + * 查询异常详情 + * @param id 日志ID + * @return Object + */ + Object findByErrDetail(Long id); + + /** + * 导出日志 + * @param logs 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List logs, HttpServletResponse response) throws Exception, Exception; + + /** + * 删除所有错误日志 + */ + void delAllByError(); + + /** + * 删除所有INFO日志 + */ + void delAllByInfo(); +} diff --git a/youchain-logging/src/main/java/com/youchain/service/dto/LogErrorDTO.java b/youchain-logging/src/main/java/com/youchain/service/dto/LogErrorDTO.java new file mode 100644 index 0000000..cc85a9c --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/dto/LogErrorDTO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Data; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author Liu Xue +* @date 2019-5-22 +*/ +@Data +public class LogErrorDTO implements Serializable { + + private Long id; + + private String username; + + private String description; + + private String method; + + private String returnData; + + private String params; + + private String browser; + + private String requestIp; + + private String address; + + private Timestamp createTime; +} \ No newline at end of file diff --git a/youchain-logging/src/main/java/com/youchain/service/dto/LogQueryCriteria.java b/youchain-logging/src/main/java/com/youchain/service/dto/LogQueryCriteria.java new file mode 100644 index 0000000..0f97f1a --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/dto/LogQueryCriteria.java @@ -0,0 +1,52 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import com.youchain.annotation.Query; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +/** + * 日志查询类 + * @author Liu Xue + * @date 2019-6-4 09:23:07 + */ +@Data +public class LogQueryCriteria { + + @Query(blurry = "username,description,address,requestIp,method,params") + private String blurry; + + @Query + private String username; + + @Query(type = Query.Type.INNER_LIKE) + private String method; + + @Query(type = Query.Type.INNER_LIKE) + private String description; + + @Query(type = Query.Type.GREATER_THAN) + private Long time; + + @Query + private String logType; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-logging/src/main/java/com/youchain/service/dto/LogSmallDTO.java b/youchain-logging/src/main/java/com/youchain/service/dto/LogSmallDTO.java new file mode 100644 index 0000000..051309a --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/dto/LogSmallDTO.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Data; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author Liu Xue + * @date 2019-5-22 + */ +@Data +public class LogSmallDTO implements Serializable { + + private String description; + + private String requestIp; + + private String returnData; + + private Long time; + + private String address; + + private String browser; + + private Timestamp createTime; +} diff --git a/youchain-logging/src/main/java/com/youchain/service/impl/LogServiceImpl.java b/youchain-logging/src/main/java/com/youchain/service/impl/LogServiceImpl.java new file mode 100644 index 0000000..8b98d13 --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/impl/LogServiceImpl.java @@ -0,0 +1,191 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.youchain.domain.Log; +import com.youchain.repository.LogRepository; +import com.youchain.service.LogService; +import com.youchain.service.dto.LogQueryCriteria; +import com.youchain.service.mapstruct.LogSmallMapper; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.service.mapstruct.LogErrorMapper; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.*; + +/** + * @author Liu Xue + * @date 2018-11-24 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class LogServiceImpl implements LogService { + private final LogRepository logRepository; + private final LogErrorMapper logErrorMapper; + private final LogSmallMapper logSmallMapper; + + @Override + public Object queryAll(LogQueryCriteria criteria, Pageable pageable) { + Page page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable); + String status = "ERROR"; + if (status.equals(criteria.getLogType())) { + return PageUtil.toPage(page.map(logErrorMapper::toDto)); + } + return page; + } + + @Override + public List queryAll(LogQueryCriteria criteria) { + return logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb))); + } + + @Override + public Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable) { + Page page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable); + return PageUtil.toPage(page.map(logSmallMapper::toDto)); + } + @Async + @Override + @Transactional(rollbackFor = Exception.class) + public void save(String url,String returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log_data) { + if (log_data == null) { + throw new IllegalArgumentException("Log 不能为 null!"); + } + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + com.youchain.annotation.Log aopLog = method.getAnnotation(com.youchain.annotation.Log.class); + + // 方法路径 + String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()"; + + // 描述 + log_data.setDescription(aopLog.value()); + + log_data.setRequestIp(ip); + log_data.setAddress(StringUtils.getCityInfo(log_data.getRequestIp())); + log_data.setMethod(url+"---"+methodName); + log_data.setUsername(username); + log_data.setParams(getParameter(method, joinPoint.getArgs())); + // 记录登录用户,隐藏密码信息 + if(signature.getName().equals("login") && StringUtils.isNotEmpty(log_data.getParams())){ + JSONObject obj = JSONUtil.parseObj(log_data.getParams()); + log_data.setUsername(obj.getStr("username", "")); + log_data.setParams(JSONUtil.toJsonStr(Dict.create().set("username", log_data.getUsername()))); + } + log_data.setBrowser(browser); + log_data.setReturnData(returnValue); + logRepository.save(log_data); + } + + @Async + @Override + @Transactional(rollbackFor = Exception.class) + public void saveLog(Log log_data) { + if (log_data == null) { + throw new IllegalArgumentException("Log 不能为 null!"); + } + logRepository.save(log_data); + } + + /** + * 根据方法和传入的参数获取请求参数 + */ + private String getParameter(Method method, Object[] args) { + List argList = new ArrayList<>(); + Parameter[] parameters = method.getParameters(); + for (int i = 0; i < parameters.length; i++) { + //将RequestBody注解修饰的参数作为请求参数 + RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class); + if (requestBody != null) { + argList.add(args[i]); + } + //将RequestParam注解修饰的参数作为请求参数 + RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class); + if (requestParam != null) { + Map map = new HashMap<>(2); + String key = parameters[i].getName(); + if (!StringUtils.isEmpty(requestParam.value())) { + key = requestParam.value(); + } + map.put(key, args[i]); + argList.add(map); + } + } + if (argList.isEmpty()) { + return ""; + } + return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList); + } + + @Override + public Object findByErrDetail(Long id) { + Log log = logRepository.findById(id).orElseGet(Log::new); + ValidationUtil.isNull(log.getId(), "Log", "id", id); + String details = log.getExceptionDetail(); + return Dict.create().set("exception", details+""); + } + + @Override + public void download(List logs, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (Log log : logs) { + Map map = new LinkedHashMap<>(); + map.put("用户名", log.getUsername()); + map.put("IP", log.getRequestIp()); + map.put("IP来源", log.getAddress()); + map.put("描述", log.getDescription()); + map.put("浏览器", log.getBrowser()); + map.put("请求耗时/毫秒", log.getTime()); + map.put("异常详情", log.getExceptionDetail()+""); + map.put("创建日期", log.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delAllByError() { + logRepository.deleteByLogType("ERROR"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delAllByInfo() { + logRepository.deleteByLogType("INFO"); + } +} diff --git a/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogErrorMapper.java b/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogErrorMapper.java new file mode 100644 index 0000000..3bbc46c --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogErrorMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.domain.Log; +import com.youchain.service.dto.LogErrorDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2019-5-22 + */ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface LogErrorMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogSmallMapper.java b/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogSmallMapper.java new file mode 100644 index 0000000..776af6c --- /dev/null +++ b/youchain-logging/src/main/java/com/youchain/service/mapstruct/LogSmallMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.domain.Log; +import com.youchain.service.dto.LogSmallDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2019-5-22 + */ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface LogSmallMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/DB_SQL.sql b/youchain-system/DB_SQL.sql new file mode 100644 index 0000000..13c14eb --- /dev/null +++ b/youchain-system/DB_SQL.sql @@ -0,0 +1,254 @@ +#2023-11-3 AGV场景表 +CREATE TABLE `base_agv_scene` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID', + `code` varchar(20) NOT NULL COMMENT '代码', + `name` varchar(20) NOT NULL COMMENT '名称', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '备注', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='AGV场景表'; + +ALTER TABLE `base_area` ADD COLUMN `agv_scene_id` bigint(20) DEFAULT NULL COMMENT 'avg场景id'; +ALTER TABLE `base_item` ADD COLUMN `agv_scene_id` bigint(20) DEFAULT NULL COMMENT 'avg场景id'; +#物料类型字典 +INSERT INTO `sys_dict` (`dict_id`, `name`, `description`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (21, 'item_type', '货物类型', 'admin', 'admin', '2023-11-03 11:49:03', '2023-11-03 11:49:03'); +INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (69, 21, '前桶', 'QT', 1, 'admin', 'admin', '2023-11-03 11:49:34', '2023-11-03 11:49:34'); +INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (69, 21, '后桶', 'HT', 2, 'admin', 'admin', '2023-11-03 11:49:34', '2023-11-03 11:49:34'); +INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (70, 21, '门封', 'MF', 3, 'admin', 'admin', '2023-11-03 13:39:13', '2023-11-03 13:39:13'); +INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (71, 21, '小件', 'XJ', 4, 'admin', 'admin', '2023-11-03 13:39:24', '2023-11-03 13:39:24'); +INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (72, 21, 'ZCZ', '轴承座', 5, 'admin', 'admin', '2023-11-03 13:39:39', '2023-11-03 13:39:39'); + +#入库点位 +ALTER table data_asn_detail add point_id bigint(20) DEFAULT NULL COMMENT '点位序号'; + +#按钮盒 +alter table base_box add `IP` varchar(50) DEFAULT NULL COMMENT 'IP' ; +alter table base_box add `lamp_status` varchar(50) DEFAULT '0' COMMENT '指示灯状态'; +alter table base_box add `lamp_code` varchar(50) DEFAULT NULL COMMENT '按钮盒编号'; + +#指示灯日志 +CREATE TABLE `sys_lamp_log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `ip` varchar(50) DEFAULT NULL COMMENT 'ip', + `button_box` varchar(50) DEFAULT NULL COMMENT '所属按钮盒', + `button_code` varchar(50) DEFAULT NULL COMMENT '按钮编码', + `operation_type` varchar(50) DEFAULT NULL COMMENT '操作类型', + `request_content` varchar(255) DEFAULT NULL COMMENT '请求内容', + `return_content` varchar(255) DEFAULT NULL COMMENT '返回内容', + `return_state` varchar(50) DEFAULT NULL COMMENT '返回状态', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='指示灯日志'; + +#轴承座物料类型变更 +update base_item it set it.good_type='ZC' where good_type='ZCZ'; + + +#data_agv_task 增加 是否扫描字段 +alter table data_agv_task add `be_scan` int(11) DEFAULT NULL COMMENT '是否扫描' ; +update data_agv_task set be_scan=0 where be_scan is null ; + +#机械臂点位物料编码 +ALTER table base_point add item_code VARCHAR(50) COMMENT '点位物料编码'; + +#点位排,用于门封解锁 +alter table base_point add rows int(11) DEFAULT NULL COMMENT '层' ; +alter table base_point add col int(11) DEFAULT NULL COMMENT '列' ; +alter table base_point add line int(11) DEFAULT NULL COMMENT '排' ; + +update base_point set rows=0,col=0,line=0 where rows is null; +#轴承座机械臂表通信配置表 +CREATE TABLE `base_zcjxb` ( +`id` bigint(20) NOT NULL AUTO_INCREMENT, +`modbus_tcp_task_finish` tinyint(1) DEFAULT '0' COMMENT 'Modbus-tcp的任务是否启用', +`modbus_tcp_point` varchar(255) DEFAULT NULL COMMENT 'Modbus-tcp对应的地标点', +`modbus_tcp_item` varchar(255) DEFAULT NULL COMMENT 'Modbus-tcp对应的物料', +`modbus_tcp_slave_id` int(11) DEFAULT NULL COMMENT '从机ID', +`task_off_on_a` tinyint(1) DEFAULT '0' COMMENT 'a车点位是否有任务', +`task_off_on_b` tinyint(1) DEFAULT '0' COMMENT 'b车点位是否有任务', +`code` int(11) DEFAULT NULL COMMENT '机械臂机台号', +`ip` varchar(100) NOT NULL COMMENT 'ip地址', +`port` int(11) NOT NULL COMMENT '端口号', +`communication_type` varchar(255) DEFAULT NULL COMMENT '通信类型', +`address` int(11) DEFAULT NULL COMMENT '地址', +`data_length` int(11) DEFAULT NULL COMMENT '数据长度', +`offset_a1` int(11) DEFAULT NULL COMMENT '偏移量-A返回空车', +`offset_b1` int(11) DEFAULT NULL COMMENT '偏移量-B返回空车', +`offset_a2` int(11) DEFAULT NULL COMMENT '偏移量-A叫料', +`offset_b2` int(11) DEFAULT NULL COMMENT '偏移量-B叫料', +`offset_a3` int(11) DEFAULT NULL COMMENT '偏移量-A车有料', +`offset_b3` int(11) DEFAULT NULL COMMENT '偏移量-B车有料', +`point_a1` varchar(255) DEFAULT NULL COMMENT 'A车的地标点', +`point_b1` varchar(255) DEFAULT NULL COMMENT 'B车的地标点', +`item_a1` varchar(255) DEFAULT NULL COMMENT 'A车的物料', +`item_b1` varchar(255) DEFAULT NULL COMMENT 'B车的物料', +`enabled` tinyint(1) DEFAULT '0' COMMENT '是否启用', +`create_by` varchar(255) DEFAULT NULL COMMENT '创建人', +`update_by` varchar(255) DEFAULT NULL COMMENT '更新人', +`create_time` datetime DEFAULT NULL COMMENT '创建时间', +`update_time` datetime DEFAULT NULL COMMENT '更新时间', +PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COMMENT='机械臂'; + +# 添加一个机械臂正在执行的任务名称 +ALTER TABLE `base_zcjxb` ADD COLUMN task_name varchar(255) DEFAULT NULL COMMENT '任务名称'; + +# 库区管理 +alter TABLE base_area add column working_station varchar(50) DEFAULT NULL COMMENT '所属工位'; +alter TABLE base_area add column point_id bigint(20) DEFAULT NULL COMMENT '缓存库位'; +alter TABLE base_area add column bexb tinyint(1) DEFAULT '0' COMMENT'线边接收'; +alter TABLE base_area add column besh tinyint(1) DEFAULT '0' COMMENT'收货仓库'; +alter TABLE base_area add column bezz tinyint(1) DEFAULT '0' COMMENT'制造库位耗用'; + +# 生产顺序计划表 +CREATE TABLE `base_production_plan` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID', + `enabled` bit(1) DEFAULT b'0' COMMENT '状态:1启用、0禁用', + `big_item_id` bigint(20) DEFAULT NULL COMMENT '完成品番', + `working_station` varchar(50) DEFAULT NULL COMMENT '工位', + `No` int(7) DEFAULT NULL COMMENT 'No', + `machine_no` int(7) DEFAULT NULL COMMENT '机号', + `import_date` datetime DEFAULT NULL COMMENT '导入日期', + `planned_date` datetime DEFAULT NULL COMMENT '计划日期', + `downline_date` datetime DEFAULT NULL COMMENT '下线日期', + `take_up_time` datetime DEFAULT NULL COMMENT '耗用时间', + `IDNO` varchar(50) DEFAULT NULL COMMENT 'IDNO', + `monthly_no` varchar(255) DEFAULT NULL COMMENT '月度序号', + `project_no` varchar(255) DEFAULT NULL COMMENT '计划单号', + `make_line` varchar(255) DEFAULT NULL COMMENT '制造线', + `order_no` bigint(20) DEFAULT NULL COMMENT '序号', + `bom_list_id` bigint(20) DEFAULT NULL COMMENT '工位清单', + `sh_area_id` bigint(20) DEFAULT NULL COMMENT '收货仓库', + `rk_area_id` bigint(20) DEFAULT NULL COMMENT '入库库区', + `off_line_part_id` bigint(20) DEFAULT NULL COMMENT '下线零件ID', + `pick_plan_id` bigint(20) DEFAULT NULL COMMENT '备货计划ID', + `type` varchar(255) DEFAULT NULL COMMENT '出库类型', + `part_variety` varchar(255) DEFAULT NULL COMMENT '部品种类', + `statue` varchar(255) DEFAULT NULL COMMENT '耗用状态', + `auto_production_id` bigint(20) DEFAULT NULL COMMENT '所属自动计划', + `description` varchar(255) DEFAULT NULL COMMENT '描述', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '更新人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改日期', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `bpp_key` (`working_station`,`IDNO`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='生产顺序计划'; + +# 部品品番 添加库位字段 +ALTER table base_item add point_id bigint(20) DEFAULT NULL COMMENT '库位'; + +# 收货管理表 +CREATE TABLE `data_asn` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8 NOT NULL COMMENT '单号', + `area_id` bigint(20) DEFAULT NULL COMMENT '库区', + `status` varchar(255) DEFAULT NULL COMMENT '状态', + `cus_code` varchar(255) DEFAULT NULL COMMENT '客户订单号', + `related_bill1` varchar(255) DEFAULT NULL COMMENT '相关单号1', + `related_bill2` varchar(255) DEFAULT NULL COMMENT '相关单号2', + `related_bill3` varchar(255) DEFAULT NULL COMMENT '相关单号3', + `order_date`datetime DEFAULT NULL DEFAULT NULL COMMENT '订单日期', + `estimate_date`datetime DEFAULT NULL COMMENT '预计到货日期', + `received_date`datetime DEFAULT NULL COMMENT '收货日期', + `from_name` varchar(255) DEFAULT NULL COMMENT '发货方', + `from_address` varchar(255) DEFAULT NULL COMMENT '发货地址', + `from_man` varchar(255) DEFAULT NULL COMMENT '发货联系人', + `from_tel` varchar(255) DEFAULT NULL COMMENT '发货电话', + `order_quantity` double DEFAULT '0' COMMENT '订单数量', + `received_quantity` double DEFAULT '0' COMMENT '收货数量', + `putaway_quantity` double DEFAULT '0' COMMENT '上架数量', + `vehicle` varchar(255) DEFAULT NULL COMMENT '车牌号', + `bill_type_id` varchar(255) DEFAULT NULL COMMENT '单据类型', + `dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID', + `description` varchar(255) DEFAULT NULL COMMENT '备注', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='收货管理'; +# 出库添加关联主表的字段 +ALTER table data_pick_detail add pick_ticket bigint(20) DEFAULT NULL COMMENT '出库管理主表'; +# 出库管理 +CREATE TABLE `data_pick_ticket` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `area` bigint(20) DEFAULT NULL COMMENT '出库库区', + `sh_area` bigint(20) DEFAULT NULL COMMENT '收货库区', + `code` varchar(20) NOT NULL COMMENT '单号', + `status` varchar(255) DEFAULT NULL COMMENT '状态', + `cus_code` varchar(20) DEFAULT NULL COMMENT '客户订单号', + `related_bill1` varchar(255) DEFAULT NULL COMMENT '相关单号1', + `related_bill2` varchar(255) DEFAULT NULL COMMENT '相关单号2', + `related_bill3` varchar(255) DEFAULT NULL COMMENT '相关单号3', + `order_date` datetime DEFAULT NULL COMMENT '订单日期', + `ship_date` datetime DEFAULT NULL COMMENT '发货日期', + `fh_by` varchar(255) DEFAULT NULL COMMENT '发货人', + `received_date` datetime DEFAULT NULL COMMENT '到达日期', + `sl_by` varchar(255) DEFAULT NULL COMMENT '接收人', + `sl_qty` double DEFAULT '0' COMMENT '收料数量', + `tl_date` time DEFAULT NULL COMMENT '投料日期', + `tl_by` varchar(255) DEFAULT NULL COMMENT '投料人', + `tl_qty` double DEFAULT '0' COMMENT '投料数量', + `ship_to_name` varchar(255) DEFAULT NULL COMMENT '收货方', + `ship_address` varchar(255) DEFAULT NULL COMMENT '收货地址', + `ship_man` varchar(255) DEFAULT NULL COMMENT '收货联系人', + `ship_tel` varchar(255) DEFAULT NULL COMMENT '收货电话', + `order_quantity` double DEFAULT '0' COMMENT '订单数量', + `allocated_quantity` double DEFAULT '0' COMMENT '出单数量', + `picked_quantity` double DEFAULT '0' COMMENT '拣货数量', + `shipped_quantity` double DEFAULT '0' COMMENT '发运数量', + `xb_qty` double DEFAULT '0' COMMENT '线边数量', + `zt_qty` double DEFAULT '0' COMMENT '在途数量', + `xq_qty` double DEFAULT '0' COMMENT '需求数量', + `bh_qty` double DEFAULT '0' COMMENT '备货数量', + `vehicle` varchar(255) DEFAULT NULL COMMENT '车牌号', + `bill_type` bigint(20) DEFAULT NULL COMMENT '单据类型', + `bp_type` bigint(20) DEFAULT NULL COMMENT '部品种类', + `dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID', + `description` varchar(255) DEFAULT NULL COMMENT '备注', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `dpt` (`code`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='出库管理'; + +# 新政字段 +ALTER table data_pick_detail add `point_id` bigint(20) DEFAULT NULL COMMENT '点位'; +# xppRecord增加状态字段 +ALTER table `data_xpp_record` add `status` varchar(255) DEFAULT NULL COMMENT '状态'; +ALTER TABLE `data_xpp_record` MODIFY COLUMN `nrs` INT(11); +# inventory 加字段 +ALTER table `data_inventory` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区'; +ALTER table `data_inventory` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位'; +# InventoryLog +ALTER table `data_inventory_log` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区'; +ALTER table `data_inventory_log` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位'; +ALTER table `data_inventory_log` add `zckw` bigint(20) DEFAULT NULL COMMENT '暂存库位'; +# Task +ALTER table `data_task` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区'; +ALTER table `data_task` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位'; +# sys_dept 表添加代码字段 +ALTER table `sys_dept` add `code` varchar(255) DEFAULT NULL COMMENT '代码'; +# 备货页面需要加的字段 +ALTER table data_pick_ticket add `pure_req_qty` double DEFAULT '0' COMMENT '纯需求数量'; +ALTER table data_pick_ticket add `prep_re` double DEFAULT '0' COMMENT '备货需求数量'; +ALTER table data_pick_ticket add `out_order_date` datetime DEFAULT NULL COMMENT '出单日期'; +ALTER table data_pick_ticket add `stocking_date` datetime DEFAULT NULL COMMENT '备货日期'; +# 出库单明细 +ALTER table data_pick_detail add `xq_qty` double DEFAULT '0' COMMENT '需求数量'; +ALTER table data_pick_detail add `pure_req_qty` double DEFAULT '0' COMMENT '纯需求数量'; +ALTER table data_pick_detail add `xb_qty` double DEFAULT '0' COMMENT '线边数量'; +ALTER table data_pick_detail add `y_stk_demand_qty` double DEFAULT '0' COMMENT '原备货需求数量'; +ALTER table data_pick_detail add `y_req_qty` double DEFAULT '0' COMMENT '原纯需求数'; diff --git a/youchain-system/pom.xml b/youchain-system/pom.xml new file mode 100644 index 0000000..dcc2ba9 --- /dev/null +++ b/youchain-system/pom.xml @@ -0,0 +1,152 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + youchain-system + 核心模块 + + + 0.11.2 + + 5.8.0 + + + + + + com.intelligt.modbus + jlibmodbus + 1.2.9.7 + + + + com.youchain + youchain-generator + 2.6 + + + com.youchain + youchain-common + + + + + + + + + com.youchain + youchain-tongyong + 2.6 + + + + + com.youchain + youchain-tools + 2.6 + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + org.quartz-scheduler + quartz + + + + + ch.ethz.ganymed + ganymed-ssh2 + build210 + + + com.jcraft + jsch + 0.1.55 + + + + + com.github.oshi + oshi-core + 6.1.4 + + + com.youchain + youchain-logging + 2.6 + compile + + + + + io.jsonwebtoken + jjwt-api + ${jjwt.version} + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + + + io.jsonwebtoken + jjwt-jackson + ${jjwt.version} + + + + io.netty + netty-all + 4.1.42.Final + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/youchain-system/src/main/java/com/youchain/AppRun.java b/youchain-system/src/main/java/com/youchain/AppRun.java new file mode 100644 index 0000000..12f6b07 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/AppRun.java @@ -0,0 +1,83 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain; + +import cn.hutool.json.JSONUtil; +import com.youchain.annotation.rest.AnonymousGetMapping; +import com.youchain.modules.license.AGxServerInfos; +import com.youchain.modules.license.LicenseValidate; +import com.youchain.modules.license.LinuxServerInfos; +import com.youchain.modules.license.WindowsServerInfos; +import com.youchain.utils.SpringContextHolder; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; +import org.springframework.boot.context.ApplicationPidFileWriter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.bind.annotation.RestController; + +/** + * 开启审计功能 -> @EnableJpaAuditing + * + * @author Liu Xue + * @date 2018/11/15 9:20:19 + */ +@EnableAsync +@RestController +@Api(hidden = true) +@SpringBootApplication +@EnableTransactionManagement +@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class}) +@EnableJpaAuditing(auditorAwareRef = "auditorAware") +@Slf4j +public class AppRun { + //@SpringBootApplication(scanBasePackages = {"org.jeecg.modules.jmreport","me.zhengjie"}) + public static void main(String[] args) { + SpringApplication springApplication = new SpringApplication(AppRun.class); + // 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/eladmin/app.pid + // 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/eladmin/app.pid` + springApplication.addListeners(new ApplicationPidFileWriter()); + springApplication.run(args); + + log.error(JSONUtil.toJsonStr(LicenseValidate.getDeviceInfo())); + + } + + @Bean + public SpringContextHolder springContextHolder() { + return new SpringContextHolder(); + } + + /** + * 访问首页提示 + * + * @return / + */ + @AnonymousGetMapping("/") + public String index() { + return "Backend service started successfully"; + } +} diff --git a/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmission.java b/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmission.java new file mode 100644 index 0000000..f2c93c7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmission.java @@ -0,0 +1,13 @@ +package com.youchain.DuplicateSubmission; + +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) +public @interface DuplicateSubmission { + + int value() default 5; +} diff --git a/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmissionAspect.java b/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmissionAspect.java new file mode 100644 index 0000000..50965f8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/DuplicateSubmission/DuplicateSubmissionAspect.java @@ -0,0 +1,123 @@ +package com.youchain.DuplicateSubmission; + +import com.alibaba.fastjson.JSON; + +import com.youchain.exception.BadRequestException; +import com.youchain.utils.RedisUtils; +import com.youchain.utils.RequestHolder; +import com.youchain.utils.SpringContextHolder; +import com.youchain.utils.StringUtils; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Aspect +@Component +public class DuplicateSubmissionAspect { + + // @Around("@annotation(com.example.demo.LogExecutionTime)")表示该环绕通知仅在使用@LogExecutionTime注解的方法上执行 + @Around("@annotation(duplicateSubmission)") + public Object logExecutionTime(ProceedingJoinPoint joinPoint,DuplicateSubmission duplicateSubmission) throws Throwable { + + int value = duplicateSubmission.value(); + + + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + String parm1=getParameter(method, joinPoint.getArgs()); + HttpServletRequest request = RequestHolder.getHttpServletRequest(); + String parm=handleParm(request); + String url=handlerUrl(request); + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + String key=url+"-"+parm1+"-"+parm; + if(redisUtils.hasKey(key)){ + throw new BadRequestException("操作过快,请稍后重试"); + } + redisUtils.set(key,"",value); + // 执行目标方法 + Object result = joinPoint.proceed(); + System.out.println("请求参数为:"+key); + + redisUtils.del(key); + return result; + } + + + private String handleParm( HttpServletRequest request) { + if (request == null) { + return ""; + } + String parm=""; + try { + parm=request.getQueryString(); + } catch (Exception e) { + parm=""; + System.out.println("parm获取失败"); + } + if(parm==null||parm.isEmpty()){ + parm=""; + } + return parm; + } + + private String getParameter(Method method, Object[] args) { + List argList = new ArrayList<>(); + Parameter[] parameters = method.getParameters(); + for (int i = 0; i < parameters.length; i++) { + // 过滤掉不能序列化的类型: MultiPartFile + if (args[i] instanceof MultipartFile) { + continue; + } + //将RequestBody注解修饰的参数作为请求参数 + RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class); + if (requestBody != null) { + argList.add(args[i]); + } + //将RequestParam注解修饰的参数作为请求参数 + RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class); + if (requestParam != null) { + Map map = new HashMap<>(2); + String key = parameters[i].getName(); + if (!StringUtils.isEmpty(requestParam.value())) { + key = requestParam.value(); + } + map.put(key, args[i]); + argList.add(map); + } + } + if (argList.isEmpty()) { + return ""; + } + return argList.size() == 1 ? JSON.toJSONString(argList.get(0)) : JSON.toJSONString(argList); + } + + private String handlerUrl( HttpServletRequest request) { + if (request == null) { + return ""; + } + String url=""; + try { + url=request.getRequestURL().toString(); + } catch (Exception e) { + url=""; + } + if(url==null||url.isEmpty()){ + url=""; + } + return url; + } +} + diff --git a/youchain-system/src/main/java/com/youchain/Netty/HexTools.java b/youchain-system/src/main/java/com/youchain/Netty/HexTools.java new file mode 100644 index 0000000..441fc9e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/HexTools.java @@ -0,0 +1,44 @@ +package com.youchain.Netty; + + + +import java.util.HashMap; +import java.util.Map; + +public class HexTools { + + //十六进制字符转十进制 + public static int covert(String content){ + int number=0; + String [] HighLetter = {"A","B","C","D","E","F"}; + Map map = new HashMap<>(); + for(int i = 0;i <= 9;i++){ + map.put(i+"",i); + } + for(int j= 10;j out) throws Exception { + /* ByteBuf frame = in.retainedDuplicate(); + final String content = frame.toString(CharsetUtil.UTF_8); + log.error("content:"+content); + list.add(content); + in.skipBytes(in.readableBytes());*/ + + + String HEXES = "0123456789ABCDEF"; + byte[] req = new byte[in.readableBytes()]; + in.readBytes(req); + final StringBuilder hex = new StringBuilder(2 * req.length); + + for (int i = 0; i < req.length; i++) { + byte b = req[i]; + hex.append(HEXES.charAt((b & 0xF0) >> 4)) + .append(HEXES.charAt((b & 0x0F))); + } + out.add(hex.toString()); + } +} + diff --git a/youchain-system/src/main/java/com/youchain/Netty/MessageEncodeHandler.java b/youchain-system/src/main/java/com/youchain/Netty/MessageEncodeHandler.java new file mode 100644 index 0000000..6bf15da --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/MessageEncodeHandler.java @@ -0,0 +1,21 @@ +package com.youchain.Netty; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; +import io.netty.util.CharsetUtil; + +public class MessageEncodeHandler extends MessageToByteEncoder { + // 数据分割符 + String delimiter; + + public MessageEncodeHandler(String delimiter) { + this.delimiter = delimiter; + } + + @Override + protected void encode(ChannelHandlerContext channelHandlerContext, String message, ByteBuf out) throws Exception { + out.writeBytes((message + delimiter).getBytes(CharsetUtil.UTF_8)); + } +} + diff --git a/youchain-system/src/main/java/com/youchain/Netty/NettyConfig.java b/youchain-system/src/main/java/com/youchain/Netty/NettyConfig.java new file mode 100644 index 0000000..226ea97 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/NettyConfig.java @@ -0,0 +1,58 @@ +package com.youchain.Netty; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelOption; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableConfigurationProperties +public class NettyConfig { + final NettyProperties nettyProperties; + + public NettyConfig(NettyProperties nettyProperties) { + this.nettyProperties = nettyProperties; + } + + /** + * boss线程池-进行客户端连接 + * + * @return + */ + @Bean + public NioEventLoopGroup boosGroup() { + return new NioEventLoopGroup(nettyProperties.getBoss()); + } + + /** + * worker线程池-进行业务处理 + * + * @return + */ + @Bean + public NioEventLoopGroup workerGroup() { + return new NioEventLoopGroup(nettyProperties.getWorker()); + } + + /** + * 服务端启动器,监听客户端连接 + * + * @return + */ + @Bean + public ServerBootstrap serverBootstrap() { + ServerBootstrap serverBootstrap = new ServerBootstrap() + // 指定使用的线程组 + .group(boosGroup(), workerGroup()) + // 指定使用的通道 + .channel(NioServerSocketChannel.class) + // 指定连接超时时间 + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, nettyProperties.getTimeout()) + // 指定worker处理器 + .childHandler(new NettyServerHandler()); + return serverBootstrap; + } +} diff --git a/youchain-system/src/main/java/com/youchain/Netty/NettyProperties.java b/youchain-system/src/main/java/com/youchain/Netty/NettyProperties.java new file mode 100644 index 0000000..cb7399b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/NettyProperties.java @@ -0,0 +1,90 @@ +package com.youchain.Netty; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "netty") +public class NettyProperties { + + /** + * boss线程数量 + */ + private Integer boss; + + /** + * worker线程数量 + */ + private Integer worker; + + /** + * 连接超时时间 + */ + private Integer timeout = 30000; + + /** + * 服务器主端口 + */ + private Integer port = 8502; + + /** + * 服务器备用端口 + */ + private Integer portSalve = 8503; + + /** + * 服务器地址 默认为本地 + */ + private String host = "127.0.0.1"; + + public Integer getBoss() { + return boss; + } + + public void setBoss(Integer boss) { + this.boss = boss; + } + + public Integer getWorker() { + return worker; + } + + public void setWorker(Integer worker) { + this.worker = worker; + } + + public Integer getTimeout() { + return timeout; + } + + public void setTimeout(Integer timeout) { + this.timeout = timeout; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public Integer getPortSalve() { + return portSalve; + } + + public void setPortSalve(Integer portSalve) { + this.portSalve = portSalve; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + // setter、getter 。。。。 + +} diff --git a/youchain-system/src/main/java/com/youchain/Netty/NettyServerBoot.java b/youchain-system/src/main/java/com/youchain/Netty/NettyServerBoot.java new file mode 100644 index 0000000..e3d3be0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/NettyServerBoot.java @@ -0,0 +1,54 @@ +package com.youchain.Netty; + + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.nio.NioEventLoopGroup; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; + +@Component +@Slf4j +public class NettyServerBoot { + + @Resource + NioEventLoopGroup boosGroup; + @Resource + NioEventLoopGroup workerGroup; + final ServerBootstrap serverBootstrap; + final NettyProperties nettyProperties; + + public NettyServerBoot(ServerBootstrap serverBootstrap, NettyProperties nettyProperties) { + this.serverBootstrap = serverBootstrap; + this.nettyProperties = nettyProperties; + } + + + /** + * 启动netty + * + * @throws InterruptedException + */ + @PostConstruct + public void start() throws InterruptedException { + // 绑定端口启动 + serverBootstrap.bind(nettyProperties.getPort()).sync(); + // 备用端口 + serverBootstrap.bind(nettyProperties.getPortSalve()).sync(); + log.info("启动Netty: {},{}", nettyProperties.getPort(), nettyProperties.getPortSalve()); + } + + /** + * 关闭netty + */ + @PreDestroy + public void close() { + log.info("关闭Netty"); + boosGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } +} + diff --git a/youchain-system/src/main/java/com/youchain/Netty/NettyServerHandler.java b/youchain-system/src/main/java/com/youchain/Netty/NettyServerHandler.java new file mode 100644 index 0000000..8ca6544 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/NettyServerHandler.java @@ -0,0 +1,27 @@ +package com.youchain.Netty; + +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.socket.SocketChannel; +import lombok.extern.slf4j.Slf4j; + +@Slf4j + +public class NettyServerHandler extends ChannelInitializer { + @Override + protected void initChannel(SocketChannel socketChannel) throws Exception { + // 数据分割符 + //String delimiterStr = "\r\n"; + //ByteBuf delimiter = Unpooled.copiedBuffer(delimiterStr.getBytes()); + ChannelPipeline pipeline = socketChannel.pipeline(); + // 使用自定义处理拆包/沾包,并且每次查找的最大长度为1024字节 + //pipeline.addLast(new DelimiterBasedFrameDecoder(1024, delimiter)); + // 将上一步解码后的数据转码为Message实例 + pipeline.addLast(new MessageDecodeHandler()); + // 对发送客户端的数据进行编码,并添加数据分隔符 + pipeline.addLast(new MessageEncodeHandler("")); + // 对数据进行最终处理 + pipeline.addLast(new ServerListenerHandler()); + } +} + diff --git a/youchain-system/src/main/java/com/youchain/Netty/NettyUtils.java b/youchain-system/src/main/java/com/youchain/Netty/NettyUtils.java new file mode 100644 index 0000000..203bed8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/NettyUtils.java @@ -0,0 +1,233 @@ +package com.youchain.Netty; + +import com.youchain.utils.RedisUtils; +import com.youchain.utils.SpringContextHolder; +import com.youchain.utils.StringUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import lombok.extern.slf4j.Slf4j; + +import java.net.InetSocketAddress; +@Slf4j +public class NettyUtils { + + public static final String button_1="0001"; + public static final String button_2="0002"; + public static final String button_3="0003"; + public static final String button_4="0004"; + + private static final String button_on="0001"; + private static final String button_off="0000"; + + public static final String light_1="0005"; + public static final String light_2="0006"; + public static final String light_3="0007"; + public static final String light_4="0008"; + + + private static final String light_off="0000"; + private static final String light_on="0001"; + + private static final String light_fast="0002"; + + private static final String light_slow="0003"; + /** + * 灯光熄灭 + * @param ip 按钮盒ip + * @param index 位置码 + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void light_off(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+light_off; + writeToClient(lamp_log_id,content,channel,"灯光熄灭"); + } + /** + * 灯光常亮 + * @param ip 按钮盒ip + * @param index 位置码light_x + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void light_on(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+light_on; + writeToClient(lamp_log_id,content,channel,"灯光常亮"); + } + /** + * 灯光快闪 + * @param ip 按钮盒ip + * @param index 位置码 + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void light_on_fast_flicker(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+light_fast; + writeToClient(lamp_log_id,content,channel,"灯光快闪"); + } + + /** + * 灯光慢闪 + * @param ip 按钮盒ip + * @param index 位置码 + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void light_on_slow_flicker(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+light_slow; + writeToClient(lamp_log_id,content,channel,"灯光慢闪"); + } + + + /** + * 按钮释放 + * @param ip 按钮盒ip + * @param index 位置码button_x + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void button_off(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+button_off; + writeToClient(lamp_log_id,content,channel,"按钮释放"); + } + + /** + * 按钮按下 + * @param ip 按钮盒ip + * @param index 位置码 + * @param lamp_log_id 日志id 如果是null为新增 + */ + public static void button_on(String ip,String index,Long lamp_log_id){ + Channel channel= getChannel(ip); + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 01 + //2位功能码 06 写入单个数据 + //4位寄存器地址 (按钮/灯) + //4位数据 (按钮 0没有被按下,1按钮被按下)(指示灯 0灭,1亮,2快闪,3慢闪) + String content="0001"+"0000"+"0006"+"01"+"06"+index+button_on; + writeToClient(lamp_log_id,content,channel,"按钮按下"); + + } + + + public static void sendMsg(String ip,String content,Long lamp_log_id){ + Channel channel= getChannel(ip); + writeToClient(lamp_log_id,content,channel,"测试"); + } + + public static Channel getChannel(String ip){ + for (Channel client : ServerListenerHandler.clients) { + String devce_ip =((InetSocketAddress)client.remoteAddress()).getAddress().getHostAddress(); + if(ip.equals(devce_ip)){ + return client; + } + } + return null; + } + + + + public static void writeToClient(final Long lamp_log_id,final String sendStr, Channel channel, final String mark) { + //加载redis + //000000000006010300010008 + //000100000006010600060000 + + if("000000000006010300010008".equals(sendStr)){ + log.info("回写心跳,执行一次"+sendStr); + ReawriteToClient(lamp_log_id,sendStr,channel,mark); + }else{ + log.info("其他数据,执行两次"+sendStr); + ReawriteToClient(lamp_log_id,sendStr,channel,mark); + try{ + Thread.sleep(100); + }catch (Exception e){ + + } + ReawriteToClient(lamp_log_id,sendStr,channel,mark); + } + + } + + + public static void ReawriteToClient(final Long lamp_log_id,final String sendStr, Channel channel, final String mark) { + //加载redis + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + if(channel==null){ + //"设备IP无效"; + if (lamp_log_id!=null){ + redisUtils.set(String.valueOf(lamp_log_id),"设备IP无效"); + } + return; + } + try { + ByteBuf bufff = Unpooled.buffer();//netty需要用ByteBuf传输 + bufff.writeBytes(HexTools.hexString2Bytes(sendStr));//对接需要16进制 + channel.writeAndFlush(bufff).addListener(new ChannelFutureListener() { + @Override + public void operationComplete(ChannelFuture future) throws Exception { + StringBuilder sb = new StringBuilder(); + if(!StringUtils.isEmpty(mark)){ + sb.append("【").append(mark).append("】"); + } + if (future.isSuccess()) { + log.info(sb.toString()+"回写成功"+sendStr); + if (lamp_log_id!=null){ + redisUtils.set(String.valueOf(lamp_log_id),sb.toString()+"回写成功"+sendStr); + } + } else { + log.error(sb.toString()+"回写失败"+sendStr); + if (lamp_log_id!=null){ + redisUtils.set(String.valueOf(lamp_log_id),sb.toString()+"回写失败"+sendStr); + } + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + log.error("调用通用writeToClient()异常"+e.getMessage()); + if (lamp_log_id!=null){ + redisUtils.set(String.valueOf(lamp_log_id), "调用通用writeToClient()异常"+e.getMessage()); + } + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/Netty/ServerListenerHandler.java b/youchain-system/src/main/java/com/youchain/Netty/ServerListenerHandler.java new file mode 100644 index 0000000..73c46c9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/Netty/ServerListenerHandler.java @@ -0,0 +1,257 @@ +package com.youchain.Netty; + +import cn.hutool.json.JSONUtil; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.repository.BoxRepository; +import com.youchain.basicdata.service.BoxService; +import com.youchain.basicdata.service.dto.BoxDto; +import com.youchain.basicdata.service.dto.BoxQueryCriteria; +import com.youchain.basicdata.service.impl.BoxServiceImpl; +import com.youchain.basicdata.service.impl.BoxServiceImpl; +import com.youchain.basicdata.service.mapstruct.BoxMapper; +import com.youchain.domain.Log; +import com.youchain.exception.handler.ApiResult; +import com.youchain.service.impl.LogServiceImpl; +import com.youchain.utils.RedisUtils; +import com.youchain.utils.SpringContextHolder; +import com.youchain.utils.StringUtils; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.group.ChannelGroup; +import io.netty.channel.group.DefaultChannelGroup; +import io.netty.util.concurrent.GlobalEventExecutor; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.net.InetSocketAddress; +import java.util.List; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.OK; + +@Slf4j +public class ServerListenerHandler extends SimpleChannelInboundHandler { + + + public static final ChannelGroup clients = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); + + + /** + * 设备接入连接时处理 + * + * @param ctx + */ + @Override + public void handlerAdded(ChannelHandlerContext ctx) { + String ip =((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress(); + log.info("有新的连接:[{}]", ip); + Channel lastClient=NettyUtils.getChannel(ip); + if(lastClient!=null){ + log.info("当前IP有旧的连接,移除旧的的连接:[{}]", ip); + clients.remove(lastClient); + } + clients.add(ctx.channel()); + + + } + + /** + * 数据处理 + * + * @param ctx + * @param content + */ + @Override + protected void channelRead0(ChannelHandlerContext ctx, String content) { + String ip =((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress(); + // 获取消息实例中的消息体 + // 对不同消息类型进行处理 + //00 00 /00 00 /00 0C /00 /07 /00 00 00 00 00 00 00 00 00 01 + //4位通讯帧号 + //4位通讯协议 + //4位数据长度(在这后面的总长度) + //2位设备地址 00 + //2位功能码 07 心跳数据 + //16 位 按钮1-按钮8 的状态 + //4位数据 呼叫器编号 + + String key="TCP"+ip; + + if(content.length()==36){ + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + + int time=(int) redisUtils.get(key,10); + + if(time>=10000){ + time=10; + } + + redisUtils.set(key,time+1); + + if(time%8==0){ + StringBuffer buff=new StringBuffer(); + buff.append("0000");//通讯帧数 + buff.append("0000");//协议类型 + buff.append("0006");//长度 + buff.append("01");//设备地址 + buff.append("03");//读取数据 + buff.append("0001");//读取目标数据的起始地址 + buff.append("0008");//读取目标寄存器的数量 + NettyUtils.writeToClient(null,buff.toString(),ctx.channel(),"读取设备状态"); + } + + log.info("心跳内容" + content); + String bt1=content.substring(16,18); + String bt2=content.substring(18,20); + String bt3=content.substring(20,22); + String bt4=content.substring(22,24); + + + +// if("01".equals(bt1)){ +// ClickButton(redisUtils,content,ip,NettyUtils.button_1,NettyUtils.light_1); +// } +// if("01".equals(bt2)){ +// ClickButton(redisUtils,content,ip,NettyUtils.button_2,NettyUtils.light_2); +// } +// if("01".equals(bt3)){ +// ClickButton(redisUtils,content,ip,NettyUtils.button_3,NettyUtils.light_3); +// } +// if("01".equals(bt4)){ +// ClickButton(redisUtils,content,ip,NettyUtils.button_4,NettyUtils.light_4); +// } + + } else{ + log.info("其他消息内容" + content); + } + + } + + +// public void ClickButton(RedisUtils redisUtils,String content,String ip,String ButtonCode,String LightCode){ +// log.info(ButtonCode+"按钮 被按下"); +// //读取bt_key +// String bt_key="TCP"+ip+ButtonCode; +// if ((Boolean) redisUtils.get(bt_key,false)) { +// log.error("{}正在执行...",bt_key); +// return; +// } +// //写入key 为Tue +// redisUtils.set(bt_key,true,120); +// //加载操作数据库 +// LampLogRepository lampLogRepository = SpringContextHolder.getBean(LampLogRepository.class); +// LampLogServiceImpl bean = SpringContextHolder.getBean(LampLogServiceImpl.class); +// BoxRepository bean1 = SpringContextHolder.getBean(BoxRepository.class); +// //插入日志 +// LampLog lampLog = new LampLog(); +// lampLog.setIp(ip);//插入ip +// lampLog.setButtonCode(ButtonCode); +// lampLog.setRequestContent(content); +// lampLog.setReturnState(ButtonCode+"被按下"); +// //获取盒子号 +// log.info("ButtonBoxCode:"+ip + ButtonCode+"===="); +// Object buttonBoxCode = redisUtils.hget("ButtonBoxCode", ip + ButtonCode,"")+""; +// if ("".equals(buttonBoxCode)){ +// log.info("ButtonBoxCode为空:"+ip + ButtonCode+"===="); +// List boxAllData = bean1.getBoxAllData(); +// for (Box box:boxAllData){ +// redisUtils.hset("ButtonBoxCode",box.getIP()+box.getLampCode(),box.getCode(),60); +// } +// lampLog.setButtonBox(redisUtils.hget("ButtonBoxCode", ip + ButtonCode,"")+""); +// log.info("ButtonBoxCode重新从redis获取:"+ip + ButtonCode+"====lampLog"+lampLog.getButtonBox()+"是否正确"); +// }else { +// log.info("ButtonBoxCode不为空:"+buttonBoxCode.toString()+"===="); +// lampLog.setButtonBox(buttonBoxCode.toString()); +// } +// lampLog.setOperationType("自动"); +// //插入日志 +// LampLog save = lampLogRepository.save(lampLog); +// //先亮灯 +// NettyUtils.light_on(ip,LightCode,save.getId()); +// bean1.updateBoxLampStatus(ip,ButtonCode,"1"); +// //处理业务 +// String boxCode=lampLog.getButtonBox(); +// if(boxCode!=null&&!boxCode.equals("")) { +// this.buttonService(boxCode);//按钮3的业务处理 +// } +// save.setReturnContent((String) redisUtils.get(String.valueOf(save.getId()))); +// //修改日志 +// bean.update(save); +// //释放按钮 修改Key为False +// redisUtils.del(String.valueOf(save.getId())); +// NettyUtils.button_off(ip,ButtonCode,save.getId()); +// redisUtils.set(bt_key,false); +// +// } + + + /** + * 设备下线处理 + * + * @param ctx + */ + @Override + public void handlerRemoved(ChannelHandlerContext ctx) { + + String ip =((InetSocketAddress)ctx.channel().remoteAddress()).getAddress().getHostAddress(); + + clients.remove(ctx.channel()); + log.info("设备下线了:{}", ip); + } + + /** + * 设备连接异常处理 + * + * @param ctx + * @param cause + */ + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + // 打印异常 + log.info("异常:{}", cause.getMessage()); + // 关闭连接 + ctx.close(); + clients.remove(ctx.channel()); + } + + //按钮1 的业务 + public ResponseEntity buttonService(String buttonBoxCode){ + log.info("WMS按钮"+buttonBoxCode+"的业务......"); + BoxServiceImpl bsi = SpringContextHolder.getBean(BoxServiceImpl.class); + BoxMapper bm= SpringContextHolder.getBean(BoxMapper.class); + BoxQueryCriteria bqc=new BoxQueryCriteria(); + bqc.setCode(buttonBoxCode); + List bds=bsi.queryAll(bqc); + if(bds.size()>0){ + BoxDto b=bds.get(0); + try { + log.info("进来WMS按钮的业务......"); +// bsi.callBox(b); + } catch (Exception e) { + Log log_data=new Log(); + log_data.setRequestIp(b.getIP()); + log_data.setUsername("按钮盒设备:"+b.getLampCode()); + log_data.setDescription("按钮盒设备业务处理"); + log_data.setLogType("ERROR"); + log_data.setReturnData(e.getMessage()); + LogServiceImpl lsi = SpringContextHolder.getBean(LogServiceImpl.class); + lsi.saveLog(log_data); + log.error("灯日志"+e.getMessage()); + Box box=bm.toEntity(b); + box.setLampStatus("0"); + bsi.update(box); + return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST); + } + return new ResponseEntity<>(ApiResult.success(OK.value(), "呼叫成功!", ""), HttpStatus.OK); + }else{ + return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "找不到对应的按钮数据", ""), HttpStatus.BAD_REQUEST); + } + } + +} + diff --git a/youchain-system/src/main/java/com/youchain/appupdate/ReturnJson/RLocLayout.java b/youchain-system/src/main/java/com/youchain/appupdate/ReturnJson/RLocLayout.java new file mode 100644 index 0000000..aa0f4a5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/ReturnJson/RLocLayout.java @@ -0,0 +1,27 @@ +package com.youchain.appupdate.ReturnJson; + +import lombok.Data; + +@Data +public class RLocLayout { + String id; +// /**行*/ +// int gRow; +// /**列*/ +// int gCol; + /**类型0空,1满车,2未启用*/ + int type; + /**代码*/ + String code; + /**物料类型*/ + String itemType; + + /**物料*/ + String itemName; + + double x; + + double y; + + +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/domain/SysAppUpdate.java b/youchain-system/src/main/java/com/youchain/appupdate/domain/SysAppUpdate.java new file mode 100644 index 0000000..462322c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/domain/SysAppUpdate.java @@ -0,0 +1,82 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-17 +**/ +@Entity +@Data +@Table(name="sys_app_update") +public class SysAppUpdate implements Serializable { + + @Id + @Column(name = "`id`") + @ApiModelProperty(value = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id=0; + + + @Column(name = "`app_name`") + @ApiModelProperty(value = "项目名称") + private String appName; + + + @Column(name = "`update_status`",nullable = false) + @NotNull + @ApiModelProperty(value = "更新状态:0表示不更新,1表示版本更新,不需要强制升级,2表示版本更新和强制升级。") + private Integer updateStatus; + + @Column(name = "`version_code`",nullable = false) + @NotNull + @ApiModelProperty(value = "版本代码:版本编号,自递增.用来比较这个版本是否是最新的版本.") + private Integer versionCode; + + @Column(name = "`version_name`") + @ApiModelProperty(value = "版本名称:显示版本名称.") + private String versionName; + + @Column(name = "`modify_content`") + @ApiModelProperty(value = "修改内容:版本更新的内容。") + private String modifyContent; + + @Column(name = "`download_url`") + @ApiModelProperty(value = "下载网站:下载应用程序APK文件的地址。") + private String downloadUrl; + + @Column(name = "`apk_size`") + @ApiModelProperty(value = "程序大小:应用程序APK文件的文件大小,单位为kb。") + private Integer apkSize; + + @Column(name = "`apk_md5`") + @ApiModelProperty(value = "APKMD5:应用APK文件的MD5值。如果没有,则不能保证APK是完整的,每次都将再次下载。框架默认情况下使用MD5加密。") + private String apkMd5; + + public void copy(SysAppUpdate source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/BindOrder.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/BindOrder.java new file mode 100644 index 0000000..79e74ad --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/BindOrder.java @@ -0,0 +1,28 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绑定工单号的入参 + */ +@Data +public class BindOrder { + @ApiModelProperty(value = "按钮盒ID") + long boxId;//按钮盒ID + + @ApiModelProperty(value = "物料编号") + String itemCode;//物料 + + @ApiModelProperty(value = "工单号") + String orderNumber;//工单号 + + public BindOrder(long boxId,String itemCode, String orderNumber) { + this.boxId = boxId; + this.orderNumber = orderNumber; + this.itemCode = itemCode; + } + + public BindOrder() { + } +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/CallBox.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/CallBox.java new file mode 100644 index 0000000..51cfb68 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/CallBox.java @@ -0,0 +1,12 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +/** + * 按钮盒呼叫的入参 + */ +@Data +public class CallBox { + @ApiModelProperty(value = "按钮盒ID") + long id;//id +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ContainerIn.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ContainerIn.java new file mode 100644 index 0000000..1b347fe --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ContainerIn.java @@ -0,0 +1,24 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 容器入场 + */ +@Data +public class ContainerIn { + + @ApiModelProperty(value = "容器编号") + String containerCode; + + @ApiModelProperty(value = "点位编号") + String position; + + @ApiModelProperty(value = "物料编号") + String itemCode; + + @ApiModelProperty(value = "检索码") + int checkCode=0; + +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockIn.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockIn.java new file mode 100644 index 0000000..0eb7119 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockIn.java @@ -0,0 +1,41 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 满车入库 + */ +@Data +public class FullStockIn { + @ApiModelProperty(value = "点位编码") + String pointCode; + + @ApiModelProperty(value = "物料编号") + String itemCode; + + @ApiModelProperty(value = "容器码") + String stockCode; + + @ApiModelProperty(value = "按钮盒") + Long boxId=0l; + + @ApiModelProperty(value = "作业场景") + String agvScene; + + @ApiModelProperty(value = "检索码") + int checkCode=0; + + + public FullStockIn(String pointCode, String itemCode, String stockCode, Long boxId,String agvScene,int checkCode) { + this.pointCode = pointCode; + this.stockCode = stockCode; + this.itemCode = itemCode; + this.boxId=boxId; + this.agvScene = agvScene; + this.checkCode=checkCode; + } + + public FullStockIn() { + } +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockOut.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockOut.java new file mode 100644 index 0000000..18fb747 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/FullStockOut.java @@ -0,0 +1,33 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 满车出库 + */ +@Data +public class FullStockOut { + + @ApiModelProperty(value = "物料编号") + String itemCode; + + @ApiModelProperty(value = "点位编码") + String pointCode; + + @ApiModelProperty(value = "作业场景") + String agvScene; + + @ApiModelProperty(value = "检索码") + int checkCode=0; + + public FullStockOut(String itemCode,String pointCode, String agvScene,int checkCode) { + this.pointCode = pointCode; + this.itemCode = itemCode; + this.agvScene = agvScene; + this.checkCode=checkCode; + } + + public FullStockOut() { + } +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/LineScanStock.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/LineScanStock.java new file mode 100644 index 0000000..0d6f494 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/LineScanStock.java @@ -0,0 +1,13 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LineScanStock { + @ApiModelProperty(value = "容器编号") + String stockCode; + + @ApiModelProperty(value = "任务编号") + String taskCode; +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/MissionStateCallback.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/MissionStateCallback.java new file mode 100644 index 0000000..8853980 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/MissionStateCallback.java @@ -0,0 +1,19 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * KMReS接口回调的入参 + */ +@Data +public class MissionStateCallback { + @ApiModelProperty(value = "任务ID") + int missionCode; + + @ApiModelProperty(value = "容器编号") + String containerCode; + + @ApiModelProperty(value = "作业当前状态") + String missionStatus; +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/Mo.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/Mo.java new file mode 100644 index 0000000..bf8ce98 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/Mo.java @@ -0,0 +1,16 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 绑定Mo票入参 + */ +@Data +public class Mo { + @ApiModelProperty(value = "Mo票") + String mo; + + @ApiModelProperty(value = "料箱号") + String stockCode; +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/PointCallStock.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/PointCallStock.java new file mode 100644 index 0000000..2166196 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/PointCallStock.java @@ -0,0 +1,17 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 扫描物料接口 + * 入参 + */ +@Data +public class PointCallStock { + @ApiModelProperty(value = "点位编码") + String pointCode; + @ApiModelProperty(value = "AGV场景") + String agvScene; + +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ScanItemCode.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ScanItemCode.java new file mode 100644 index 0000000..258eb17 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/ScanItemCode.java @@ -0,0 +1,16 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 扫描物料接口 + * 入参 + */ +@Data +public class ScanItemCode { + @ApiModelProperty(value = "物料编号") + String itemCode; + @ApiModelProperty(value = "库位编号") + String pointCode; +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/inputJson/SmallCallStock.java b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/SmallCallStock.java new file mode 100644 index 0000000..6a19fe6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/inputJson/SmallCallStock.java @@ -0,0 +1,20 @@ +package com.youchain.appupdate.inputJson; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 小件-满料出库入参 + */ +@Data +public class SmallCallStock { + + @ApiModelProperty(value = "按钮盒ID") + long id;//id + + @ApiModelProperty(value = "物料编号") + String itemCode; + + @ApiModelProperty(value = "箱数") + int quantity; +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/repository/SysAppUpdateRepository.java b/youchain-system/src/main/java/com/youchain/appupdate/repository/SysAppUpdateRepository.java new file mode 100644 index 0000000..0122f55 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/repository/SysAppUpdateRepository.java @@ -0,0 +1,30 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.repository; + +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.basicdata.domain.Box; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-17 +**/ +public interface SysAppUpdateRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/rest/ScreenMdController.java b/youchain-system/src/main/java/com/youchain/appupdate/rest/ScreenMdController.java new file mode 100644 index 0000000..bf9c88e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/rest/ScreenMdController.java @@ -0,0 +1,166 @@ +package com.youchain.appupdate.rest; + +import cn.hutool.json.JSONArray; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.businessdata.service.impl.*; +import com.youchain.report_data.utils.PieChart; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.icepear.echarts.Option; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.List; + + +@RestController +@RequiredArgsConstructor +@Api(tags = "美的大屏数据显示") +@RequestMapping("/api/screenMdView") +@Slf4j +public class ScreenMdController { + private final ScreenMdServiceImpl screenMdImpl; + @PostMapping(value="/locLayout") + @Log("库位布局") + @ApiOperation("库位布局") + @AnonymousAccess + public ResponseEntity locLayout(String zoneType) { + //0空1满2禁用3空车区满 + if(zoneType==null){ + zoneType="MD"; + } + List xys=screenMdImpl.getLocXy(zoneType); + List objs=screenMdImpl.queryLayout(zoneType); + HashMap map=new HashMap(); + map.put("mg_top",2); + map.put("mg_left",1); + HashMap seatList=new HashMap(); + int type0=0; + int type1=0; + int type2=0; + int type3=0; + if(objs.size()>0){ + JSONArray seat=new JSONArray(); + Object[] xy=xys.get(0); + HashMap itemTypes=new HashMap(); + for(Object[] obj:objs){ + double minX=Double.parseDouble(xy[0].toString()); + double minY=Double.parseDouble(xy[1].toString()); + double maxX=Double.parseDouble(xy[2].toString()); + double maxY=Double.parseDouble(xy[3].toString()); + HashMap d=new HashMap(); + Object id=obj[0]; + Object code=obj[1]; + double gRow=Double.parseDouble(obj[2].toString()); + double gCol=Double.parseDouble(obj[3].toString()); + Object barCode=obj[4]; + Object lot=obj[5]; + Object disabled=obj[6]; + String inv_status=obj[7]==null?"":obj[7].toString(); + Object loc_status=obj[8]; + String type="4";//1禁用,2满料,3AGV未送物料占用,4 空闲,5空车占用 + //禁用(红色,白×),有物料(绿,白车),4,空(紫,百空),空占用(紫,橙空) + if(disabled.toString().equals("true")){ + type="1"; + }else if(loc_status.equals("OCCUPY")&&inv_status.equals("OPEN")){ + type="2"; + }else if(loc_status.equals("OCCUPY")&&inv_status.equals("ZY")){ + type="3"; + }else if(loc_status.equals("FREE")&&inv_status.equals("")){ + type="4"; + }else if(loc_status.equals("OCCUPY")&&inv_status.equals("")){ + type="5"; + } + d.put("id", obj[0]+""); +// d.put("gRow",Math.abs((int)Math.ceil(gCol-maxY))); +// d.put("gCol",(int)Math.ceil(gRow-minX)); + //库位靠左考上显示 + gRow=gRow-minX; + gCol=gCol-minY; + //重新计算最大最小XY + maxX=maxX-minX; + minX=0d; + maxY=maxY-minY; + minY=0; + + double gRow2=gCol; + double gCol2=gRow; + + double maxX2=maxY; + double maxY2 =maxX; + + + d.put("gRow",Math.abs(gRow2-maxX2)); + d.put("gCol",gCol2); + d.put("type", type); + d.put("lot", lot); + d.put("code", code); + d.put("item_code", barCode); + seat.add(d); + } + String movieName="重庆美的点位布局图"; + map.put("movieName",movieName);//+mes); + map.put("seatList",seat); + } + return new ResponseEntity(map, HttpStatus.OK); + } + + @PostMapping(value="/locTypePie") + @Log("库位比列") + @ApiOperation("库位比列") + @AnonymousAccess + public ResponseEntity locTypePie(String type) { + //1禁用,2满料,3AGV未送物料占用,4 空闲,5空车占用 + DecimalFormat df = new DecimalFormat("#.0"); + int locCount=screenMdImpl.getLocCount(type); + int sjCount=screenMdImpl.getLocStatusCount(type); + String color0="#ededed"; + String color1="#FF0000"; + String scoreName="SCORE"; + double percentage=sjCount*100*0.1*10/locCount; +// percentage=Math.round(percentage); + percentage=Double.parseDouble(df.format(percentage)); + if(type.equals("1")){ +// color0="#04CDE6"; + color1="#0CC8E6"; + color1="#021334FF"; + }else if(type.equals("2")){ +// color0="#73E239"; + color1="#35B45E"; + color1="#021334FF"; + }else if(type.equals("3")){ +// color0="#FEBA6B"; + color1="#F29961"; + color1="#021334FF"; + }else if(type.equals("4")){ +// color0="#E15E68"; + color1="#E53240"; + color1="#021334FF"; + }else if(type.equals("5")){ +// color0="#A682E6"; + color1="#6244E6"; + color1="#021334FF"; + } + Option option= PieChart.pieStyle(color0,color1,scoreName,percentage); + return new ResponseEntity(option, HttpStatus.OK); + } + + @PostMapping(value="/locTypePieQty") + @Log("库位比列数量") + @ApiOperation("库位比列数量") + @AnonymousAccess + public ResponseEntity locTypePieQty(String type) { + int sjCount=screenMdImpl.getLocStatusCount(type); + HashMap map=new HashMap(); + map.put("data",sjCount); + return new ResponseEntity(map, HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/appupdate/rest/SysAppUpdateController.java b/youchain-system/src/main/java/com/youchain/appupdate/rest/SysAppUpdateController.java new file mode 100644 index 0000000..30b709c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/rest/SysAppUpdateController.java @@ -0,0 +1,131 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.rest; + +import com.youchain.Netty.NettyUtils; +import com.youchain.Netty.ServerListenerHandler; +import com.youchain.annotation.Log; +import com.youchain.annotation.rest.AnonymousGetMapping; +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.appupdate.service.SysAppUpdateService; +import com.youchain.appupdate.service.dto.SysAppUpdateQueryCriteria; +import com.youchain.appupdate.service.dto.SysNewAppUpdateDto; +import io.netty.channel.Channel; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-17 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "app_update管理") +@RequestMapping("/api/sysAppUpdate") +public class SysAppUpdateController { + + private final SysAppUpdateService sysAppUpdateService; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('sysAppUpdate:list')") + public void exportSysAppUpdate(HttpServletResponse response, SysAppUpdateQueryCriteria criteria) throws Exception { + sysAppUpdateService.download(sysAppUpdateService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询app_update") + @ApiOperation("查询app_update") + @PreAuthorize("@el.check('sysAppUpdate:list')") + public ResponseEntity querySysAppUpdate(SysAppUpdateQueryCriteria criteria, Pageable pageable){ + + return new ResponseEntity<>(sysAppUpdateService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @Log("获取最新版本") + @ApiOperation("获取最新版本tdshfdisuhfosihfosi093t") + @AnonymousGetMapping(value = "/new") + public ResponseEntity querySysNewAppUpdate(SysAppUpdateQueryCriteria criteria, Pageable pageable){ + + log.error(criteria.getBaseurl()); + List list= sysAppUpdateService.queryByname(criteria); + if(list.size()>0){ + SysNewAppUpdateDto so=list.get(list.size()-1); + + String url=so.getDownloadUrl(); + so.setCode("0"); + so.setUpdateStatus(1); + so.setDownloadUrl(criteria.getBaseurl()+url); + return new ResponseEntity<>(so,HttpStatus.OK); + } + + return new ResponseEntity<>("",HttpStatus.OK); + } + + + @PostMapping + @ApiOperation("上传文件") + @PreAuthorize("@el.check('sysAppUpdate:add')") + public ResponseEntity createSysAppUpdate(@RequestParam String appName,@RequestParam int versionCode,@RequestParam String versionName,@RequestParam String modifyContent, @RequestParam("file") MultipartFile file){ + + return new ResponseEntity<>(sysAppUpdateService.create(appName,versionCode,versionName,modifyContent,file),HttpStatus.CREATED); + + } + + + + @PutMapping + @Log("修改app_update") + @ApiOperation("修改app_update") + @PreAuthorize("@el.check('sysAppUpdate:edit')") + public ResponseEntity updateSysAppUpdate(@Validated @RequestBody SysAppUpdate resources){ + sysAppUpdateService.update(resources); + + for (Channel client : ServerListenerHandler.clients) { + String devce_ip =((InetSocketAddress)client.remoteAddress()).getAddress().getHostAddress(); + NettyUtils.light_on(devce_ip,NettyUtils.light_1,null); + } + + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除app_update") + @ApiOperation("删除app_update") + @PreAuthorize("@el.check('sysAppUpdate:del')") + public ResponseEntity deleteSysAppUpdate(@RequestBody Integer[] ids) { + sysAppUpdateService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/SysAppUpdateService.java b/youchain-system/src/main/java/com/youchain/appupdate/service/SysAppUpdateService.java new file mode 100644 index 0000000..8bb29a5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/SysAppUpdateService.java @@ -0,0 +1,85 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service; + +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.appupdate.service.dto.SysAppUpdateDto; +import com.youchain.appupdate.service.dto.SysAppUpdateQueryCriteria; +import com.youchain.appupdate.service.dto.SysNewAppUpdateDto; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author liuxue +* @date 2023-07-17 +**/ +public interface SysAppUpdateService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(SysAppUpdateQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(SysAppUpdateQueryCriteria criteria); + + List queryByname(SysAppUpdateQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return SysAppUpdateDto + */ + SysAppUpdateDto findById(Integer id); + + + + SysAppUpdateDto create( String appName,int versionCode, String versionName, String modifyContent, MultipartFile file); + + /** + * 编辑 + * @param resources / + */ + void update(SysAppUpdate resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Integer[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateDto.java b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateDto.java new file mode 100644 index 0000000..282e79f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateDto.java @@ -0,0 +1,54 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-17 +**/ +@Data +public class SysAppUpdateDto implements Serializable { + + private Integer id; + + /** 项目名称 */ + private String appName; + /** 更新状态:0表示不更新,1表示版本更新,不需要强制升级,2表示版本更新和强制升级。 */ + private Integer updateStatus; + + /** 版本代码:版本编号,自递增.用来比较这个版本是否是最新的版本. */ + private Integer versionCode; + + /** 版本名称:显示版本名称. */ + private String versionName; + + /** 修改内容:版本更新的内容。 */ + private String modifyContent; + + /** 下载网站:下载应用程序APK文件的地址。 */ + private String downloadUrl; + + /** 程序大小:应用程序APK文件的文件大小,单位为kb。 */ + private Integer apkSize; + + /** APKMD5:应用APK文件的MD5值。如果没有,则不能保证APK是完整的,每次都将再次下载。框架默认情况下使用MD5加密。 */ + private String apkMd5; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateQueryCriteria.java b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateQueryCriteria.java new file mode 100644 index 0000000..4ff4f50 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysAppUpdateQueryCriteria.java @@ -0,0 +1,34 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.dto; + + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** + * @website https://eladmin.vip + * @author liuxue + * @date 2023-07-18 + **/ +@Data +public class SysAppUpdateQueryCriteria{ + @Query(type = Query.Type.EQUAL) + private String appName; + + private String baseurl; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysNewAppUpdateDto.java b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysNewAppUpdateDto.java new file mode 100644 index 0000000..a7b0f9c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/dto/SysNewAppUpdateDto.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-17 +**/ +@Data +public class SysNewAppUpdateDto implements Serializable { + + private String Code; + + private String Msg; + + /** 项目名称 */ + private String appName; + /** 更新状态:0表示不更新,1表示版本更新,不需要强制升级,2表示版本更新和强制升级。 */ + private Integer updateStatus; + + /** 版本代码:版本编号,自递增.用来比较这个版本是否是最新的版本. */ + private Integer versionCode; + + /** 版本名称:显示版本名称. */ + private String versionName; + + /** 修改内容:版本更新的内容。 */ + private String modifyContent; + + /** 下载网站:下载应用程序APK文件的地址。 */ + private String downloadUrl; + + /** 程序大小:应用程序APK文件的文件大小,单位为kb。 */ + private Integer apkSize; + + /** APKMD5:应用APK文件的MD5值。如果没有,则不能保证APK是完整的,每次都将再次下载。框架默认情况下使用MD5加密。 */ + private String apkMd5; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/impl/SysAppUpdateServiceImpl.java b/youchain-system/src/main/java/com/youchain/appupdate/service/impl/SysAppUpdateServiceImpl.java new file mode 100644 index 0000000..d901554 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/impl/SysAppUpdateServiceImpl.java @@ -0,0 +1,152 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.appupdate.service.dto.SysNewAppUpdateDto; +import com.youchain.appupdate.service.mapstruct.SysNewAppUpdateMapper; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.appupdate.repository.SysAppUpdateRepository; +import com.youchain.appupdate.service.SysAppUpdateService; +import com.youchain.appupdate.service.dto.SysAppUpdateDto; +import com.youchain.appupdate.service.dto.SysAppUpdateQueryCriteria; +import com.youchain.appupdate.service.mapstruct.SysAppUpdateMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author liuxue +* @date 2023-07-17 +**/ +@Slf4j +@Service +@RequiredArgsConstructor +public class SysAppUpdateServiceImpl implements SysAppUpdateService { + + private final SysAppUpdateRepository sysAppUpdateRepository; + private final SysAppUpdateMapper sysAppUpdateMapper; + private final SysNewAppUpdateMapper sysNewAppUpdateMapper; + private final FileProperties properties; + @Override + public Map queryAll(SysAppUpdateQueryCriteria criteria, Pageable pageable){ + Page page = sysAppUpdateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + for (SysAppUpdate bean:page ) { + log.info(""+bean.getAppName()); + } + + return PageUtil.toPage(page.map(sysAppUpdateMapper::toDto)); + } + + @Override + public List queryAll(SysAppUpdateQueryCriteria criteria){ + return sysAppUpdateMapper.toDto(sysAppUpdateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + + @Override + public List queryByname(SysAppUpdateQueryCriteria criteria){ + return sysNewAppUpdateMapper.toDto(sysAppUpdateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public SysAppUpdateDto findById(Integer id) { + SysAppUpdate sysAppUpdate = sysAppUpdateRepository.findById(id).orElseGet(SysAppUpdate::new); + ValidationUtil.isNull(sysAppUpdate.getId(),"SysAppUpdate","id",id); + return sysAppUpdateMapper.toDto(sysAppUpdate); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public SysAppUpdateDto create(String appName,int versionCode, String versionName, String modifyContent, MultipartFile multipartFile) { + + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + if(ObjectUtil.isNull(file)){ + throw new BadRequestException("上传失败"); + } + //name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name; + + + Long size=multipartFile.getSize()/1024; + SysAppUpdate resources=new SysAppUpdate(); + resources.setAppName(appName); + resources.setId(0); + resources.setUpdateStatus(0); + resources.setVersionCode(versionCode); + resources.setVersionName(versionName); + resources.setModifyContent(modifyContent); + + resources.setDownloadUrl("/file/"+type+"/"+file.getName()); + resources.setApkSize(size.intValue()); + resources.setApkMd5(""); + + return sysAppUpdateMapper.toDto(sysAppUpdateRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SysAppUpdate resources) { + SysAppUpdate sysAppUpdate = sysAppUpdateRepository.findById(resources.getId()).orElseGet(SysAppUpdate::new); + ValidationUtil.isNull( sysAppUpdate.getId(),"SysAppUpdate","id",resources.getId()); + sysAppUpdate.copy(resources); + sysAppUpdateRepository.save(sysAppUpdate); + } + + @Override + public void deleteAll(Integer[] ids) { + for (Integer id : ids) { + sysAppUpdateRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (SysAppUpdateDto sysAppUpdate : all) { + Map map = new LinkedHashMap<>(); + map.put("更新状态。", sysAppUpdate.getUpdateStatus()); + map.put("版本代码", sysAppUpdate.getVersionCode()); + map.put("版本名称", sysAppUpdate.getVersionName()); + map.put("修改内容", sysAppUpdate.getModifyContent()); + map.put("下载网站", sysAppUpdate.getDownloadUrl()); + map.put("程序大小", sysAppUpdate.getApkSize()); + map.put("APKMD5", sysAppUpdate.getApkMd5()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysAppUpdateMapper.java b/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysAppUpdateMapper.java new file mode 100644 index 0000000..c51725a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysAppUpdateMapper.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.mapstruct; + + +import com.youchain.base.BaseMapper; +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.appupdate.service.dto.SysAppUpdateDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @website https://eladmin.vip + * @author liuxue + * @date 2023-07-18 + **/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface SysAppUpdateMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysNewAppUpdateMapper.java b/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysNewAppUpdateMapper.java new file mode 100644 index 0000000..3c800c6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/appupdate/service/mapstruct/SysNewAppUpdateMapper.java @@ -0,0 +1,34 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.appupdate.service.mapstruct; + + +import com.youchain.appupdate.domain.SysAppUpdate; +import com.youchain.appupdate.service.dto.SysAppUpdateDto; +import com.youchain.appupdate.service.dto.SysNewAppUpdateDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @website https://eladmin.vip + * @author liuxue + * @date 2023-07-18 + **/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface SysNewAppUpdateMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Area.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Area.java new file mode 100644 index 0000000..e82c556 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Area.java @@ -0,0 +1,133 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Set; + +/** + * @author HJL + * @website https://eladmin.vip + * @description / + * @date 2023-08-14 + **/ +@Entity +@Data +@Table(name = "base_area") +public class Area extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Long id; + + @Column(name = "`code`", nullable = false) + @NotBlank + @ApiModelProperty(value = "库区编号") + private String code; + + @Column(name = "`name`", nullable = false) + @NotBlank + @ApiModelProperty(value = "库区名称") + private String name; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`enabled`", nullable = false) + @NotNull + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + @Column(name = "`heat`") + @ApiModelProperty(value = "热度值") + private Double heat=0d; + + @Column(name = "`pos_x`") + @ApiModelProperty(value = "坐标X,更改成排序号") + private Double posX=0d; + + @Column(name = "`pos_y`") + @ApiModelProperty(value = "坐标Y") + private Double posY=0d; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + + @Column(name = "`sequence_no`") + @ApiModelProperty(value = "序列号") + private String sequenceNo; + + @Column(name = "`org_code`") + @ApiModelProperty(value = "org编号") + private String orgCode; + + @Column(name = "`gc_code`") + @ApiModelProperty(value = "工厂") + private String gcCode; + + @Column(name = "`working_station`",nullable = true) + @ApiModelProperty(value = "所属工位") + private String workingStation; + +// @OneToOne(mappedBy = "area") +// @JoinColumn(name = "point_id") +// @ApiModelProperty(value = "缓存库位") +// private Point point; + + @Column(name = "`point_id`") + @ApiModelProperty(value = "缓存库位ID") + private Long pointId; + @Column(name = "`point_code`") + @ApiModelProperty(value = "缓存库位Code") + private String pointCode; + + @Column(name = "`bexb`") + @ApiModelProperty(value = "线边接收") + private Boolean bexb; + + @Column(name = "`besh`") + @ApiModelProperty(value = "收货仓库") + private Boolean besh; + + @Column(name = "`bezz`") + @ApiModelProperty(value = "制造库位耗用") + private Boolean bezz; + + @Column(name = "`shdd`") + @ApiModelProperty(value = "收货担当") + private String shdd; + + public void copy(Area source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanDetail.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanDetail.java new file mode 100644 index 0000000..8aa7074 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanDetail.java @@ -0,0 +1,125 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Date; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-07 +**/ +@Entity +@Data +@Table(name="base_automatic_plan_detail") +public class AutomaticPlanDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + @Column(name = "`code`") + @ApiModelProperty(value = "流水") + private String code; + @OneToOne + @JoinColumn(name = "`automatic_planning_id`") + @ApiModelProperty(value = "铺线计划ID") + private AutomaticPlanning automaticPlanning; + + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货仓库") + private Area shArea; + + @Column(name = "`fx_quantity`") + @ApiModelProperty(value = "辅线数量") + private Integer fxQuantity=0; + + @Column(name = "`jh_quantity`") + @ApiModelProperty(value = "计划数量") + private Integer jhQuantity=0; + + @Column(name = "`sx_quantity`") + @ApiModelProperty(value = "上线计划数量") + private Integer sxQuantity; + @Column(name = "`batch_num`") + @ApiModelProperty(value = "分批数量") + private Integer batchNum=0; + + @Column(name = "`hy_quantity`") + @ApiModelProperty(value = "耗用数量") + private Integer hyQuantity=0; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=Boolean.TRUE; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + @Column(name = "`start_num`") + @ApiModelProperty(value = "开始机号") + private String startNum; + + @Column(name = "`zd_start_num`") + @ApiModelProperty(value = "指定开始机号") + private String zdStartNum; + + @Column(name = "`end_num`") + @ApiModelProperty(value = "截止机号") + private String endNum; + + @Column(name = "`sc_end_num`") + @ApiModelProperty(value = "生产截止机号") + private String scEndNum; + + @Column(name = "`hy_start_num`") + @ApiModelProperty(value = "耗用开始机号") + private String hyStartNum; + + @Column(name = "`hy_end_num`") + @ApiModelProperty(value = "耗用截止机号") + private String hyEndNum; + @Column(name = "`jh_date`") + @ApiModelProperty(value = "计划日期") + private Date jhDate; + @Column(name = "`sh_hour`") + @ApiModelProperty(value = "送货小时数") + private Integer shHour=0; + + + public void copy(AutomaticPlanDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanning.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanning.java new file mode 100644 index 0000000..155c312 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/AutomaticPlanning.java @@ -0,0 +1,136 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Date; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @description / + * @date 2024-01-05 + **/ +@Entity +@Data +@Table(name = "base_automatic_planning") +public class AutomaticPlanning extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货仓库") + private Area shArea; + @Column(name = "`code`") + @ApiModelProperty(value = "流水") + private String code; + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + @Column(name = "`fx_quantity`") + @ApiModelProperty(value = "铺线数量") + private Integer fxQuantity=0; + + @Column(name = "`jh_quantity`") + @ApiModelProperty(value = "计划数量") + private Integer jhQuantity=0; + + @Column(name = "`sx_quantity`") + @ApiModelProperty(value = "上线计划数量") + private Integer sxQuantity=0; + + @Column(name = "`batch_num`") + @ApiModelProperty(value = "分批数量") + private Integer batchNum=0; + + @Column(name = "`sh_hour`") + @ApiModelProperty(value = "送货小时数") + private Integer shHour=0; + + @Column(name = "`hy_quantity`") + @ApiModelProperty(value = "耗用数量") + private Integer hyQuantity=0; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + @Column(name = "`start_num`") + @ApiModelProperty(value = "开始机号") + private String startNum; + + @Column(name = "`zd_start_num`") + @ApiModelProperty(value = "指定开始机号") + private String zdStartNum; + + @Column(name = "`end_num`") + @ApiModelProperty(value = "截止机号") + private String endNum; + + @Column(name = "`sc_end_num`") + @ApiModelProperty(value = "生产截止机号") + private String scEndNum; + + @Column(name = "`hy_start_num`") + @ApiModelProperty(value = "耗用开始机号") + private String hyStartNum; + + @Column(name = "`hy_end_num`") + @ApiModelProperty(value = "耗用截止机号") + private String hyEndNum; + + @Column(name = "`jh_date`") + @ApiModelProperty(value = "计划日期") + private Date jhDate; + + @Column(name = "`is_sx`") + @ApiModelProperty(value = "是否上线") + private Boolean isSx=Boolean.TRUE; + + @Column(name = "`is_end`") + @ApiModelProperty(value = "按照输入end IDNO耗用") + private Boolean isEnd=Boolean.FALSE; + + + + public void copy(AutomaticPlanning source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/BigItem.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/BigItem.java new file mode 100644 index 0000000..dc1c3b2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/BigItem.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2023-12-29 +**/ +@Entity +@Data +@Table(name="base_big_item") +public class BigItem extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`code`",nullable = false) + @NotBlank + @ApiModelProperty(value = "完成品品番") + private String code; + + @Column(name = "`name`",nullable = false) + @NotBlank + @ApiModelProperty(value = "完成形式名") + private String name; + + @Column(name = "`models`",nullable = false) + @NotBlank + @ApiModelProperty(value = "机种") + private String models; + + @Column(name = "`country`") + @NotBlank + @ApiModelProperty(value = "国别") + private String country; + + @Column(name = "`outbound_type`") + @ApiModelProperty(value = "出库类型") + private String outboundType; + + @Column(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Long deptId; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + public void copy(BigItem source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/BillType.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/BillType.java new file mode 100644 index 0000000..ced434f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/BillType.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-07 +**/ +@Entity +@Data +@Table(name="base_bill_type") +public class BillType extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`code`") + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "`name`") + @ApiModelProperty(value = "名称") + private String name; + + @Column(name = "`prefix`") + @ApiModelProperty(value = "前缀") + private String prefix; + + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`type`") + @ApiModelProperty(value = "类型") + private String type; + + @Column(name = "`enabled`",nullable = false) + @NotNull + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=true; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号") + private Long sourceId; + + public void copy(BillType source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccount.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccount.java new file mode 100644 index 0000000..f8fcac8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccount.java @@ -0,0 +1,123 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-02 +**/ +@Entity +@Data +@Table(name="base_bom_account") +public class BomAccount extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "完成品品番") + private BigItem bigItem; + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "部品品番") + private Item item; + + @Column(name = "`contents`") + @ApiModelProperty(value = "加工内容") + private String contents; + + @Column(name = "`singles`") + @ApiModelProperty(value = "单用") + private Integer singles=0; + + @OneToOne + @JoinColumn(name = "`r_area_id`") + @ApiModelProperty(value = "接收仓库") + private Area rArea; + + @OneToOne + @JoinColumn(name = "`c_area_id`") + @ApiModelProperty(value = "出库仓库") + private Area cArea; + @Column(name = "`out_type`") + @ApiModelProperty(value = "出库类型") + private String outType; + + @Column(name = "`station_type`") + @ApiModelProperty(value = "工位") + private String stationType; + + @Column(name = "`bp_type`") + @ApiModelProperty(value = "部品种类") + private String bp_type; + + @OneToOne + @JoinColumn(name = "`h_point_id`") + @ApiModelProperty(value = "缓存库位") + private Point hPoint; + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`AC`") + @ApiModelProperty(value = "A/C") + private String ac; + + @Column(name = "`bonded`") + @ApiModelProperty(value = "税别") + private String bonded; + + @OneToOne + @JoinColumn(name = "`z_point_id`") + @ApiModelProperty(value = "制造库位") + private Point zPoint; + + @Column(name = "`supplier`") + @ApiModelProperty(value = "供应商") + private String supplier; + + @Column(name = "`pc_qty`") + @ApiModelProperty(value = "分批需求数") + private Double pcQty=0d; + + public void copy(BomAccount source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccountLog.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccountLog.java new file mode 100644 index 0000000..b7b93f8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/BomAccountLog.java @@ -0,0 +1,127 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-24 +**/ +@Entity +@Data +@Table(name="base_bom_account_log") +public class BomAccountLog extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "完成品品番") + private BigItem bigItem; + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "部品品番") + private Item item; + + @Column(name = "`contents`") + @ApiModelProperty(value = "加工内容") + private String contents; + + @Column(name = "`singles`") + @ApiModelProperty(value = "单用") + private Integer singles; + + @OneToOne + @JoinColumn(name = "`r_area_id`") + @ApiModelProperty(value = "接受仓库") + private Area rArea; + + @OneToOne + @JoinColumn(name = "`c_area_id`") + @ApiModelProperty(value = "出库仓库") + private Area cArea; + @Column(name = "`out_type`") + @ApiModelProperty(value = "出库类型") + private String outType; + + @Column(name = "`station_type`") + @ApiModelProperty(value = "工位") + private String stationType; + + @Column(name = "`bp_type`") + @ApiModelProperty(value = "部品种类") + private String bp_type; + + @OneToOne + @JoinColumn(name = "`h_point_id`") + @ApiModelProperty(value = "缓存库位") + private Point hPoint; + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=Boolean.TRUE; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`AC`") + @ApiModelProperty(value = "A/C") + private String ac; + + @Column(name = "`bonded`") + @ApiModelProperty(value = "税别") + private String bonded; + + @OneToOne + @JoinColumn(name = "`z_point_id`") + @ApiModelProperty(value = "制造库位") + private Point zPoint; + + @Column(name = "`supplier`") + @ApiModelProperty(value = "供应商") + private String supplier; + + @Column(name = "`bom_account_id`") + @ApiModelProperty(value = "BOMID") + private Long bomAccountId; + + @Column(name = "`oper_type`") + @ApiModelProperty(value = "操作类型") + private String operType; + + public void copy(BomAccountLog source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Box.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Box.java new file mode 100644 index 0000000..877ebba --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Box.java @@ -0,0 +1,102 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import javax.persistence.Entity; +import javax.persistence.Table; +import org.hibernate.annotations.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2023-08-17 +**/ +@Entity +@Data +@Table(name="base_box") +public class Box extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`code`",nullable = false) + @NotBlank + @ApiModelProperty(value = "按钮盒编号") + private String code; + + @Column(name = "`name`",nullable = false) + @NotBlank + @ApiModelProperty(value = "按钮盒名称") + private String name; + + @OneToOne + @JoinColumn(name = "`item_id`",nullable = true) + @ApiModelProperty(value = "物料") + private Item item; + + @OneToOne + @JoinColumn(name = "`point_id`",nullable = false) + @NotNull + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`enabled`",nullable = false) + @NotNull + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=true; + + @Column(name = "`order_Number`") + @ApiModelProperty(value = "工单号") + private String orderNumber; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`sort`") + @ApiModelProperty(value = "排序") + private int sort=0; + + @Column(name = "`IP`") + @ApiModelProperty(value = "IP") + private String iP; + + @Column(name = "`lamp_status`") + @ApiModelProperty(value = "指示灯状态") + private String lampStatus; + + @Column(name = "`lamp_code`") + @ApiModelProperty(value = "按钮盒编号") + private String lampCode; + public void copy(Box source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/DesignList.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/DesignList.java new file mode 100644 index 0000000..38011a0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/DesignList.java @@ -0,0 +1,151 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.LastModifiedBy; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author LY +* @date 2024-04-26 +**/ +@Entity +@Data +@Table(name="data_design_list") +public class DesignList extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Long id; + + @Column(name = "`no`") + @ApiModelProperty(value = "No") + private String no; + @Column(name = "`chase_center`") + @ApiModelProperty(value = "変通No.11桁") + private String chaseCenter; + + @Column(name = "`contraposition`") + @ApiModelProperty(value = "设变号") + private String contraposition; + + @Column(name = "`designation`") + @ApiModelProperty(value = "一括番号") + private String designation; + + @Column(name = "`hypothesis`") + @ApiModelProperty(value = "关联设变") + private String hypothesis; + + @Column(name = "`supplier_code`") + @ApiModelProperty(value = "供应商代码") + private String supplierCode; + + @Column(name = "`supplier_name`") + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @Column(name = "`ac`") + @ApiModelProperty(value = "A/C") + private String ac; + + @Column(name = "`content`") + @ApiModelProperty(value = "加工内容") + private String content; + + @Column(name = "`product_name`") + @ApiModelProperty(value = "品名(中文)") + private String productName; + + @Column(name = "`use_singly`") + @ApiModelProperty(value = "单用") + private Integer useSingly; + + @Column(name = "`enable`") + @ApiModelProperty(value = "订货要否") + private Boolean enable; + + @Column(name = "`naso`") + @ApiModelProperty(value = "纳所") + private String naso; + + @Column(name = "`monthly_output`") + @ApiModelProperty(value = "月产量") + private String monthlyOutput; + + @Column(name = "`t_type_code`") + @ApiModelProperty(value = "T型式代码") + private String tTypeCode; + + @Column(name = "`t_type_name`") + @ApiModelProperty(value = "T型式名") + private String tTypeName; + + @Column(name = "`scrap_disposal`") + @ApiModelProperty(value = "旧品处理") + private String scrapDisposal; + + @Column(name = "`implementation_date`") + @ApiModelProperty(value = "系统实施日") + private String implementationDate; + + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "完成品品番") + private BigItem bigItem; + + @OneToOne + @JoinColumn(name = "`new_item_id`") + @ApiModelProperty(value = "新品番") + private Item nitem; + + @OneToOne + @JoinColumn(name = "`old_item_id`") + @ApiModelProperty(value = "旧品番") + private Item oitem; + @Column(name = "`old_item_code`") + @ApiModelProperty(value = "旧品番") + private String oldItemCode; + @Column(name = "`new_item_code`") + @ApiModelProperty(value = "新品番") + private String newItemCode; + @Column(name = "`big_item_code`") + @ApiModelProperty(value = "完成品番") + private String bigItemCode; + + + + + + public void copy(DesignList source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java new file mode 100644 index 0000000..bda9951 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Item.java @@ -0,0 +1,223 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @website https://eladmin.vip + * @description / + * @author houjianlan + * @date 2023-08-07 + **/ +@Entity +@Data +@Table(name="base_item") +public class Item extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`code`",nullable = false) + @NotBlank + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "`name`",nullable = false) + @NotBlank + @ApiModelProperty(value = "名称") + private String name; + + @Column(name = "`specs`") + @ApiModelProperty(value = "规格") + private String specs; + + @Column(name = "`structure_id`") + @ApiModelProperty(value = "客户ID") + private Long structureId; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`is_attribute1`") + @ApiModelProperty(value = "是否发动机") + private Boolean isAttribute1=true; + @Column(name = "`is_attribute2`") + @ApiModelProperty(value = "是否预备货") + private Boolean isAttribute2=true; + @Column(name = "`enabled`") + @ApiModelProperty(value = "是否失效") + private Boolean enabled=true; + + @Column(name = "`valid_period`") + @ApiModelProperty(value = "保质期") + private Integer validPeriod; + + @Column(name = "`alert_leading_days`") + @ApiModelProperty(value = "预警天数") + private Integer alertLeadingDays; + + @Column(name = "`large_class`") + @ApiModelProperty(value = "大类,组合代码,自动叫料捆绑,数量一致") + private String largeClass; + + @Column(name = "`center_class`") + @ApiModelProperty(value = "中类") + private String centerClass; + + @Column(name = "`small_class`") + @ApiModelProperty(value = "小类") + private String smallClass; + + @Column(name = "`good_type`") + @ApiModelProperty(value = "物料类型") + private String goodType; + + @Column(name = "`length`") + @ApiModelProperty(value = "长") + private Double length=0d; + + @Column(name = "`width`") + @ApiModelProperty(value = "宽") + private Double width=0d; + + @Column(name = "`height`") + @ApiModelProperty(value = "高") + private Double height=0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight=0d; + + @Column(name = "`volume`") + @ApiModelProperty(value = "体积") + private Double volume=0d; + + @Column(name = "`unit`") + @ApiModelProperty(value = "单位") + private String unit; + + @Column(name = "`master_unit`") + @ApiModelProperty(value = "大单位") + private String masterUnit; + + @Column(name = "`pack_number`") + @ApiModelProperty(value = "包装系数") + private Integer packNumber=1; + + @Column(name = "`bar_code`") + @ApiModelProperty(value = "条码") + private String barCode; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号") + private Long sourceId; + + @OneToOne + @JoinColumn(name = "stock_type") + @ApiModelProperty(value = "料箱类型") + private StockType stockType; + + @Column(name = "`extend_d1`") + @ApiModelProperty(value = "默认容器装载数") + private Double extendD1=1d; + + @Column(name = "`extend_d2`") + @ApiModelProperty(value = "冷却时长") + private Double extendD2=4d; + + @Column(name = "`extend_d3`") + @ApiModelProperty(value = "收容数") + private Double extendD3=0d; + + @Column(name = "`extend_d4`") + @ApiModelProperty(value = "扩展小数4") + private Double extendD4=0d; + + @Column(name = "`extend_d5`") + @ApiModelProperty(value = "扩展小数5") + private Double extendD5=0d; + + @Column(name = "`extend_num1`") + @ApiModelProperty(value = "扩展整型1") + private Long extendNum1; + + @Column(name = "`extend_num2`") + @ApiModelProperty(value = "扩展整型2") + private Long extendNum2; + + @Column(name = "`extend_num3`") + @ApiModelProperty(value = "扩展整型3") + private Long extendNum3; + + @Column(name = "`extend_num4`") + @ApiModelProperty(value = "扩展整型4") + private Long extendNum4; + + @Column(name = "`extend_num5`") + @ApiModelProperty(value = "扩展整型5") + private Long extendNum5; + + @Column(name = "`extend_str1`") + @ApiModelProperty(value = "接口代码") + private String extendStr1; + + @Column(name = "`extend_str2`") + @ApiModelProperty(value = "扩展字符2") + private String extendStr2; + + @Column(name = "`extend_str3`") + @ApiModelProperty(value = "何姿") + private String extendStr3; + + @Column(name = "`extend_str4`") + @ApiModelProperty(value = "扩展字符4") + private String extendStr4; + + @Column(name = "`extend_str5`") + @ApiModelProperty(value = "扩展字符5") + private String extendStr5; + @OneToOne + @JoinColumn(name = "`point_id`") + @ApiModelProperty(value = "库位") + private Point point; + + public void copy(Item source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemLis.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemLis.java new file mode 100644 index 0000000..fcee49d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemLis.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-03 +**/ +@Entity +@Data +@Table(name="base_item_lis") +public class ItemLis extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "完成品品番") + private BigItem bigItem; + + @Column(name = "`out_type`",nullable = false) + @NotBlank + @ApiModelProperty(value = "出库类型") + private String outType; + + @Column(name = "`bp_type`") + @ApiModelProperty(value = "部品种类") + private String bpType; + @OneToOne + @JoinColumn(name = "`r_area_id`") + @ApiModelProperty(value = "入库库区") + private Area rArea; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + @Column(name = "`station_type`") + @ApiModelProperty(value = "工位") + private String stationType; + + public void copy(ItemLis source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemRelation.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemRelation.java new file mode 100644 index 0000000..f90ad0a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/ItemRelation.java @@ -0,0 +1,89 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-04 +**/ +@Entity +@Data +@Table(name="base_item_relation") +public class ItemRelation extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`be_supplier`") + @ApiModelProperty(value = "供应商") + private String beSupplier; + + @Column(name = "`bar_code`") + @ApiModelProperty(value = "key") + private String barCode; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "品番") + private Item item; + + @Column(name = "`code`") + @ApiModelProperty(value = "纳入场所") + private String code; + + @Column(name = "`door`") + @ApiModelProperty(value = "门") + private String door; + + @Column(name = "`type`") + @ApiModelProperty(value = "箱种") + private String type; + + @Column(name = "`quantity`") + @ApiModelProperty(value = "收容数") + private Double quantity; + + @Column(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Long deptId; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + public void copy(ItemRelation source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java new file mode 100644 index 0000000..ff6ed95 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Point.java @@ -0,0 +1,124 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-26 +**/ +@Entity +@Data +@Table(name="base_point") +public class Point extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Long id; + + @Column(name = "`code`") + @ApiModelProperty(value = "RCS代码") + private String code; + + @Column(name = "`name`") + @ApiModelProperty(value = "名称") + private String name; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`description`") + @ApiModelProperty(value = "存储类型") + private String description; + + @Column(name = "`beat_code`") + @ApiModelProperty(value = "区域编码") + private String beatCode; + + @Column(name = "`item_code`") + @ApiModelProperty(value = "机械臂作业物料编码") + private String itemCode; + + @OneToOne + @JoinColumn(name = "area_id") + @ApiModelProperty(value = "库区ID") + private Area area; + +// @OneToOne +// @JoinColumn(name = "point_id") +// @ApiModelProperty(value = "暂存库位") +// private Point point; + @ApiModelProperty(value = "是否启用") + private Boolean enabled=Boolean.TRUE; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`pos_x`") + @ApiModelProperty(value = "坐标X") + private Double posX=0d; + + @Column(name = "`pos_y`") + @ApiModelProperty(value = "坐标Y") + private Double posY=0d; + + @Column(name = "`pos_z`") + @ApiModelProperty(value = "坐标Z") + private Double posZ=0d; + + @Column(name = "`type`") + @ApiModelProperty(value = "类型") + private String type; + + @Column(name = "`heat`") + @ApiModelProperty(value = "热度") + private Double heat; + + @Column(name = "`rows`") + @ApiModelProperty(value = "层") + private int rows=0; + + @Column(name = "`col`") + @ApiModelProperty(value = "列") + private int col=0; + + @Column(name = "`line`") + @ApiModelProperty(value = "排") + private int line=0; + + @Column(name = "`sort_index`") + @ApiModelProperty(value = "排序") + private int sortIndex=0; + public void copy(Point source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlan.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlan.java new file mode 100644 index 0000000..a8fa56b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlan.java @@ -0,0 +1,156 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-04 +**/ +@Entity +@Data +@Table(name="base_production_plan") +public class ProductionPlan extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled; + + @OneToOne + @JoinColumn(name = "`big_item_id`",nullable = false) + @ApiModelProperty(value = "完成品番") + private BigItem bigItem; + + @Column(name = "`working_station`",nullable = false) + @NotBlank + @ApiModelProperty(value = "工位") + private String workingStation; + + @Column(name = "`No`",nullable = false) + @NotNull + @ApiModelProperty(value = "No") + private Integer no; + + @Column(name = "`import_date`") + @ApiModelProperty(value = "导入日期") + private Timestamp importDate; + + @Column(name = "`planned_date`") + @ApiModelProperty(value = "计划日期") + private Timestamp plannedDate; + + @Column(name = "`downline_date`",nullable = false) + @NotNull + @ApiModelProperty(value = "下线日期") + private Timestamp downlineDate; + + @Column(name = "`take_up_time`") + @ApiModelProperty(value = "耗用时间") + private Timestamp takeUpTime; + + @Column(name = "`IDNO`") + @ApiModelProperty(value = "IDNO") + private String idno; + + @Column(name = "`monthly_no`") + @ApiModelProperty(value = "月度序号") + private String monthlyNo; + + @Column(name = "`project_no`") + @ApiModelProperty(value = "计划单号") + private String projectNo; + + @Column(name = "`make_line`") + @ApiModelProperty(value = "制造线") + private String makeLine; + + @Column(name = "`order_no`") + @ApiModelProperty(value = "序号") + private Long orderNo; + + @OneToOne + @JoinColumn(name = "`bom_list_id`") + @ApiModelProperty(value = "工位清单") + private BomAccount bomList; + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货仓库") + private Area shArea; + @OneToOne + @JoinColumn(name = "`rk_area_id`") + @ApiModelProperty(value = "入库库区") + private Area rkArea; + + @Column(name = "`pick_plan_id`") + @ApiModelProperty(value = "备货计划ID") + private Long pickPlan; + + @Column(name = "`type`") + @ApiModelProperty(value = "出库类型") + private String type; + + @Column(name = "`part_variety`") + @ApiModelProperty(value = "部品种类") + private String partVariety; + + @Column(name = "`statue`") + @ApiModelProperty(value = "耗用状态") + private String statue; + @OneToOne + @JoinColumn(name = "`auto_production_id`") + @ApiModelProperty(value = "所属自动计划") + private ProductionPlan autoProduction; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`off_line_part_id`") + @ApiModelProperty(value = "下线零件ID") + private Long offLinePart; + + @Column(name = "`machine_no`",nullable = false) + @NotNull + @ApiModelProperty(value = "机号") + private String machineNo; + + public void copy(ProductionPlan source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlanVo.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlanVo.java new file mode 100644 index 0000000..123e148 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/ProductionPlanVo.java @@ -0,0 +1,12 @@ +package com.youchain.basicdata.domain; + +import lombok.Data; + +@Data +public class ProductionPlanVo { + private Long id; + private String machineNo; + private String workingStation; + private String name; + private Integer number; +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/Stock.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/Stock.java new file mode 100644 index 0000000..95f6b83 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/Stock.java @@ -0,0 +1,110 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-28 +**/ +@Entity +@Data +@Table(name="base_stock") +public class Stock extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "容器ID") + private Long id; + + @Column(name = "`code`",nullable = false) + @ApiModelProperty(value = "容器代码") + private String code; + + @Column(name = "`status`") + @ApiModelProperty(value = "容器状态") + private String status; + + @Column(name = "`pid`") + @ApiModelProperty(value = "上级容器ID") + private Long pid; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @OneToOne + @JoinColumn(name = "point_id") + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`sub_count`") + @ApiModelProperty(value = "子容器数量") + private Integer subCount; + + @Column(name = "`name`") + @NotBlank + @ApiModelProperty(value = "容器名称") + private String name; + + + @OneToOne + @JoinColumn(name = "type_id") + @ApiModelProperty(value = "容器类型") + private StockType stockType; + + + @Column(name = "`use_weight`") + @ApiModelProperty(value = "容器使用重量") + private Double useWeight; + + @Column(name = "`use_size`") + @ApiModelProperty(value = "容器使用体积") + private Double useSize; + + @Column(name = "`usage_weight`") + @ApiModelProperty(value = "容器重量占用率") + private Double usageWeight; + + @Column(name = "`usage_size`") + @ApiModelProperty(value = "容器体积占用率") + private Double usageSize; + + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @Column(name = "`top_id`") + @ApiModelProperty(value = "顶级容器ID") + private Long topId; + + public void copy(Stock source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/StockType.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/StockType.java new file mode 100644 index 0000000..dcf28d7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/StockType.java @@ -0,0 +1,86 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-28 +**/ +@Entity +@Data +@Table(name="base_stock_type") +public class StockType extends BaseEntity implements Serializable { + + @Id + @Column(name = "`id`") + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`name`") + @ApiModelProperty(value = "名称") + private String name; + + @Column(name = "`code`") + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "`enabled`",nullable = false) + @NotNull + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=true; + + @Column(name = "`length`") + @ApiModelProperty(value = "长") + private Double length=0d; + + @Column(name = "`width`") + @ApiModelProperty(value = "宽") + private Double width=0d; + + @Column(name = "`height`") + @ApiModelProperty(value = "高") + private Double height=0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight=0d; + + @Column(name = "`size`") + @ApiModelProperty(value = "体积") + private Double size=0d; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + public void copy(StockType source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/domain/TableConfig.java b/youchain-system/src/main/java/com/youchain/basicdata/domain/TableConfig.java new file mode 100644 index 0000000..1088a5e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/domain/TableConfig.java @@ -0,0 +1,58 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author LiuXue +* @date 2023-08-28 +**/ +@Entity +@Data +@Table(name="base_table_config") +public class TableConfig extends BaseEntity implements Serializable { + + @Id + @Column(name = "`id`") + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID") + private Integer id; + + @Column(name = "`table_type`") + @ApiModelProperty(value = "tableType") + private String tableType; + + @Column(name = "`value`") + @ApiModelProperty(value = "value") + private String value; + + + + public void copy(TableConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java new file mode 100644 index 0000000..01c2839 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/AreaRepository.java @@ -0,0 +1,60 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author HJL +* @date 2023-08-14 +**/ +public interface AreaRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM base_area", nativeQuery = true) + List getAreas(); + @Query(value = "SELECT * FROM base_area area where area.code =:code", nativeQuery = true) + Area getByCode(@Param("code")String code); + + @Query(value = "SELECT * FROM base_area area where area.name =:name", nativeQuery = true) + Area getByName(@Param("name")String name); + + @Query(value = "SELECT * FROM base_area area where area.code =:code or area.name=:name", nativeQuery = true) + Area findByCodeOrName(@Param("code")String code,@Param("name")String name); + + @Query(value = "SELECT * FROM base_area area where area.code =:code and area.bexb=1", nativeQuery = true) + Area getJsKq(@Param("code")String code); + + /** + * 将working_station字段设置位null + * @param id + */ + @Modifying + @Transactional + @Query(value = "UPDATE `base_area` area SET area.working_station = NULL where id = :id", nativeQuery = true) + void updateWorkingStationISNull(@Param("id") Long id); + + @Query(value = "SELECT * FROM base_area t where t.code in ('A仓','S仓')", nativeQuery = true) + List getBomOutAreas(); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanDetailRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanDetailRepository.java new file mode 100644 index 0000000..b8751f8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanDetailRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-07 +**/ +public interface AutomaticPlanDetailRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanningRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanningRepository.java new file mode 100644 index 0000000..e1b1b74 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/AutomaticPlanningRepository.java @@ -0,0 +1,50 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.domain.BomAccount; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-05 +**/ +public interface AutomaticPlanningRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据 ShAreaId 查询 + * @param sh_area_id / + * @return / + */ + AutomaticPlanning findByShAreaId(Long sh_area_id); + + @Query(value = "SELECT DATE_FORMAT(b.update_time,'%Y-%m-%d') jh_date FROM `base_automatic_planning` b where b.sh_area_id=?1 and b.is_sx=1", nativeQuery = true) + String queryUpdateTime(Long area_id); + + @Query(value = "SELECT * FROM base_automatic_planning p where sh_area_id=?1 and p.is_sx=?2", nativeQuery = true) + List existSxData(Long area_id,Boolean is_sx); + + @Query(value = "SELECT id FROM base_automatic_planning where sh_area_id=?1", nativeQuery = true) + Long Id(Long area_id); + + @Query(value = "SELECT * FROM base_automatic_planning p where p.is_sx=1", nativeQuery = true) + List getAll(); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BigItemRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BigItemRepository.java new file mode 100644 index 0000000..3a85b99 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BigItemRepository.java @@ -0,0 +1,49 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.BigItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-12-29 +**/ +public interface BigItemRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据 Code 查询 + * @param code / + * @return / + */ + @Query(value = "SELECT * FROM base_big_item i where i.code=?1", nativeQuery = true) + BigItem findByCode(String code); + + @Query(value = "SELECT * FROM base_big_item i where i.code=?1 and i.models=?2", nativeQuery = true) + BigItem findUnique(String code,String models); + + @Query(value = "SELECT * FROM base_big_item bigItem where bigItem.code=:code and bigItem.name=:name", nativeQuery = true) + BigItem findByCodeName(@Param("code") String code,@Param("name") String name); + + @Query(value = "SELECT * FROM base_big_item", nativeQuery = true) + List getBigItem(); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BillTypeRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BillTypeRepository.java new file mode 100644 index 0000000..8aefcfd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BillTypeRepository.java @@ -0,0 +1,35 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.domain.BomAccount; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-07 +**/ +public interface BillTypeRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "SELECT * FROM `base_bill_type` bbt WHERE bbt.name =:name", nativeQuery = true) + BillType findByName(@Param("name") String name); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountLogRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountLogRepository.java new file mode 100644 index 0000000..ccc2c69 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountLogRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.BomAccountLog; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-24 +**/ +public interface BomAccountLogRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java new file mode 100644 index 0000000..86bc6a6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BomAccountRepository.java @@ -0,0 +1,72 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-02 +**/ +public interface BomAccountRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 唯一 查询 + * @param big_item_id + * @param item_id + * @return + */ + @Query(value = "SELECT * FROM base_bom_account ba WHERE ba.big_item_id=?1 and ba.item_id=?2 and ba.r_area_id=?3 and ba.z_point_id=?4", nativeQuery = true) + BomAccount findByOnly(Long big_item_id,Long item_id,Long r_area_id,Long z_point_id); + + /** + * 查询说有的 接收仓库 为true的 bigitem + * @return + */ + @Query(value = "SELECT * FROM `base_bom_account` b where b.r_area_id in (select a.id from base_area a where a.bexb=1) GROUP BY b.big_item_id", nativeQuery = true) + List queryBomAccountsBIidOne(); + + @Query(value = "select * from base_big_item where id in (SELECT DISTINCT b.big_item_id FROM `base_bom_account` b where b.r_area_id in (select a.id from base_area a where a.bexb=1) )", nativeQuery = true) + List queryBigItemALl(); + + @Query(value = "SELECT * FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2 and b.z_point_id=?3", nativeQuery = true) + List queryBomUnique(Long area_id, Long item_id, Long poin_id); + @Query(value = "SELECT IFNULL(sum(pc_qty),0) FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2 and b.z_point_id=?3", nativeQuery = true) + Double getPcQty(Long area_id, Long item_id, Long point_id); + + @Query(value = "SELECT * FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2", nativeQuery = true) + List getBomList(Long area_id, Long item_id); + + @Query(value = "SELECT * FROM `base_bom_account` b where b.item_id=?1", nativeQuery = true) + List getItemBomList( Long item_id); + + @Query(value = "SELECT * FROM `base_bom_account` b where b.big_item_id=?1", nativeQuery = true) + List getBigItemBomList( Long big_item_id); + + @Query(value = "SELECT r_area_id FROM `base_bom_account` b where b.big_item_id=?1 group by b.r_area_id", nativeQuery = true) + List getJsAreaList( Long big_item_id); + @Query(value = "SELECT IFNULL(max(b.c_area_id),0) FROM `base_bom_account` b where b.item_id=?1", nativeQuery = true) + Long getItemAreaId( Long item_id); + //获得所有BOM清单 + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/BoxRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/BoxRepository.java new file mode 100644 index 0000000..3ff0cc0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/BoxRepository.java @@ -0,0 +1,46 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.service.dto.BoxDto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-17 +**/ +public interface BoxRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM base_box b WHERE b.item_id = ?1 ", nativeQuery = true) + Box getBoxByItem(long itemId); + + @Query(value = "SELECT * FROM base_box b WHERE b.code = ?1 ", nativeQuery = true) + Box getBoxByCode(String code); + @Modifying + @Transactional + @Query(value = "update base_box b set b.lamp_status = :lamp_status WHERE b.IP = :ip and b.lamp_code =:lamp_code ", nativeQuery = true) + void updateBoxLampStatus(@Param("ip") String ip,@Param("lamp_code")String lamp_code,@Param("lamp_status")String lamp_status); + + @Query(value = "SELECT * FROM base_box", nativeQuery = true) + List getBoxAllData(); +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/DesignListRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/DesignListRepository.java new file mode 100644 index 0000000..d7be703 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/DesignListRepository.java @@ -0,0 +1,35 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.domain.DesignList; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author LY +* @date 2024-04-26 +**/ +public interface DesignListRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "SELECT * FROM data_design_list where chase_center=?1", nativeQuery = true) + DesignList exist(String chase_center); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemLisRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemLisRepository.java new file mode 100644 index 0000000..55dd419 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemLisRepository.java @@ -0,0 +1,41 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.domain.ProductionPlan; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-03 +**/ +public interface ItemLisRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT itemList.* FROM `base_item_lis` itemList inner join `base_big_item` bigItem on itemList.big_item_id= bigItem.id where itemList.out_type ='单点' and bigItem.`code` = :bigItemCode", nativeQuery = true) + List findByBigItemCode(@Param("bigItemCode") String bigItemCode); + + @Query(value = "SELECT itemList.* FROM `base_item_lis` itemList inner join `base_big_item` bigItem on itemList.big_item_id= bigItem.id where itemList.out_type ='单点' and bigItem.`code` = :bigItemCode and itemList.station_type in :stationType", nativeQuery = true) + List findByGwBigCode(@Param("bigItemCode") String bigItemCode,@Param("stationType") String[] stationType); + + @Query(value = "SELECT * FROM `base_item_lis` itemList where itemList.big_item_id =:bigItemId and itemList.station_type =:stationType", nativeQuery = true) + ItemLis findByBigItemIdStationType(@Param("bigItemId") Long bigItemId,@Param("stationType") String stationType); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRelationRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRelationRepository.java new file mode 100644 index 0000000..4085be8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRelationRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.ItemRelation; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +public interface ItemRelationRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java new file mode 100644 index 0000000..1c2a358 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java @@ -0,0 +1,40 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +public interface ItemRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM base_item i WHERE i.code=?1 and i.enabled=true", nativeQuery = true) + Item findByCode(String code); + + @Query(value = "SELECT * FROM base_item i WHERE i.code=?1", nativeQuery = true) + Item findByAllCode(String code); + + @Query(value = "SELECT DISTINCT b.* FROM `data_item_key` a INNER JOIN `base_item` b on a.item_id = b.id", nativeQuery = true) + List quryOneItemAll(); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java new file mode 100644 index 0000000..5445172 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/PointRepository.java @@ -0,0 +1,40 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.Point; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-26 +**/ +public interface PointRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT u.id,u.code FROM base_point p WHERE p.enabled=1 and p.status='FREE'", nativeQuery = true) + public List> getKyPointList(); + @Query(value = "SELECT p.* FROM base_point p WHERE p.enabled=1 and p.type=?1", nativeQuery = true) + public List getPointList(String type); + @Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true) + Point findByCode(String code); + /*@Query(value = "SELECT p.* FROM base_point p WHERE p.code=?1", nativeQuery = true) + List findByCodes(String code);*/ +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/ProductionPlanRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/ProductionPlanRepository.java new file mode 100644 index 0000000..aa7786b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/ProductionPlanRepository.java @@ -0,0 +1,83 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.ProductionPlan; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @date 2024-01-04 + **/ +public interface ProductionPlanRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据制造线+IDNO查找ProductionPlan是否存在记录 + * @param idno + * @return + */ + @Query(value = "SELECT * FROM base_production_plan p WHERE p.idno = :idno", nativeQuery = true) + List findByIDNO( @Param("idno") String idno); + /**查找目前最大的序号*/ + @Query(value = "SELECT max(order_no) FROM `base_production_plan` bpp ", nativeQuery = true) + Long getMaxOrderNo(); + + + + /** + * @param idno + * @return + */ + @Query(value = "SELECT * FROM base_production_plan p WHERE p.make_line=:make_line and p.idno >= :idno and p.working_station in :workingStation", nativeQuery = true) + List findByGwIdnoList( @Param("make_line") String make_line,@Param("idno") String idno,@Param("workingStation") String[] workingStation); + @Query(value = "SELECT * FROM base_production_plan p WHERE p.make_line=:make_line and p.IDNO >= :IDNO", nativeQuery = true) + List findByIdnoList( @Param("make_line") String make_line,@Param("IDNO") String IDNO); + @Query(value = "SELECT count(id) FROM base_production_plan p WHERE p.make_line=:make_line and p.IDNO >= :IDNO and p.working_station in :workingStation and p.statue!='UN_CONSUME'", nativeQuery = true) + int existsGwHyIdno( @Param("make_line") String make_line, @Param("IDNO") String IDNO,@Param("workingStation") String[] workingStation); + + @Query(value = "SELECT count(id) FROM base_production_plan p WHERE p.make_line=:make_line and p.IDNO >= :IDNO and p.statue!='UN_CONSUME'", nativeQuery = true) + int existsHyIdno( @Param("make_line") String make_line, @Param("IDNO") String IDNO); + + + /** + * 查询可以生成的数据 + */ + @Query(value = "SELECT * FROM `base_production_plan` bpp where bpp.working_station = :workingStation and bpp.statue='UN_CONSUME' AND bpp.`IDNO`>= :IDNO order by bpp.`IDNO` ASC", nativeQuery = true) + List getAllData(@Param("workingStation") String workingStation, @Param("IDNO")String IDNO); + + @Query(value = "SELECT * FROM `base_production_plan` bpp where bpp.working_station = :workingStation and bpp.statue='UN_CONSUME' AND bpp.`IDNO`<= :IDNO order by bpp.`IDNO` ASC", nativeQuery = true) + List getIdNoAllData(@Param("workingStation") String workingStation, @Param("IDNO")String IDNO); + + @Query(value = "SELECT bpp.working_station FROM `base_production_plan` bpp where bpp.`IDNO`<= :IDNO group by bpp.working_station", nativeQuery = true) + List getIdNoWhyGw( @Param("IDNO")String IDNO); + + @Query(value = "SELECT * FROM `base_production_plan` bpp where bpp.working_station = ?1 and bpp.statue='UN_CONSUME' LIMIT ?2 ", nativeQuery = true) + List getLimitPlan(String workingStation,int num); + + @Query(value = "SELECT * FROM `base_production_plan` bpp where bpp.working_station = :workingStation and bpp.statue='UN_CONSUME' AND bpp.`IDNO`>= :IDNO1 AND bpp.`IDNO`<= :IDNO2 order by bpp.`IDNO` ASC", nativeQuery = true) + List getList(@Param("workingStation") String workingStation, @Param("IDNO1")String IDNO1, @Param("IDNO2")String IDNO2); + + @Query(value = "SELECT max(bpp.IDNO) FROM `base_production_plan` bpp where bpp.working_station = :workingStation and bpp.statue='UN_CONSUME'", nativeQuery = true) + String getIdNoWhyScGw( @Param("workingStation") String workingStation); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/StockRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/StockRepository.java new file mode 100644 index 0000000..ade496c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/StockRepository.java @@ -0,0 +1,47 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.StockSmallDto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +public interface StockRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT u.id,u.code FROM base_stock u WHERE u.enabled=1 and u.status='FREE' and (u.code = ?1 or 1=1 )", nativeQuery = true) + List> getKyStockList(String code); + + @Query(value = "SELECT u.id as id,u.code as code FROM base_stock u WHERE u.code = ?1 or 1=1", nativeQuery = true) + List getStockList2(String code); + + /** + * 通过容器编号查询容器 + * @param code + * @return + */ + @Query(value = "SELECT * FROM base_stock u WHERE u.code = ?1 ", nativeQuery = true) + Stock getStockByCode(String code); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/StockTypeRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/StockTypeRepository.java new file mode 100644 index 0000000..14e52de --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/StockTypeRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.StockType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +public interface StockTypeRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/TableConfigRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/TableConfigRepository.java new file mode 100644 index 0000000..f4a98ad --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/TableConfigRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.repository; + +import com.youchain.basicdata.domain.TableConfig; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author LiuXue +* @date 2023-08-28 +**/ +public interface TableConfigRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/AreaController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/AreaController.java new file mode 100644 index 0000000..e35192d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/AreaController.java @@ -0,0 +1,150 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.PointRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.AreaQueryCriteria; +import com.youchain.basicdata.service.dto.AreaSmallDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.mapstruct.AreaMapper; +import com.youchain.basicdata.service.mapstruct.PointMapper; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.DeptService; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import com.youchain.modules.system.service.mapstruct.DeptMapper; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author HJL +* @date 2023-08-14 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "area管理") +@RequestMapping("/api/area") +public class AreaController { + + private final AreaService areaService; + private final PointService pointService; + private final DeptService deptService; + private final DeptMapper deptMapper; + private final PointRepository pointRepository; + private final AreaMapper areaMapper; + private final AreaRepository areaRepository; + + @PostMapping("/getAreas") + @Log("加载下拉框area") + public ResponseEntity queryArea(@RequestBody(required=false) String type){ + return new ResponseEntity<>(areaService.getAreas(type),HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportArea(HttpServletResponse response, AreaQueryCriteria criteria) throws Exception { + areaService.download(areaService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询area") + @ApiOperation("查询area") + @AnonymousAccess + public ResponseEntity queryArea(AreaQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(areaService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping(value = "/queryAreaList") + @Log("查询queryAreaList") + @ApiOperation("queryAreaList") + @AnonymousAccess + public ResponseEntity queryAreaList(AreaQueryCriteria criteria){ + return new ResponseEntity<>(areaService.queryAll(criteria),HttpStatus.OK); + } + + @PostMapping + @Log("新增area") + @ApiOperation("新增area") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createArea(@Validated @RequestBody Area resources){ + resources.setDept(UserUtils.getDept()); + AreaDto areaDto=areaService.create(resources); + Area area=areaRepository.getById(areaDto.getId()); + if(area.getBexb()){ + String pointCode = area.getCode()+"_ZC"; + Point point = pointRepository.findByCode(pointCode); + if (point == null){ + point=pointService.createPoint(pointCode,BaseStatus.HCKW,area); + } + resources.setPointId(point.getId()); + resources.setPointCode(pointCode); + } + areaService.update(area); + return new ResponseEntity<>(areaDto,HttpStatus.CREATED); + } + + @PutMapping + @Log("修改area") + @ApiOperation("修改area") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateArea(@Validated @RequestBody Area resources){ + if(resources.getBexb()) { + String pointCode = resources.getCode() + "_ZC"; + Point point = pointRepository.findByCode(pointCode); + if (point == null) { + point=pointService.createPoint(pointCode,BaseStatus.HCKW,resources); + } + resources.setPointId(point.getId()); + resources.setPointCode(pointCode); + } + areaService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除area") + @ApiOperation("删除area") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteArea(@RequestBody Long[] ids) { + areaService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanDetailController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanDetailController.java new file mode 100644 index 0000000..198b77a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanDetailController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.service.AutomaticPlanDetailService; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-07 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "automaticPlanDetail管理") +@RequestMapping("/api/automaticPlanDetail") +public class AutomaticPlanDetailController { + + private final AutomaticPlanDetailService automaticPlanDetailService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportAutomaticPlanDetail(HttpServletResponse response, AutomaticPlanDetailQueryCriteria criteria) throws Exception { + automaticPlanDetailService.download(automaticPlanDetailService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询automaticPlanDetail") + @ApiOperation("查询automaticPlanDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryAutomaticPlanDetail(AutomaticPlanDetailQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(automaticPlanDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增automaticPlanDetail") + @ApiOperation("新增automaticPlanDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createAutomaticPlanDetail(@Validated @RequestBody AutomaticPlanDetail resources){ + return new ResponseEntity<>(automaticPlanDetailService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改automaticPlanDetail") + @ApiOperation("修改automaticPlanDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateAutomaticPlanDetail(@Validated @RequestBody AutomaticPlanDetail resources){ + automaticPlanDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除automaticPlanDetail") + @ApiOperation("删除automaticPlanDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteAutomaticPlanDetail(@RequestBody Long[] ids) { + automaticPlanDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanningController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanningController.java new file mode 100644 index 0000000..a5ead2e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/AutomaticPlanningController.java @@ -0,0 +1,447 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.AutomaticPlanningRepository; +import com.youchain.basicdata.repository.ProductionPlanRepository; +import com.youchain.basicdata.service.*; +import com.youchain.basicdata.service.dto.AutomaticPlanningDto; +import com.youchain.basicdata.service.dto.AutomaticPlanningQueryCriteria; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.repository.PlanPickDetailRepository; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.impl.InventoryBakServiceImpl; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.*; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-05 +**/ +@RestController +@RequiredArgsConstructor +@Slf4j +@Api(tags = "automaticPlanning管理") +@RequestMapping("/api/automaticPlanning") +public class AutomaticPlanningController { + + private final AutomaticPlanningService automaticPlanningService; + private final AutomaticPlanningRepository automaticPlanningRepository; + private final AutomaticPlanDetailService automaticPlanDetailService; + private final InventoryBakService inventoryBakService; + private final ProductionPlanService productionPlanService; + private final ProductionPlanRepository productionPlanRepository; + private final BomAccountService bomAccountService; + private final PlanPickDetailService planPickDetailService; + //导入 + private final FileProperties properties; + private final AreaRepository areaRepository; + private final CodeUtils codeUtils; + + @Log("导入上线计划") + @PostMapping(value = "/importAutomaticPlanning") + @ApiOperation("导入上线计划") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity importAutomaticPlanning(@RequestParam("file") MultipartFile multipartFile,@RequestParam(value = "isSx")Boolean isSx) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + ExcelReader reader = ExcelUtil.getReader(file); + List> readAll = reader.readAll(); + String code = codeUtils.getCode_yyMMdd("ZD",3); + int i = 0; + for (i = 0; i < readAll.size(); i++) { + Timestamp jhDate = null; + String jhrq = OptionalUtils.getTrimmedString(readAll.get(i), "计划日期", null); + int fxQuantity =OptionalUtils.getTrimmedInteger(readAll.get(i), "已铺线数量", 0); + int sxQuantity = OptionalUtils.getTrimmedInteger(readAll.get(i), "上线计划数", 0); + if(isSx==false){ + sxQuantity = OptionalUtils.getTrimmedInteger(readAll.get(i), "上线耗用数", 0); + } + int batchNum = OptionalUtils.getTrimmedInteger(readAll.get(i), "分批次数", 0); + int shHour = OptionalUtils.getTrimmedInteger(readAll.get(i), "送货小时", 0); + Boolean isEnd = OptionalUtils.getBooleanValue(readAll.get(i), "是否手工", false); + String zdStartNum = OptionalUtils.getTrimmedString(readAll.get(i), "指定开始机号", null); + String endNum = OptionalUtils.getTrimmedString(readAll.get(i), "结束IDNO", null); + String description =OptionalUtils.getTrimmedString(readAll.get(i), "备注", null); + String shck = OptionalUtils.getTrimmedString(readAll.get(i), "收货仓库", null); + if(shck.equals("")){ + break; + } + if (!"".equals(jhrq)) { + jhDate = Timestamp.valueOf(jhrq); + } + Area shArea = areaRepository.getByName(shck); + if (shArea == null) { + throw new BadRequestException(shck + "收货仓库不存在"); + } + List plans = automaticPlanningRepository.existSxData(shArea.getId(),isSx); + AutomaticPlanning automaticPlanning = null; + if (plans.size() > 0) { + automaticPlanning = plans.get(0); + } else { + automaticPlanning = new AutomaticPlanning(); + automaticPlanning.setShArea(shArea); + automaticPlanning.setDept(UserUtils.getDept()); + automaticPlanning.setIsSx(isSx); + } + automaticPlanning.setCode(code); + automaticPlanning.setZdStartNum(zdStartNum); + automaticPlanning.setJhDate(jhDate); + automaticPlanning.setFxQuantity(fxQuantity); + automaticPlanning.setSxQuantity(sxQuantity); + automaticPlanning.setBatchNum(batchNum); + automaticPlanning.setShHour(shHour); + automaticPlanning.setDescription(description); + automaticPlanning.setIsEnd(isEnd); + if (plans.size() == 0) { + automaticPlanningService.create(automaticPlanning); + } + String gw=automaticPlanning.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,automaticPlanning.getSxQuantity()); + List whyList =null; + if(!automaticPlanning.getIsEnd()) { + whyList=productionPlanRepository.getIdNoAllData(gw, map.get("endNum")); + automaticPlanning.setEndNum(map.get("endNum")); + }else { + automaticPlanning.setEndNum(endNum); + whyList = productionPlanRepository.getList(gw,map.get("startNum"),automaticPlanning.getEndNum()); + } + if(zdStartNum!=null&&!zdStartNum.equals("")){ + whyList = productionPlanRepository.getList(gw,zdStartNum,automaticPlanning.getEndNum()); + } + automaticPlanning.setStartNum(map.get("startNum")); + automaticPlanning.setJhQuantity(whyList.size()); + automaticPlanning.setScEndNum(productionPlanRepository.getIdNoWhyScGw(gw)); + automaticPlanning.setStatus("未审核"); + automaticPlanningService.update(automaticPlanning); + } + return new ResponseEntity<>("导入成功",HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportAutomaticPlanning(HttpServletResponse response, AutomaticPlanningQueryCriteria criteria) throws Exception { + automaticPlanningService.download(automaticPlanningService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询automaticPlanning") + @ApiOperation("查询automaticPlanning") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryAutomaticPlanning(AutomaticPlanningQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(automaticPlanningService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增automaticPlanning") + @ApiOperation("新增automaticPlanning") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity createAutomaticPlanning(@Validated @RequestBody AutomaticPlanning resources){ + resources.setDept(UserUtils.getDept()); + String gw=resources.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,resources.getSxQuantity()); + List whyList =null; + if(!resources.getIsEnd()) { + whyList=productionPlanRepository.getIdNoAllData(gw, map.get("endNum")); + resources.setEndNum(map.get("endNum")); + }else { + whyList = productionPlanRepository.getList(gw,map.get("startNum"),resources.getEndNum()); + } + resources.setStartNum(map.get("startNum")); + resources.setJhQuantity(whyList.size()); + resources.setStatus("未审核"); + return new ResponseEntity<>(automaticPlanningService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改automaticPlanning") + @ApiOperation("修改automaticPlanning") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateAutomaticPlanning(@Validated @RequestBody AutomaticPlanning resources){ + //计算逻辑 + String gw=resources.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,resources.getSxQuantity()); + List whyList =null; + if(!resources.getIsEnd()) { + whyList=productionPlanRepository.getIdNoAllData(gw, map.get("endNum")); + resources.setEndNum(map.get("endNum")); + }else { + whyList = productionPlanRepository.getList(gw,map.get("startNum"),resources.getEndNum()); + } + resources.setStartNum(map.get("startNum")); + resources.setJhQuantity(whyList.size()); + resources.setStatus("未审核"); + automaticPlanningService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除automaticPlanning") + @ApiOperation("删除automaticPlanning") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteAutomaticPlanning(@RequestBody Long[] ids) { + automaticPlanningService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/batchOrder") + @Log("铺线计划-自动叫料") + @ApiOperation("铺线计划-自动叫料") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity batchOrder(@RequestBody Long[] ids) { + for (Long id:ids){ + AutomaticPlanning automaticPlanning=automaticPlanningRepository.getById(id); + if(automaticPlanning.getStatus().equals("已审核")){ + throw new BadRequestException(automaticPlanning.getShArea().getCode()+ "状态不正确"); + } + //得到该工位下的实际数量 + String gw=automaticPlanning.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,automaticPlanning.getSxQuantity()); + String endNum=map.get("endNum"); + String startNum=map.get("startNum"); + List whyList =null; + if(!automaticPlanning.getIsEnd()){ + whyList= productionPlanRepository.getIdNoAllData(gw,endNum); + automaticPlanning.setEndNum(endNum); + }else { + whyList = productionPlanRepository.getList(gw,map.get("startNum"),automaticPlanning.getEndNum()); + } + String zdStartNum=automaticPlanning.getZdStartNum(); + if(zdStartNum!=null&&!zdStartNum.equals("")){ + whyList = productionPlanRepository.getList(gw,zdStartNum,automaticPlanning.getEndNum()); + } + automaticPlanning.setStatus("已审核"); + automaticPlanning.setStartNum(startNum); + automaticPlanning.setJhQuantity(whyList.size()); + ProductionPlan plan=whyList.get(0); + //自动生成对应的明细数据 + AutomaticPlanDetail detail=automaticPlanDetailService.storeAutomaticPlanDetail(automaticPlanning); + detail.setCode(automaticPlanning.getCode()); + Long shAreaId=detail.getShArea().getId(); + //自动生成线边库存 + inventoryBakService.insertBatch(detail.getId(),shAreaId); + //将BOM的批次数改为0 + bomAccountService.updateBatch(shAreaId); + //铺线数量不做平均,不参与计算 + int num=detail.getJhQuantity(); + int s=num/detail.getBatchNum();//商 + int ys=num%detail.getBatchNum();//余数 + Boolean isLast=Boolean.FALSE;//是不是最后一批次 + String des=""; + //计算时段,9小时按批次-1计算,第一批默认8:30到,11:30-12:30休息 + int agv_sd=0; + if(detail.getBatchNum()>1){ + agv_sd=detail.getShHour()*60/(detail.getBatchNum()-1); + } + for(int i=1;i<=detail.getBatchNum();i++){ + String batch="第"+i+"批"; +// num=detail.getFxQuantity()+ys+s*i; + num=ys+s*i; + if(i>1&&s==0){ + continue; + } + if(i==detail.getBatchNum()){ + isLast=Boolean.TRUE; + } + Timestamp batchTime= DateUtil.getBatchTime(agv_sd*(i-1),automaticPlanning.getJhDate()); + //可以生成的 + String code=productionPlanService.manualGenerationSavePlanPick(whyList,num,batch,detail,isLast,batchTime); + planPickDetailService.createAutoPlan(i,code,shAreaId,detail,isLast,batchTime); + des+=code+";"; + } + detail.setDescription(des); + automaticPlanDetailService.update(detail); + } + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + + @PostMapping("/batchOrderZone") + @Log("铺线计划-自动叫料库区") + @ApiOperation("铺线计划-自动叫料库区") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity batchOrderZone(@RequestBody HashMap res) { +// Long[] ids=map.get("ids").toString().toCharArray(); + String plan_code = codeUtils.getCode_yyMMdd("JH",3); + List codes=new ArrayList<>(); + List detailIds=new ArrayList<>(); + List ids= (List) res.get("ids"); + String type=res.get("type").toString(); + for (Object id:ids){ + AutomaticPlanning automaticPlanning=automaticPlanningRepository.getById(Long.parseLong(id.toString())); + if(automaticPlanning.getStatus().equals("已审核")){ + throw new BadRequestException(automaticPlanning.getShArea().getCode()+ "状态不正确"); + } + //得到该工位下的实际数量 + String gw=automaticPlanning.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,automaticPlanning.getSxQuantity()); + String endNum=map.get("endNum"); + String startNum=map.get("startNum"); + List whyList =null; + if(!automaticPlanning.getIsEnd()){ + whyList= productionPlanRepository.getIdNoAllData(gw,endNum); + automaticPlanning.setEndNum(endNum); + }else { + whyList = productionPlanRepository.getList(gw,map.get("startNum"),automaticPlanning.getEndNum()); + } + String zdStartNum=automaticPlanning.getZdStartNum(); + if(zdStartNum!=null&&!zdStartNum.equals("")){ + whyList = productionPlanRepository.getList(gw,zdStartNum,automaticPlanning.getEndNum()); + } + automaticPlanning.setStatus("已审核"); + automaticPlanning.setStartNum(startNum); + automaticPlanning.setJhQuantity(whyList.size()); + ProductionPlan plan=whyList.get(0); + //自动生成对应的明细数据 + AutomaticPlanDetail detail=automaticPlanDetailService.storeAutomaticPlanDetail(automaticPlanning); + detail.setCode(automaticPlanning.getCode()); + Long shAreaId=detail.getShArea().getId(); + //自动生成线边库存 + inventoryBakService.insertBatch(detail.getId(),shAreaId); + //自动生成备货库存 + if(type.equals(BizStatus.PX_BH)){ + inventoryBakService.insertBhBatch(detail.getId(), shAreaId); + } + + //将BOM的批次数改为0 + bomAccountService.updateBatch(shAreaId); + //铺线数量不做平均,不参与计算 + int num=detail.getJhQuantity(); + int pxQty=detail.getFxQuantity(); + if(type.equals(BizStatus.PX)||type.equals(BizStatus.PX_BH)){ + num = num - pxQty;//该数量计入批次平均 + } + if(num<0){ + num=0; + } + int s=num/detail.getBatchNum(); + int ys=num%detail.getBatchNum(); + Boolean isLast=Boolean.FALSE; + String des=""; + //计算时段,9小时按批次-1计算,第一批默认8:30到,11:30-12:30休息 + int agv_sd=0; + if(detail.getBatchNum()>1){ + agv_sd=detail.getShHour()*60/(detail.getBatchNum()-1); + } + for(int i=1;i<=detail.getBatchNum();i++){ + String batch="第"+i+"批"; +// num=detail.getFxQuantity()+ys+s*i; + num=ys+s*i; + if(type.equals(BizStatus.PX)||type.equals(BizStatus.PX_BH)){ + num=num+ pxQty; + if(pxQty>detail.getJhQuantity()){ + num=detail.getJhQuantity(); + } + } + if(i>1&&s<=0){ + continue; + } + if(i==detail.getBatchNum()){ + isLast=Boolean.TRUE; + } + log.info(num+"===="+batch); + Timestamp batchTime= DateUtil.getBatchTime(agv_sd*(i-1),automaticPlanning.getJhDate()); + //可以生成的 + String code=productionPlanService.manualGenerationSavePlanPick(whyList,num,batch,detail,isLast,batchTime); + codes.add(code); + //planPickDetailService.createAutoPlan(i,code,shAreaId,detail,isLast,batchTime); + des+=code+";"; + } + detailIds.add(detail.getId()); + detail.setDescription(des); + automaticPlanDetailService.update(detail); + } + planPickDetailService.createAutoPlan(codes.toArray(new String[codes.size()]),detailIds.toArray(new Long[detailIds.size()]),type); + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + + @PostMapping("/batchHy") + @Log("铺线计划-自动耗用") + @ApiOperation("铺线计划-自动耗用") + @PreAuthorize("@el.check('automaticPlanning:batchOrder')") + @Transactional + public ResponseEntity batchHy(@RequestBody Long[] ids) { + for (Long id:ids){ + AutomaticPlanning automaticPlanning=automaticPlanningRepository.getById(id); + if(automaticPlanning.getStatus().equals("已审核")){ + throw new BadRequestException(automaticPlanning.getShArea().getCode()+ "状态不正确"); + } + //得到该工位下的实际数量 + String gw=automaticPlanning.getShArea().getWorkingStation(); + HashMap map= productionPlanService.getEndIdNO(gw,automaticPlanning.getSxQuantity()); + String endNum=map.get("endNum"); + String startNum=map.get("startNum"); + List whyList =null; + if(!automaticPlanning.getIsEnd()){ + whyList= productionPlanRepository.getIdNoAllData(gw,endNum); + automaticPlanning.setEndNum(endNum); + }else { + whyList = productionPlanRepository.getList(gw,map.get("startNum"),automaticPlanning.getEndNum()); + } + automaticPlanning.setStatus("已审核"); + automaticPlanning.setJhQuantity(whyList.size()); + automaticPlanning.setStartNum(startNum); + automaticPlanningService.update(automaticPlanning); + AutomaticPlanDetail detail=automaticPlanDetailService.storeAutomaticPlanDetail(automaticPlanning); + productionPlanService.scsxHaoyong(whyList,gw, "上线计划自动耗用:"+detail.getId()); + } + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BigItemController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BigItemController.java new file mode 100644 index 0000000..aa96bff --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BigItemController.java @@ -0,0 +1,136 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.service.BigItemService; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.dto.BigItemDto; +import com.youchain.basicdata.service.dto.BigItemQueryCriteria; +import com.youchain.basicdata.service.dto.BomAccountDto; +import com.youchain.basicdata.service.dto.BomAccountQueryCriteria; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-12-29 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "bigItem管理") +@Slf4j +@RequestMapping("/api/bigItem") +public class BigItemController { + + private final BigItemService bigItemService; + private final BomAccountService bomAccountService; + private final BomAccountRepository bomAccountRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportBigItem(HttpServletResponse response, BigItemQueryCriteria criteria) throws Exception { + bigItemService.download(bigItemService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询bigItem") + @ApiOperation("查询bigItem") + @AnonymousAccess + public ResponseEntity queryBigItem(BigItemQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(bigItemService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + + @GetMapping("/queryBigItemAll") + @Log("查询bigItem全部") + @ApiOperation("查询bigItem全部") + @AnonymousAccess + public ResponseEntity queryBigItemAll(BigItemQueryCriteria criteria){ + return new ResponseEntity<>(bigItemService.queryAll(criteria),HttpStatus.OK); + } + + + + @GetMapping("/queryBigItemAllInBomAccount") + @Log("查询在BomAccount里的BigItem数据并去重") + @ApiOperation("查询在BomAccount里的BigItem数据并去重") + @AnonymousAccess + public ResponseEntity queryBigItemAllInBomAccount(){ + //BOM工位清单 + List bomAccounts = bomAccountRepository.queryBomAccountsBIidOne(); + log.info("size:"+bomAccounts.size()); + //获取所有对象的BigItem + List collect = bomAccounts.stream().map(BomAccount::getBigItem).collect(Collectors.toList()); +// List collect = bomAccountRepository.queryBigItemALl(); + return new ResponseEntity<>(collect,HttpStatus.OK); + } + + @PostMapping + @Log("新增bigItem") + @ApiOperation("新增bigItem") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBigItem(@Validated @RequestBody BigItem resources){ + resources.setDeptId(UserUtils.getDept().getId()); + return new ResponseEntity<>(bigItemService.create(resources),HttpStatus.CREATED); + } + @PostMapping("/getBigItem") + @Log("加载BigItem下拉框") + @AnonymousAccess + public ResponseEntity getBigItem(@RequestBody(required=false) String type){ + return new ResponseEntity<>(bigItemService.getBigItem("1"),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改bigItem") + @ApiOperation("修改bigItem") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBigItem(@Validated @RequestBody BigItem resources){ + bigItemService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除bigItem") + @ApiOperation("删除bigItem") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBigItem(@RequestBody Long[] ids) { + bigItemService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BillTypeController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BillTypeController.java new file mode 100644 index 0000000..e23f5a2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BillTypeController.java @@ -0,0 +1,105 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.service.BillTypeService; +import com.youchain.basicdata.service.dto.BillTypeQueryCriteria; +import com.youchain.basicdata.service.dto.PointQueryCriteria; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.Objects; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-07 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "bill_type管理") +@RequestMapping("/api/billType") +public class BillTypeController { + + private final BillTypeService billTypeService; + + + @GetMapping(value = "/queryBillTypeList") + @Log("下拉查询") + @ApiOperation("下拉查询") +// @PreAuthorize("@el.check('point:queryBillTypeList')") + @AnonymousAccess + public ResponseEntity queryBillTypeList(BillTypeQueryCriteria criteria){ + return new ResponseEntity<>(billTypeService.queryAll(criteria),HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportBillType(HttpServletResponse response, BillTypeQueryCriteria criteria) throws Exception { + billTypeService.download(billTypeService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询bill_type") + @ApiOperation("查询bill_type") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryBillType(BillTypeQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(billTypeService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增bill_type") + @ApiOperation("新增bill_type") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBillType(@Validated @RequestBody BillType resources){ + if (Objects.isNull(resources.getDept())){ + resources.setDept(UserUtils.getDept()); + } + return new ResponseEntity<>(billTypeService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改bill_type") + @ApiOperation("修改bill_type") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBillType(@Validated @RequestBody BillType resources){ + billTypeService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除bill_type") + @ApiOperation("删除bill_type") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBillType(@RequestBody Long[] ids) { + billTypeService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java new file mode 100644 index 0000000..a4a7b2a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountController.java @@ -0,0 +1,181 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.repository.PointRepository; +import com.youchain.basicdata.repository.TableConfigRepository; +import com.youchain.basicdata.service.BomAccountLogService; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.*; +import com.youchain.basicdata.service.impl.TableConfigServiceImpl; +import com.youchain.basicdata.service.mapstruct.BomAccountMapper; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-02 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "bomAccount管理") +@RequestMapping("/api/bomAccount") +public class BomAccountController { + + private final BomAccountService bomAccountService; + private final BomAccountLogService bomAccountLogService; + private final BomAccountMapper bomAccountMapper; + private final PointRepository pointRepository; + private final PointService pointService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportBomAccount(HttpServletResponse response, BomAccountQueryCriteria criteria) throws Exception { + bomAccountService.download(bomAccountService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询bomAccount") + @ApiOperation("查询bomAccount") + @AnonymousAccess + public ResponseEntity queryBomAccount(BomAccountQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(bomAccountService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping("/queryBomAccountList") + @Log("查询bomAccount全部") + @ApiOperation("查询bomAccount全部") + @AnonymousAccess + public ResponseEntity queryBomAccountList(BomAccountQueryCriteria criteria){ + return new ResponseEntity<>(bomAccountService.queryAll(criteria),HttpStatus.OK); + } + + @GetMapping(value = "/queryBigItemByStationType/{stationType}") + @Log("根据工位查询bomAccount") + @ApiOperation("根据工位查询bomAccount") + @AnonymousAccess + public ResponseEntity queryBomAccountByStationType(@PathVariable("stationType") String stationType){ + List bigItems = bomAccountService.queryBigItemByType(stationType); + return new ResponseEntity<>(bigItems,HttpStatus.OK); + } + + @GetMapping(value = "/queryItemByArea/{areaId}") + @Log("根据库区查询bomAccount品番") + @ApiOperation("根据库区查询bomAccount品番") + @AnonymousAccess + public ResponseEntity queryItemByArea(@PathVariable("areaId") Long areaId){ + List boms=bomAccountService.queryByArea(areaId); + return new ResponseEntity<>(boms,HttpStatus.OK); + } + + @GetMapping(value = "/queryBomAccountPoints") + @Log("查询bomAccount品番库位") + @ApiOperation("查询bomAccount品番库位") + @AnonymousAccess + public ResponseEntity queryBomAccountPoints(){ + List boms=bomAccountService.queryBomAccountPoints(); + return new ResponseEntity<>(boms,HttpStatus.OK); + } + + @PostMapping + @Log("新增bomAccount") + @ApiOperation("新增bomAccount") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBomAccount(@Validated @RequestBody BomAccount resources){ +// if(resources.getHPoint().getCode()==null){ +// resources.setHPoint(null); +// }else{ +// Point point=pointRepository.findByCode(resources.getHPoint().getCode()); +// if (point == null) { +// point = pointService.createPoint(resources.getHPoint().getCode(), "ZCKW", resources.getRArea(),null); +// } +// resources.setHPoint(point); +// } + if(resources.getZPoint().getCode()==null){ + resources.setZPoint(null); + }else{ + Point point=pointRepository.findByCode(resources.getZPoint().getCode()); + if (point == null) { + point = pointService.createPoint(resources.getZPoint().getCode(), BaseStatus.HCKW, resources.getRArea()); + } + resources.setZPoint(point); + } + BomAccountDto bomAccountDto=bomAccountService.create(resources); + bomAccountLogService.copyBomAccount(bomAccountDto.getId(),"add"); + return new ResponseEntity<>(bomAccountDto,HttpStatus.CREATED); + } + + @PutMapping + @Log("修改bomAccount") + @ApiOperation("修改bomAccount") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBomAccount(@Validated @RequestBody BomAccount resources){ +// if(resources.getHPoint().getCode()==null){ +// resources.setHPoint(null); +// }else{ +// Point point=pointRepository.findByCode(resources.getHPoint().getCode()); +// if (point == null) { +// point = pointService.createPoint(resources.getHPoint().getCode(), "ZCKW", resources.getRArea(),null); +// } +// resources.setHPoint(point); +// } + if(resources.getZPoint().getCode()==null){ + resources.setZPoint(null); + }else{ + Point point=pointRepository.findByCode(resources.getZPoint().getCode()); + if (point == null) { + point = pointService.createPoint(resources.getZPoint().getCode(), BaseStatus.HCKW, resources.getRArea()); + } + resources.setZPoint(point); + } + bomAccountService.update(resources); + bomAccountLogService.copyBomAccount(resources.getId(),"update"); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除bomAccount") + @ApiOperation("删除bomAccount") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBomAccount(@RequestBody Long[] ids) { + bomAccountService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountLogController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountLogController.java new file mode 100644 index 0000000..694e976 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BomAccountLogController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BomAccountLog; +import com.youchain.basicdata.service.BomAccountLogService; +import com.youchain.basicdata.service.dto.BomAccountLogQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-24 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "bomAccountLog管理") +@RequestMapping("/api/bomAccountLog") +public class BomAccountLogController { + + private final BomAccountLogService bomAccountLogService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('bomAccountLog:list')") + public void exportBomAccountLog(HttpServletResponse response, BomAccountLogQueryCriteria criteria) throws Exception { + bomAccountLogService.download(bomAccountLogService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询bomAccountLog") + @ApiOperation("查询bomAccountLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryBomAccountLog(BomAccountLogQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(bomAccountLogService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增bomAccountLog") + @ApiOperation("新增bomAccountLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBomAccountLog(@Validated @RequestBody BomAccountLog resources){ + return new ResponseEntity<>(bomAccountLogService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改bomAccountLog") + @ApiOperation("修改bomAccountLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBomAccountLog(@Validated @RequestBody BomAccountLog resources){ + bomAccountLogService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除bomAccountLog") + @ApiOperation("删除bomAccountLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBomAccountLog(@RequestBody Long[] ids) { + bomAccountLogService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/BoxController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/BoxController.java new file mode 100644 index 0000000..6d5251a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/BoxController.java @@ -0,0 +1,100 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.service.BoxService; +import com.youchain.basicdata.service.dto.BoxQueryCriteria; +import com.youchain.exception.handler.ApiError; +import com.youchain.utils.CodeUtils; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.OK; + +/** + * @author huojin + * @website https://eladmin.vip + * @date 2023-08-17 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "box管理") +@RequestMapping("/api/box") +@Slf4j +public class BoxController { + + private final BoxService boxService; + + private final CodeUtils codeUtils; + + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportBox(HttpServletResponse response, BoxQueryCriteria criteria) throws Exception { + boxService.download(boxService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询box") + @ApiOperation("查询box") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryBox(BoxQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(boxService.queryAll(criteria, pageable), OK); + } + + @PostMapping + @Log("新增box") + @ApiOperation("新增box") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBox(@Validated @RequestBody Box resources) { + resources.setDept(UserUtils.getDept()); + boxService.create(resources); + return new ResponseEntity<>(boxService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改box") + @ApiOperation("修改box") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBox(@Validated @RequestBody Box resources) { + boxService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除box") + @ApiOperation("删除box") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBox(@RequestBody Long[] ids) { + boxService.deleteAll(ids); + return new ResponseEntity<>(OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/DesignListController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/DesignListController.java new file mode 100644 index 0000000..6f93a34 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/DesignListController.java @@ -0,0 +1,191 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.Log; +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.repository.DesignListRepository; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.DesignListService; +import com.youchain.basicdata.service.dto.DesignListQueryCriteria; +import com.youchain.config.FileProperties; +import com.youchain.exception.handler.ApiError; +import com.youchain.utils.FileUtil; +import com.youchain.utils.OptionalUtils; +import com.youchain.utils.SecurityUtils; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author LY +* @date 2024-04-26 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "design管理") +@RequestMapping("/api/designList") +public class DesignListController { + + private final DesignListService designListService; + + + //导入 + private final FileProperties properties; + private final DesignListRepository designListRepository; + private final BigItemRepository bigItemRepository; + private final ItemRepository itemRepository; + + @Log("导入设变清单") + @PostMapping(value = "/importDesignList") + @ApiOperation("导入设变清单") + @PreAuthorize("@el.check('designList:list')") + public ResponseEntity importAutomaticPlanning(@RequestParam("file") MultipartFile multipartFile) throws ParseException { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + ExcelReader reader = ExcelUtil.getReader(file); + List> readAll = reader.readAll(); + int i = 0; + for (i = 0; i < readAll.size(); i++) { + String no = OptionalUtils.getTrimmedString(readAll.get(i), "No", null); + if(no==null||no.equals("")){ + break; + } + String bt = OptionalUtils.getTrimmedString(readAll.get(i), "変通No.11桁", null); + String sbh = OptionalUtils.getTrimmedString(readAll.get(i), "设变号", null); + String ykfh = OptionalUtils.getTrimmedString(readAll.get(i), "一括番号", null); + String jfh = OptionalUtils.getTrimmedString(readAll.get(i), "旧品番", null); + String glsb =OptionalUtils.getTrimmedString(readAll.get(i), "关联设变", null); + String xfh = OptionalUtils.getTrimmedString(readAll.get(i), "新品番", null); + String gysdm =OptionalUtils.getTrimmedString(readAll.get(i), "供应商代码", null); + String gysmc = OptionalUtils.getTrimmedString(readAll.get(i), "供应商名称", null); + String ac = OptionalUtils.getTrimmedString(readAll.get(i), "A/C", null); + String jgnr =OptionalUtils.getTrimmedString(readAll.get(i), "加工内容", null); + String pm = OptionalUtils.getTrimmedString(readAll.get(i), "品名(中文)", null); + Integer dy = OptionalUtils.getTrimmedInteger(readAll.get(i), "单用", 0); + boolean yf = OptionalUtils.getBooleanValue(readAll.get(i), "订货要否", false); + String ns = OptionalUtils.getTrimmedString(readAll.get(i), "纳所", null); + String ycl = OptionalUtils.getTrimmedString(readAll.get(i), "月产量", null); + String txdm =OptionalUtils.getTrimmedString(readAll.get(i), "T型式代码", null); + String txm = OptionalUtils.getTrimmedString(readAll.get(i), "T型式名", null); + String jpcl = OptionalUtils.getTrimmedString(readAll.get(i), "旧品处理", null); + String xtss = OptionalUtils.getTrimmedString(readAll.get(i), "系统\n" + "实施日", null); + DesignList d=new DesignList(); + d.setNo(no); + d.setChaseCenter(bt); + d.setContraposition(sbh); + d.setDesignation(ykfh); + d.setHypothesis(glsb); + d.setSupplierCode(gysdm); + d.setSupplierName(gysmc); + d.setAc(ac); + d.setContent(jgnr); + d.setProductName(pm); + d.setUseSingly(dy); + d.setEnable(yf); + d.setNaso(ns); + d.setMonthlyOutput(ycl); + d.setTTypeCode(txdm); + d.setTTypeName(txm); + d.setScrapDisposal(jpcl); + d.setImplementationDate(xtss); + d.setCreateBy(SecurityUtils.getCurrentUser().getUsername()); + //查询完成品番的id + BigItem bigItem = bigItemRepository.findByCode(txdm); + //查询旧品番的id + Item oitem = itemRepository.findByCode(jfh); + //查询新品番的id + Item nitem = itemRepository.findByCode(xfh); + d.setNitem(nitem); + d.setOitem(oitem); + d.setBigItem(bigItem); + d.setOldItemCode(jfh); + d.setNewItemCode(xfh); + d.setBigItemCode(txdm); + designListService.create(d); + } + return new ResponseEntity<>("导入成功",HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('designList:list')") + public void exportDesignList(HttpServletResponse response, DesignListQueryCriteria criteria) throws Exception { + designListService.download(designListService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询design") + @ApiOperation("查询design") + @PreAuthorize("@el.check('designList:list')") + public ResponseEntity queryDesignList(DesignListQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(designListService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增design") + @ApiOperation("新增design") + @PreAuthorize("@el.check('designList:add')") + public ResponseEntity createDesignList(@Validated @RequestBody DesignList resources){ + return new ResponseEntity<>(designListService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改design") + @ApiOperation("修改design") + @PreAuthorize("@el.check('designList:edit')") + public ResponseEntity updateDesignList(@Validated @RequestBody DesignList resources){ + designListService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除design") + @ApiOperation("删除design") + @PreAuthorize("@el.check('designList:del')") + public ResponseEntity deleteDesignList(@RequestBody Long[] ids) { + designListService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java new file mode 100644 index 0000000..4b32871 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ImportDataController.java @@ -0,0 +1,240 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.ImportDataService; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.StockTypeService; +import com.youchain.basicdata.service.dto.BomAccountQueryCriteria; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.ItemQueryCriteria; +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.service.AsnService; +import com.youchain.businessdata.service.PickDetailService; +import com.youchain.businessdata.service.PickTicketService; +import com.youchain.businessdata.service.dto.AsnDto; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.BizStatus; +import com.youchain.utils.CodeUtils; +import com.youchain.utils.FileUtil; +import com.youchain.utils.UserUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "导入管理") +@Slf4j +@RequestMapping("/api/importData") +public class ImportDataController { + private final FileProperties properties; + private final BigItemRepository bigItemRepository; + private final ItemRepository itemRepository; + private final ImportDataService importDataService; + private final AsnService asnService; + private final PickTicketService pickTicketService; + private final PickDetailService pickDetailService; + private final CodeUtils codeUtils; + @Log("导入完成品品番") + @ApiOperation("导入完成品品番") + @PostMapping(value = "/bigItem") + @Transactional + @AnonymousAccess + public ResponseEntity importBigItem( @RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + int a=0;//新增 + int b=0;//修改 + int c=0;//错误 + int d=0;//执行 + List cList=new ArrayList<>(); + for (int i = 0; i < readAll.size(); i++) { + String code =readAll.get(i).get("完成品品番")==null?null:readAll.get(i).get("完成品品番").toString(); + if(code==null||code.equals("")){ + break; + } + String re = importDataService.importBigItem(readAll.get(i)); + } + return new ResponseEntity("导入成功",HttpStatus.OK); + } + @Log("导入部品品番") + @ApiOperation("导入部品品番") + @PostMapping(value = "/item") + @Transactional + @AnonymousAccess + public ResponseEntity importItem( @RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + int a=0;//新增 + int b=0;//修改 + for (int i = 0; i < readAll.size(); i++) { + Map map=readAll.get(i); + String code =(String) map.get("品番"); + if(code==null||code.equals("")){ + break; + } + String re = importDataService.importItem(map); + if (re.equals("a")){ + a=a+1; + }else if (re.equals("b")){ + b=b+1; + } + } + return new ResponseEntity("导入成功:执行"+(a+b)+"行 新增"+a+"行,修改"+b+"行",HttpStatus.OK); + } + @Log("导入其他入库") + @ApiOperation("导入其他入库") + @PostMapping(value = "/importAsnDetail") + @Transactional + @AnonymousAccess + public ResponseEntity importAsnDetail(@RequestParam Long asnId, @RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + List cList=new ArrayList<>(); + Asn asn=asnService.getEntity(asnId); + if(asn==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在"); + } + if(!asn.getStatus().equals(BizStatus.OPEN)) + { + throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确"); + } + for (int i = 0; i < readAll.size(); i++) { + String re = importDataService.importAsnDetail(readAll.get(i),asn); + if(re!=null&&!re.equals("")){ + throw new BadRequestException(HttpStatus.NOT_FOUND, (i+1)+"行"+re); + } + } + return new ResponseEntity("导入成功", HttpStatus.OK); + } + @Log("导入其他出库") + @ApiOperation("导入其他出库") + @PostMapping(value = "/importPickDetail") + @Transactional + @AnonymousAccess + public ResponseEntity importPickDetail(@RequestParam Long ptId, @RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + List cList=new ArrayList<>(); + PickTicket pt=pickTicketService.getEntity(ptId); + if(pt==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据不存在"); + } + if(!pt.getStatus().equals(BizStatus.OPEN)&&!pt.getStatus().equals(BizStatus.ALLOCATE)) + { + throw new BadRequestException(HttpStatus.NOT_FOUND, "该单据状态不正确"); + } + for (int i = 0; i < readAll.size(); i++) { + String re = importDataService.importPickDetail(readAll.get(i),pt); + if(re!=null&&!re.equals("")){ + throw new BadRequestException(HttpStatus.NOT_FOUND, (i+1)+"行"+re); + } + } + List ds=pickDetailService.queryPickDetailList(pt.getId()); +// for(PickDetail d:ds) { +// pickDetailService.allocate(d.getId(),d.getOrderQty()); +// } + return new ResponseEntity("导入成功", HttpStatus.OK); + } + + @Log("导入手工指示") + @ApiOperation("导入手工指示") + @PostMapping(value = "/importPickInstruction") + @Transactional + @AnonymousAccess + public ResponseEntity importPickInstruction(@RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + importDataService.importPickInstruction(readAll); + return new ResponseEntity("导入成功", HttpStatus.OK); + } + + @Log("导入移位明细") + @ApiOperation("导入移位明细") + @PostMapping(value = "/importCountMoveDetail") + @Transactional + @AnonymousAccess + public ResponseEntity importCountMoveDetail(@RequestParam Long countId,@RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + importDataService.importCountMoveDetail(countId,readAll); + return new ResponseEntity("导入成功", HttpStatus.OK); + } + + @Log("导入BOM工位清单") + @ApiOperation("导入BOM工位清单") + @PostMapping(value = "/bomAccount") + @Transactional + @AnonymousAccess + public ResponseEntity importBomAccount( @RequestParam("file") MultipartFile multipartFile) { + List> readAll = getMaps(multipartFile); + for (int i = 0; i < readAll.size(); i++) { + importDataService.importBomAccount(i,readAll.get(i)); + } + return new ResponseEntity("导入成功"+ readAll.size()+"行", HttpStatus.OK); + } + + + /** + * 解析导入文件 + * @param multipartFile + * @return + */ + private List> getMaps(MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + log.error("--" + properties.getPath().getPath() + type + File.separator); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + log.error("--" + file.getPath()); + ExcelReader reader = ExcelUtil.getReader(file); + List> readAll = reader.readAll(); + return readAll; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemController.java new file mode 100644 index 0000000..93a30d8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemController.java @@ -0,0 +1,202 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.StockTypeService; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.ItemQueryCriteria; +import com.youchain.basicdata.service.dto.StockTypeQueryCriteria; +import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria; +import com.youchain.config.FileProperties; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.DictService; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.FileUtil; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; + + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "item管理") +@Slf4j +@RequestMapping("/api/item") +public class ItemController { + + private final ItemService itemService; + private final FileProperties properties; + private final StockTypeService stockTypeService; + private final DictDetailService dictDetailService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportItem(HttpServletResponse response, ItemQueryCriteria criteria) throws Exception { + itemService.download(itemService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询item") + @ApiOperation("查询item") + @AnonymousAccess + public ResponseEntity queryItem(ItemQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(itemService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @GetMapping("/queryItemAll") + @Log("查询Item全部数据") + @ApiOperation("查询Item全部数据") + @AnonymousAccess + public ResponseEntity queryItemAll(ItemQueryCriteria criteria){ + return new ResponseEntity<>(itemService.queryAll(criteria),HttpStatus.OK); + } + + @GetMapping("/itemList") + @Log("查询所有的物料数据") + @ApiOperation("查询所有的物料数据") + @AnonymousAccess + public ResponseEntity> queryItemList(ItemQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(itemService.queryAll(criteria), HttpStatus.OK); + } + + + @PostMapping + @Log("新增item") + @ApiOperation("新增item") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createItem(@Validated @RequestBody Item resources){ + resources.setDept(UserUtils.getDept()); + return new ResponseEntity<>(itemService.create(resources),HttpStatus.CREATED); + } + + @PostMapping(value = "/import_data") + @ApiOperation("导入物料") + @Transactional + @AnonymousAccess + public ResponseEntity createSysAppUpdate( @RequestParam("file") MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + log.error("--" + properties.getPath().getPath() + type + File.separator); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + log.error("--" + file.getPath()); + + Map map_stock = stockTypeService.queryAll(); + DictQueryCriteria dictQueryCriteria=new DictQueryCriteria(); + dictQueryCriteria.setBlurry("item_unit"); + Map map_dic = dictDetailService.getDictDetailByName("item_unit"); + DictQueryCriteria itemTypeDc=new DictQueryCriteria(); + itemTypeDc.setBlurry("item_type"); + Map item_type_dic = dictDetailService.getDictDetailByName("item_type"); + ExcelReader reader = ExcelUtil.getReader(file); + int i=0; + int edit_len=0; + int new_len=0; + try{ + List> readAll = reader.readAll(); + for ( i = 0; i < readAll.size(); i++) { + Item item = new Item(); + String code=readAll.get(i).get("物料代码").toString().trim(); + item.setCode(code); + item.setName("" + readAll.get(i).get("物料名称")); + //容器类型 + String stocktype_Str = "" + readAll.get(i).get("容器类型"); + item.setStockType(map_stock.get(stocktype_Str)); + String unit=readAll.get(i).get("单位")+""; + item.setUnit(map_dic.get(unit).getValue()); + String packNumber=readAll.get(i).get("默认容器装载数").toString().trim(); + item.setPackNumber(Integer.parseInt(packNumber)); + String itemType=readAll.get(i).get("物料类型")+""; + item.setGoodType(item_type_dic.get(itemType).getValue()); + item.setLength(Double.parseDouble("" + readAll.get(i).get("长"))); + item.setWidth(Double.parseDouble("" + readAll.get(i).get("宽"))); + item.setHeight(Double.parseDouble("" + readAll.get(i).get("高"))); + ItemQueryCriteria itemQueryCriteria=new ItemQueryCriteria(); + itemQueryCriteria.setCode(code); + List itemDto_list=itemService.queryAll(itemQueryCriteria); + if(itemDto_list.size()<=0){ + new_len++; + log.error("不存在--" + readAll.get(i).get("编码")+"--"); + itemService.create(item); + }else{ + edit_len++; + log.error("存在--" + readAll.get(i).get("编码")+"--"); + item.setId(itemDto_list.get(0).getId()); + itemService.update(item); + } + } + }catch (Exception e){ + ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), "导入异常---第"+(i+1)+"行:"+e.toString()); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } + ApiError apiError = ApiError.errorJosn(HttpStatus.OK.value(), "导入成功:"+(i)+"行 新增("+new_len+")修改("+edit_len+")"); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + + } + + @PutMapping + @Log("修改item") + @ApiOperation("修改item") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateItem(@Validated @RequestBody Item resources){ + itemService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除item") + @ApiOperation("删除item") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteItem(@RequestBody Long[] ids) { + itemService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemLisController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemLisController.java new file mode 100644 index 0000000..e77995b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemLisController.java @@ -0,0 +1,178 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.repository.ItemLisRepository; +import com.youchain.basicdata.service.ItemLisService; +import com.youchain.basicdata.service.dto.ItemLisQueryCriteria; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.FileUtil; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @date 2024-01-03 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "itemLis管理") +@RequestMapping("/api/itemLis") +public class ItemLisController { + + private final ItemLisService itemLisService; + private final FileProperties properties; + private final BigItemRepository bigItemRepository; + private final ItemLisRepository itemLisRepository; + private final AreaRepository areaRepository; + + @PostMapping(value = "/import_data") + @ApiOperation("导入完成品工位清单") + @Transactional + @AnonymousAccess + @Log("导入完成品工位清单") + public ResponseEntity createSysAppUpdate(@RequestParam("file") MultipartFile multipartFile) throws Exception { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + Dept dept = UserUtils.getDept(); + + ExcelReader reader = ExcelUtil.getReader(file); + List> readAll = reader.readAll(); + int i = 0;//序号 + int edit_len = 0; + int new_len = 0; + Map map = new HashMap();//制造线,序号 + for (i = 0; i < readAll.size(); i++) { + //完成品品番 完成品型式名 工位 出库类型 入库库区 备注 + String bigItemCode = readAll.get(i).get("完成品品番").toString().trim(); + String bigItemName = readAll.get(i).get("完成品型式名").toString().trim(); + String stationType = readAll.get(i).get("工位").toString().trim(); + String outType = readAll.get(i).get("出库类型").toString().trim(); + String rAreaCode = readAll.get(i).get("入库库区").toString().trim(); + String description = readAll.get(i).get("备注")==null?"":readAll.get(i).get("备注").toString().trim(); + + //查询完成品番的id + BigItem bigItem = bigItemRepository.findByCode(bigItemCode); + if (bigItem==null) { + throw new BadRequestException(bigItemCode + "不存在" + (i + 1)); + } + //入库库区 + Area area = areaRepository.findByCodeOrName(rAreaCode,rAreaCode); + if(area==null) { + throw new BadRequestException(rAreaCode + "不存在" + (i + 1)); + } + //查询是否已经存在 + Boolean isNew=Boolean.FALSE; + ItemLis itemLis = itemLisRepository.findByBigItemIdStationType(bigItem.getId(), stationType); + if (itemLis==null) { + itemLis = new ItemLis(); + itemLis.setBigItem(bigItem); + itemLis.setStationType(stationType); + isNew=Boolean.TRUE; + } + //开始插入数据 + itemLis.setOutType(outType); + itemLis.setRArea(area); + itemLis.setDept(dept); + itemLis.setDescription(description); + if(isNew){ + itemLisService.create(itemLis); + }else{ + itemLisService.update(itemLis); + } + } + return new ResponseEntity<>("导入成功",HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportItemLis(HttpServletResponse response, ItemLisQueryCriteria criteria) throws Exception { + itemLisService.download(itemLisService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询itemLis") + @ApiOperation("查询itemLis") + @AnonymousAccess + public ResponseEntity queryItemLis(ItemLisQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(itemLisService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增itemLis") + @ApiOperation("新增itemLis") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createItemLis(@Validated @RequestBody ItemLis resources) { + //存入所属工位 + resources.setStationType(resources.getRArea().getWorkingStation()); + return new ResponseEntity<>(itemLisService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改itemLis") + @ApiOperation("修改itemLis") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateItemLis(@Validated @RequestBody ItemLis resources) { + itemLisService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除itemLis") + @ApiOperation("删除itemLis") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteItemLis(@RequestBody Long[] ids) { + itemLisService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemRelationController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemRelationController.java new file mode 100644 index 0000000..89ed350 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ItemRelationController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.ItemRelation; +import com.youchain.basicdata.service.ItemRelationService; +import com.youchain.basicdata.service.dto.ItemRelationQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "itemRelation管理") +@RequestMapping("/api/itemRelation") +public class ItemRelationController { + + private final ItemRelationService itemRelationService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportItemRelation(HttpServletResponse response, ItemRelationQueryCriteria criteria) throws Exception { + itemRelationService.download(itemRelationService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询itemRelation") + @ApiOperation("查询itemRelation") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryItemRelation(ItemRelationQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(itemRelationService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增itemRelation") + @ApiOperation("新增itemRelation") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createItemRelation(@Validated @RequestBody ItemRelation resources){ + return new ResponseEntity<>(itemRelationService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改itemRelation") + @ApiOperation("修改itemRelation") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateItemRelation(@Validated @RequestBody ItemRelation resources){ + itemRelationService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除itemRelation") + @ApiOperation("删除itemRelation") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteItemRelation(@RequestBody Long[] ids) { + itemRelationService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java new file mode 100644 index 0000000..402a692 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/PointController.java @@ -0,0 +1,257 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.PointQueryCriteria; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.dto.InventoryDto; +import com.youchain.businessdata.service.dto.InventoryQueryCriteria; +import com.youchain.config.FileProperties; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.FileUtil; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author liuxue + * @website https://eladmin.vip + * @date 2023-07-26 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "ponit管理") +@Slf4j +@RequestMapping("/api/point") +public class PointController { + + private final PointService pointService; + + private final AreaService areaService; + + private final FileProperties properties; + private final ItemRepository itemRepository; + private final InventoryService inventoryService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPoint(HttpServletResponse response, PointQueryCriteria criteria) throws Exception { + pointService.download(pointService.queryAll(criteria), response); + } + + @Log("导入点位") + @PostMapping(value = "/import_point") + @ApiOperation("导入点位") + @AnonymousAccess + public ResponseEntity importPoint(@RequestParam("file") MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + + Dept dept = UserUtils.getDept(); + //编码、描述、库区、存储类型 + ExcelReader reader = ExcelUtil.getReader(file); + int i = 0; + int edit_len = 0; + int new_len = 0; + List> readAll = reader.readAll(); + for (i = 0; i < readAll.size(); i++) { + String code = readAll.get(i).get("编码").toString().trim(); + String types = readAll.get(i).get("存储类型").toString().trim(); + String areaCode = readAll.get(i).get("库区").toString().trim(); + String ccTYPE = readAll.get(i).get("描述") == null ? "" : readAll.get(i).get("描述").toString().trim(); + Area area = areaService.findByCode(areaCode); + if (area == null) { + ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), "找不到库区" + areaCode); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } + Point point = pointService.getPoint(code, null, null, null); + Boolean isNew=Boolean.FALSE; + if (point == null) { + point = new Point(); + point.setCode(code); + point.setDept(dept); + point.setEnabled(true); + point.setStatus(BaseStatus.FREE); + point.setName(code); + isNew=Boolean.TRUE; + } + String lx = ""; + if (types.equals("存货")) { + lx = BaseStatus.CH; + } else if (types.equals("制造库位")) { + lx = BaseStatus.ZZKW; + }else if (types.equals("缓存库位")) { + lx = BaseStatus.HCKW; + } + point.setType(lx); + point.setArea(area); + point.setDescription(ccTYPE); + if(isNew){ + pointService.create(point); + }else { + pointService.update(point); + } + } + ApiError apiError = ApiError.errorJosn(HttpStatus.OK.value(), "导入成功:" + (i) + "行 新增(" + new_len + ")修改(" + edit_len + ")"); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + + } + + @GetMapping + @Log("查询point") + @ApiOperation("查询point") + @AnonymousAccess + public ResponseEntity queryPoint(PointQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(pointService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping("/getPoints") + @Log("加载point下拉框") + @ApiOperation("加载point下拉框") + @AnonymousAccess + public ResponseEntity getPointList(@RequestBody(required = false) String type) { + return new ResponseEntity<>(pointService.getPointList(type), HttpStatus.OK); + } + + @GetMapping(value = "/queryPointList") + @Log("下拉查询点位") + @ApiOperation("下拉查询点位") + @AnonymousAccess + public ResponseEntity queryPointList(PointQueryCriteria criteria) { + return new ResponseEntity<>(pointService.queryAll(criteria), HttpStatus.OK); + } + + @GetMapping(value = "/getOutPointAll") + @Log("获取出库点位") + @ApiOperation("获取出库点位") + @AnonymousAccess + public ResponseEntity getOutPointAll(PointQueryCriteria criteria) { + InventoryQueryCriteria inventoryQueryCriteria = new InventoryQueryCriteria(); + if (criteria.getAreaName() != null) { + List items = itemRepository.quryOneItemAll(); + List itemCode = new ArrayList<>(); + for (Item item : items) { + itemCode.add(item.getCode()); + } + inventoryQueryCriteria.setItemCode(itemCode); + inventoryQueryCriteria.setAreaName(criteria.getAreaName()); + List inventoryDtos = inventoryService.queryAll(inventoryQueryCriteria); + List collect = inventoryDtos.stream().map(InventoryDto::getPoint).collect(Collectors.toList()); + return new ResponseEntity<>(collect, HttpStatus.OK); + } + return new ResponseEntity<>(null, HttpStatus.OK); + } + + + @GetMapping(value = "/queryKyPointList") + @Log("查询可用空闲的点位point") + @ApiOperation("查询可用空闲的点位point") + @AnonymousAccess + public ResponseEntity queryKyPointList(PointQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(pointService.queryKyPointList(), HttpStatus.OK); + } + + @PostMapping + @Log("新增point") + @ApiOperation("新增point") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPoint(@Validated @RequestBody Point resources) { + resources.setDept(UserUtils.getDept()); + return new ResponseEntity<>(pointService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改point") + @ApiOperation("修改point") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePoint(@Validated @RequestBody Point resources) { +// if (!Objects.isNull(resources.getPoint())){ +// if (resources.getPoint().getId() == null){ +// resources.setPoint(null); +// } +// } + pointService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @PutMapping("/updatePoint") + @Log("修改point") + @ApiOperation("修改point") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePointOK(@Validated @RequestBody Point resources) { + pointService.update(resources); + return new ResponseEntity<>(HttpStatus.OK); + } + + @DeleteMapping + @Log("删除point") + @ApiOperation("删除point") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePoint(@RequestBody Long[] ids) { + pointService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/queryPoint") + @Log("光电点位状态查询") + @ApiOperation("光电点位状态查询") + @AnonymousAccess + public ResponseEntity queryPoint(@RequestBody String json) { + JSONObject jsonObject = JSON.parseObject(json); + String pointCode = jsonObject.getString("pointCode") == null ? "" : jsonObject.getString("pointCode");//输送线、光电编号 + pointService.queryPoint(pointCode); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/ProductionPlanController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/ProductionPlanController.java new file mode 100644 index 0000000..a6e0f00 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/ProductionPlanController.java @@ -0,0 +1,255 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.basicdata.domain.ProductionPlanVo; +import com.youchain.basicdata.repository.ItemLisRepository; +import com.youchain.basicdata.repository.ProductionPlanRepository; +import com.youchain.basicdata.service.BigItemService; +import com.youchain.basicdata.service.ProductionPlanService; +import com.youchain.basicdata.service.dto.ProductionPlanQueryCriteria; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.inputJson.buttenJson.ProductionPlanButton; +import com.youchain.businessdata.service.SparepartsService; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.DateUtil; +import com.youchain.utils.FileUtil; +import com.youchain.utils.OptionalUtils; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @date 2024-01-04 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "productionPlan管理") +@RequestMapping("/api/productionPlan") +public class ProductionPlanController { + + private final ProductionPlanService productionPlanService; + private final ProductionPlanRepository productionPlanRepository; + private final BigItemService bigItemService; + private final ItemLisRepository itemLisRepository; + private final FileProperties properties; + private final SparepartsService sparepartsService; + + @PostMapping(value = "/import_data") + @ApiOperation("导入生产顺序计划") + @Log("导入生产顺序计划") + @Transactional + @AnonymousAccess + public ResponseEntity createSysAppUpdate(@RequestParam("file") MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + Dept dept = UserUtils.getDept(); + ExcelReader reader = ExcelUtil.getReader(file); + List> readAll = reader.readAll(); + int i = 0;//序号 + Map map = new HashMap();//制造线,序号 + for (i = 0; i < readAll.size(); i++) { + //No 工位 下线日期 IDNO 月度序号 机型 机型名称 国别 机号 备注 + String No = OptionalUtils.getTrimmedString(readAll.get(i),"No",null); + String makeLine = OptionalUtils.getTrimmedString(readAll.get(i),"工位",null); + String downlineDate = OptionalUtils.getTrimmedString(readAll.get(i),"下线日期",null); + String IDNO = OptionalUtils.getTrimmedString(readAll.get(i),"IDNO",null); + String monthlyNo = OptionalUtils.getTrimmedString(readAll.get(i),"月度序号",null); + String bigItemCode =OptionalUtils.getTrimmedString(readAll.get(i),"机型",null); + String machineNo =OptionalUtils.getTrimmedString(readAll.get(i),"机号",null); + String description = OptionalUtils.getTrimmedString(readAll.get(i),"备注",null); + String areaCode =OptionalUtils.getTrimmedString(readAll.get(i),"工位编码",null); + String[] areaCodes=null; + if(areaCode!=null){ + areaCodes=areaCode.split(","); + } + log.info(i+"==="+"idno:"+IDNO); + Long orderNo =1L; + List idnoList = productionPlanRepository.findByIDNO(IDNO); + if (!idnoList.isEmpty()) { + orderNo = idnoList.get(0).getOrderNo(); + } else { + orderNo = productionPlanRepository.getMaxOrderNo(); + if (orderNo==null) { + map.put(makeLine, 1L); + }else{ + orderNo=orderNo+1; + } + } + //判断 status是否为consume状态的 + if(areaCode==null) { + int hyCount = productionPlanRepository.existsHyIdno(makeLine,IDNO); + if (hyCount > 0) { + throw new BadRequestException("大于" + IDNO + "存在已耗用数据"); + } else { + List byMakeLineOrderNo = productionPlanRepository.findByIdnoList(makeLine,IDNO); + productionPlanRepository.deleteAll(byMakeLineOrderNo); + } + }else{ + int hyCount = productionPlanRepository.existsGwHyIdno(makeLine, IDNO,areaCodes); + if (hyCount > 0) { + throw new BadRequestException( "大于" + IDNO + "存在已耗用数据"); + } else { + List byMakeLineOrderNo = productionPlanRepository.findByGwIdnoList(makeLine,IDNO ,areaCodes); + productionPlanRepository.deleteAll(byMakeLineOrderNo); + } + } + List byBigItemList = itemLisRepository.findByBigItemCode(bigItemCode); + if(areaCode!=null){ + byBigItemList = itemLisRepository.findByGwBigCode(bigItemCode,areaCodes); + } + if(byBigItemList.size()==0){ + throw new BadRequestException( bigItemCode + "未找到对应工位清单"); + } + for (ItemLis itemlist : byBigItemList) { + ProductionPlan productionPlan = new ProductionPlan(); + productionPlan.setBigItem(itemlist.getBigItem()); + productionPlan.setType(itemlist.getOutType()); + productionPlan.setWorkingStation(itemlist.getStationType()); + productionPlan.setPartVariety(itemlist.getBpType()); + productionPlan.setRkArea(itemlist.getRArea()); + productionPlan.setDept(dept); + productionPlan.setDescription(description); + productionPlan.setEnabled(itemlist.getEnabled()); + productionPlan.setNo(Integer.valueOf(No)); + productionPlan.setMakeLine(makeLine); + productionPlan.setDownlineDate( new Timestamp(DateUtil.ymd_date(downlineDate).getTime())); + productionPlan.setIdno(IDNO); + productionPlan.setImportDate(new Timestamp (new Date ().getTime())); + productionPlan.setMonthlyNo(monthlyNo); + productionPlan.setMachineNo(machineNo); + productionPlan.setStatue("UN_CONSUME"); + productionPlan.setOrderNo(orderNo); + productionPlanRepository.save(productionPlan); + + } + } + return new ResponseEntity<>("导入成功",HttpStatus.OK); + } + + + @PutMapping(value = "/haoYong") + @ApiOperation("批量耗用") + @Log("批量耗用") + @Transactional + @PreAuthorize("@el.check('super:man')") + public ResponseEntity piLiangHaoYong( @RequestBody ProductionPlanVo productionPlanVo){ + List productionPlans = productionPlanService.piLiangHaoYong(productionPlanVo); + if(productionPlans == null || productionPlans.size() < productionPlanVo.getNumber()){ + return new ResponseEntity(ApiResult.fail(400,"库存不够,无法批量耗用",""), HttpStatus.BAD_REQUEST); + } + productionPlanService.scsxHaoyong(productionPlans,productionPlanVo.getWorkingStation(),"生产顺序计划耗用"); + return new ResponseEntity<>(ApiResult.success("耗用成功!",""), HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportProductionPlan(HttpServletResponse response, ProductionPlanQueryCriteria criteria) throws Exception { + productionPlanService.download(productionPlanService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询productionPlan") + @ApiOperation("查询productionPlan") + @AnonymousAccess + public ResponseEntity queryProductionPlan(ProductionPlanQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(productionPlanService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增productionPlan") + @ApiOperation("新增productionPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createProductionPlan(@Validated @RequestBody ProductionPlan resources) { + return new ResponseEntity<>(productionPlanService.create(resources), HttpStatus.CREATED); + } + @PostMapping("/manualGeneration") + @Log("生产顺序-手工生成") + @ApiOperation("生产顺序-手工生成") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity manualGeneration(@Validated @RequestBody ProductionPlanButton resources) { + if (resources.getManualGeneration().getQuantity() == 0){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "数量不能为0"); + } + ProductionPlan plan=resources.getManualGeneration().getProductionPlan(); + List whyList = productionPlanRepository.getAllData(plan.getWorkingStation(), plan.getIdno()); + int num=resources.getManualGeneration().getQuantity(); + if(whyList.size()("手工生成成功", HttpStatus.CREATED); + } + + @PutMapping + @Log("修改productionPlan") + @ApiOperation("修改productionPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateProductionPlan(@Validated @RequestBody ProductionPlan resources) { + productionPlanService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除productionPlan") + @ApiOperation("删除productionPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteProductionPlan(@RequestBody Long[] ids) { + productionPlanService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/StockController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/StockController.java new file mode 100644 index 0000000..14ef734 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/StockController.java @@ -0,0 +1,205 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.service.StockService; +import com.youchain.basicdata.service.StockTypeService; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.config.FileProperties; +import com.youchain.exception.handler.ApiError; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.FileUtil; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@RestController +@RequiredArgsConstructor +@Slf4j +@Api(tags = "stock管理") +@RequestMapping("/api/stock") +public class StockController { + + private final StockService stockService; + + private final FileProperties properties; + + private final StockTypeService stockTypeService; + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportStock(HttpServletResponse response, StockQueryCriteria criteria) throws Exception { + stockService.download(stockService.queryAll(criteria), response); + } + + @PostMapping(value = "/import_stock") + @ApiOperation("容器导入") + @AnonymousAccess + public ResponseEntity importStock( @RequestParam("file") MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + log.error("--" + properties.getPath().getPath() + type + File.separator); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + log.error("--" + file.getPath()); + //代码、库区 + ExcelReader reader = ExcelUtil.getReader(file); + int i=0; + int edit_len=0; + int new_len=0; + try{ + List> readAll = reader.readAll(); + for ( i = 0; i < readAll.size(); i++) { + int j=0; + String code=readAll.get(i).get("代码").toString().trim(); + String stockTypeCode=readAll.get(i).get("类型").toString().trim(); + StockType st=stockTypeService.findByCode(stockTypeCode); + if(code==null || code.length()<=0){ + break; + } + if(st==null){ + ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),"找不到容器类型"+stockTypeCode); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } + Stock stock=stockService.findByCode(code,null); + if(stock==null){ + stock=new Stock(); + stock.setCode(code); + stock.setName(code); + log.error(j+++"====="); + stock.setStatus(BaseStatus.FREE); + stock.setEnabled(true); + new_len++; + stock.setStockType(st); + log.error(j+++"====="); + stock.setDept(UserUtils.getDept()); + log.error(j+++"====="); + stockService.create(stock); + log.error(j+++"====="); + }else{ + edit_len++; + } + log.error(j+++"a====="); + stock.setStockType(st); + stockService.update(stock); + log.error(j+++"a====="); + } + }catch (Exception e){ + ApiError apiError = ApiError.errorJosn(HttpStatus.BAD_REQUEST.value(), "导入异常---第"+(i+1)+"行:"+e.toString()); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } + + + ApiError apiError = ApiError.errorJosn(HttpStatus.OK.value(), "导入成功:"+(i)+"行 新增("+new_len+")修改("+edit_len+")"); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + + } + + @GetMapping + @Log("查询stock") + @ApiOperation("查询stock") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryStock(StockQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(stockService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("查询可用空闲的容器stock") + @ApiOperation("查询可用空闲的容器stock") + @GetMapping(value = "/queryKyStockList") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryKyStockList(StockQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(stockService.queryKyStockList("124"),HttpStatus.OK); + } + + @PostMapping + @Log("新增stock") + @ApiOperation("新增stock") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createStock(@Validated @RequestBody Stock resources){ + resources.setDept(UserUtils.getDept()); + resources.setEnabled(true); + return new ResponseEntity<>(stockService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改stock") + @ApiOperation("修改stock") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateStock(@Validated @RequestBody Stock resources){ + stockService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @PutMapping("/updateStockOK") + @Log("修改stock") + @ApiOperation("修改stock") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateStockOK(@Validated @RequestBody Stock resources){ + stockService.update(resources); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PutMapping("/updateStockStatus") + @Log("批量修改stock的状态") + @ApiOperation("批量修改stock的状态") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateStockStatus(@Validated @RequestBody List stockList){ + for (Stock s : stockList) { + stockService.update(s); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @DeleteMapping + @Log("删除stock") + @ApiOperation("删除stock") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteStock(@RequestBody Long[] ids) { + stockService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/StockTypeController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/StockTypeController.java new file mode 100644 index 0000000..7e8caf7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/StockTypeController.java @@ -0,0 +1,89 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.service.StockTypeService; +import com.youchain.basicdata.service.dto.StockTypeQueryCriteria; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "stock_type管理") +@RequestMapping("/api/stockType") +public class StockTypeController { + + private final StockTypeService stockTypeService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('stockType:list')") + public void exportStockType(HttpServletResponse response, StockTypeQueryCriteria criteria) throws Exception { + stockTypeService.download(stockTypeService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询stock_type") + @ApiOperation("查询stock_type") + @PreAuthorize("@el.check('stockType:list')") + public ResponseEntity queryStockType(StockTypeQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(stockTypeService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增stock_type") + @ApiOperation("新增stock_type") + @PreAuthorize("@el.check('stockType:add')") + public ResponseEntity createStockType(@Validated @RequestBody StockType resources){ + resources.setDept(UserUtils.getDept()); + return new ResponseEntity<>(stockTypeService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改stock_type") + @ApiOperation("修改stock_type") + @PreAuthorize("@el.check('stockType:edit')") + public ResponseEntity updateStockType(@Validated @RequestBody StockType resources){ + stockTypeService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除stock_type") + @ApiOperation("删除stock_type") + @PreAuthorize("@el.check('stockType:del')") + public ResponseEntity deleteStockType(@RequestBody Long[] ids) { + stockTypeService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/rest/TableConfigController.java b/youchain-system/src/main/java/com/youchain/basicdata/rest/TableConfigController.java new file mode 100644 index 0000000..cb6c3be --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/rest/TableConfigController.java @@ -0,0 +1,113 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.TableConfig; +import com.youchain.basicdata.service.TableConfigService; +import com.youchain.basicdata.service.dto.TableConfigDto; +import com.youchain.basicdata.service.dto.TableConfigQueryCriteria; +import com.youchain.utils.SecurityUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author LiuXue +* @date 2023-08-28 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "tableconfig管理") +@RequestMapping("/api/tableConfig") +public class TableConfigController { + + private final TableConfigService tableConfigService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('tableConfig:list')") + public void exportTableConfig(HttpServletResponse response, TableConfigQueryCriteria criteria) throws Exception { + tableConfigService.download(tableConfigService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询tableconfig") + @ApiOperation("查询tableconfig") + @PreAuthorize("@el.check('tableConfig:list')") + public ResponseEntity queryTableConfig(TableConfigQueryCriteria criteria, Pageable pageable){ + criteria.setCreateBy(SecurityUtils.getCurrentUsername()); + return new ResponseEntity<>(tableConfigService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @GetMapping("/All") + @Log("查询tableconfig") + @ApiOperation("查询tableconfig") + @AnonymousAccess + public ResponseEntity queryTableConfigOne(TableConfigQueryCriteria criteria, Pageable pageable){ + criteria.setCreateBy("admin"); + List tableConfigDtos= tableConfigService.queryAll(criteria); + return new ResponseEntity<>(tableConfigDtos,HttpStatus.OK); + } + + @PostMapping + @Log("新增tableconfig") + @ApiOperation("新增tableconfig") + @PreAuthorize("@el.check('tableConfig:add')") + public ResponseEntity createTableConfig(@Validated @RequestBody TableConfig resources){ + if(!SecurityUtils.getCurrentUsername().equals("admin")){ + return new ResponseEntity<>("仅限管理员使用",HttpStatus.BAD_REQUEST); + } + if(resources.getTableType()==null||resources.getTableType().length()<=0||"".equals(resources.getTableType())){ + return new ResponseEntity<>("TableKey异常",HttpStatus.BAD_REQUEST); + } + resources.setCreateBy("admin"); + return new ResponseEntity<>(tableConfigService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改tableconfig") + @ApiOperation("修改tableconfig") + @PreAuthorize("@el.check('tableConfig:edit')") + public ResponseEntity updateTableConfig(@Validated @RequestBody TableConfig resources){ + if(!SecurityUtils.getCurrentUsername().equals("admin")){ + return new ResponseEntity<>("仅限管理员使用",HttpStatus.BAD_REQUEST); + } + tableConfigService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除tableconfig") + @ApiOperation("删除tableconfig") + @PreAuthorize("@el.check('tableConfig:del')") + public ResponseEntity deleteTableConfig(@RequestBody Integer[] ids) { + tableConfigService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java new file mode 100644 index 0000000..14482ab --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/AreaService.java @@ -0,0 +1,94 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.AreaQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author HJL +* @date 2023-08-14 +**/ +public interface AreaService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(AreaQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(AreaQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return AreaDto + */ + AreaDto findById(Long id); + + Area findEntityById(Long id); + + /** + * 根据code查询 + * @param code + * @return + */ + Area findByCode(String code); + + /** + * 创建 + * @param resources / + * @return AreaDto + */ + AreaDto create(Area resources); + + /** + * 编辑 + * @param resources / + */ + void update(Area resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + List getAreas(String type); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanDetailService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanDetailService.java new file mode 100644 index 0000000..c206486 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanDetailService.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailDto; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-04-07 +**/ +public interface AutomaticPlanDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(AutomaticPlanDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(AutomaticPlanDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return AutomaticPlanDetailDto + */ + AutomaticPlanDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return AutomaticPlanDetailDto + */ + AutomaticPlanDetailDto create(AutomaticPlanDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(AutomaticPlanDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; + + /** + * 保存计划明细 + * @param automaticPlanning + */ + AutomaticPlanDetail storeAutomaticPlanDetail(AutomaticPlanning automaticPlanning); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanningService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanningService.java new file mode 100644 index 0000000..1b48bf1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/AutomaticPlanningService.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.service.dto.AutomaticPlanningDto; +import com.youchain.basicdata.service.dto.AutomaticPlanningQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author JiangKun +* @date 2024-01-05 +**/ +public interface AutomaticPlanningService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(AutomaticPlanningQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(AutomaticPlanningQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return AutomaticPlanningDto + */ + AutomaticPlanningDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return AutomaticPlanningDto + */ + AutomaticPlanningDto create(AutomaticPlanning resources); + + /** + * 编辑 + * @param resources / + */ + void update(AutomaticPlanning resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/BigItemService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/BigItemService.java new file mode 100644 index 0000000..2f3b039 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/BigItemService.java @@ -0,0 +1,85 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.service.dto.BigItemDto; +import com.youchain.basicdata.service.dto.BigItemQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2023-12-29 +**/ +public interface BigItemService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BigItemQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BigItemQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return BigItemDto + */ + BigItemDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return BigItemDto + */ + BigItemDto create(BigItem resources); + + /** + * 编辑 + * @param resources / + */ + void update(BigItem resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + List getBigItem(String type); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/BillTypeService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/BillTypeService.java new file mode 100644 index 0000000..da7dfbc --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/BillTypeService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.basicdata.service.dto.BillTypeQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-08-07 +**/ +public interface BillTypeService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BillTypeQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BillTypeQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return BillTypeDto + */ + BillTypeDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return BillTypeDto + */ + BillTypeDto create(BillType resources); + + /** + * 编辑 + * @param resources / + */ + void update(BillType resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountLogService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountLogService.java new file mode 100644 index 0000000..92213c7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountLogService.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.BomAccountLog; +import com.youchain.basicdata.service.dto.BomAccountLogDto; +import com.youchain.basicdata.service.dto.BomAccountLogQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-04-24 +**/ +public interface BomAccountLogService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BomAccountLogQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BomAccountLogQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return BomAccountLogDto + */ + BomAccountLogDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return BomAccountLogDto + */ + BomAccountLogDto create(BomAccountLog resources); + + /** + * 编辑 + * @param resources / + */ + void update(BomAccountLog resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; + + /** + * 复制记录生成日志 + * @param id + * @param operType + */ + void copyBomAccount(Long id, String operType); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountService.java new file mode 100644 index 0000000..dc539a5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/BomAccountService.java @@ -0,0 +1,132 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.dto.BomAccountDto; +import com.youchain.basicdata.service.dto.BomAccountPointDto; +import com.youchain.basicdata.service.dto.BomAccountQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2024-01-02 +**/ +public interface BomAccountService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BomAccountQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BomAccountQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return BomAccountDto + */ + BomAccountDto findById(Long id); + + /** + * 根据ID查找对象 + * @param id + * @return + */ + BomAccount findByEntity(Long id); + + /** + * 创建 + * @param resources / + * @return BomAccountDto + */ + BomAccountDto create(BomAccount resources); + + /** + * 编辑 + * @param resources / + */ + void update(BomAccount resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + List queryBigItemByType(String stationType); + /**得到品番*/ + List queryItemByArea(Long areaId); + + + List queryByArea(Long areaId); + + List queryBomAccountPoints(); + + /*** + * 查询是否有对应的BOM工位清单 + * @param bigItemId + * @param jsAreaId + * @return + */ + List queryBomAccount(Long bigItemId,Long jsAreaId,String gw); + /*** + * 备货计划生成对应的备货操作明细数据 + * @param code + * @param shAreaId + * @param bp_type + * @return + */ + + List queryBomAccountList(String code,Long outAreaId, Long shAreaId,String bp_type,String type); + + List bomAccountAreas(String code, Long shAreaId,String bp_type,String type); + /** + * 根据条件进行查询 + */ + List queryBomAccountList(BomAccount bomAccount); + + /** + * 批量更新BOM的批次需求数,以便分批计算 + * @param areaId + */ + void updateBatch(Long areaId); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/BoxService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/BoxService.java new file mode 100644 index 0000000..8cb5e80 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/BoxService.java @@ -0,0 +1,130 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.BoxDto; +import com.youchain.basicdata.service.dto.BoxQueryCriteria; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.businessdata.domain.Task; +import org.springframework.data.domain.Pageable; + +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** + * @author huojin + * @website https://eladmin.vip + * @description 服务接口 + * @date 2023-08-17 + **/ +public interface BoxService { + + /** + * 查询数据分页 + * + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BoxQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * + * @param criteria 条件参数 + * @return List + */ + List queryAll(BoxQueryCriteria criteria); + + /** + * 根据ID查询 + * + * @param id ID + * @return BoxDto + */ + BoxDto findById(Long id); + + /** + * 创建 + * + * @param resources / + * @return BoxDto + */ + BoxDto create(Box resources); + + /** + * 编辑 + * + * @param resources / + */ + void update(Box resources); + + /** + * 多选删除 + * + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 根据物料ID查询按钮盒 + * + * @param ItemId + * @return + */ + Box getBoxByItem(long ItemId); + + /** + * 根据按钮盒编号查询按钮盒 + * + * @param code + * @return + */ + Box getBoxByCode(String code); + + Box toEntity(BoxDto boxDto); + + void refreshPointStatus(); + + /** + * 根据点位编号、物料编号、工单号查询按钮盒 + * + * @param pointCode + * @return + */ + Box getBoxByPointCode(String pointCode); + + List queryBoxList(String areaName); + + void callTrolley(PointDto pointDto, String pointCode); + + Task createTask(Item item, Stock stock, Point endPoint); +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/DesignListService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/DesignListService.java new file mode 100644 index 0000000..c9ed6cc --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/DesignListService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.DesignList; +import com.youchain.basicdata.service.dto.DesignListDto; +import com.youchain.basicdata.service.dto.DesignListQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author LY +* @date 2024-04-26 +**/ +public interface DesignListService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(DesignListQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(DesignListQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return DesignListDto + */ + DesignListDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return DesignListDto + */ + DesignListDto create(DesignList resources); + + /** + * 编辑 + * @param resources / + */ + void update(DesignList resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ImportDataService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ImportDataService.java new file mode 100644 index 0000000..36438ad --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ImportDataService.java @@ -0,0 +1,58 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.AreaQueryCriteria; +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.PickTicket; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @description 导入接口 +* @author HJL +* @date 2023-08-14 +**/ +public interface ImportDataService { + /** + * 导入Bom工位 + */ + void importBomAccount(int row,Map readAll); + + /** + * + * @param stringObjectMap + * @return + */ + String importItem(Map stringObjectMap); + + String importBigItem(Map stringObjectMap); + + String importAsnDetail(Map readAll, Asn asn); + + String importPickDetail(Map readAll, PickTicket pickTicket); + void importPickInstruction(List> readAll); + + void importCountMoveDetail(Long countId,List> readAll); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ItemLisService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemLisService.java new file mode 100644 index 0000000..d2f0592 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemLisService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.service.dto.ItemLisDto; +import com.youchain.basicdata.service.dto.ItemLisQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2024-01-03 +**/ +public interface ItemLisService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ItemLisQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ItemLisQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ItemLisDto + */ + ItemLisDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return ItemLisDto + */ + ItemLisDto create(ItemLis resources); + + /** + * 编辑 + * @param resources / + */ + void update(ItemLis resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ItemRelationService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemRelationService.java new file mode 100644 index 0000000..7979f12 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemRelationService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.ItemRelation; +import com.youchain.basicdata.service.dto.ItemRelationDto; +import com.youchain.basicdata.service.dto.ItemRelationQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2024-01-04 +**/ +public interface ItemRelationService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ItemRelationQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ItemRelationQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ItemRelationDto + */ + ItemRelationDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return ItemRelationDto + */ + ItemRelationDto create(ItemRelation resources); + + /** + * 编辑 + * @param resources / + */ + void update(ItemRelation resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ItemService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemService.java new file mode 100644 index 0000000..ef8a64b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ItemService.java @@ -0,0 +1,115 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service; + +import com.youchain.appupdate.service.dto.SysAppUpdateDto; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.ItemQueryCriteria; +import com.youchain.basicdata.service.dto.ItemSmallDto; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.service.dto.PickDetailDto; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** + * @website https://eladmin.vip + * @description 服务接口 + * @author houjianlan + * @date 2023-08-07 + **/ +public interface ItemService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ItemQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ItemQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ItemDto + */ + ItemDto findById(Long id); + + /** + * 根据ID查询 + * @param id ID + * @return ItemDto + */ + Item findByItemId(Long id); + + ItemDto findByCode(String itemCode); + + /** + * 创建 + * @param resources / + * @return ItemDto + */ + ItemDto create(Item resources); + + + + /** + * 编辑 + * @param resources / + */ + void update(Item resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + *dto转实体 + * @param itemDto + * @return + */ + Item toEntity(ItemDto itemDto); + + /** + *查找物料是否存在 + * @param itemCode + * @return + */ + Item existItem(String itemCode); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/PointService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/PointService.java new file mode 100644 index 0000000..700b5d5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/PointService.java @@ -0,0 +1,165 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.PointQueryCriteria; +import com.youchain.basicdata.service.dto.PointSmallDto; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author liuxue +* @date 2023-07-26 +**/ +public interface PointService { + + /** + * 查询pointList + * @param type 1 查询 + * @return + */ + List getPointList(String type); + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PointQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PointQueryCriteria criteria); + + + /** + * 查询所有数据不分页 + * @return List + */ + List queryKyPointList(); + + /** + * 根据ID查询 + * @param id ID + * @return PointDto + */ + PointDto findById(Long id); + + /** + * 根据ID查询 + * @param id ID + * @return PointDto + */ + Point findEntityById(Long id); + + /** + * 创建 + * @param resources / + * @return PointDto + */ + PointDto create(Point resources); + + /** + * 编辑 + * @param resources / + */ + void update(Point resources); + + /** + * 检验库位编码 是否存在,如果不存在就新增一个 + * @param resources + * @param type + * @param area + * @return + */ + Point extracted(Point resources, String type, Area area); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + *dto转实体 + * @param pointDto + * @return + */ + Point toEntity(PointDto pointDto); + + + void queryPoint(String pointCode); + + + List getPoint(String type,String areaCode); + /** + * 得到指定点位 + * @param code + * @param status + * @param type + * @param areaName + * @return + */ + Point getPoint(String code,String status,String type,String areaCode); + + /** + * 查询空点位 + * @return + */ + Point getPointByFree(String areaName,String goodType); + + /** + * 查询空点位后桶的 + * @return + */ + Point getPointByFreeH(String areaName,String goodType); + /** + * 查询空点位前桶的 + * @return + */ + Point getPointByFreeQ(String areaName,String goodType); + + /** + * 自动生成库位 + * @param code + * @param type + * @param area + * @return + */ + Point createPoint(String code,String type,Area area); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/ProductionPlanService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/ProductionPlanService.java new file mode 100644 index 0000000..52eeda0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/ProductionPlanService.java @@ -0,0 +1,114 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.basicdata.domain.ProductionPlanVo; +import com.youchain.basicdata.service.dto.ProductionPlanDto; +import com.youchain.basicdata.service.dto.ProductionPlanQueryCriteria; +import com.youchain.businessdata.inputJson.buttenJson.ProductionPlanButton; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author JiangKun +* @date 2024-01-04 +**/ +public interface ProductionPlanService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ProductionPlanQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ProductionPlanQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ProductionPlanDto + */ + ProductionPlanDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return ProductionPlanDto + */ + ProductionPlanDto create(ProductionPlan resources); + + /** + * 编辑 + * @param resources / + */ + void update(ProductionPlan resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 手工生成 + * + */ + + String manualGenerationSavePlanPick(List plans, int num, String batch, AutomaticPlanDetail detail, Boolean isLast, Timestamp batchTime); + + /** + * 批量耗用查询 + */ + List piLiangHaoYong(ProductionPlanVo productionPlanVo); + + /** + * 根据数量获取截止IdNO + * @param gw + * @param qty + * @return + */ + HashMap getEndIdNO(String gw, int qty); + /** + * 批量耗用 + */ + void scsxHaoyong(List productionPlans,String gw,String des); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/StockService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/StockService.java new file mode 100644 index 0000000..8ebad32 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/StockService.java @@ -0,0 +1,135 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.basicdata.service.dto.StockSmallDto; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.businessdata.domain.AsnDetail; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author liuxue +* @date 2023-07-28 +**/ +public interface StockService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(StockQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(StockQueryCriteria criteria); + + /** + * 查询所有数据不分页 + * @param code 条件参数 + * @return List + */ + List queryKyStockList(String code); + + List queryStockList2(String code); + + /** + * 根据ID查询 + * @param id ID + * @return StockDto + */ + StockDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return StockDto + */ + StockDto create(Stock resources); + + /** + * 编辑 + * @param resources / + */ + void update(Stock resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + *dto转实体 + * @param stockDto + * @return + */ + Stock toEntity(StockDto stockDto); + /** + * 根据code查找容器 + * @param code + * @param status + * @return + */ + Stock findByCode(String code, String status); + + + /** + * 根据点位code查找容器 + * @param code + * @return + */ + Stock findByPointCode(String code); + + /** + * 查询已绑定的空料车 + * @return + */ + Stock findByKStock(String areaName); + + /** + * 查询空闲已入场可用的容器 + * @param areaName + * @return + */ + Stock findStockByPoint(String areaName); + + List findByKStockList(String areaName); + +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/StockTypeService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/StockTypeService.java new file mode 100644 index 0000000..eebf1f1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/StockTypeService.java @@ -0,0 +1,96 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.service.dto.StockTypeDto; +import com.youchain.basicdata.service.dto.StockTypeQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author liuxue +* @date 2023-07-28 +**/ +public interface StockTypeService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(StockTypeQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(StockTypeQueryCriteria criteria); + + + Map queryAll(); + + + /** + * 根据ID查询 + * @param id ID + * @return StockTypeDto + */ + StockTypeDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return StockTypeDto + */ + StockTypeDto create(StockType resources); + + /** + * 编辑 + * @param resources / + */ + void update(StockType resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + + /** + * 根据code查找容器类型 + * @param code + * @return + */ + StockType findByCode(String code); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/TableConfigService.java b/youchain-system/src/main/java/com/youchain/basicdata/service/TableConfigService.java new file mode 100644 index 0000000..78d8338 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/TableConfigService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service; + +import com.youchain.basicdata.domain.TableConfig; +import com.youchain.basicdata.service.dto.TableConfigDto; +import com.youchain.basicdata.service.dto.TableConfigQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author LiuXue +* @date 2023-08-28 +**/ +public interface TableConfigService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TableConfigQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TableConfigQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TableConfigDto + */ + TableConfigDto findById(Integer id); + + /** + * 创建 + * @param resources / + * @return TableConfigDto + */ + TableConfigDto create(TableConfig resources); + + /** + * 编辑 + * @param resources / + */ + void update(TableConfig resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Integer[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaDto.java new file mode 100644 index 0000000..3dc86e4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaDto.java @@ -0,0 +1,99 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.Point; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author HJL +* @date 2023-08-14 +**/ +@Data +public class AreaDto implements Serializable { + + private Long id; + + /** 库区编号 */ + private String code; + + /** 库区名称 */ + private String name; + + /** 描述 */ + private String description; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 热度值 */ + private Double heat; + + /** 坐标X */ + private Double posX; + + /** 坐标Y */ + private Double posY; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 序列号 */ + private String sequenceNo; + + /** org编号 */ + private String orgCode; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 更新时间 */ + private Timestamp updateTime; + + /** 所属工位 */ + private String workingStation; +// /** 缓存库位 */ +// private PointDto point; + /** 所属工位 */ + private String pointId; + /** 缓存库位 */ + private String pointCode; + /** 线边接收 */ + private Boolean bexb; + + /** 收货仓库 */ + private Boolean besh; + + /** 制造库位耗用 */ + private Boolean bezz; + + /**收货担当*/ + private String shdd; + /**工厂*/ + private String gcCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaQueryCriteria.java new file mode 100644 index 0000000..992ac00 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaQueryCriteria.java @@ -0,0 +1,59 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** + * @website https://eladmin.vip + * @author HJL + * @date 2023-08-14 + **/ +@Data +public class AreaQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + @Query(type = Query.Type.INNER_LIKE) + private String gcCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 模糊 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; + + /** 模糊 */ + @Query() + private Double heat; + + /** 是否收货 */ + @Query(type = Query.Type.EQUAL) + private Boolean besh; + + + /** 线边接收 */ + @Query(type = Query.Type.EQUAL) + private Boolean bexb; + + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaSmallDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaSmallDto.java new file mode 100644 index 0000000..241eaf7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AreaSmallDto.java @@ -0,0 +1,48 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.base.BaseDTO; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-21 +**/ +@Getter +@Setter +public class AreaSmallDto extends BaseDTO implements Serializable { + + private Integer id; + + /** 库区编号 */ + private String code; + + /** 库区名称 */ + private String name; + + /** 坐标X */ + private Double posX; + + /** 所属工位 */ + private String workingStation; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailDto.java new file mode 100644 index 0000000..b6e73c6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailDto.java @@ -0,0 +1,86 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Date; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-07 +**/ +@Data +public class AutomaticPlanDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 铺线计划ID */ + private Long automaticPlanningId; + + /** 收货仓库 */ + private Long shAreaId; + + /** 辅线数量 */ + private Integer fxQuantity; + + /** 计划数量 */ + private Integer jhQuantity; + + /** 耗用数量 */ + private Integer hyQuantity; + + /** 仓库ID */ + private Long deptId; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改日期 */ + private Timestamp updateTime; + + private Integer batchNum=0; + + private String startNum; + + private String endNum; + + private String hyStartNum; + + private String hyEndNum; + + private Date jhDate; + private Integer shHour=0; + private Integer sxQuantity; + private String zdStartNum; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailQueryCriteria.java new file mode 100644 index 0000000..0101a29 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanDetailQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-07 +**/ +@Data +public class AutomaticPlanDetailQueryCriteria{ + + /** 精确 */ + @Query + private Long automaticPlanningId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningDto.java new file mode 100644 index 0000000..198725a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningDto.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Date; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-05 +**/ +@Data +public class AutomaticPlanningDto implements Serializable { + + /** ID */ + private Long id; + private String code; + private String status; + + /** 收货仓库 */ + private AreaDto shArea; + + /** 辅线数量 */ + private Integer fxQuantity; + + /** 计划数量 */ + private Integer jhQuantity; + + /** 耗用数量 */ + private Integer hyQuantity; + + /** 仓库ID */ + private Long deptId; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改日期 */ + private Timestamp updateTime; + + private Integer batchNum=0; + + private String startNum; + + private String endNum; + + private String hyStartNum; + + private String hyEndNum; + + private Date jhDate; + + private Integer sxQuantity; + + private Boolean isSx; + private Integer shHour=0; + private Boolean isEnd; + private String zdStartNum; + private String scEndNum; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningQueryCriteria.java new file mode 100644 index 0000000..0fff58f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/AutomaticPlanningQueryCriteria.java @@ -0,0 +1,45 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-05 +**/ +@Data +public class AutomaticPlanningQueryCriteria{ + /** 模糊 */ + @Query(propName = "code",joinName = "shArea",type = Query.Type.INNER_LIKE) + private String shAreaCode; + + @Query(propName = "gcCode",joinName = "shArea",type = Query.Type.INNER_LIKE) + private String gcCode; + + @Query(propName = "isSx",type = Query.Type.EQUAL) + private Boolean isSx; + + @Query(propName = "status",type = Query.Type.EQUAL) + private String status; + + @Query(joinName = "area",propName = "name",type = Query.Type.IN) + private List areaNames; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemDto.java new file mode 100644 index 0000000..85b6c6a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemDto.java @@ -0,0 +1,69 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2023-12-29 +**/ +@Data +public class BigItemDto implements Serializable { + + /** ID */ + private Long id; + + /** 完成品品番 */ + private String code; + + /** 完成形式名 */ + private String name; + + /** 机种 */ + private String models; + + /** 国别 */ + private String country; + + /** 出库类型 */ + private String outboundType; + + /** 仓库ID */ + private Long deptId; + + /** 是否启用 */ + private Boolean enabled; + + /** 描述 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemQueryCriteria.java new file mode 100644 index 0000000..268d885 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BigItemQueryCriteria.java @@ -0,0 +1,53 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-12-29 +**/ +@Data +public class BigItemQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String models; + + /** 精确 */ + @Query + private String country; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String outboundType; + + /** 精确 */ + @Query + private Boolean enabled; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeDto.java new file mode 100644 index 0000000..3e7ac35 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeDto.java @@ -0,0 +1,71 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-07 +**/ +@Data +public class BillTypeDto implements Serializable { + + /** ID */ + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 前缀 */ + private String prefix; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 类型 */ + private String type; + + /** 是否启用 */ + private Boolean enabled; + + /** 来源名称 */ + private String sourceName; + + /** 来源序号 */ + private Long sourceId; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeQueryCriteria.java new file mode 100644 index 0000000..83bbc0b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BillTypeQueryCriteria.java @@ -0,0 +1,44 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-07 +**/ +@Data +public class BillTypeQueryCriteria{ + /** 代码 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 名称 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 类型 */ + @Query(type = Query.Type.EQUAL) + private String type; + + /** 是否启用 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java new file mode 100644 index 0000000..c20a01f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountDto.java @@ -0,0 +1,101 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-02 +**/ +@Data +public class BomAccountDto implements Serializable { + + /** ID */ + private Long id; + + /** 完成品品番 */ + private BigItemDto bigItem; + + /** 部品品番 */ + private ItemDto item; + + /** 加工内容 */ + private String contents; + + /** 单用 */ + private Integer singles; + + /** 接收仓库 */ + private AreaDto rArea; + + /** 出库仓库 */ + private AreaDto cArea; + + /** 出库类型 */ + private String outType; + + /** 工位 */ + private String stationType; +// private String out_type; + /** 部品种类 */ + private String bp_type; + + /** 缓存库位 */ + private PointDto hPoint; + + /** 仓库ID */ + private DeptDto dept; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 描述 */ + private String description; + + /** A/C */ + private String ac; + + /** 税别 */ + private String bonded; + + /** 制造库位 */ + private PointDto zPoint; + + /** + * 供应商 + */ + private String supplier; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogDto.java new file mode 100644 index 0000000..3603266 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogDto.java @@ -0,0 +1,104 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-24 +**/ +@Data +public class BomAccountLogDto implements Serializable { + + /** ID */ + private Long id; + + /** 完成品品番 */ + private BigItemDto bigItem; + + /** 部品品番 */ + private ItemDto item; + + /** 加工内容 */ + private String contents; + + /** 单用 */ + private Integer singles; + + /** 接收仓库 */ + private AreaDto rArea; + + /** 出库仓库 */ + private AreaDto cArea; + + /** 出库类型 */ + private String outType; + + /** 工位 */ + private String stationType; +// private String out_type; + /** 部品种类 */ + private String bp_type; + + /** 缓存库位 */ + private PointDto hPoint; + + /** 仓库ID */ + private DeptDto dept; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 描述 */ + private String description; + + /** A/C */ + private String ac; + + /** 税别 */ + private String bonded; + + /** 制造库位 */ + private PointDto zPoint; + /** + * 供应商 + */ + private String supplier; + + /** BOMID */ + private Long bomAccountId; + + /** 操作类型 */ + private String operType; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogQueryCriteria.java new file mode 100644 index 0000000..9e5e08a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountLogQueryCriteria.java @@ -0,0 +1,62 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-24 +**/ +@Data +public class BomAccountLogQueryCriteria{ + + /** 精确 */ + @Query + private String operType; + /** 模糊 */ + @Query(propName = "code",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemCode; + @Query(propName = "name",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemName; + @Query(propName = "code",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemCode; + @Query(propName = "name",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemName; + @Query(propName = "code",joinName = "rArea",type = Query.Type.INNER_LIKE) + private String rAreaCode; + @Query(propName = "besh",joinName = "rArea",type = Query.Type.EQUAL) + private Boolean rAreaBesh; + @Query(propName = "bexb",joinName = "rArea",type = Query.Type.EQUAL) + private Boolean rAreaBexb; + @Query(propName = "code",joinName = "cArea",type = Query.Type.INNER_LIKE) + private String cAreaCode; + @Query(propName = "code",joinName = "zPoint",type = Query.Type.INNER_LIKE) + private String zPointCode; + /** 精确 */ + @Query + private String out_type; + @Query(type = Query.Type.BETWEEN) + private List createTime; + /** 精确 */ + @Query(type = Query.Type.EQUAL) + private String stationType; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountPointDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountPointDto.java new file mode 100644 index 0000000..8a43ead --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountPointDto.java @@ -0,0 +1,41 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-17 +**/ +@Data +public class BomAccountPointDto implements Serializable { + private Long bom_account_id; + private Long item_id; + private String item_code; + private String item_name; + private double srs; + private Long rk_id; + private String gw_code; + private String gw_name; + private Long zzkw_id; + private String zzkw_code; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java new file mode 100644 index 0000000..57a682c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BomAccountQueryCriteria.java @@ -0,0 +1,61 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-02 +**/ +@Data +public class BomAccountQueryCriteria{ + /** 模糊 */ + @Query(propName = "code",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemCode; + @Query(propName = "name",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemName; + @Query(propName = "code",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemCode; + @Query(propName = "name",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemName; + @Query(propName = "code",joinName = "rArea",type = Query.Type.INNER_LIKE) + private String rAreaCode; + @Query(propName = "besh",joinName = "rArea",type = Query.Type.EQUAL) + private Boolean rAreaBesh; + @Query(propName = "bexb",joinName = "rArea",type = Query.Type.EQUAL) + private Boolean rAreaBexb; + @Query(propName = "code",joinName = "cArea",type = Query.Type.INNER_LIKE) + private String cAreaCode; + @Query(propName = "code",joinName = "zPoint",type = Query.Type.INNER_LIKE) + private String zPointCode; + /** 精确 */ + @Query + private String out_type; + @Query(type = Query.Type.BETWEEN) + private List createTime; + /** 精确 */ + @Query(type = Query.Type.EQUAL) + private String stationType; + + @Query + private String outType; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxDto.java new file mode 100644 index 0000000..591ca7b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxDto.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2023-08-17 +**/ +@Data +public class BoxDto implements Serializable { + + /** ID */ + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 物料 */ + + private ItemDto item; + + /** 点位*/ + private PointDto point; + + /** 是否启用*/ + private Boolean enabled; + + /** 工单号*/ + private String orderNumber; + + /** 排序*/ + private String sort; + + /** 仓库*/ + private Dept dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + /** + * IP + */ + private String iP; + /** + * 指示灯状态 + */ + private String lampStatus; + /** + * 按钮盒编号 + */ + private String lampCode; +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxQueryCriteria.java new file mode 100644 index 0000000..896e640 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/BoxQueryCriteria.java @@ -0,0 +1,49 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-17 +**/ +@Data +public class BoxQueryCriteria{ + /** 代码 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 物料编号 */ + @Query(propName = "code",joinName = "item") + private String itemCode; + + /** 点位编号 */ + @Query(propName = "code",joinName = "point") + private String pointCode; + + /** 库区名称 */ + @Query(propName = "name",joinName = "point>area>",type = Query.Type.EQUAL) + private String areaName; + + + /** 是否启用 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListDto.java new file mode 100644 index 0000000..d7ff560 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListDto.java @@ -0,0 +1,118 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.Item; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author LY +* @date 2024-04-26 +**/ +@Data +public class DesignListDto implements Serializable { + + /** id */ + private Long id; + + /** no */ + private String no; + + /** 変通No.11桁 */ + private String chaseCenter; + + /** 设变号 */ + private String contraposition; + + /** 一括番号 */ + private String designation; + + /** 关联设变 */ + private String hypothesis; + + /** 供应商代码 */ + private String supplierCode; + + /** 供应商名称 */ + private String supplierName; + + /** A/C */ + private String ac; + + /** 加工内容 */ + private String content; + + /** 品名(中文) */ + private String productName; + + /** 单用 */ + private Integer useSingly; + + /** 订货要否 */ + private Boolean enable; + + /** 纳所 */ + private String naso; + + /** 月产量 */ + private String monthlyOutput; + + /** T型式代码 */ + private String tTypeCode; + + /** T型式名 */ + private String tTypeName; + + /** 旧品处理 */ + private String scrapDisposal; + + /** 系统实施日 */ + private String implementationDate; + + + /** 完成品品番 */ + private BigItem bigItem; + + /** 新品番 */ + private Item nitem; + + /** 旧品番 */ + private Item oitem; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + private String oldItemCode; + private String newItemCode; + private String bigItemCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListQueryCriteria.java new file mode 100644 index 0000000..6898b82 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/DesignListQueryCriteria.java @@ -0,0 +1,29 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author LY +* @date 2024-04-26 +**/ +@Data +public class DesignListQueryCriteria{ +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java new file mode 100644 index 0000000..073f6fc --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemDto.java @@ -0,0 +1,159 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.StockType; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @website https://eladmin.vip + * @description / + * @author houjianlan + * @date 2023-08-07 + **/ +@Data +public class ItemDto implements Serializable { + + /** ID */ + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 规格 */ + private String specs; + + /** 客户ID */ + private Long structureId; + + /** 描述 */ + private String description; + + /** 是否发动机 */ + private Boolean isAttribute1; + /** 是否预备货 */ + private Boolean isAttribute2; + /** 状态 */ + private Boolean enabled; + + /** 保质期 */ + private Integer validPeriod; + + /** 预警天数 */ + private Integer alertLeadingDays; + + /** 大类 */ + private String largeClass; + + /** 中类 */ + private String centerClass; + + /** 小类 */ + private String smallClass; + + /** 物料类型 */ + private String goodType; + + /** 长 */ + private Double length; + + /** 宽 */ + private Double width; + + /** 高 */ + private Double height; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double volume; + + /** 单位 */ + private String unit; + + /** 大单位 */ + private String masterUnit; + + /** 包装系数 */ + private Integer packNumber; + + /** 条码 */ + private String barCode; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 来源名称 */ + private String sourceName; + + /** 来源序号 */ + private Long sourceId; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 容器类型 */ + private StockType stockType; + + private Long extendNum1; + + private Long extendNum2; + + private Long extendNum3; + + private Long extendNum4; + + private Long extendNum5; + + private Double extendD1; + + private Double extendD2; + + private Double extendD3; + + private Double extendD4; + + private Double extendD5; + + private String extendStr1; + + private String extendStr2; + + private String extendStr3; + + private String extendStr4; + + private String extendStr5; + + private PointDto point; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisDto.java new file mode 100644 index 0000000..365059d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisDto.java @@ -0,0 +1,71 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-03 +**/ +@Data +public class ItemLisDto implements Serializable { + + /** ID */ + private Long id; + + /** 完成品番 */ + private BigItem bigItem; + + /** 出库类型 */ + private String outType; + + /** 部品种类 */ + private String bpType; + + /** 入库库区 */ + private AreaDto rArea; + + /** 仓库ID */ + private Dept dept; + + /** 描述 */ + private String description; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 工位 */ + private String stationType; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisQueryCriteria.java new file mode 100644 index 0000000..9e739c4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemLisQueryCriteria.java @@ -0,0 +1,46 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-03 +**/ +@Data +public class ItemLisQueryCriteria{ + + /** 模糊 */ + @Query(propName = "code",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemCode; + @Query(propName = "name",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemName; + /** 精确 */ + @Query + private String outType; + + /** 精确 */ + @Query + private String stationType; + + /** 模糊 */ + @Query(propName = "code",joinName = "area",type = Query.Type.INNER_LIKE) + private String rAreaCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemQueryCriteria.java new file mode 100644 index 0000000..b94a8ea --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemQueryCriteria.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@Data +public class ItemQueryCriteria{ + + /** 代码 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 名称 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 类型 */ + @Query(type = Query.Type.INNER_LIKE) + private String goodType; + + /** 规格 */ + @Query(type = Query.Type.INNER_LIKE) + private String specs; + + /** 组合编码 */ + @Query(type = Query.Type.INNER_LIKE) + private String largeClass; + + /** 是否启用 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; + + /** 模糊 */ + @Query(propName = "code",joinName = "point",type = Query.Type.INNER_LIKE) + private String pointCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationDto.java new file mode 100644 index 0000000..58d8d45 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationDto.java @@ -0,0 +1,76 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.Item; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2024-01-04 +**/ +@Data +public class ItemRelationDto implements Serializable { + + /** ID */ + private Long id; + + /** 供应商 */ + private Long beSupplier; + + /** key */ + private String barCode; + + /** 品番 */ + private Item item; + + /** 纳入场所 */ + private String code; + + /** 门 */ + private String door; + + /** 箱种 */ + private String type; + + /** 收容数 */ + private Double quantity; + + /** 仓库ID */ + private Long deptId; + + /** 描述 */ + private String description; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationQueryCriteria.java new file mode 100644 index 0000000..a739664 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemRelationQueryCriteria.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +@Data +public class ItemRelationQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private Long beSupplier; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String barCode; + + /** 模糊 */ + @Query(propName = "code",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String door; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String type; + /** BETWEEN */ + @Query(type = Query.Type.BETWEEN) + private List createTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemSmallDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemSmallDto.java new file mode 100644 index 0000000..673fe37 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ItemSmallDto.java @@ -0,0 +1,50 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.domain.Dept; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-07 +**/ +@Data +public class ItemSmallDto implements Serializable { + + /** ID */ + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 类型 */ + private String goodType; + + /** 规格 */ + private String specs; + + /** 单位 */ + private String unit; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java new file mode 100644 index 0000000..76b6a8c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointDto.java @@ -0,0 +1,98 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.Point; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-26 +**/ +@Data +public class PointDto implements Serializable { + + private Long id; + + /** RCS代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 状态 */ + private String status; + + /** 描述 */ + private String description; + + /** 区域编码 */ + private String beatCode; + + /** 物料编码 */ + private String itemCode; + + /** 库区ID */ + private AreaSmallDto area; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 坐标X */ + private Double posX; + + /** 坐标Y */ + private Double posY; + + /** 坐标Z */ + private Double posZ; + + /** 类型 */ + private String type; + + /** 热度 */ + private Double heat; + /** 列 */ + private int col; + /** 排 */ + private int line; + /** 层 */ + private int rows; + + /** 排序 */ + private int sortIndex; +// /** 排序 */ +// private Point point; + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointQueryCriteria.java new file mode 100644 index 0000000..365f57e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointQueryCriteria.java @@ -0,0 +1,67 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.annotation.DataPermission; +import com.youchain.annotation.Query; +import lombok.Data; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-26 +**/ +@Data +public class PointQueryCriteria { + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 状态 */ + @Query(type = Query.Type.EQUAL) + private String status; + + /** 物料编码 */ + @Query(type = Query.Type.EQUAL) + private String itemCode; + + /** 类型 */ + @Query(type = Query.Type.EQUAL) + private String type; + + @Query(propName = "type",type = Query.Type.IN) + private List typeData; + + @Query(propName = "type",type = Query.Type.NOT_IN) + private List typeNotData; + + + /** 库区ID */ + @Query(joinName = "area", propName="name",type = Query.Type.EQUAL) + private String areaName; + + /** 状态:1启用、0禁用 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointSmallDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointSmallDto.java new file mode 100644 index 0000000..bda952c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/PointSmallDto.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-26 +**/ +@Data +public class PointSmallDto implements Serializable { + + private Long id; + + /** RCS代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 状态 */ + private String status; + + /** 描述 */ + private String description; + + /** 区域编码 */ + private String beatCode; + + /** 物料编码 */ + private String itemCode; + + /** 库区ID */ + private AreaSmallDto area; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 坐标X */ + private Double posX; + + /** 坐标Y */ + private Double posY; + + /** 坐标Z */ + private Double posZ; + + /** 类型 */ + private String type; + + /** 热度 */ + private Double heat; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanDto.java new file mode 100644 index 0000000..fba5146 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanDto.java @@ -0,0 +1,125 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-04 +**/ +@Data +public class ProductionPlanDto implements Serializable { + + /** ID */ + private Long id; + + /** 仓库ID */ + private DeptDto dept; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 完成品番 */ + private BigItemDto bigItem; + + /** 工位 */ + private String workingStation; + + /** No */ + private Integer no; + + /** 导入日期 */ + private Timestamp importDate; + + /** 计划日期 */ + private Timestamp plannedDate; + + /** 下线日期 */ + private Timestamp downlineDate; + + /** 耗用时间 */ + private Timestamp takeUpTime; + + /** IDNO */ + private String idno; + + /** 月度序号 */ + private String monthlyNo; + + /** 计划单号 */ + private String projectNo; + + /** 制造线 */ + private String makeLine; + + /** 序号 */ + private Long orderNo; + + /** 工位清单 */ + private BomAccountDto bomList; + + /** 收货仓库 */ + private AreaDto shArea; + + /** 入库库区 */ + private AreaDto rkArea; + + /** 备货计划ID */ + private Long pickPlan; + + /** 出库类型 */ + private String type; + + /** 部品种类 */ + private String partVariety; + + /** 耗用状态 */ + private String statue; + + /** 所属自动计划 */ + private ProductionPlanDto autoProduction; + + /** 描述 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改日期 */ + private Timestamp updateTime; + + /** 下线零件ID */ + private Long offLinePart; + + /** 机号 */ + private String machineNo; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanQueryCriteria.java new file mode 100644 index 0000000..2079624 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/ProductionPlanQueryCriteria.java @@ -0,0 +1,72 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import lombok.Data; + +import java.security.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-04 +**/ +@Data +public class ProductionPlanQueryCriteria{ + + /** 状态:1启用、0禁用 */ + @Query(type = Query.Type.EQUAL) + private Boolean enabled; + + /** 精确 */ + @Query(joinName = "bigItem",propName = "code",type = Query.Type.EQUAL) + private String bigItemModels; + + /** 精确 */ + @Query(joinName = "rkArea",propName = "code",type = Query.Type.EQUAL) + private String rkCode; + + /** 精确 */ + @Query + private String downlineDate; + + /** 精确 */ + @Query(type = Query.Type.INNER_LIKE) + private String idno; + /** 工位 */ + @Query + private String workingStation; + + /** 耗用状态*/ + @Query + private String statue; + /** + * 计划单号 + */ + @Query + private String projectNo; + + /** + * 月度序号 + */ + @Query + private String monthlyNo; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockDto.java new file mode 100644 index 0000000..a7bd4b5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockDto.java @@ -0,0 +1,89 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-28 +**/ +@Data +public class StockDto implements Serializable { + + /** 容器ID */ + private Long id; + + /** 容器代码 */ + private String code; + + /** 容器状态 */ + private String status; + + /** 上级容器ID */ + private Long pid; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 地标ID */ + private PointSmallDto point; + + /** 子容器数量 */ + private Integer subCount; + + /** 容器名称 */ + private String name; + + /** 类型名称 */ + private StockTypeSmallDto stockType; + + + /** 容器使用重量 */ + private Double useWeight; + + /** 容器使用体积 */ + private Double useSize; + + /** 容器重量占用率 */ + private Double usageWeight; + + /** 容器体积占用率 */ + private Double usageSize; + + /** 状态:1启用、0禁用 */ + private Boolean enabled; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 顶级容器ID */ + private Long topId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockQueryCriteria.java new file mode 100644 index 0000000..245e122 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockQueryCriteria.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.annotation.DataPermission; +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@Data +@DataPermission(joinName = "dept", fieldName = "id") +public class StockQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String eq_code; + + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String status; + + /** 容器类型代码 */ + @Query(joinName = "stockType", propName="code",type = Query.Type.EQUAL) + private String stockTypeCode; + + /** 容器类型名称 */ + @Query(joinName = "stockType", propName="name",type = Query.Type.EQUAL) + private String stockTypeName; + + /** 点位code */ + @Query(joinName = "point", propName="code",type = Query.Type.EQUAL) + private String pointCode; + + @Query(joinName = "point>area>", propName="name",type = Query.Type.EQUAL) + private String areaName; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockSmallDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockSmallDto.java new file mode 100644 index 0000000..8fe55fd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockSmallDto.java @@ -0,0 +1,39 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import javax.persistence.*; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-07-28 +**/ +public class StockSmallDto{ + + /** 容器ID */ + @Id + public Long id; + + /** 容器代码 */ + public String code; + /** 容器状态 */ + public String status; + /** 启用 */ + private Boolean enabled; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeDto.java new file mode 100644 index 0000000..a0108d2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeDto.java @@ -0,0 +1,62 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.io.Serializable; +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.serializer.ToStringSerializer; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-28 +**/ +@Data +public class StockTypeDto implements Serializable { + + /** ID */ + /** 防止精度丢失 */ + private Long id; + + /** 名称 */ + private String name; + + /** 代码 */ + private String code; + + /** 长 */ + private Double length; + + /** 宽 */ + private Double width; + + /** 高 */ + private Double height; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double size; + + /** 启用 */ + private Boolean enabled; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeQueryCriteria.java new file mode 100644 index 0000000..a8da10d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeQueryCriteria.java @@ -0,0 +1,38 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.youchain.annotation.DataPermission; +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@Data +@DataPermission(joinName = "dept", fieldName = "id") +public class StockTypeQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeSmallDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeSmallDto.java new file mode 100644 index 0000000..f24396e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/StockTypeSmallDto.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.serializer.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-28 +**/ +@Data +public class StockTypeSmallDto implements Serializable { + + /** ID */ + private Long id; + + /** 名称 */ + private String name; + + /** 代码 */ + private String code; + + /** 长 */ + private Double length; + + /** 宽 */ + private Double width; + + /** 高 */ + private Double height; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double size; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigDto.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigDto.java new file mode 100644 index 0000000..2a6ec08 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigDto.java @@ -0,0 +1,44 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author LiuXue +* @date 2023-08-28 +**/ +@Data +public class TableConfigDto implements Serializable { + + private Integer id; + + private String tableType; + + private String value; + + private String createBy; + + private String updateBy; + + private Timestamp createTime; + + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigQueryCriteria.java b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigQueryCriteria.java new file mode 100644 index 0000000..885f1e8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/dto/TableConfigQueryCriteria.java @@ -0,0 +1,36 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author LiuXue +* @date 2023-08-28 +**/ +@Data +public class TableConfigQueryCriteria{ + + /** 精确 */ + @Query(type = Query.Type.EQUAL) + private String tableType; + + @Query(type = Query.Type.EQUAL) + private String createBy; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java new file mode 100644 index 0000000..262e441 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AreaServiceImpl.java @@ -0,0 +1,133 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import cn.hutool.json.JSONUtil; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.mapstruct.PointMapper; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.AreaQueryCriteria; +import com.youchain.basicdata.service.mapstruct.AreaMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** + * @author HJL + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-14 + **/ +@Service +@Slf4j +@RequiredArgsConstructor +public class AreaServiceImpl implements AreaService { + + private final AreaRepository areaRepository; + private final AreaMapper areaMapper; + private final EntityManager entityMapper; + private final PointService pointService; + + @Override + public Map queryAll(AreaQueryCriteria criteria, Pageable pageable) { + Page page = areaRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(areaMapper::toDto)); + } + + @Override + public List queryAll(AreaQueryCriteria criteria) { + return areaMapper.toDto(areaRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public AreaDto findById(Long id) { + Area area = areaRepository.findById(id).orElseGet(Area::new); + ValidationUtil.isNull(area.getId(), "Area", "id", id); + return areaMapper.toDto(area); + } + + @Override + @Transactional + public Area findEntityById(Long id) { + Area area = areaRepository.findById(id).orElseGet(Area::new); + ValidationUtil.isNull(area.getId(), "Area", "id", id); + return area; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AreaDto create(Area resources) { + return areaMapper.toDto(areaRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Area resources) { + Area area = areaRepository.findById(resources.getId()).orElseGet(Area::new); + ValidationUtil.isNull(area.getId(), "Area", "id", resources.getId()); + area.copy(resources); + areaRepository.save(area); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + areaRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"Area"); + FileUtil.downloadExcel(list, response); + } + + @Override + public List getAreas(String type) { + List areas = areaRepository.getAreas(); + return areaMapper.toDto(areas); + } + + @Override + public Area findByCode(String code) { + String hql = "select t from Area t where t.code='" + code + "' or t.name='" + code + "' "; + Query query = entityMapper.createQuery(hql); + List ts = query.getResultList(); + if (ts.size() > 0) { + return ts.get(0); + } + return null; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanDetailServiceImpl.java new file mode 100644 index 0000000..e012f64 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanDetailServiceImpl.java @@ -0,0 +1,116 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.AutomaticPlanDetailRepository; +import com.youchain.basicdata.service.AutomaticPlanDetailService; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailDto; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailQueryCriteria; +import com.youchain.basicdata.service.mapstruct.AutomaticPlanDetailMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-04-07 +**/ +@Service +@RequiredArgsConstructor +public class AutomaticPlanDetailServiceImpl implements AutomaticPlanDetailService { + + private final AutomaticPlanDetailRepository automaticPlanDetailRepository; + private final AutomaticPlanDetailMapper automaticPlanDetailMapper; + + @Override + public Map queryAll(AutomaticPlanDetailQueryCriteria criteria, Pageable pageable){ + Page page = automaticPlanDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(automaticPlanDetailMapper::toDto)); + } + + @Override + public List queryAll(AutomaticPlanDetailQueryCriteria criteria){ + return automaticPlanDetailMapper.toDto(automaticPlanDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public AutomaticPlanDetailDto findById(Long id) { + AutomaticPlanDetail automaticPlanDetail = automaticPlanDetailRepository.findById(id).orElseGet(AutomaticPlanDetail::new); + ValidationUtil.isNull(automaticPlanDetail.getId(),"AutomaticPlanDetail","id",id); + return automaticPlanDetailMapper.toDto(automaticPlanDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AutomaticPlanDetailDto create(AutomaticPlanDetail resources) { + return automaticPlanDetailMapper.toDto(automaticPlanDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(AutomaticPlanDetail resources) { + AutomaticPlanDetail automaticPlanDetail = automaticPlanDetailRepository.findById(resources.getId()).orElseGet(AutomaticPlanDetail::new); + ValidationUtil.isNull( automaticPlanDetail.getId(),"AutomaticPlanDetail","id",resources.getId()); + automaticPlanDetail.copy(resources); + automaticPlanDetailRepository.save(automaticPlanDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + automaticPlanDetailRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"AutomaticPlanDetail"); + FileUtil.downloadExcel(list, response); + } + + @Override + public AutomaticPlanDetail storeAutomaticPlanDetail(AutomaticPlanning automaticPlanning) { + AutomaticPlanDetail detail=new AutomaticPlanDetail(); + detail.setAutomaticPlanning(automaticPlanning); + detail.setDept(automaticPlanning.getDept()); + detail.setShArea(automaticPlanning.getShArea()); + detail.setBatchNum(automaticPlanning.getBatchNum()); + detail.setDescription(automaticPlanning.getDescription()); + detail.setSxQuantity(automaticPlanning.getSxQuantity()); + detail.setFxQuantity(automaticPlanning.getFxQuantity()); + detail.setJhQuantity(automaticPlanning.getJhQuantity()); + detail.setStartNum(automaticPlanning.getStartNum()); + detail.setEndNum(automaticPlanning.getEndNum()); + detail.setJhDate(automaticPlanning.getJhDate()); + detail.setShHour(automaticPlanning.getShHour()); + this.create(detail); + return detail; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanningServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanningServiceImpl.java new file mode 100644 index 0000000..f7aa78e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/AutomaticPlanningServiceImpl.java @@ -0,0 +1,114 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.AutomaticPlanningRepository; +import com.youchain.basicdata.service.AutomaticPlanningService; +import com.youchain.basicdata.service.dto.AutomaticPlanningDto; +import com.youchain.basicdata.service.dto.AutomaticPlanningQueryCriteria; +import com.youchain.basicdata.service.mapstruct.AutomaticPlanningMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author JiangKun +* @date 2024-01-05 +**/ +@Service +@RequiredArgsConstructor +public class AutomaticPlanningServiceImpl implements AutomaticPlanningService { + + private final AutomaticPlanningRepository automaticPlanningRepository; + private final AutomaticPlanningMapper automaticPlanningMapper; + + + @Override + public Map queryAll(AutomaticPlanningQueryCriteria criteria, Pageable pageable){ + Page page = automaticPlanningRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(automaticPlanningMapper::toDto)); + } + + @Override + public List queryAll(AutomaticPlanningQueryCriteria criteria){ + return automaticPlanningMapper.toDto(automaticPlanningRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public AutomaticPlanningDto findById(Long id) { + AutomaticPlanning automaticPlanning = automaticPlanningRepository.findById(id).orElseGet(AutomaticPlanning::new); + ValidationUtil.isNull(automaticPlanning.getId(),"AutomaticPlanning","id",id); + return automaticPlanningMapper.toDto(automaticPlanning); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AutomaticPlanningDto create(AutomaticPlanning resources) { + return automaticPlanningMapper.toDto(automaticPlanningRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(AutomaticPlanning resources) { + AutomaticPlanning automaticPlanning = automaticPlanningRepository.findById(resources.getId()).orElseGet(AutomaticPlanning::new); + ValidationUtil.isNull( automaticPlanning.getId(),"AutomaticPlanning","id",resources.getId()); + automaticPlanning.copy(resources); + automaticPlanningRepository.save(automaticPlanning); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + automaticPlanningRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"AutomaticPlanning"); +// List> list = new ArrayList<>(); +// for (AutomaticPlanningDto automaticPlanning : all) { +// Map map = new LinkedHashMap<>(); +// map.put("收货仓库", automaticPlanning.getShArea()); +// map.put("辅线数量", automaticPlanning.getFxQuantity()); +// map.put("计划数量", automaticPlanning.getJhQuantity()); +// map.put("耗用数量", automaticPlanning.getHyQuantity()); +// map.put("仓库ID", automaticPlanning.getDeptId()); +// map.put("状态:1启用、0禁用", automaticPlanning.getEnabled()); +// map.put("备注", automaticPlanning.getDescription()); +// map.put("创建人", automaticPlanning.getCreateBy()); +// map.put("更新人", automaticPlanning.getUpdateBy()); +// map.put("创建时间", automaticPlanning.getCreateTime()); +// map.put("修改日期", automaticPlanning.getUpdateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BigItemServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BigItemServiceImpl.java new file mode 100644 index 0000000..e3a7290 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BigItemServiceImpl.java @@ -0,0 +1,118 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.exception.EntityExistException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.service.BigItemService; +import com.youchain.basicdata.service.dto.BigItemDto; +import com.youchain.basicdata.service.dto.BigItemQueryCriteria; +import com.youchain.basicdata.service.mapstruct.BigItemMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author baobinglin +* @date 2023-12-29 +**/ +@Service +@RequiredArgsConstructor +public class BigItemServiceImpl implements BigItemService { + + private final BigItemRepository bigItemRepository; + private final BigItemMapper bigItemMapper; + + @Override + public Map queryAll(BigItemQueryCriteria criteria, Pageable pageable){ + Page page = bigItemRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(bigItemMapper::toDto)); + } + + @Override + public List queryAll(BigItemQueryCriteria criteria){ + return bigItemMapper.toDto(bigItemRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public BigItemDto findById(Long id) { + BigItem bigItem = bigItemRepository.findById(id).orElseGet(BigItem::new); + ValidationUtil.isNull(bigItem.getId(),"BigItem","id",id); + return bigItemMapper.toDto(bigItem); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BigItemDto create(BigItem resources) { + return bigItemMapper.toDto(bigItemRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BigItem resources) { + BigItem bigItem = bigItemRepository.findById(resources.getId()).orElseGet(BigItem::new); + ValidationUtil.isNull( bigItem.getId(),"BigItem","id",resources.getId()); + bigItem.copy(resources); + bigItemRepository.save(bigItem); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + bigItemRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"BigItem"); +// List> list = new ArrayList<>(); +// for (BigItemDto bigItem : all) { +// Map map = new LinkedHashMap<>(); +// map.put("完成品品番", bigItem.getCode()); +// map.put("完成形式名", bigItem.getName()); +// map.put("机种", bigItem.getModels()); +// map.put("国别", bigItem.getCountry()); +// map.put("出库类型", bigItem.getOutboundType()); +// map.put("仓库ID", bigItem.getDeptId()); +// map.put("是否启用", bigItem.getEnabled()); +// map.put("描述", bigItem.getDescription()); +// map.put("创建人", bigItem.getCreateBy()); +// map.put("修改人", bigItem.getUpdateBy()); +// map.put("创建时间", bigItem.getCreateTime()); +// map.put("修改时间", bigItem.getUpdateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } + public List getBigItem(String type){ + List bigItems=bigItemRepository.getBigItem(); + return bigItemMapper.toDto(bigItems); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BillTypeServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BillTypeServiceImpl.java new file mode 100644 index 0000000..7462584 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BillTypeServiceImpl.java @@ -0,0 +1,111 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.BillType; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.basicdata.service.BillTypeService; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.basicdata.service.dto.BillTypeQueryCriteria; +import com.youchain.basicdata.service.mapstruct.BillTypeMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2023-08-07 +**/ +@Service +@RequiredArgsConstructor +public class BillTypeServiceImpl implements BillTypeService { + + private final BillTypeRepository billTypeRepository; + private final BillTypeMapper billTypeMapper; + + @Override + public Map queryAll(BillTypeQueryCriteria criteria, Pageable pageable){ + Page page = billTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(billTypeMapper::toDto)); + } + + @Override + public List queryAll(BillTypeQueryCriteria criteria){ + return billTypeMapper.toDto(billTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public BillTypeDto findById(Long id) { + BillType billType = billTypeRepository.findById(id).orElseGet(BillType::new); + ValidationUtil.isNull(billType.getId(),"BillType","id",id); + return billTypeMapper.toDto(billType); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BillTypeDto create(BillType resources) { + return billTypeMapper.toDto(billTypeRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BillType resources) { + BillType billType = billTypeRepository.findById(resources.getId()).orElseGet(BillType::new); + ValidationUtil.isNull( billType.getId(),"BillType","id",resources.getId()); + billType.copy(resources); + billTypeRepository.save(billType); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + billTypeRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"BillType"); +// List> list = new ArrayList<>(); +// for (BillTypeDto billType : all) { +// Map map = new LinkedHashMap<>(); +// map.put("代码", billType.getCode()); +// map.put("名称", billType.getName()); +// map.put("仓库ID", billType.getDept()); +// map.put("类型", billType.getType()); +// map.put("来源名称", billType.getSourceName()); +// map.put("来源序号", billType.getSourceId()); +// map.put("创建人", billType.getCreateBy()); +// map.put("修改人", billType.getUpdateBy()); +// map.put("创建时间", billType.getCreateTime()); +// map.put("修改时间", billType.getUpdateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountLogServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountLogServiceImpl.java new file mode 100644 index 0000000..bd979b3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountLogServiceImpl.java @@ -0,0 +1,124 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.BomAccountLog; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.BomAccountLogRepository; +import com.youchain.basicdata.service.BomAccountLogService; +import com.youchain.basicdata.service.dto.BomAccountLogDto; +import com.youchain.basicdata.service.dto.BomAccountLogQueryCriteria; +import com.youchain.basicdata.service.mapstruct.BomAccountLogMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-04-24 +**/ +@Service +@RequiredArgsConstructor +public class BomAccountLogServiceImpl implements BomAccountLogService { + + private final BomAccountLogRepository bomAccountLogRepository; + private final BomAccountLogMapper bomAccountLogMapper; + private final BomAccountRepository bomAccountRepository; + + @Override + public Map queryAll(BomAccountLogQueryCriteria criteria, Pageable pageable){ + Page page = bomAccountLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(bomAccountLogMapper::toDto)); + } + + @Override + public List queryAll(BomAccountLogQueryCriteria criteria){ + return bomAccountLogMapper.toDto(bomAccountLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public BomAccountLogDto findById(Long id) { + BomAccountLog bomAccountLog = bomAccountLogRepository.findById(id).orElseGet(BomAccountLog::new); + ValidationUtil.isNull(bomAccountLog.getId(),"BomAccountLog","id",id); + return bomAccountLogMapper.toDto(bomAccountLog); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BomAccountLogDto create(BomAccountLog resources) { + return bomAccountLogMapper.toDto(bomAccountLogRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BomAccountLog resources) { + BomAccountLog bomAccountLog = bomAccountLogRepository.findById(resources.getId()).orElseGet(BomAccountLog::new); + ValidationUtil.isNull( bomAccountLog.getId(),"BomAccountLog","id",resources.getId()); + bomAccountLog.copy(resources); + bomAccountLogRepository.save(bomAccountLog); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + bomAccountLogRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"BomAccountLog"); + FileUtil.downloadExcel(list, response); + } + + public void copyBomAccount(Long id,String operType){ + BomAccount bomAccount=bomAccountRepository.getById(id); + BomAccountLog log=new BomAccountLog(); + log.setOperType(operType); + log.setBomAccountId(bomAccount.getId()); + log.setDept(bomAccount.getDept()); + log.setAc(bomAccount.getAc()); + log.setBonded(bomAccount.getBonded()); + log.setContents(bomAccount.getContents()); + log.setSingles(bomAccount.getSingles()); + log.setSupplier(bomAccount.getSupplier()); + log.setStationType(bomAccount.getStationType()); + log.setOutType(bomAccount.getOutType()); + log.setBigItem(bomAccount.getBigItem()); + log.setEnabled(bomAccount.getEnabled()); + log.setItem(bomAccount.getItem()); + log.setBp_type(bomAccount.getBp_type()); + log.setCArea(bomAccount.getCArea()); + log.setRArea(bomAccount.getRArea()); + log.setHPoint(bomAccount.getHPoint()); + log.setZPoint(bomAccount.getZPoint()); + log.setDescription(bomAccount.getDescription()); + this.create(log); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java new file mode 100644 index 0000000..d005468 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BomAccountServiceImpl.java @@ -0,0 +1,294 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSON; +import com.youchain.appupdate.ReturnJson.RLocLayout; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.BomAccountLog; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.BomAccountLogService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.*; +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.modules.system.service.impl.DictDetailServiceImpl; +import com.youchain.modules.system.service.impl.DictServiceImpl; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.mapstruct.BomAccountMapper; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author baobinglin +* @date 2024-01-02 +**/ +@Service +@Slf4j +@RequiredArgsConstructor +@CacheConfig(cacheNames = "bomAccount") +public class BomAccountServiceImpl implements BomAccountService { + + private final BomAccountRepository bomAccountRepository; + private final BomAccountMapper bomAccountMapper; + private final PointService pointService; + private final EntityManager entityManager; + private final RedisUtils redisUtils; + private final BomAccountLogService bomAccountLogService; + + @Override + @Cacheable(key = "'queryALL1:' + #p0") + public Map queryAll(BomAccountQueryCriteria criteria, Pageable pageable){ + Page page = bomAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(bomAccountMapper::toDto)); + } + + @Override + @Cacheable(key = "'queryALL2:' + #p0") + public List queryAll(BomAccountQueryCriteria criteria){ + return bomAccountMapper.toDto(bomAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + @Cacheable(key = "'id:' + #p0") + public BomAccountDto findById(Long id) { + BomAccount bomAccount = bomAccountRepository.findById(id).orElseGet(BomAccount::new); + ValidationUtil.isNull(bomAccount.getId(),"BomAccount","id",id); + return bomAccountMapper.toDto(bomAccount); + } + + @Override + @Transactional + public BomAccount findByEntity(Long id) { + BomAccount bomAccount = bomAccountRepository.findById(id).orElseGet(BomAccount::new); + ValidationUtil.isNull(bomAccount.getId(),"BomAccount","id",id); + return bomAccount; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BomAccountDto create(BomAccount resources) { + resources.setDept(UserUtils.getDept()); + BomAccount ba=bomAccountRepository.save(resources); + delCaches(); + return bomAccountMapper.toDto(ba); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BomAccount resources) { + BomAccount bomAccount = bomAccountRepository.findById(resources.getId()).orElseGet(BomAccount::new); + ValidationUtil.isNull( bomAccount.getId(),"BomAccount","id",resources.getId()); + bomAccount.copy(resources); + bomAccountRepository.save(bomAccount); + delCaches(); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + bomAccountLogService.copyBomAccount(id,"del"); + bomAccountRepository.deleteById(id); + } + delCaches(); + + } + public void delCaches(){ + + Set keys=redisUtils.getAllKey("*bomAccount*"); + for (Object key:keys) { + log.error("key:"+key); + redisUtils.del(key.toString()); + } + + + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"BomAccount"); + FileUtil.downloadExcel(list, response); + } + + + + @Override + public List queryBigItemByType(String stationType) { + String hql = "select t.bigItem from BomAccount t where t.stationType = '" + stationType + "' group by t.bigItem"; + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + if (!resultList.isEmpty()){ + return resultList; + } + return null; + } + + + @Override + @Cacheable(key = "'areaid:' + #p0") + public List queryByArea(Long areaId) { +// String hql = "from BomAccount ba where ba.rArea.id = " + areaId+" group by ba.item.id,ba.zPoint.id"; + String hql = "from BomAccount ba where ba.rArea.id = " + areaId+" and ba.id in (select max(t.id) from BomAccount t where t.rArea.id = " + areaId + " group by t.item.id,t.zPoint.id)"; + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + long ed=System.currentTimeMillis(); + return bomAccountMapper.toDto(resultList); + } + + @Override + public List queryItemByArea(Long areaId) { + String hql = "select max(t.id),t.item.id,max(t.item.code),max(t.item.name),t.zPoint.id,max(t.zPoint.code),max(t.rArea.id),max(t.rArea.code) from BomAccount t where t.rArea.id = " + areaId + " group by t.item.id,t.zPoint.id"; + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + JSONArray array=new JSONArray(); + if (resultList.size()>0){ + for(Object[] obj:resultList){ + HashMap d=new HashMap<>(); + d.put("id",obj[0]); + d.put("itemId",obj[1]); + d.put("itemCode",obj[2]); + d.put("itemName",obj[3]); + d.put("zzkwId",obj[4]); + d.put("zzkwCode",obj[5]); + d.put("rAreaId",obj[6]); + d.put("rAreaCode",obj[7]); + array.add(d); + } + } + return array; + } + + + @Override + public List queryBomAccountPoints() { + String sql = "select max(ba.id) bom_account_id,max(rk.id) rk_id,max(rk.code) gw_code,max(rk.name) gw_name," + + "max(it.id) item_id,max(it.code) item_code,max(it.name) item_name,max(p.id) zzkw_id,max(p.code) zzkw_code,\n" + + "max(it.extend_d3) srs \n" + + "from base_bom_account ba \n" + + "LEFT JOIN base_item it on it.id=ba.item_id\n" + + "LEFT JOIN base_area rk on rk.id=ba.r_area_id\n" + + "left join base_point p on p.id=ba.z_point_id\n" + + "GROUP BY ba.r_area_id,ba.item_id,ba.z_point_id"; + log.info("sql==="+sql); + List ts = entityManager.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List l = com.alibaba.fastjson.JSON.parseArray(JSON.toJSONString(ts), BomAccountPointDto.class); + return l; + } + + public List queryBomAccount(Long bigItemId,Long shAreaId,String gw) { + String hql = "from BomAccount t where t.bigItem.id="+bigItemId+" and t.outType='单点' and t.item.enabled=true"; + if(shAreaId!=null){ + hql+=" and t.rArea.id = " + shAreaId; + } + if(gw!=null&&!gw.equals("")){ + hql+=" and t.rArea.workingStation = '" + gw+"'"; + } + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + @Override + public List queryBomAccountList(String code,Long outAreaId, Long shAreaId,String bp_type,String type) { + String hql =null; + if(type.equals("0")){ + hql = "select t.cArea.id,t.bp_type from BomAccount t,PlanPickDetail ptd " + + " where ptd.code='"+code+"' and t.bigItem.id=ptd.bigItem.id and t.outType='单点' and t.item.enabled=true and t.rArea.id = " + shAreaId + + " group by t.cArea.id,t.bp_type " + + " order by t.cArea.id"; + }else{ + hql = "select max(t.id),sum(t.singles*ptd.orderQuantity) from BomAccount t,PlanPickDetail ptd " + + " where ptd.code='"+code+"' and t.bigItem.id=ptd.bigItem.id and t.outType='单点' and t.item.enabled=true and t.rArea.id = " + shAreaId + + " and t.cArea.id="+outAreaId + + " and t.bp_type='"+bp_type+"'" + + " group by t.zPoint.id,t.item.id"; + } + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + public List bomAccountAreas(String code, Long shAreaId,String bp_type,String type) { + String hql =null; + if(type.equals("0")){ + hql = "select t.cArea.id,t.bp_type from BomAccount t,PlanPickDetail ptd " + + " where ptd.code='"+code+"' and t.bigItem.id=ptd.bigItem.id and t.outType='单点' and t.item.enabled=true and t.rArea.id = " + shAreaId + + " group by t.cArea.id,t.bp_type " + + " order by t.cArea.id"; + }else{ + hql = "select t.cArea.id,max(t.id),sum(t.singles*ptd.orderQuantity) from BomAccount t,PlanPickDetail ptd " + + " where ptd.code='"+code+"' and t.bigItem.id=ptd.bigItem.id and t.outType='单点' and t.item.enabled=true and t.rArea.id = " + shAreaId + + " and t.bp_type='"+bp_type+"'" + + " group by t.cArea.id,t.zPoint.id,t.item.id"; + } + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + @Override + public List queryBomAccountList(BomAccount bomAccount) { + String hql = "from BomAccount t where 1=1 and t.item.enabled=true"; + if (bomAccount.getBigItem() != null){ + hql += " and t.bigItem.id = " + bomAccount.getBigItem().getId(); + }else if (bomAccount.getStationType() != null){ + hql += " and t.stationType = '" + bomAccount.getStationType() + "'"; + } + Query query = entityManager.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + @Override + public void updateBatch(Long areaId) { + String sql="update base_bom_account bom set bom.pc_qty=0 where bom.r_area_id="+areaId; + Query query=entityManager.createNativeQuery(sql); + query.executeUpdate(); + } + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BoxServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BoxServiceImpl.java new file mode 100644 index 0000000..5a9f705 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/BoxServiceImpl.java @@ -0,0 +1,337 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.youchain.Netty.NettyUtils; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.StockService; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.service.*; +import com.youchain.exception.handler.ApiResult; +import com.youchain.modules.system.repository.DictRepository; +import com.youchain.modules.system.service.DictService; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.BoxRepository; +import com.youchain.basicdata.service.BoxService; +import com.youchain.basicdata.service.dto.BoxDto; +import com.youchain.basicdata.service.dto.BoxQueryCriteria; +import com.youchain.basicdata.service.mapstruct.BoxMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author huojin + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-17 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class BoxServiceImpl implements BoxService { + + private final BoxRepository boxRepository; + private final BoxMapper boxMapper; + private final EntityManager entityManager; + private final PointService pointService; + private final StockService stockService; + private final ItemService itemService; + private final AsnDetailService asnDetailService; + private final ItemKeyService itemKeyService; + private final TaskService taskService; + private final InventoryService inventoryService; + private final PickDetailService pickDetailService; + private final DictRepository dictRepository; + private final RedisUtils redisUtils; + private final DictService dictService; + + @Override + public Map queryAll(BoxQueryCriteria criteria, Pageable pageable) { + Page page = boxRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(boxMapper::toDto)); + } + + @Override + public List queryAll(BoxQueryCriteria criteria) { + return boxMapper.toDto(boxRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public BoxDto findById(Long id) { + Box box = boxRepository.findById(id).orElseGet(Box::new); + ValidationUtil.isNull(box.getId(), "Box", "id", id); + return boxMapper.toDto(box); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BoxDto create(Box resources) { + return boxMapper.toDto(boxRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Box resources) { + redisUtils.del("ButtonBoxCode"); + //判断那个按钮盒 + if (resources.getLampCode() != null && resources.getLampCode().length() > 0) { + switch (resources.getLampCode()) { + case "0001": + this.executeLampStatus(resources.getLampStatus(), resources.getIP(), NettyUtils.light_1); + break; + case "0002": + this.executeLampStatus(resources.getLampStatus(), resources.getIP(), NettyUtils.light_2); + break; + case "0003": + this.executeLampStatus(resources.getLampStatus(), resources.getIP(), NettyUtils.light_3); + break; + case "0004": + this.executeLampStatus(resources.getLampStatus(), resources.getIP(), NettyUtils.light_4); + break; + default: + log.error("{}:按钮盒编码【{}】出错", resources.getCode(), resources.getLampCode()); + return; + } + } + + //根据IP和按钮盒编号查询是否存在了,存在提示,不存在绑定 + if ((resources.getIP() != null && resources.getIP().length() > 0) && (resources.getLampCode() != null && resources.getLampCode().length() > 0)) { + String hql = " from Box box where box.iP='" + resources.getIP() + "' and box.lampCode='" + resources.getLampCode() + "' and box.id!=" + resources.getId() + " "; + Query query = entityManager.createQuery(hql); + List boxList = query.getResultList(); + if (boxList.size() > 0) { + StringBuffer sbf = new StringBuffer(); + for (Box box : boxList) { + sbf.append(box.getLampCode()).append(",").toString(); + } + throw new RuntimeException("按钮盒编号" + sbf.deleteCharAt(sbf.length() - 1) + "已绑定!"); + } + } + Box box = boxRepository.findById(resources.getId()).orElseGet(Box::new); + ValidationUtil.isNull(box.getId(), "Box", "id", resources.getId()); + box.copy(resources); + boxRepository.save(box); + + + } + + /** + * 亮对应的灯 + * + * @param lamp_status 指示灯状态 ->灯光熄灭 light_off、灯光常亮 light_on、灯光快闪 light_on_fast_flicker、 + * 灯光慢闪 light_on_slow_flicker、按钮释放 button_off + * @param ip ip地址 + * @param index 对应的盒子 + * @return + */ + public Boolean executeLampStatus(String lamp_status, String ip, String index) { + switch (lamp_status) { + case "0": + NettyUtils.light_off(ip, index, null); + break; + case "1": + NettyUtils.light_on(ip, index, null); + break; + case "2": + NettyUtils.light_on_fast_flicker(ip, index, null); + break; + case "3": + NettyUtils.light_on_slow_flicker(ip, index, null); + break; + default: + log.error("按钮盒状态修改错误:0~3"); + return false; + } + return true; + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + boxRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (BoxDto box : all) { + Map map = new LinkedHashMap<>(); + map.put("物料ID", box.getItem()); + map.put("点位ID", box.getPoint()); +// map.put("IP", box.getIP()); +// map.put("指示灯状态", box.getLampStatus()); +// map.put("按钮盒编号",box.getLampCode()); + map.put("创建人", box.getCreateBy()); + map.put("修改人", box.getUpdateBy()); + map.put("创建时间", box.getCreateTime()); + map.put("修改时间", box.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public Box getBoxByItem(long itemId) { + return boxRepository.getBoxByItem(itemId); + } + + @Override + public Box getBoxByCode(String code) { + return boxRepository.getBoxByCode(code); + } + + @Override + public Box toEntity(BoxDto boxDto) { + return boxMapper.toEntity(boxDto); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void refreshPointStatus() { + String sql = "update Point point set point.status='USED' where point.id in (select box.point.id from Box box) and point.type='SHIP' "; + Query query = entityManager.createQuery(sql); + long num = query.executeUpdate(); + + String sql2 = "update Point point set point.status='FREE' where point.id not in (select box.point.id from Box box) and point.type='SHIP' "; + Query query2 = entityManager.createQuery(sql2); + long num2 = query2.executeUpdate(); + + } + + @Override + public Box getBoxByPointCode(String pointCode) { + Box box = null; + String hql = " from Box box where box.point.code='" + pointCode + "'"; + Query query = entityManager.createQuery(hql); + List BoxList = query.getResultList(); + if (BoxList.size() > 0) { + box = BoxList.get(0); + return box; + } + return box; + } + + @Override + public List queryBoxList(String areaName) { + if (areaName.equals("前后桶部装")) { + areaName = "前桶部装"; + } + String hql = " from Box box where box.enabled=true and box.point.area.name like '" + areaName + "%' order by box.sort "; + Query query = entityManager.createQuery(hql); + List boxList = query.getResultList(); + return boxList; + } + + + @Override + public void callTrolley(PointDto pointDto, String pointCode) { + //判断判断呼叫点位 + if (pointDto.getArea().getName().equals(AreaNameDic.ZCFB)) { + //pointDto 为目标点位 + Point endPoint = pointService.toEntity(pointDto);//轴承座入库缓存区转实体 + if (endPoint.getStatus().equals(BaseStatus.FREE)) {//轴承座入库缓存区要为空 + //轴承座空车区 是占用 名字是:轴承座空车区 +// Point startPoint = pointService.findByCode(null, BaseStatus.USED, BaseStatus.STORAGE, "轴承座空车区", null); + Point startPoint =null;// pointService.findByCode(null, BaseStatus.USED, BaseStatus.STORAGE, AreaNameDic.ZCK, null); + if (startPoint == null) { + throw new RuntimeException("空车区没有空料车!"); + } + //查询料车 + Stock stock = stockService.findByPointCode(startPoint.getCode()); + if (stock == null) { + throw new RuntimeException(startPoint.getCode() + "没有绑定容器!"); + } + //下面注释掉 +// String resultJson = agvTaskService.sendAgvTaskImpl(agvTask);//发送任务 +// JSONObject resulObject = JSON.parseObject(resultJson); +// String code = resulObject.getString("code") == null ? "" : resulObject.getString("code"); +// String message = resulObject.getString("message") == null ? "" : resulObject.getString("message"); +// @org.springframework.data.jpa.repository.Query(value = "SELECT * FROM sys_dict b WHERE b.name = ?1 ", nativeQuery = true) +// String getDictDescription(String name); + String code = dictRepository.getDictDescription("agv_on_off").getDescription(); + endPoint.setStatus(BaseStatus.USED); + pointService.update(endPoint); + startPoint.setStatus(BaseStatus.FREE); + pointService.update(startPoint); + if (code.equals("ON")) {//根据字典进行判断执行与否 + //按钮盒点位占用,空车缓存点位释放 +// endPoint.setStatus(BaseStatus.USED); +// pointService.update(endPoint); +// startPoint.setStatus(BaseStatus.FREE); +// pointService.update(startPoint); + } else { + throw new RuntimeException("任务生产失败"); + } + } else { + throw new RuntimeException(endPoint.getCode() + "点位已有任务,请勿重复操作!"); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Task createTask(Item item, Stock stock, Point endPoint) { + AsnDetail asnDetail = new AsnDetail(); + asnDetail.setItem(item); + asnDetail.setLineNo(1l); + asnDetail.setStatus(BizStatus.OPEN); + asnDetail.setOrderQty(item.getExtendD1()); + asnDetail.setDept(item.getDept()); + Date date = cn.hutool.core.date.DateUtil.date(); + String propC1 = DateUtil.format(date, "yyyyMMdd"); + asnDetail.setPropC1(propC1); + asnDetailService.create(asnDetail); + + //生成Itemkey + ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1()); + + + //生成入库记录 + Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail, null, null, null, stock, stock, null, endPoint, null, null, null, endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept()); + taskService.create(task); + return task; + } + +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/DesignListServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/DesignListServiceImpl.java new file mode 100644 index 0000000..e9aa092 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/DesignListServiceImpl.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.DesignList; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.DesignListRepository; +import com.youchain.basicdata.service.DesignListService; +import com.youchain.basicdata.service.dto.DesignListDto; +import com.youchain.basicdata.service.dto.DesignListQueryCriteria; +import com.youchain.basicdata.service.mapstruct.DesignListMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author LY +* @date 2024-04-26 +**/ +@Service +@RequiredArgsConstructor +public class DesignListServiceImpl implements DesignListService { + + private final DesignListRepository designListRepository; + private final DesignListMapper designListMapper; + + @Override + public Map queryAll(DesignListQueryCriteria criteria, Pageable pageable){ + Page page = designListRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + + return PageUtil.toPage(page.map(designListMapper::toDto)); + } + + @Override + public List queryAll(DesignListQueryCriteria criteria){ + return designListMapper.toDto(designListRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public DesignListDto findById(Long id) { + DesignList designList = designListRepository.findById(id).orElseGet(DesignList::new); + ValidationUtil.isNull(designList.getId(),"DesignList","id",id); + return designListMapper.toDto(designList); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public DesignListDto create(DesignList resources) { + return designListMapper.toDto(designListRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DesignList resources) { + DesignList designList = designListRepository.exist(resources.getChaseCenter()); + ValidationUtil.isNull( designList.getChaseCenter(),"DesignList","chaseCenter",resources.getChaseCenter()); + designList.copy(resources); + designListRepository.save(designList); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + designListRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all,"DesignList"); + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java new file mode 100644 index 0000000..25df929 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ImportDataServiceImpl.java @@ -0,0 +1,428 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import com.sun.org.apache.xpath.internal.operations.Bool; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.*; +import com.youchain.basicdata.service.*; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.AreaQueryCriteria; +import com.youchain.basicdata.service.mapstruct.AreaMapper; +import com.youchain.basicdata.service.mapstruct.PointMapper; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.repository.CountMoveRepository; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.ItemKeyRepository; +import com.youchain.businessdata.service.*; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.repository.DictDetailRepository; +import com.youchain.modules.system.repository.DictRepository; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.*; + +/** + * @author HJL + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-14 + **/ +@Service +@RequiredArgsConstructor +public class ImportDataServiceImpl implements ImportDataService { + private final FileProperties properties; + private final BigItemRepository bigItemRepository; + private final AreaRepository areaRepository; + private final ItemRepository itemRepository; + private final DictDetailRepository dictDetailRepository; + private final PointRepository pointRepository; + private final PointService pointService; + private final AreaService areaService; + private final BomAccountRepository bomAccountRepository; + private final AreaMapper areaMapper; + private final PointMapper pointMapper; + private final ItemService itemService; + private final AsnDetailService asnDetailService; + private final AsnService asnService; + private final PickDetailService pickDetailService; + private final PickTicketService pickTicketService; + private final InventoryService inventoryService; + private final BigItemService bigItemService; + private final BomAccountService bomAccountService; + private final BomAccountLogService bomAccountLogService; + private final CodeUtils codeUtils; + private final BillTypeRepository billTypeRepository; + private final PickInstructionService pickInstructionService; + private final CountMoveRepository countMoveRepository; + private final ItemKeyRepository itemKeyRepository; + private final InventoryRepository inventoryRepository; + private final CountMoveService countMoveService; + + @Override + public void importBomAccount(int row,Map readAll) { + String bigItemCode =readAll.get("完成品品番")==null?null:readAll.get("完成品品番").toString(); + String station_type =readAll.get("工位")==null?null:readAll.get("工位").toString(); + String itemCode = readAll.get("部品品番")==null?null:readAll.get("部品品番").toString(); + String ac = readAll.get("AC")==null?null:readAll.get("AC").toString(); + String contents = readAll.get("加工内容")==null?null:readAll.get("加工内容").toString(); + String single = readAll.get("单用")==null?null:readAll.get("单用").toString(); + String r_area_name = readAll.get("入库库区")==null?null:readAll.get("入库库区").toString(); + String c_area_name =readAll.get("出库库区")==null?null:readAll.get("出库库区").toString(); + String z_point_code =readAll.get("制造库位")==null?null:readAll.get("制造库位").toString(); +// String c_point_code =readAll.get("暂存库位")==null?null:readAll.get("暂存库位").toString(); + String out_type = readAll.get("出库类型")==null?null:readAll.get("出库类型").toString(); + String supplier = readAll.get("供应商")==null?null:readAll.get("供应商").toString(); + String bp_type = readAll.get("部品种类")==null?null:readAll.get("部品种类").toString(); + + BigItem bigItem = null; + if (bigItemCode.length() > 0) { + bigItem = bigItemRepository.findByCode(bigItemCode); + if (bigItem == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+bigItemCode+"完成品品番无效"); + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入完成品品番"); + } + Item item = null; + if (itemCode.length() > 0) { + item = itemRepository.findByCode(itemCode); + if (item == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+itemCode+"部品品番无效"); + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入部品品番"); + } + Area r_area = null; + if (r_area_name.length() > 0) { + r_area = areaRepository.getByName(r_area_name); + if (r_area == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+r_area_name+"入库库区无效"); + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入入库库区"); + } + Area c_area = null; + if (c_area_name.length() > 0) { + c_area = areaRepository.getByName(c_area_name); + if (c_area == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+c_area_name+"出库库区无效"); + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入出库库区"); + } +// Point c_point = null; +// if (c_point_code!=null&&!c_point_code.equals("")) { +// c_point = pointRepository.findByCode(c_point_code); +// if (c_point == null) { +// c_point = pointService.createPoint(c_point_code, "ZCKW", r_area,c_point); +// } +// } + Point z_point = null; + if (z_point_code!=null&&!z_point_code.equals("")) { + z_point = pointRepository.findByCode(z_point_code); + if (z_point == null) { +// z_point = pointService.createPoint(z_point_code, "ZZKW", r_area,c_point); + z_point = pointService.createPoint(z_point_code, "ZZKW", r_area); + } + + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入制造库位"); + } + Boolean isNew= Boolean.FALSE; + BomAccount bomAccount = bomAccountRepository.findByOnly(bigItem.getId(), item.getId(), r_area.getId(), z_point.getId()); + if (bomAccount == null) { + bomAccount = new BomAccount(); + bomAccount.setBigItem(bigItem); + bomAccount.setItem(item); + bomAccount.setRArea(r_area); + bomAccount.setDept(r_area.getDept()); + bomAccount.setZPoint(z_point); + bomAccount.setBp_type(bp_type); + isNew=Boolean.TRUE; + } + bomAccount.setStationType(station_type); + bomAccount.setCArea(c_area); + bomAccount.setAc(ac); + bomAccount.setContents(contents); + bomAccount.setEnabled(true); + bomAccount.setSingles(Integer.parseInt(single)); + bomAccount.setOutType(out_type); + bomAccount.setSupplier(supplier); + if(isNew){ + bomAccountService.create(bomAccount); + bomAccountLogService.copyBomAccount(bomAccount.getId(),"import_add"); + }else{ + bomAccountService.update(bomAccount); + bomAccountLogService.copyBomAccount(bomAccount.getId(),"import_update"); + } + } + + @Override + public String importItem(Map readAll) { + String re = ""; + String code = readAll.get("品番")==null?null:readAll.get("品番").toString(); + String name = readAll.get("品名")==null?null:readAll.get("品名").toString(); + String specs = readAll.get("规格")==null?null:readAll.get("规格").toString(); + String unit = readAll.get("单位")==null?null:readAll.get("单位").toString(); + String hz = readAll.get("荷资")==null?null:readAll.get("荷资").toString(); + String srs =readAll.get("收容数")==null?null:readAll.get("收容数").toString(); + if (code.length() > 0) { + Item item = itemRepository.findByAllCode(code); + if (item == null) { + re = "a"; + item = new Item(); + item.setDept(UserUtils.getDept()); + item.setCode(code); + } else { + re = "b"; + } + item.setName(name); + item.setExtendStr3(hz); + item.setExtendD3(Double.parseDouble(srs)); + if (unit!=null&&!unit.equals("")) { + DictDetail dictDetail = dictDetailRepository.findByDictAndLabel("item_unit", unit); + item.setUnit(dictDetail.getValue()); + } + item.setSpecs(specs); + if (re.equals("a")){ + itemRepository.save(item); + }else if (re.equals("b")){ + itemService.update(item); + } + } + return re; + } + + @Override + public String importBigItem(Map readAll) { + String re = ""; + String code =readAll.get("完成品品番")==null?null:readAll.get("完成品品番").toString().trim(); + String name = readAll.get("完成品型式名")==null?null:readAll.get("完成品型式名").toString().trim(); + String models =readAll.get("机种")==null?null:readAll.get("机种").toString().trim(); + String country =readAll.get("国别")==null?null:readAll.get("国别").toString().trim(); + String outboundType =readAll.get("出库类型")==null?null:readAll.get("出库类型").toString().trim(); + if (code.length() > 0) { + BigItem bigItem = bigItemRepository.findByCode(code); + if (bigItem == null) { + re = "a"; + bigItem = new BigItem(); + bigItem.setCode(code); + bigItem.setDeptId(UserUtils.getDept().getId()); + } else { + re = "b"; + } + bigItem.setModels(models); + bigItem.setName(name); + bigItem.setCountry(country); + bigItem.setOutboundType(outboundType); + bigItem.setEnabled(true); + if (re.equals("a")){ + bigItemService.create(bigItem); + }else if (re.equals("b")){ + bigItemService.update(bigItem); + } + } + return re; + } + + @Override + public String importAsnDetail(Map readAll, Asn asn) { + String re = ""; + String code =readAll.get("品番")==null?null:readAll.get("品番").toString(); + String qty = readAll.get("数量")==null?null:readAll.get("数量").toString(); + String zzkw = readAll.get("制造库位")==null?null:readAll.get("制造库位").toString(); + if (code.length() > 0) { + Item item = itemRepository.findByCode(code); + if (item == null) { + return "部品品番无效"; + } + Point point=pointService.getPoint(zzkw,null,null,null); + if(point==null){ + return "制造库位无效"; + } + List boms= bomAccountRepository.queryBomUnique(asn.getArea().getId(),item.getId(), point.getId()); + if(boms.size()<=0){ + return "BOM工位清单不存在"; + } + AsnDetail asnDetail=new AsnDetail(); + asnDetail.setAsn(asn); + asnDetail.setDept(UserUtils.getDept()); + asnDetail.setStatus(BizStatus.OPEN); + asnDetail.setItem(item); + asnDetail.setPoint(point); + asnDetail.setOrderQty(Double.parseDouble(qty)); + asnDetailService.create(asnDetail); + asn.setOrderQuantity(asn.getOrderQuantity()+asnDetail.getOrderQty()); + asnService.update(asn); + } + return re; + } + + @Override + public String importPickDetail(Map readAll, PickTicket pickTicket) { + String re = ""; + String code = "" + readAll.get("品番"); + String qty = "" + readAll.get("数量"); + String zzkw = "" + readAll.get("制造库位"); + String remark = "" + readAll.get("备注"); + if (code.length() > 0) { + Item item = itemRepository.findByCode(code); + if (item == null) { + return "部品品番无效"; + } + Point point=pointService.getPoint(zzkw,null,null,null); + Long zzkwId=null; + if(point==null){ + if(pickTicket.getArea().getBexb()) { + return "制造库位无效"; + } + }else{ + zzkwId=point.getId(); + } +// List boms= bomAccountRepository.queryBomUnique(pickTicket.getArea().getId(),item.getId(), point.getId()); +// if(boms.size()<=0){ +// return "BOM工位清单不存在"; +// } + Double xbQty=inventoryService.getInvQty(item.getId(),pickTicket.getArea().getId(),zzkwId); + if(xbQty.intValue()> readAll) { + String zsCode=codeUtils.getCode_yyMMdd("ZS",3); + BillType billType = billTypeRepository.findByName(BaseStatus.BT_SGDD); + for (int i = 0; i < readAll.size(); i++) { + Map map=readAll.get(i); + String code =map.get("品番")==null?null:map.get("品番").toString().trim(); + String qty = map.get("数量")==null?null:map.get("数量").toString().trim(); + String areaName =map.get("纳所")==null?null:map.get("纳所").toString().trim(); + if (code.length() > 0) { + PickInstruction pickInstruction=new PickInstruction(); + Item item = itemRepository.findByCode(code); + if (item == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+code+"部品品番无效"); + } + Area r_area = null; + if (areaName.length() > 0) { + r_area = areaRepository.getByName(areaName); + if (r_area == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+areaName+"纳所无效"); + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+"请输入纳所"); + } + List boms= bomAccountRepository.getBomList(r_area.getId(),item.getId()); + if(boms.size()<=0){ + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+code+"找不到BOM清单"); + } + BomAccount bomAccount=boms.get(0); + pickInstruction.setAllocationNumber(zsCode); + pickInstruction.setOutKType(billType); + pickInstruction.setItem(item); + pickInstruction.setAc(bomAccount.getAc()); + pickInstruction.setStatus(BizStatus.OPEN); + pickInstruction.setBomId(bomAccount.getId()); + pickInstruction.setIndicatedQty(Double.parseDouble(qty)); + pickInstruction.setCkArea(bomAccount.getCArea()); + pickInstruction.setRkArea(bomAccount.getRArea()); + pickInstruction.setZzkwPoint(bomAccount.getZPoint()); + pickInstruction.setAllocationDate(new Timestamp(new Date().getTime())); + pickInstructionService.create(pickInstruction); + }else{ + break; + } + } + } + + @Override + public void importCountMoveDetail(Long countId,List> readAll) { + for (int i = 0; i < readAll.size(); i++) { + Map map=readAll.get(i); + String code =map.get("品番")==null?null:map.get("品番").toString().trim(); + String src_point_code = map.get("原库位")==null?null:map.get("原库位").toString().trim(); + String dst_point_code = map.get("目标库位")==null?null:map.get("目标库位").toString().trim(); + String pc1 = map.get("批次号")==null?null:map.get("批次号").toString().trim(); + if (code.length() > 0) { + CountMove countMove=countMoveRepository.getById(countId); + Item item = itemRepository.findByCode(code); + if (item == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+code+"部品品番无效"); + } + Point point=pointService.getPoint(src_point_code,null,null,countMove.getSrcArea().getCode()); + if (point == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+src_point_code+"原库位不存在"); + } + List itemKeyList=itemKeyRepository.queryItemKey(item.getId(),pc1); + if (itemKeyList.size() == 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+code+"不存在库存"); + } + ItemKey ik=itemKeyList.get(0); + List inventoryList=inventoryRepository.queryInventoryPointIk(point.getId(),ik.getId()); + if (inventoryList.size() == 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+code+"不存在库存"); + } + Point dstPoint=null; + if(dst_point_code==null){ + dstPoint=countMove.getDstPoint(); + }else{ + dstPoint=pointService.getPoint(dst_point_code,null,null,countMove.getDstArea().getCode()); + if (point == null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, i+1+"行"+dst_point_code+"目标库位不存在"); + } + } + countMoveService.createCountDetail(countMove,inventoryList.get(0),ik,dstPoint); + }else{ + break; + } + } + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemLisServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemLisServiceImpl.java new file mode 100644 index 0000000..a4f1604 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemLisServiceImpl.java @@ -0,0 +1,99 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.ItemLisRepository; +import com.youchain.basicdata.service.ItemLisService; +import com.youchain.basicdata.service.dto.ItemLisDto; +import com.youchain.basicdata.service.dto.ItemLisQueryCriteria; +import com.youchain.basicdata.service.mapstruct.ItemLisMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author baobinglin +* @date 2024-01-03 +**/ +@Service +@Slf4j +@RequiredArgsConstructor +public class ItemLisServiceImpl implements ItemLisService { + + private final ItemLisRepository itemLisRepository; + private final ItemLisMapper itemLisMapper; + + @Override + public Map queryAll(ItemLisQueryCriteria criteria, Pageable pageable){ + Page page = itemLisRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(itemLisMapper::toDto)); + } + + @Override + public List queryAll(ItemLisQueryCriteria criteria){ + return itemLisMapper.toDto(itemLisRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ItemLisDto findById(Long id) { + ItemLis itemLis = itemLisRepository.findById(id).orElseGet(ItemLis::new); + ValidationUtil.isNull(itemLis.getId(),"ItemLis","id",id); + return itemLisMapper.toDto(itemLis); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ItemLisDto create(ItemLis resources) { + return itemLisMapper.toDto(itemLisRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ItemLis resources) { + ItemLis itemLis = itemLisRepository.findById(resources.getId()).orElseGet(ItemLis::new); + ValidationUtil.isNull( itemLis.getId(),"ItemLis","id",resources.getId()); + itemLis.copy(resources); + itemLisRepository.save(itemLis); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + itemLisRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + + List> list= ExcelDownUtils.CreateMap(all,"ItemLis"); + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemRelationServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemRelationServiceImpl.java new file mode 100644 index 0000000..07b8d9f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemRelationServiceImpl.java @@ -0,0 +1,115 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.ItemRelation; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.ItemRelationRepository; +import com.youchain.basicdata.service.ItemRelationService; +import com.youchain.basicdata.service.dto.ItemRelationDto; +import com.youchain.basicdata.service.dto.ItemRelationQueryCriteria; +import com.youchain.basicdata.service.mapstruct.ItemRelationMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author baobinglin +* @date 2024-01-04 +**/ +@Service +@RequiredArgsConstructor +public class ItemRelationServiceImpl implements ItemRelationService { + + private final ItemRelationRepository itemRelationRepository; + private final ItemRelationMapper itemRelationMapper; + + @Override + public Map queryAll(ItemRelationQueryCriteria criteria, Pageable pageable){ + Page page = itemRelationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(itemRelationMapper::toDto)); + } + + @Override + public List queryAll(ItemRelationQueryCriteria criteria){ + return itemRelationMapper.toDto(itemRelationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ItemRelationDto findById(Long id) { + ItemRelation itemRelation = itemRelationRepository.findById(id).orElseGet(ItemRelation::new); + ValidationUtil.isNull(itemRelation.getId(),"ItemRelation","id",id); + return itemRelationMapper.toDto(itemRelation); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ItemRelationDto create(ItemRelation resources) { + return itemRelationMapper.toDto(itemRelationRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ItemRelation resources) { + ItemRelation itemRelation = itemRelationRepository.findById(resources.getId()).orElseGet(ItemRelation::new); + ValidationUtil.isNull( itemRelation.getId(),"ItemRelation","id",resources.getId()); + itemRelation.copy(resources); + itemRelationRepository.save(itemRelation); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + itemRelationRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"ItemRelation"); +// List> list = new ArrayList<>(); +// for (ItemRelationDto itemRelation : all) { +// Map map = new LinkedHashMap<>(); +// map.put("供应商", itemRelation.getBeSupplier()); +// map.put("key", itemRelation.getBarCode()); +// map.put("品番", itemRelation.getItem()); +// map.put("纳入场所", itemRelation.getCode()); +// map.put("门", itemRelation.getDoor()); +// map.put("箱种", itemRelation.getType()); +// map.put("收容数", itemRelation.getQuantity()); +// map.put("仓库ID", itemRelation.getDeptId()); +// map.put("描述", itemRelation.getDescription()); +// map.put("状态:1启用、0禁用", itemRelation.getEnabled()); +// map.put("创建人", itemRelation.getCreateBy()); +// map.put("修改人", itemRelation.getUpdateBy()); +// map.put("创建时间", itemRelation.getCreateTime()); +// map.put("修改时间", itemRelation.getUpdateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemServiceImpl.java new file mode 100644 index 0000000..0c8d5d2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ItemServiceImpl.java @@ -0,0 +1,141 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.dto.ItemSmallDto; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.ItemQueryCriteria; +import com.youchain.basicdata.service.mapstruct.ItemMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import org.springframework.data.domain.Example; +import java.util.Optional; + +/** + * @website https://eladmin.vip + * @description 服务实现 + * @author houjianlan + * @date 2023-08-07 + **/ +@Service +@RequiredArgsConstructor +public class ItemServiceImpl implements ItemService { + + private final ItemRepository itemRepository; + private final ItemMapper itemMapper; + private final EntityManager entityMapper; + + @Override + public Map queryAll(ItemQueryCriteria criteria, Pageable pageable){ + Page page = itemRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(itemMapper::toDto)); + } + + @Override + public List queryAll(ItemQueryCriteria criteria){ + return itemMapper.toDto(itemRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ItemDto findById(Long id) { + Item item = itemRepository.findById(id).orElseGet(Item::new); + ValidationUtil.isNull(item.getId(),"Item","id",id); + return itemMapper.toDto(item); + } + + @Override + @Transactional + public Item findByItemId(Long id) { + Item item = itemRepository.findById(id).orElseGet(Item::new); + return item; + } + @Override + @Transactional + public ItemDto findByCode(String itemCode) { + Item itemExample = new Item(); + itemExample.setCode(itemCode); + Example example = Example.of(itemExample); + List its=itemRepository.findAll(example); + if(its.size()>0){ + return itemMapper.toDto(its.get(0)); + }else { + return null; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ItemDto create(Item resources) { + return itemMapper.toDto(itemRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Item resources) { + Item item = itemRepository.findById(resources.getId()).orElseGet(Item::new); + ValidationUtil.isNull( item.getId(),"Item","id",resources.getId()); + item.copy(resources); + itemRepository.save(item); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + itemRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"Item"); + FileUtil.downloadExcel(list, response); + } + + @Override + public Item toEntity(ItemDto itemDto) { + return itemMapper.toEntity(itemDto); + } + + + @Override + public Item existItem(String itemCode){ + String hql="select it from Item it where it.code='"+itemCode+"'"; + Query query=entityMapper.createQuery(hql); + List its=query.getResultList(); + if(its.size()>0){ + return its.get(0); + } + return null; + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/PointServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/PointServiceImpl.java new file mode 100644 index 0000000..57cde46 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/PointServiceImpl.java @@ -0,0 +1,494 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.youchain.appupdate.ReturnJson.RLocLayout; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.PointRepository; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.PointSmallDto; +import com.youchain.basicdata.service.dto.PointQueryCriteria; +import com.youchain.basicdata.service.mapstruct.PointMapper; +import lombok.extern.slf4j.Slf4j; +import net.dreamlu.mica.core.utils.JsonUtil; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author liuxue + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-07-26 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class PointServiceImpl implements PointService { + + private final PointRepository pointRepository; + private final PointMapper pointMapper; + private final EntityManager entityMapper; + + @Override + public List getPointList(String type) { + List pointList = null; +// if (type.equals(null) || type.equals("1")) { +// pointList = pointRepository.getPointList(BaseStatus.ZCKW); +// } else + if (type.equals("2")) { + pointList = pointRepository.getPointList(BaseStatus.HCKW); + } else if (type.equals("3")) { + pointList = pointRepository.getPointList(BaseStatus.CH); + } else if (type.equals("4")) {//FHZC + pointList = pointRepository.getPointList(BaseStatus.BHZC); + } else if (type.equals("5")) {//ZZKW + pointList = pointRepository.getPointList(BaseStatus.ZZKW); + } + return pointMapper.toDto(pointList); + } + + @Override + public Map queryAll(PointQueryCriteria criteria, Pageable pageable) { + Page page = pointRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(pointMapper::toDto)); + } + + @Override + public List queryAll(PointQueryCriteria criteria) { + return pointMapper.toDto(pointRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + public List queryKyPointList() { + List> maps = pointRepository.getKyPointList(); + String irsStr = JSON.toJSONString(maps); + List evaUserResps = JSON.parseArray(irsStr, PointSmallDto.class); + return evaUserResps; + } + + @Override + public List getPoint(String type, String areaCode) { + String hql = " from Point p where p.enabled=true and p.status='FREE' and p.type='" + type + "' "; + if (areaCode != null) { + hql += " and p.area.code='" + areaCode + "'"; + } + Query query = entityMapper.createQuery(hql); + List pointList = query.getResultList(); + return pointList; + } + + + @Override + @Transactional + public PointDto findById(Long id) { + Point point = pointRepository.findById(id).orElseGet(Point::new); + ValidationUtil.isNull(point.getId(), "Point", "id", id); + return pointMapper.toDto(point); + } + + @Override + @Transactional + public Point findEntityById(Long id) { + Point point = pointRepository.findById(id).orElseGet(Point::new); + ValidationUtil.isNull(point.getId(), "Point", "id", id); + return point; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PointDto create(Point resources) { +// resources.setPoint(extracted(resources, null, null)); + return pointMapper.toDto(pointRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Point resources) { + //获取缓存库位 + Point point = pointRepository.findById(resources.getId()).orElseGet(Point::new); + ValidationUtil.isNull(point.getId(), "Point", "id", resources.getId()); + point.copy(resources); + pointRepository.save(point); + } + + /** + * 检验库位编码 是否存在,如果不存在就新增一个 + * + * @param resources + * @param type + * @param area + * @return + */ + @Override + public Point extracted(Point resources, String type, Area area) { + String pointCode = null; + +// if (resources.getPoint() == null && resources.getCode() != null) { +// pointCode = resources.getCode(); +// } +// if (resources.getPoint() != null && resources.getPoint().getCode() != null) { +// pointCode = resources.getPoint().getCode(); +// } + if (pointCode == null) { + return null; + } + Point point = pointRepository.findByCode(pointCode); + if (point == null) { + point = new Point(); + //创建暂存库位 + if (resources.getDept() == null) { + point.setDept(UserUtils.getDept()); + } else { + point.setDept(resources.getDept()); + } + if (area != null) { + point.setArea(area); + } else { + point.setArea(resources.getArea()); + } + point.setEnabled(true); + + point.setCode(pointCode); + point.setName(pointCode); + if (type != null) { + point.setType(type); + } else { + point.setType(BaseStatus.HCKW); + } + point.setSortIndex(resources.getSortIndex()); + if (resources.getStatus() == null) { + point.setStatus(BaseStatus.FREE); + } else { + point.setStatus(resources.getStatus()); + } + pointRepository.save(point); + } + return point; + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + pointRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"Point"); + FileUtil.downloadExcel(list, response); + } + + @Override + public Point toEntity(PointDto pointDto) { + return pointMapper.toEntity(pointDto); + } + + @Override + public void queryPoint(String pointCode) { + /* String resultJson= HttpPostUtil.sendPostReq(UrlApi.agv_url, jsonObject.toString());//返回ResponseJson*/ + String resultJson = "{\n" + + "\"status\":200,\n" + + "\"message\":\"\",\n" + + "\"data\":[{\n" + + "\"pointCode\":\"xxxxxx\",\n" + + "\"pointStatus\":0\n" + + "}]\n" + + "}"; + JSONObject resulObject = JSON.parseObject(resultJson); + String code = resulObject.getString("status") == null ? "" : resulObject.getString("status"); + if (code.equals("200")) { + + + } + } + + @Override + public Point getPoint(String code, String status, String type, String areaCode) { + String hql = " from Point point where 1=1 and point.enabled=true "; + if (code != null && code.length() > 0) { + hql += " and point.code='" + code + "'"; + } + if (status != null && status.length() > 0) { + hql += " and point.status='" + status + "'"; + } + if (type != null && type.length() > 0) { + hql += " and point.type='" + type + "'"; + } + if (areaCode != null && areaCode.length() > 0) { + hql += " and point.area.code = '" + areaCode + "' "; + } + + Query query = entityMapper.createQuery(hql); + List pointList = query.getResultList(); + if (pointList.size() > 0) { + return pointList.get(0); + } + return null; + } + + @Override + public Point getPointByFree(String areaName, String goodType) { + + + if (areaName != null && areaName.length() > 0) { + String hql = " from Point point where 1=1 " + + " and point.enabled=true " + + " and point.status='FREE'" + + " and point.type='STORAGE'" + + " and point.id not in (select stock.point.id from Stock stock where stock.point.id>0 ) "; + if (areaName.indexOf(",") != -1) { + List list = Arrays.asList(areaName.split(",")); + String names = list.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")); + hql += " and point.area.name in (" + names + ") "; + } else { + hql += " and point.area.name = '" + areaName + "' "; + } + + if (goodType != null && goodType.length() > 0) { + hql += " and point.description='" + goodType + "'"; + } + Query query = entityMapper.createQuery(hql); + List pointList = query.getResultList(); + if (pointList.size() > 0) { + return pointList.get(0); + } + } + + return null; + } + + @Override + public Point getPointByFreeH(String areaName, String goodType) { + if (areaName != null && areaName.length() > 0) { + String hql = " from Point point where 1=1 " + + " and point.enabled=true " + + " and point.status='FREE'" + + " and point.type='STORAGE'" + + " and point.id not in (select stock.point.id from Stock stock where stock.point.id>0 ) and point.description is null or point.description = '' "; + if (areaName.indexOf(",") != -1) { + List list = Arrays.asList(areaName.split(",")); + String names = list.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")); + hql += " and point.area.name in (" + names + ") "; + } else { + hql += " and point.area.name = '" + areaName + "' "; + } + + if (goodType != null && goodType.length() > 0) { + hql += " and point.description='" + goodType + "'"; + } + Query query = entityMapper.createQuery(hql); + List pointList = query.getResultList(); + if (pointList.size() > 0) { + return pointList.get(0); + } + } + + return null; + } + + @Override + public Point getPointByFreeQ(String areaName, String goodType) { + if (areaName != null && areaName.length() > 0) { + String hql = " from Point point where 1=1 " + + " and point.enabled=true " + + " and point.status='FREE'" + + " and point.type='STORAGE'" + + " and point.id not in (select stock.point.id from Stock stock where stock.point.id>0 ) and point.description in ('前桶440','前桶480')"; + if (areaName.indexOf(",") != -1) { + List list = Arrays.asList(areaName.split(",")); + String names = list.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")); + hql += " and point.area.name in (" + names + ") "; + } else { + hql += " and point.area.name = '" + areaName + "' "; + } + + if (goodType != null && goodType.length() > 0) { + hql += " and point.description='" + goodType + "'"; + } + Query query = entityMapper.createQuery(hql); + List pointList = query.getResultList(); + if (pointList.size() > 0) { + return pointList.get(0); + } + } + return null; + } + + public List queryPointKmd() { + List pointList = null; + String hql = "select p.area.name,p.status,count(p.status) from Point p where p.area.name in " + + "('" + AreaNameDic.QHTL + "','" + AreaNameDic.QHTK + "','" + AreaNameDic.ZCK + "','" + AreaNameDic.ZCM + "')" + + " group by p.area.name,p.status order by p.area.name"; + Query query = entityMapper.createQuery(hql); + pointList = query.getResultList(); + + return pointList; + } + + public List getPointMinxy(String zoneType) { + List pointList = null; + String hql = "select min(p.posX),min(p.posY) ,max(p.posX),max(p.posY) from Point p where 1=1 and p.posX>0 and p.posY>0"; + if (zoneType.equals("QHT")) { + hql += " and p.area.name in ('" + AreaNameDic.QHTL + "','" + AreaNameDic.QHTK + "')"; + } else if (zoneType.equals("ZCKM")) { + hql += " and p.area.name in ('" + AreaNameDic.ZCM + "','" + AreaNameDic.ZCK + "')"; + } else if (zoneType.equals("ZCJXB01")) { + hql += " and p.area.name ='" + AreaNameDic.ZCJXB + "' and p.code like '%-01'"; + } else if (zoneType.equals("ZCJXB02")) { + hql += " and p.area.name ='" + AreaNameDic.ZCJXB + "' and p.code like '%-02'"; + } + Query query = entityMapper.createQuery(hql); + pointList = query.getResultList(); + + return pointList; + } + + public int getPointCout_type(String itemType) { + String hql = "select count(p.id) from Point p where 1=1 "; + if (itemType.equals("前桶440") || itemType.equals("前桶480")) { + hql += " and p.area.name='" + AreaNameDic.QHTL + "' and p.description='" + itemType + "'"; + } else if (itemType.equals("KC")) { + hql = " select count(p.id) from Point p where p.area.id=27 ";//前后桶空车区空车数量 + } else { + hql += " and p.area.name='" + AreaNameDic.QHTL + "' and (p.description is null or p.description ='')"; + } + Query query = entityMapper.createQuery(hql); + return Integer.parseInt(query.getResultList().get(0).toString()); + } + + @Transactional(readOnly = true) + public int getInvCout_type(String itemType) { + String sql = "select count(inv.id)" + + " from data_inventory inv " + + "LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n" + + "where 1=1 and inv.quantity>0 and it.good_type='" + itemType + "'"; + if (itemType.equals("KC")) { + sql = "select count(id) from base_point where area_id=27 and status='USED'";//前后桶空车区空车数量 + } + List ts = entityMapper.createNativeQuery(sql).getResultList(); + return Integer.parseInt(ts.get(0).toString()); + } + + @Transactional(readOnly = true) + public String getInvCoutInfo2(String itemType) { + String sql = "select CONCAT(count(inv.id),'车 ',sum(inv.quantity),'个')" + + " from data_inventory inv " + + "LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n" + + "where 1=1 and inv.quantity>0 and it.good_type='" + itemType + "'"; + + Object t = entityMapper.createNativeQuery(sql).getSingleResult(); +// log.info(sql+"===="+ts.get(0).toString()+"==="+ts.size()); +// for(int i=0;i0 and it.good_type='" + itemType + "'"; + if (itemType.equals("KC")) { + sql = "select count(id) from base_point where area_id=27 AND status='USED'";//前后桶空车区空车数量 + List ts = entityMapper.createNativeQuery(sql).getResultList(); + return ts.get(0).toString(); + } else { + List ts = entityMapper.createNativeQuery(sql).getResultList(); + Object[] obj = ts.get(0); + return obj[0].toString() + "车 " + obj[1].toString(); + } + } + + + @Transactional(readOnly = true) + public List queryLayout(String zoneType, int minx, int miny) { + String sql = "select p.code id,inv.point_id,z.name,p.`status`,SUBSTRING(p.code, -6) code,it.good_type itemType,it.code itemName,\n" + + "p.pos_x x,p.pos_y y," + + "case when z.`name`= '前后桶空车区' and p.`status`='USED' then 3 when p.enabled=0 then '2' when p.`status`='USED' and inv.point_id>0 then '1' else '0' end type\n" + + " from base_point p\n" + + "left join data_inventory inv on inv.point_id=p.id and inv.quantity>0\n" + + "left join base_area z on z.id=p.area_id\n" + + "LEFT JOIN data_item_key ik on ik.id=inv.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n" + + "where 1=1 and p.pos_x>0 and p.pos_y>0"; + if (zoneType.equals("QHT")) { + sql += " and z.`name` in ('" + AreaNameDic.QHTL + "','" + AreaNameDic.QHTK + "')"; + } else if (zoneType.equals("ZCKM")) { + sql += " and z.`name` in ('" + AreaNameDic.ZCM + "','" + AreaNameDic.ZCK + "')"; + } else if (zoneType.equals("ZCJXB01")) { + sql += " and z.`name` ='" + AreaNameDic.ZCJXB + "' and p.code like '%-01'"; + } else if (zoneType.equals("ZCJXB02")) { + sql += " and z.`name` ='" + AreaNameDic.ZCJXB + "' and p.code like '%-02'"; + } + sql += " order by p.pos_x,p.pos_y"; + List ts = entityMapper.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List l = JSON.parseArray(JSON.toJSONString(ts), RLocLayout.class); + return l; + } + + @Transactional(readOnly = true) + public List getZcJxb() { + String sql = "SELECT SUBSTRING(p.code,8,4) jxb ,CAST(SUBSTRING(p.code,10,2) AS SIGNED) xh,p1.code code1,p2.code code2,p1.`status` status1,p2.`status` status2,p1.item_code item_code1,p2.item_code item_code2,p1.pos_x,p1.pos_y\n" + + "FROM `base_point` p \n" + + "left join base_point p1 on p1.code=CONCAT(SUBSTRING(p.code,1,11),'-01')\n" + + "left join base_point p2 on p2.code=CONCAT(SUBSTRING(p.code,1,11),'-02')\n" + + "where p.area_id=31 and p.pos_x>0 and p.pos_y>0\n" + + "GROUP BY SUBSTRING(p.code,8,4)"; + List ts = entityMapper.createNativeQuery(sql).getResultList(); + return ts; + } + + public Point createPoint(String code,String type,Area area){ + Point point = new Point(); + point.setCode(code); + point.setArea(area); + point.setType(type); + point.setDept(UserUtils.getDept()); +// point.setPoint(c_point); + this.create(point); + return point; + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ProductionPlanServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ProductionPlanServiceImpl.java new file mode 100644 index 0000000..f2220eb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/ProductionPlanServiceImpl.java @@ -0,0 +1,224 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.inputJson.buttenJson.ManualGeneration; +import com.youchain.businessdata.inputJson.buttenJson.ProductionPlanButton; +import com.youchain.businessdata.repository.PlanPickDetailRepository; +import com.youchain.businessdata.service.PlanPickDetailService; +import com.youchain.businessdata.service.SparepartsService; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.ProductionPlanRepository; +import com.youchain.basicdata.service.ProductionPlanService; +import com.youchain.basicdata.service.dto.ProductionPlanDto; +import com.youchain.basicdata.service.dto.ProductionPlanQueryCriteria; +import com.youchain.basicdata.service.mapstruct.ProductionPlanMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.time.YearMonth; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-01-04 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class ProductionPlanServiceImpl implements ProductionPlanService { + + private final ProductionPlanRepository productionPlanRepository; + private final ProductionPlanMapper productionPlanMapper; + private final BillTypeRepository billTypeRepository; + private final PlanPickDetailRepository planPickDetailRepository; + private final PlanPickDetailService planPickDetailService; + private final CodeUtils codeUtils; + private final EntityManager entityMapper; + private final SparepartsService sparepartsService; + private final BigItemRepository bigItemRepository; + + @Override + public Map queryAll(ProductionPlanQueryCriteria criteria, Pageable pageable) { + Page page = productionPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(productionPlanMapper::toDto)); + } + + @Override + public List queryAll(ProductionPlanQueryCriteria criteria) { + return productionPlanMapper.toDto(productionPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public ProductionPlanDto findById(Long id) { + ProductionPlan productionPlan = productionPlanRepository.findById(id).orElseGet(ProductionPlan::new); + ValidationUtil.isNull(productionPlan.getId(), "ProductionPlan", "id", id); + return productionPlanMapper.toDto(productionPlan); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ProductionPlanDto create(ProductionPlan resources) { + return productionPlanMapper.toDto(productionPlanRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProductionPlan resources) { + ProductionPlan productionPlan = productionPlanRepository.findById(resources.getId()).orElseGet(ProductionPlan::new); + ValidationUtil.isNull(productionPlan.getId(), "ProductionPlan", "id", resources.getId()); + productionPlan.copy(resources); + productionPlanRepository.save(productionPlan); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + productionPlanRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"ProductionPlan"); + FileUtil.downloadExcel(list, response); + } + @Override + public String manualGenerationSavePlanPick(List plans, int num, String batch, AutomaticPlanDetail detail, Boolean isLast, Timestamp batchTime) { + //获取最新单号 + String code = codeUtils.getCode_yyMMdd("JH-",3); + List ppd_his = planPickDetailRepository.findByCode(code); + if(ppd_his.size()>0){ + throw new BadRequestException(code+"单号已存在"); + } + BillType billType = billTypeRepository.findByName(BaseStatus.BT_DD); + for (int i = 0; i < num; i++) { + ProductionPlan p = plans.get(i); + PlanPickDetail ppd = planPickDetailRepository.findPlanPickData(code, p.getBigItem().getId()); + if (!Objects.isNull(ppd)) { + //备货数量 + ppd.setOrderQuantity(ppd.getOrderQuantity() + 1d); + ppd.setEndNo(p.getMachineNo()); + planPickDetailService.update(ppd); + }else { + ppd = new PlanPickDetail(); + ppd.setBigItem(p.getBigItem()); + ppd.setStartNo(p.getMachineNo()); + ppd.setEndNo(p.getMachineNo()); + ppd.setOrderQuantity(1d);//每次叫料加上对应的铺线数量 + ppd.setZone(p.getRkArea()); + ppd.setBillType(billType); + ppd.setCode(code); + ppd.setRemark(batch); + ppd.setBatchTime(batchTime); + ppd.setGcCode(p.getRkArea().getGcCode()); + ppd.setPxDetailId(detail.getId()); + ppd.setIsLast(isLast); + planPickDetailService.create(ppd); + } + p.setProjectNo(code); + this.update(p); + } + return code; + } + + @Override + public List piLiangHaoYong(ProductionPlanVo productionPlanVo) { + Long id = productionPlanVo.getId(); + String workingStation = productionPlanVo.getWorkingStation(); + Integer number = productionPlanVo.getNumber(); + String hql = " from ProductionPlan t where t.id >="+id+"and t.workingStation = '"+workingStation+"' and t.statue='UN_CONSUME' order by t.id ASC"; + Query query = entityMapper.createQuery(hql); + query.setMaxResults(number); + List resultList = query.getResultList(); + if (!resultList.isEmpty()){ + return resultList; + } + return null; + } + + public HashMap getEndIdNO(String gw,int qty){ + List minList = productionPlanRepository.getLimitPlan(gw,1); + HashMap map=new HashMap<>(); + if(minList.size()<=0){ + map.put("startNum","无数据"); + map.put("endNum","无数据"); + + }else{ + ProductionPlan minPlan=minList.get(0); + + String startNum=minPlan.getIdno(); + log.info("startNum"+startNum); + String qz=startNum.substring(0,4); + String sz=startNum.substring(4,startNum.length()); + String endNum=qz+String.format("%0"+sz.length()+"d",Integer.parseInt(sz)+qty-1); + map.put("startNum",startNum); + map.put("endNum",endNum); + } + return map; + + } + public void scsxHaoyong(List productionPlans,String gw,String des){ + for (ProductionPlan productionPlan: productionPlans){ + productionPlan.setStatue("CONSUME"); + productionPlan.setTakeUpTime(new Timestamp(new Date().getTime())); + this.update(productionPlan); + } + Map map = new HashMap<>(); + for(ProductionPlan productionPlan : productionPlans){ + Long id = productionPlan.getBigItem().getId(); + if(map.containsKey(id)){ + map.put(id,map.get(id)+1); + }else { + map.put(id,1); + } + } + for(Long key : map.keySet()){ + Spareparts spareparts = new Spareparts(); + spareparts.setStationType(gw); + spareparts.setStatus("UN_CONSUME"); + spareparts.setDate(new Timestamp(new Date().getTime())); + BigItem bigItem = bigItemRepository.getById(key); +// bigItem.setId(key); + spareparts.setBigItemId(bigItem); + spareparts.setOrderQuantity(map.get(key)); + spareparts.setDescription(des); + sparepartsService.create(spareparts); + + //自动耗用 + sparepartsService.hySpareParts(spareparts.getId()); + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockServiceImpl.java new file mode 100644 index 0000000..f406b41 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockServiceImpl.java @@ -0,0 +1,219 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.StockRepository; +import com.youchain.basicdata.service.StockService; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.basicdata.service.dto.StockSmallDto; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.basicdata.service.mapstruct.StockMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author liuxue +* @date 2023-07-28 +**/ +@Service +@RequiredArgsConstructor +@Slf4j +public class StockServiceImpl implements StockService { + + private final StockRepository stockRepository; + private final StockMapper stockMapper; + private final EntityManager entityMapper; + + @Override + public Map queryAll(StockQueryCriteria criteria, Pageable pageable){ + Page page = stockRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(stockMapper::toDto)); + } + + @Override + public List queryAll(StockQueryCriteria criteria){ + return stockMapper.toDto(stockRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public List queryKyStockList(String code){ + List> maps=stockRepository.getKyStockList(code); + String irsStr = JSON.toJSONString(maps); + log.info(irsStr); + List evaUserResps = JSON.parseArray(irsStr,StockSmallDto.class); + return evaUserResps; + } + + @Override + public List queryStockList2(String code){ + List objs=stockRepository.getStockList2(code); + List list= EntityUtils.castEntity(objs, StockSmallDto.class, new StockSmallDto()); + log.info("fangfa2 "+list.toString()); + return list; + } + + @Override + @Transactional + public StockDto findById(Long id) { + Stock stock = stockRepository.findById(id).orElseGet(Stock::new); + ValidationUtil.isNull(stock.getId(),"Stock","id",id); + return stockMapper.toDto(stock); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public StockDto create(Stock resources) { + return stockMapper.toDto(stockRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Stock resources) { + Stock stock = stockRepository.findById(resources.getId()).orElseGet(Stock::new); + ValidationUtil.isNull( stock.getId(),"Stock","id",resources.getId()); + stock.copy(resources); + stockRepository.save(stock); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + stockRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (StockDto stock : all) { + Map map = new LinkedHashMap<>(); + map.put("容器代码", stock.getCode()); + map.put("上级容器ID", stock.getPid()); + map.put("仓库ID", stock.getDept().getName()); + map.put("地标ID", stock.getPoint().getName()); + map.put("子容器数量", stock.getSubCount()); + map.put("容器名称", stock.getName()); + map.put("类型名称", stock.getStockType().getName()); + map.put("容器使用重量", stock.getUseWeight()); + map.put("容器使用体积", stock.getUseSize()); + map.put("容器重量占用率", stock.getUsageWeight()); + map.put("容器体积占用率", stock.getUsageSize()); + map.put("状态", stock.getEnabled()); + map.put("创建人", stock.getCreateBy()); + map.put("修改人", stock.getUpdateBy()); + map.put("创建时间", stock.getCreateTime()); + map.put("修改时间", stock.getUpdateTime()); + map.put("顶级容器ID", stock.getTopId()); + list.add(map); + } + + FileUtil.downloadExcel(list, response); + } + @Override + public Stock toEntity(StockDto stockDto) { + return stockMapper.toEntity(stockDto); + } + @Override + public Stock findByCode(String code, String status){ + String hql="select t from Stock t where t.code='"+code+"'"; + if(status!=null && status.length()>0){ + hql+=" and t.status='"+status+"'"; + } + Query query=entityMapper.createQuery(hql); + List ts=query.getResultList(); + if(ts.size()>0){ + return ts.get(0); + } + return null; + } + + @Override + public Stock findByPointCode(String code) { + String hql=" from Stock t where t.point.code='"+code+"'"; + Query query=entityMapper.createQuery(hql); + List stockList=query.getResultList(); + if(stockList.size()>0){ + return stockList.get(0); + } + return null; + } + + @Override + public Stock findByKStock(String areaName) { + String hql=" from Stock t where t.point.id>0 and t.point.status='USED' and t.status='FREE' and t.point.type='STORAGE' "; + if(areaName.equals(AreaNameDic.QTYK) ||areaName.equals(AreaNameDic.HTYK)){ + hql+=" and t.point.area.name in ('前后桶空车区','前后桶部装空车缓存区')"; + }else{ + hql+=" and t.point.area.name ='"+areaName+"'"; + } + Query query=entityMapper.createQuery(hql); + List stockList=query.getResultList(); + if(stockList.size()>0){ + return stockList.get(0); + } + return null; + } + + + @Override + public Stock findStockByPoint(String areaName) { + String hql=" from Stock t where t.point.id>0 and t.point.status='USED' and t.status='FREE' and t.point.type='STORAGE' "; + if(areaName!=null){ + hql+=" and t.point.area.name ='"+areaName+"'"; + } + Query query=entityMapper.createQuery(hql); + List stockList=query.getResultList(); + if(stockList.size()>0){ + return stockList.get(0); + } + return null; + } + + @Override + public List findByKStockList(String areaName) { + String hql=" from Stock t where t.point.id>0 and t.point.status='USED' and t.status='FREE' and t.point.type='STORAGE' "; + if(areaName!=null){ + hql+=" and t.point.area.name ='"+areaName+"'"; + } + Query query=entityMapper.createQuery(hql); + List stockList=query.getResultList(); + if(stockList.size()>0){ + return stockList; + } + return null; + } +} diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockTypeServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockTypeServiceImpl.java new file mode 100644 index 0000000..9c927fb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/StockTypeServiceImpl.java @@ -0,0 +1,137 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.StockType; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.StockTypeRepository; +import com.youchain.basicdata.service.StockTypeService; +import com.youchain.basicdata.service.dto.StockTypeDto; +import com.youchain.basicdata.service.dto.StockTypeQueryCriteria; +import com.youchain.basicdata.service.mapstruct.StockTypeMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author liuxue +* @date 2023-07-28 +**/ +@Service +@RequiredArgsConstructor +public class StockTypeServiceImpl implements StockTypeService { + + private final StockTypeRepository stockTypeRepository; + private final StockTypeMapper stockTypeMapper; + private final EntityManager entityMapper; + + @Override + public Map queryAll(StockTypeQueryCriteria criteria, Pageable pageable){ + Page page = stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(stockTypeMapper::toDto)); + } + + @Override + public List queryAll(StockTypeQueryCriteria criteria){ + return stockTypeMapper.toDto(stockTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public Map queryAll(){ + List stockTypeList= stockTypeRepository.findAll(); + Map map = new HashMap<>(); + for (StockType s:stockTypeList ) { + map.put(s.getCode(),s); + } + return map; + } + + @Override + @Transactional + public StockTypeDto findById(Long id) { + StockType stockType = stockTypeRepository.findById(id).orElseGet(StockType::new); + ValidationUtil.isNull(stockType.getId(),"StockType","id",id); + return stockTypeMapper.toDto(stockType); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public StockTypeDto create(StockType resources) { + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + resources.setId(snowflake.nextId()); + return stockTypeMapper.toDto(stockTypeRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StockType resources) { + StockType stockType = stockTypeRepository.findById(resources.getId()).orElseGet(StockType::new); + ValidationUtil.isNull( stockType.getId(),"StockType","id",resources.getId()); + stockType.copy(resources); + stockTypeRepository.save(stockType); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + stockTypeRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (StockTypeDto stockType : all) { + Map map = new LinkedHashMap<>(); + map.put("名称", stockType.getName()); + map.put("代码", stockType.getCode()); + map.put("长", stockType.getLength()); + map.put("宽", stockType.getWidth()); + map.put("高", stockType.getHeight()); + map.put("重量", stockType.getWeight()); + map.put("体积", stockType.getSize()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public StockType findByCode(String code){ + String hql="select t from StockType t where t.code='"+code+"'"; + Query query=entityMapper.createQuery(hql); + List ts=query.getResultList(); + if(ts.size()>0){ + return ts.get(0); + } + return null; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/impl/TableConfigServiceImpl.java b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/TableConfigServiceImpl.java new file mode 100644 index 0000000..ba87525 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/impl/TableConfigServiceImpl.java @@ -0,0 +1,126 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.impl; + +import com.youchain.basicdata.domain.TableConfig; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.basicdata.repository.TableConfigRepository; +import com.youchain.basicdata.service.TableConfigService; +import com.youchain.basicdata.service.dto.TableConfigDto; +import com.youchain.basicdata.service.dto.TableConfigQueryCriteria; +import com.youchain.basicdata.service.mapstruct.TableConfigMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author LiuXue +* @date 2023-08-28 +**/ +@Service +@RequiredArgsConstructor +public class TableConfigServiceImpl implements TableConfigService { + + private final TableConfigRepository tableConfigRepository; + private final TableConfigMapper tableConfigMapper; + + @Override + public Map queryAll(TableConfigQueryCriteria criteria, Pageable pageable){ + Page page = tableConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tableConfigMapper::toDto)); + } + + @Override + public List queryAll(TableConfigQueryCriteria criteria){ + return tableConfigMapper.toDto(tableConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public TableConfigDto findById(Integer id) { + TableConfig tableConfig = tableConfigRepository.findById(id).orElseGet(TableConfig::new); + ValidationUtil.isNull(tableConfig.getId(),"TableConfig","id",id); + return tableConfigMapper.toDto(tableConfig); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TableConfigDto create(TableConfig resources) { + TableConfigQueryCriteria criteria =new TableConfigQueryCriteria(); + if(resources.getTableType().length()<=0){ + return null; + } + criteria.setTableType(resources.getTableType()); + criteria.setCreateBy(resources.getCreateBy()); + List list=tableConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); + if(list.size()>0){ + TableConfig tableConfig=list.get(0); + ValidationUtil.isNull( tableConfig.getId(),"TableConfig","id",resources.getId()); + tableConfig.copy(resources); + tableConfigRepository.save(tableConfig); + return tableConfigMapper.toDto(tableConfig); + }else{ + return tableConfigMapper.toDto(tableConfigRepository.save(resources)); + } + + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TableConfig resources) { + TableConfig tableConfig = tableConfigRepository.findById(resources.getId()).orElseGet(TableConfig::new); + ValidationUtil.isNull( tableConfig.getId(),"TableConfig","id",resources.getId()); + tableConfig.copy(resources); + tableConfigRepository.save(tableConfig); + } + + @Override + public void deleteAll(Integer[] ids) { + for (Integer id : ids) { + tableConfigRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (TableConfigDto tableConfig : all) { + Map map = new LinkedHashMap<>(); + map.put(" tableType", tableConfig.getTableType()); + map.put(" value", tableConfig.getValue()); + map.put(" createBy", tableConfig.getCreateBy()); + map.put(" updateBy", tableConfig.getUpdateBy()); + map.put(" createTime", tableConfig.getCreateTime()); + map.put(" updateTime", tableConfig.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AreaMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AreaMapper.java new file mode 100644 index 0000000..4e0c598 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AreaMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author HJL +* @date 2023-08-14 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface AreaMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanDetailMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanDetailMapper.java new file mode 100644 index 0000000..325e40c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.service.dto.AutomaticPlanDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-07 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface AutomaticPlanDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanningMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanningMapper.java new file mode 100644 index 0000000..c6d086e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/AutomaticPlanningMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.service.dto.AutomaticPlanningDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-05 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface AutomaticPlanningMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BigItemMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BigItemMapper.java new file mode 100644 index 0000000..f0a5c4e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BigItemMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.service.dto.BigItemDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-12-29 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BigItemMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BillTypeMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BillTypeMapper.java new file mode 100644 index 0000000..ea0755f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BillTypeMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.service.dto.BillTypeDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-07 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BillTypeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountLogMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountLogMapper.java new file mode 100644 index 0000000..272fdf1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountLogMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.BomAccountLog; +import com.youchain.basicdata.service.dto.BomAccountLogDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-24 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BomAccountLogMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountMapper.java new file mode 100644 index 0000000..355dc44 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BomAccountMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.service.dto.BomAccountDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-02 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BomAccountMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BoxMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BoxMapper.java new file mode 100644 index 0000000..1022df2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/BoxMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.service.dto.BoxDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-17 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BoxMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/DesignListMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/DesignListMapper.java new file mode 100644 index 0000000..20b3d9d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/DesignListMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.DesignList; +import com.youchain.basicdata.service.dto.DesignListDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author LY +* @date 2024-04-26 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DesignListMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemLisMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemLisMapper.java new file mode 100644 index 0000000..16c606f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemLisMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.service.dto.ItemLisDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-03 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ItemLisMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemMapper.java new file mode 100644 index 0000000..f7098ea --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.dto.ItemDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ItemMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemRelationMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemRelationMapper.java new file mode 100644 index 0000000..f0a82a6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ItemRelationMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.ItemRelation; +import com.youchain.basicdata.service.dto.ItemRelationDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ItemRelationMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointMapper.java new file mode 100644 index 0000000..b67c561 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.dto.PointDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-26 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PointMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointSmallMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointSmallMapper.java new file mode 100644 index 0000000..fef8379 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/PointSmallMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.dto.PointSmallDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-26 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PointSmallMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ProductionPlanMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ProductionPlanMapper.java new file mode 100644 index 0000000..7f07464 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/ProductionPlanMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.basicdata.service.dto.ProductionPlanDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-04 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ProductionPlanMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockMapper.java new file mode 100644 index 0000000..326f9e1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.StockDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface StockMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockTypeMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockTypeMapper.java new file mode 100644 index 0000000..6b00570 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/StockTypeMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.StockType; +import com.youchain.basicdata.service.dto.StockTypeDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-07-28 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface StockTypeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/TableConfigMapper.java b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/TableConfigMapper.java new file mode 100644 index 0000000..90e6ee0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/basicdata/service/mapstruct/TableConfigMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.basicdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.basicdata.domain.TableConfig; +import com.youchain.basicdata.service.dto.TableConfigDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author LiuXue +* @date 2023-08-28 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TableConfigMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/Asn.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/Asn.java new file mode 100644 index 0000000..b14ac00 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/Asn.java @@ -0,0 +1,141 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-09 +**/ +@Entity +@Data +@Table(name="data_asn") +public class Asn extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`code`",unique = true,nullable = false) + @NotBlank + @ApiModelProperty(value = "单号") + private String code; + + @OneToOne + @JoinColumn(name = "`area_id`",nullable = false) + @NotNull + @ApiModelProperty(value = "库区") + private Area area; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`cus_code`") + @ApiModelProperty(value = "客户订单号") + private String cusCode; + + @Column(name = "`related_bill1`") + @ApiModelProperty(value = "相关单号1") + private String relatedBill1; + + @Column(name = "`related_bill2`") + @ApiModelProperty(value = "相关单号2") + private String relatedBill2; + + @Column(name = "`related_bill3`") + @ApiModelProperty(value = "相关单号3") + private String relatedBill3; + + @Column(name = "`order_date`",nullable = false) + @NotNull + @ApiModelProperty(value = "订单日期") + private Timestamp orderDate; + + @Column(name = "`estimate_date`") + @ApiModelProperty(value = "预计到货日期") + private Timestamp estimateDate; + + @Column(name = "`received_date`") + @ApiModelProperty(value = "收货日期") + private Timestamp receivedDate; + + @Column(name = "`from_name`") + @ApiModelProperty(value = "发货方") + private String fromName; + + @Column(name = "`from_address`") + @ApiModelProperty(value = "发货地址") + private String fromAddress; + + @Column(name = "`from_man`") + @ApiModelProperty(value = "发货联系人") + private String fromMan; + + @Column(name = "`from_tel`") + @ApiModelProperty(value = "发货电话") + private String fromTel; + + @Column(name = "`order_quantity`") + @ApiModelProperty(value = "订单数量") + private Double orderQuantity; + + @Column(name = "`received_quantity`") + @ApiModelProperty(value = "收货数量") + private Double receivedQuantity; + + @Column(name = "`putaway_quantity`") + @ApiModelProperty(value = "上架数量") + private Double putawayQuantity; + + @Column(name = "`vehicle`") + @ApiModelProperty(value = "车牌号") + private String vehicle; + + @OneToOne + @JoinColumn(name = "`bill_type_id`") + @ApiModelProperty(value = "单据类型") + private BillType billType; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + public void copy(Asn source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/AsnDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/AsnDetail.java new file mode 100644 index 0000000..45129ce --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/AsnDetail.java @@ -0,0 +1,164 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.domain.StockType; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author hjl + * @website https://eladmin.vip + * @description / + * @date 2023-08-14 + **/ +@Entity +@Data +@Table(name = "data_asn_detail") +public class AsnDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`asn_id`") + @ApiModelProperty(value = "订单序号") + private Asn asn; + + @OneToOne + @JoinColumn(name = "`item_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "物料") + private Item item; + + @OneToOne + @JoinColumn(name = "`stock_id`") + @ApiModelProperty(value = "容器") + private Stock stock; + + @OneToOne + @JoinColumn(name = "`point_id`") + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`line_no`") + @ApiModelProperty(value = "行号") + private Long lineNo; + + @Column(name = "`po`") + @ApiModelProperty(value = "Mo票") + private String po; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty = 0d; + + @Column(name = "`received_qty`") + @ApiModelProperty(value = "收货数量") + private Double receivedQty = 0d; + + @Column(name = "`move_qty`") + @ApiModelProperty(value = "移位数量") + private Double moveQty = 0d; + + @Column(name = "`put_qty`") + @ApiModelProperty(value = "上架数量") + private Double putQty = 0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight = 0d; + + @Column(name = "`volume`") + @ApiModelProperty(value = "体积") + private Double volume = 0d; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`prop_c1`") + @ApiModelProperty(value = "批次号") + private String propC1; + + @Column(name = "`prop_c2`") + @ApiModelProperty(value = "序列号") + private String propC2; + + @Column(name = "`prop_c3`") + @ApiModelProperty(value = "厂家编号") + private String propC3; + + @Column(name = "`prop_c4`") + @ApiModelProperty(value = "属性4") + private String propC4; + + @Column(name = "`prop_c5`") + @ApiModelProperty(value = "属性5") + private String propC5; + + @Column(name = "`prop_c6`") + @ApiModelProperty(value = "属性6") + private String propC6; + + @Column(name = "`prop_d1`") + @ApiModelProperty(value = "生产日期") + private Timestamp propD1; + + @Column(name = "`prop_d2`") + @ApiModelProperty(value = "到期日期") + private Timestamp propD2; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号") + private Long sourceId; + + @Column(name = "`order_number`") + @ApiModelProperty(value = "工单号") + private String orderNumber; + + public void copy(AsnDetail source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/BaseCode.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/BaseCode.java new file mode 100644 index 0000000..f522064 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/BaseCode.java @@ -0,0 +1,59 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2023-08-22 +**/ +@Entity +@Data +@Table(name="base_code") +public class BaseCode implements Serializable { + + @Column(name = "`code`",nullable = true) + @ApiModelProperty(value = "code") + private String code; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Integer id; + + @Column(name = "`key`",nullable = true) + @ApiModelProperty(value = "key") + private String key; + + @Column(name = "`value`",nullable = true) + @ApiModelProperty(value = "value") + private String value; + + public void copy(BaseCode source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountDetail.java new file mode 100644 index 0000000..fe4633a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountDetail.java @@ -0,0 +1,93 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-20 +**/ +@Entity +@Data +@Table(name="data_count_detail") +public class CountDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`plan_id`") + @ApiModelProperty(value = "计划") + private CountPlan plan; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "物料") + private Item item; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`warehouse_id`") + @ApiModelProperty(value = "仓库") + private Dept warehouse; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "库存") + private Long invId; + + @Column(name = "`plan_qty`") + @ApiModelProperty(value = "计划数量") + private Double planQty=0d; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "盘点数量") + private Double countQty=0d; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + + public void copy(CountDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMove.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMove.java new file mode 100644 index 0000000..b603f2b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMove.java @@ -0,0 +1,108 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-19 +**/ +@Entity +@Data +@Table(name="data_count_move") +public class CountMove extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "序号") + private Long id; + + @Column(name = "`code`") + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "`name`") + @ApiModelProperty(value = "名称") + private String name; + + @OneToOne + @JoinColumn(name = "`src_area_id`") + @ApiModelProperty(value = "移出库区") + private Area srcArea; + + @OneToOne + @JoinColumn(name = "`dst_area_id`") + @ApiModelProperty(value = "目标库区") + private Area dstArea; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标库位") + private Point dstPoint; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status= BizStatus.OPEN; + + @Column(name = "`type`") + @ApiModelProperty(value = "类型") + private String type; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty=0d; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "盘点数量") + private Double countQty=0d; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号") + private Long sourceId; + + public void copy(CountMove source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetail.java new file mode 100644 index 0000000..197db6f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetail.java @@ -0,0 +1,98 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Point; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-21 +**/ +@Entity +@Data +@Table(name="data_count_move_detail") +public class CountMoveDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`count_move_id`") + @ApiModelProperty(value = "盘点序号") + private CountMove countMove; + + @OneToOne + @JoinColumn(name = "`item_Key_id`") + @ApiModelProperty(value = "物料") + private ItemKey itemKey; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "库存") + private Long invId; + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "原库位") + private Point srcPoint; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标库位") + private Point dstPoint; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "盘点数量") + private Double countQty; + + @Column(name = "`status`") + @ApiModelProperty(value = "盘点状态") + private String status; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + + + + public void copy(CountMoveDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetailRecord.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetailRecord.java new file mode 100644 index 0000000..4c895cd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountMoveDetailRecord.java @@ -0,0 +1,118 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.basicdata.domain.Point; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import javax.persistence.Entity; +import com.youchain.base.BaseEntity; +import javax.persistence.Table; +import org.hibernate.annotations.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-21 +**/ +@Entity +@Data +@Table(name="data_count_move_detail_record") +public class CountMoveDetailRecord extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`count_move_id`") + @ApiModelProperty(value = "盘点序号") + private CountMove countMove; + + @OneToOne + @JoinColumn(name = "`count_move_detail_id`") + @ApiModelProperty(value = "盘点明细序号") + private CountMoveDetail countMoveDetail; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "物料") + private ItemKey itemKey; + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "原库位") + private Point srcPoint; + + @OneToOne + @JoinColumn(name = "`count_point_id`") + @ApiModelProperty(value = "盘点库位") + private Point countPoint; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标库位") + private Point dstPoint; + + @Column(name = "`plan_qty`") + @ApiModelProperty(value = "计划数量") + private Double planQty; + + @OneToOne + @JoinColumn(name = "`xpp_id`") + @ApiModelProperty(value = "现品票序号") + private XppRecord xpp; + + @Column(name = "`xpp_ewm`") + @ApiModelProperty(value = "现品票二维码") + private String xppEwm; + + @Column(name = "`xpp_qty`") + @ApiModelProperty(value = "现品票数量") + private Double xppQty; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "盘点数量") + private Double countQty; + + @Column(name = "`status`") + @ApiModelProperty(value = "盘点状态") + private String status; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + + public void copy(CountMoveDetailRecord source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountPlan.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountPlan.java new file mode 100644 index 0000000..7cfd260 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountPlan.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-19 +**/ +@Entity +@Data +@Table(name="data_count_plan") +public class CountPlan extends BaseEntity implements Serializable { + + @Id + @Column(name = "`id`") + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "序号") + private Long id; + + @Column(name = "`code`") + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "`name`") + @ApiModelProperty(value = "名称") + private String name; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`type`",nullable = false) + @NotBlank + @ApiModelProperty(value = "类型") + private String type; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "盘点数量") + private Double countQty; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号") + private Long sourceId; + + + public void copy(CountPlan source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/CountRecord.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountRecord.java new file mode 100644 index 0000000..3672578 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/CountRecord.java @@ -0,0 +1,141 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-20 +**/ +@Entity +@Data +@Table(name="data_count_record") +public class CountRecord extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "物料序号") + private Item item; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "物料序号") + private ItemKey itemKey; + + @Column(name = "`bill_code`") + @ApiModelProperty(value = "单据号") + private String billCode; + + @OneToOne + @JoinColumn(name = "`count_detail_id`") + @ApiModelProperty(value = "盘点明细ID") + private CountDetail countDetail; + + @OneToOne + @JoinColumn(name = "`src_stock_id`") + @ApiModelProperty(value = "源容器") + private Stock srcStock; + + @OneToOne + @JoinColumn(name = "`dst_stock_id`") + @ApiModelProperty(value = "目标容器") + private Stock dstStock; + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "源点位") + private Point srcPoint; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标点位") + private Point dstPoint; + + @Column(name = "`src_stock_code`") + @ApiModelProperty(value = "源容器编码") + private String srcStockCode; + + @Column(name = "`dst_stock_code`") + @ApiModelProperty(value = "目标容器编码") + private String dstStockCode; + + @Column(name = "`src_point_code`") + @ApiModelProperty(value = "源点位编码") + private String srcPointCode; + + @Column(name = "`dst_point_code`") + @ApiModelProperty(value = "目标点位编码") + private String dstPointCode; + + @Column(name = "`inv_status`") + @ApiModelProperty(value = "属性6") + private String invStatus; + + @Column(name = "`task_status`") + @ApiModelProperty(value = "属性6") + private String taskStatus; + + @Column(name = "`be_skip`") + @ApiModelProperty(value = "跳过") + private Boolean beSkip=false; + + @Column(name = "`be_back`") + @ApiModelProperty(value = "退回") + private Boolean beBack=false; + + @Column(name = "`plan_qty`") + @ApiModelProperty(value = "计划数量") + private Double planQty=0d; + + @Column(name = "`count_qty`") + @ApiModelProperty(value = "移位数量") + private Double countQty=0d; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "库存ID") + private Long invId; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + + public void copy(CountRecord source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/Inventory.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/Inventory.java new file mode 100644 index 0000000..c9a48e7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/Inventory.java @@ -0,0 +1,162 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import javax.persistence.Entity; +import javax.persistence.Table; + +import org.hibernate.annotations.*; + +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author huojin + * @website https://eladmin.vip + * @description / + * @date 2023-08-22 + **/ +@Entity +@Data +@Table(name = "data_inventory") +public class Inventory extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`bill_code`") + @ApiModelProperty(value = "单据号") + private String billCode; + + @OneToOne + @JoinColumn(name = "`item_key_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "物料属性") + private ItemKey itemKey; + + @OneToOne + @JoinColumn(name = "`point_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`point_code`") + @ApiModelProperty(value = "点位号") + private String pointCode; + + + @OneToOne + @JoinColumn(name = "`stock_id`", nullable = true) + @NotNull + @ApiModelProperty(value = "容器") + private Stock stock; + + @Column(name = "`stock_code`") + @ApiModelProperty(value = "容器号") + private String stockCode; + + + @OneToOne + @JoinColumn(name = "`big_stock_id`", nullable = true) + @NotNull + @ApiModelProperty(value = "大容器") + private Stock bigStock; + + @Column(name = "`quantity`") + @ApiModelProperty(value = "数量") + private Double quantity = 0d; + + @Column(name = "`queued_qty`") + @ApiModelProperty(value = "分配数") + private Double queuedQty = 0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight = 0d; + + @Column(name = "`volume`") + @ApiModelProperty(value = "体积") + private Double volume = 0d; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`be_lock`") + @ApiModelProperty(value = "是否锁定") + private Boolean beLock = false; + + @Column(name = "`be_reject`") + @ApiModelProperty(value = "是否不良品") + private Boolean beReject = false; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`storage_date`") + @ApiModelProperty(value = "存货日期") + private Timestamp storageDate; + + + @OneToOne + @JoinColumn(name = "`dept_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "仓库") + private Dept dept; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`zzkw`") + @ApiModelProperty(value = "制造库位") + private Point zzkw; + + + public void copy(Inventory source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } + + public void addQty(double qty) { + this.setQuantity(this.quantity + qty); + } + public void reduce(double qty) { + this.setQuantity(this.quantity -qty); + } + + public double availableQty() { + return this.quantity-this.queuedQty; + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryBak.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryBak.java new file mode 100644 index 0000000..a50bf79 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryBak.java @@ -0,0 +1,162 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-03 +**/ +@Entity +@Data +@Table(name="data_inventory_bak") +public class InventoryBak extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`bill_code`") + @ApiModelProperty(value = "单据号") + private String billCode; + + @OneToOne + @JoinColumn(name = "`item_key_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "物料属性") + private ItemKey itemKey; + + @OneToOne + @JoinColumn(name = "`item_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "物料") + private Item item; + + @OneToOne + @JoinColumn(name = "`point_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`point_code`") + @ApiModelProperty(value = "点位号") + private String pointCode; + + + @OneToOne + @JoinColumn(name = "`stock_id`", nullable = true) + @NotNull + @ApiModelProperty(value = "容器") + private Stock stock; + + @Column(name = "`stock_code`") + @ApiModelProperty(value = "容器号") + private String stockCode; + + + @OneToOne + @JoinColumn(name = "`big_stock_id`", nullable = true) + @NotNull + @ApiModelProperty(value = "大容器") + private Stock bigStock; + + @Column(name = "`quantity`") + @ApiModelProperty(value = "数量") + private Double quantity = 0d; + + @Column(name = "`queued_qty`") + @ApiModelProperty(value = "分配数") + private Double queuedQty = 0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight = 0d; + + @Column(name = "`volume`") + @ApiModelProperty(value = "体积") + private Double volume = 0d; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`be_lock`") + @ApiModelProperty(value = "是否锁定") + private Boolean beLock = false; + + @Column(name = "`be_reject`") + @ApiModelProperty(value = "是否不良品") + private Boolean beReject = false; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`storage_date`") + @ApiModelProperty(value = "存货日期") + private Timestamp storageDate; + + + @OneToOne + @JoinColumn(name = "`dept_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "仓库") + private Dept dept; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`zzkw`") + @ApiModelProperty(value = "制造库位") + private Point zzkw; + + @Column(name = "`bf_date`") + @ApiModelProperty(value = "备份日期") + private Timestamp bfDate; + + @Column(name = "`detail_id`") + @ApiModelProperty(value = "铺线计划明细序号") + private Long detailId; + + @Column(name = "`pick_detail_id`") + @ApiModelProperty(value = "备货明细序号") + private Long pickDetailId; + + public void copy(InventoryBak source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryLog.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryLog.java new file mode 100644 index 0000000..0eb1a02 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/InventoryLog.java @@ -0,0 +1,171 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-31 +**/ +@Entity +@Data +@Table(name="data_inventory_log") +public class InventoryLog extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`log_type`",nullable = false) + @NotBlank + @ApiModelProperty(value = "操作类型") + private String logType; + + @Column(name = "`inc_dec`",nullable = false) + @NotNull + @ApiModelProperty(value = "增加/减少") + private String incDec; + + @Column(name = "`related_bill`") + @ApiModelProperty(value = "单据号") + private String relatedBill; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "点位") + private ItemKey itemKey; + + @Column(name = "`storage_date`") + @ApiModelProperty(value = "存货日期") + private Timestamp storageDate; + + @Column(name = "`soi`") + @ApiModelProperty(value = "入库单号") + private String soi; + + @Column(name = "`occur_quantity`") + @ApiModelProperty(value = "发生数量") + private Double occurQuantity; + + @Column(name = "`occur_time`") + @ApiModelProperty(value = "发生时间") + private Timestamp occurTime; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`ref_obj`") + @ApiModelProperty(value = "引用对象") + private String refObj; + + @Column(name = "`ref_obj_id`") + @ApiModelProperty(value = "引用ID") + private Long refObjId; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "发生库存ID") + private Long invId; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "源点位") + private Point srcPoint; + + @Column(name = "`src_point_code`") + @ApiModelProperty(value = "源点位号") + private String srcPointCode; + + @OneToOne + @JoinColumn(name = "`src_stock_id`") + @ApiModelProperty(value = "源容器") + private Stock srcStock; + + @Column(name = "`src_stock_code`") + @ApiModelProperty(value = "源容器号") + private String srcStockCode; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "点位") + private Point dstPoint; + + @Column(name = "`dst_point_code`") + @ApiModelProperty(value = "目标点位号") + private String dstPointCode; + + @OneToOne + @JoinColumn(name = "`dst_stock_id`") + @ApiModelProperty(value = "目标容器") + private Stock dstStock; + + @Column(name = "`dst_stock_code`") + @ApiModelProperty(value = "目标容器号") + private String dstStockCode; + + @Column(name = "`src_qty`") + @ApiModelProperty(value = "源数量") + private Double srcQty=0d; + + @Column(name = "`dst_qty`") + @ApiModelProperty(value = "目标数量") + private Double dstQty=0d; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`zzkw`") + @ApiModelProperty(value = "制造库位") + private Point zzkw; + + @OneToOne + @JoinColumn(name = "`zckw`") + @ApiModelProperty(value = "暂存库位") + private Point zckw; + + public void copy(InventoryLog source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/ItemKey.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/ItemKey.java new file mode 100644 index 0000000..f86a6be --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/ItemKey.java @@ -0,0 +1,99 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Item; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; +import java.util.Date; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-21 +**/ +@Entity +@Data +@Table(name="data_item_key") +public class ItemKey extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "物料序号") + private Item item; + + @Column(name = "`prop_c1`") + @ApiModelProperty(value = "批次号") + private String propC1; + + @Column(name = "`prop_c2`") + @ApiModelProperty(value = "序列号") + private String propC2; + + @Column(name = "`prop_c3`") + @ApiModelProperty(value = "属性4") + private String propC3; + + @Column(name = "`prop_c4`") + @ApiModelProperty(value = "属性4") + private String propC4; + + @Column(name = "`prop_c5`") + @ApiModelProperty(value = "属性5") + private String propC5; + + @Column(name = "`prop_c6`") + @ApiModelProperty(value = "属性6") + private String propC6; + + @Column(name = "`prop_d1`") + @ApiModelProperty(value = "生产日期") + private Date propD1; + + @Column(name = "`prop_d2`") + @ApiModelProperty(value = "到期日期") + private Timestamp propD2; + + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`order_number`") + @ApiModelProperty(value = "工单号") + private String orderNumber; + + + public void copy(ItemKey source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PickDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickDetail.java new file mode 100644 index 0000000..6545150 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickDetail.java @@ -0,0 +1,229 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author huojin + * @website https://eladmin.vip + * @description / + * @date 2023-08-16 + **/ +@Entity +@Data +@Table(name = "data_pick_detail") +public class PickDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`pick_id`") + @ApiModelProperty(value = "指示单生成订单序号") + private Long pickId; + + @OneToOne + @JoinColumn(name = "`item_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "物料") + private Item item; + + @Column(name = "`line_no`") + @ApiModelProperty(value = "行号") + private Long lineNo; + + @Column(name = "`po`") + @ApiModelProperty(value = "po订单号") + private String po; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty = 0d; + + @Column(name = "`allocated_qty`") + @ApiModelProperty(value = "分配数量") + private Double allocatedQty = 0d; + + @Column(name = "`picked_qty`") + @ApiModelProperty(value = "拣货数量") + private Double pickedQty = 0d; + + @Column(name = "`shipped_qty`") + @ApiModelProperty(value = "发运数量") + private Double shippedQty = 0d; + + @Column(name = "`weight`") + @ApiModelProperty(value = "重量") + private Double weight = 0d; + + @Column(name = "`volume`") + @ApiModelProperty(value = "体积") + private Double volume = 0d; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`prop_c1`") + @ApiModelProperty(value = "批次号") + private String propC1; + + @Column(name = "`prop_c2`") + @ApiModelProperty(value = "序列号") + private String propC2; + + @Column(name = "`prop_c3`") + @ApiModelProperty(value = "属性3") + private String propC3; + + @Column(name = "`prop_c4`") + @ApiModelProperty(value = "纯需求") + private Double propC4=0d; + + @Column(name = "`prop_c5`") + @ApiModelProperty(value = "属性5") + private String propC5; + + @Column(name = "`prop_c6`") + @ApiModelProperty(value = "属性6") + private String propC6; + + @Column(name = "`prop_d1`") + @ApiModelProperty(value = "生产日期") + private Timestamp propD1; + + @Column(name = "`prop_d2`") + @ApiModelProperty(value = "到期日期") + private Timestamp propD2; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库") + private Dept dept; + + @Column(name = "`source_name`") + @ApiModelProperty(value = "来源名称,波次补料中的备货单号") + private String sourceName; + + @Column(name = "`source_id`") + @ApiModelProperty(value = "来源序号,波次补料中的明细ID") + private Long sourceId; + @OneToOne + @JoinColumn(name = "`pick_ticket_id`") + @NotFound(action= NotFoundAction.IGNORE) + @ApiModelProperty(value = "出库管理主表") + private PickTicket pickTicket; + + @OneToOne + @JoinColumn(name = "`point_id`") + @ApiModelProperty(value = "点位") + private Point point; + + @Column(name = "`xq_qty`") + @ApiModelProperty(value = "需求数量") + private Double xqQty = 0d; + + @Column(name = "`pure_req_qty`") + @ApiModelProperty(value = "纯需求数量,批次需求数取BOM") + private Double pureReqQty = 0d; + + @Column(name = "`pure_xq_bz`") + @ApiModelProperty(value = "纯需求不足") + private Double pureXqBz = 0d; + + @Column(name = "`xb_qty`") + @ApiModelProperty(value = "线边数量") + private Double xbQty = 0d; + + @Column(name = "`xb_bh_qty`") + @ApiModelProperty(value = "线边备货数量") + private Double xbBhQty = 0d; + + @Column(name = "`y_stk_demand_qty`") + @ApiModelProperty(value = "原备货需求数量") + private Double yStkDemandQty = 0d; + + @Column(name = "`y_req_qty`") + @ApiModelProperty(value = "原纯需求数") + private Double yReqQty = 0d; + + @Column(name = "`contents`") + @ApiModelProperty(value = "加工内容") + private String contents ; + + @Column(name = "`ac`") + @ApiModelProperty(value = "ac") + private String ac ; + + @Column(name = "`supplier`") + @ApiModelProperty(value = "供应商名") + private String supplier; + + + @Column(name = "`tl_qty`") + @ApiModelProperty(value = "投料数量") + private Double tlQty=0d; + + @Column(name = "`js_qty`") + @ApiModelProperty(value = "接收数量") + private Double jsQty=0d; + + @Column(name = "`bc_qty`") + @ApiModelProperty(value = "波次补货数量") + private Double bcQty=0d; + + @Column(name = "`bom_id`") + @ApiModelProperty(value = "BOM序号") + private Long bomId; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "出库库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货库区") + private Area shArea; + + + public void copy(PickDetail source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PickInstruction.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickInstruction.java new file mode 100644 index 0000000..1cf26a5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickInstruction.java @@ -0,0 +1,135 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Entity +@Data +@Table(name="data_pick_instruction") +public class PickInstruction extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`allocation_number`") + @ApiModelProperty(value = "指示单号") + private String allocationNumber; + + @Column(name = "`allocation_date`") + @ApiModelProperty(value = "指示日期") + private Timestamp allocationDate; + + @OneToOne + @JoinColumn(name = "`rk_area_id`") + @ApiModelProperty(value = "入库库区") + private Area rkArea; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "品番") + private Item item; + + @Column(name = "`ac`") + @ApiModelProperty(value = "A/C") + private String ac; + + @Column(name = "`process_content`") + @ApiModelProperty(value = "加工内容 ") + private String processContent; + + @Column(name = "`tax_category`") + @ApiModelProperty(value = "税别") + private String taxCategory; + + @OneToOne + @JoinColumn(name = "`out_k_type`") + @ApiModelProperty(value = "出库类型") + private BillType outKType; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status = BizStatus.WCD; + + @Column(name = "`indicated_qty`") + @ApiModelProperty(value = "指示数量") + private Double indicatedQty = 0d; + + @Column(name = "`allocated_qty`") + @ApiModelProperty(value = "出单数量") + private Double allocatedQty = 0d; + + @Column(name = "`bc_allocated_qty`") + @ApiModelProperty(value = "本次出单数") + private Double bcAllocatedQty = 0d; + + @Column(name = "`picked_qty`") + @ApiModelProperty(value = "备货数量") + private Double pickedQty = 0d; + + @Column(name = "`zt_qty`") + @ApiModelProperty(value = "在途数量") + private Double ztQty = 0d; + + @OneToOne + @JoinColumn(name = "`zzkw_point_id`",nullable = false) + @NotNull + @ApiModelProperty(value = "制造库位") + private Point zzkwPoint; + + @OneToOne + @JoinColumn(name = "`ck_area_id`") + @ApiModelProperty(value = "出库库区") + private Area ckArea; + + @Column(name = "`kit_number`") + @ApiModelProperty(value = "成套单号") + private String kitNumber; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`bom_id`") + @ApiModelProperty(value = "BOM序号") + private Long bomId; + + public void copy(PickInstruction source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PickKitPlan.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickKitPlan.java new file mode 100644 index 0000000..86c4525 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickKitPlan.java @@ -0,0 +1,91 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.Point; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author DengJiangKun + * @website https://eladmin.vip + * @description / + * @date 2024-02-28 + **/ +@Entity +@Data +@Table(name = "data_pick_kit_plan") +public class PickKitPlan extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`plan_number`") + @ApiModelProperty(value = "计划号") + private String planNumber; + + @OneToOne + @JoinColumn(name = "`work_area_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "工位") + private Area workArea; + + @Column(name = "`plan_date`") + @ApiModelProperty(value = "计划日期") + private Timestamp planDate; + + @OneToOne + @JoinColumn(name = "`big_item_id`", nullable = false) + @NotNull + @ApiModelProperty(value = "Bom完成品工位清单") + private BigItem bigItem; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status= BizStatus.WCD; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`order_qty`", nullable = false) + @NotNull + @ApiModelProperty(value = "订单数量") + private Double orderQty=0d; + + @Column(name = "`allocated_qty`") + @ApiModelProperty(value = "出单数量") + private Double allocatedQty=0d; + + + public void copy(PickKitPlan source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PickOut.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickOut.java new file mode 100644 index 0000000..2793138 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickOut.java @@ -0,0 +1,117 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author jiangkun +* @date 2024-02-21 +**/ +@Entity +@Data +@Table(name="data_pick_out") +public class PickOut extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`order_no`") + @ApiModelProperty(value = "单号") + private String orderNo; + + @Column(name = "`bh_no`") + @ApiModelProperty(value = "备货单号") + private String bhNo; + + @Column(name = "`plate_no`") + @ApiModelProperty(value = "车牌号") + private String plateNo; + + @Column(name = "`order_qty`") + @ApiModelProperty(value = "订单数量") + private Double orderQty=0d; + + @Column(name = "`dispatch_qty`") + @ApiModelProperty(value = "出库数量") + private Double dispatchQty = 0d; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status = "OPEN"; + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "出库库区") + private Area area; + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货库区") + private Area shArea; + + @Column(name = "`sl_by`") + @ApiModelProperty(value = "接收人") + private String slBy; + + @Column(name = "`sl_qty`") + @ApiModelProperty(value = "收料数量") + private Double slQty=0d; + + @Column(name = "`sl_date`") + @ApiModelProperty(value = "接收日期") + private Timestamp slDate; + + @Column(name = "`tl_date`") + @ApiModelProperty(value = "投料日期") + private Timestamp tlDate; + + @Column(name = "`tl_by`") + @ApiModelProperty(value = "投料人") + private String tlBy; + + @Column(name = "`tl_qty`") + @ApiModelProperty(value = "投料数量") + private Double tlQty=0d; + + @Column(name = "`gc_code`") + @ApiModelProperty(value = "接收工厂") + private String gcCode; + + public void copy(PickOut source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PickTicket.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickTicket.java new file mode 100644 index 0000000..afbb363 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PickTicket.java @@ -0,0 +1,227 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Time; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @description / + * @date 2024-01-11 + **/ +@Entity +@Data +@Table(name = "data_pick_ticket") +public class PickTicket extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + @OneToOne + @JoinColumn(name = "`area`", nullable = false) + @ApiModelProperty(value = "出库库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`sh_area`") + @ApiModelProperty(value = "收货库区") + private Area shArea; + + @Column(name = "`code`", nullable = false) + @NotBlank + @ApiModelProperty(value = "单号") + private String code; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status= BizStatus.OPEN; + + @Column(name = "`cus_code`") + @ApiModelProperty(value = "客户订单号") + private String cusCode; + + @Column(name = "`related_bill1`") + @ApiModelProperty(value = "相关单号1") + private String relatedBill1; + + @Column(name = "`related_bill2`") + @ApiModelProperty(value = "相关单号2") + private String relatedBill2; + + @Column(name = "`related_bill3`") + @ApiModelProperty(value = "相关单号3") + private String relatedBill3; + + @Column(name = "`order_date`") + @ApiModelProperty(value = "订单日期") + private Timestamp orderDate; + + @Column(name = "`ship_date`") + @ApiModelProperty(value = "发货日期") + private Timestamp shipDate; + + @Column(name = "`fh_by`") + @ApiModelProperty(value = "发货人") + private String fhBy; + + @Column(name = "`received_date`") + @ApiModelProperty(value = "到达日期") + private Timestamp receivedDate; + + @Column(name = "`sl_by`") + @ApiModelProperty(value = "接收人") + private String slBy; + + @Column(name = "`sl_qty`") + @ApiModelProperty(value = "收料数量") + private Double slQty=0d; + + @Column(name = "`sl_date`") + @ApiModelProperty(value = "接收日期") + private Timestamp slDate; + + @Column(name = "`tl_date`") + @ApiModelProperty(value = "投料日期") + private Timestamp tlDate; + + @Column(name = "`tl_by`") + @ApiModelProperty(value = "投料人") + private String tlBy; + + @Column(name = "`tl_qty`") + @ApiModelProperty(value = "投料数量") + private Double tlQty=0d; + + @Column(name = "`ship_to_name`") + @ApiModelProperty(value = "收货方") + private String shipToName; + + @Column(name = "`ship_address`") + @ApiModelProperty(value = "收货地址") + private String shipAddress; + + @Column(name = "`ship_man`") + @ApiModelProperty(value = "收货联系人") + private String shipMan; + + @Column(name = "`ship_tel`") + @ApiModelProperty(value = "收货电话") + private String shipTel; + + @Column(name = "`xq_qty`") + @ApiModelProperty(value = "需求数量") + private Double xqQty=0d; + + @Column(name = "`order_quantity`") + @ApiModelProperty(value = "订单数量") + private Double orderQuantity=0d; + + @Column(name = "`bh_qty`") + @ApiModelProperty(value = "备货数量") + private Double bhQty=0d; + + @Column(name = "`allocated_quantity`") + @ApiModelProperty(value = "出单数量") + private Double allocatedQuantity=0d; + + @Column(name = "`picked_quantity`") + @ApiModelProperty(value = "拣货数量") + private Double pickedQuantity=0d; + + @Column(name = "`shipped_quantity`") + @ApiModelProperty(value = "发运数量") + private Double shippedQuantity=0d; + + @Column(name = "`xb_qty`") + @ApiModelProperty(value = "线边数量") + private Double xbQty=0d; + + @Column(name = "`zt_qty`") + @ApiModelProperty(value = "在途数量") + private Double ztQty=0d; + + @Column(name = "`vehicle`") + @ApiModelProperty(value = "车牌号") + private String vehicle; + @OneToOne + @JoinColumn(name = "`bill_type`", unique = true) + @ApiModelProperty(value = "单据类型") + private BillType billType; + + @Column(name = "`bp_type`") + @ApiModelProperty(value = "部品种类") + private String bpType; + @OneToOne + @JoinColumn(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + @Column(name = "`pure_req_qty`") + @ApiModelProperty(value = "纯需求数量") + private Double pureReqQty = 0d; + + @Column(name = "`prep_re`") + @ApiModelProperty(value = "备货需求数量") + private Double prepRe = 0d; + + @Column(name = "`out_order_date`") + @ApiModelProperty(value = "出单日期") + private Timestamp outOrderDate; + + @Column(name = "`stocking_date`") + @ApiModelProperty(value = "备货日期") + private Timestamp stockingDate; + + @Column(name = "`bc_qty`") + @ApiModelProperty(value = "波次补货数量") + private Double bcQty=0d; + + @Column(name = "`pc`") + @ApiModelProperty(value = "分批批次") + private String pc; + + @Column(name = "`batch_time`") + @ApiModelProperty(value = "分批时段") + private Timestamp batchTime; + + @Column(name = "`gc_code`") + @ApiModelProperty(value = "工厂") + private String gcCode; + public void copy(PickTicket source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/PlanPickDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/PlanPickDetail.java new file mode 100644 index 0000000..c32d682 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/PlanPickDetail.java @@ -0,0 +1,136 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.domain.Item; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import javax.persistence.Entity; +import javax.persistence.Table; +import org.hibernate.annotations.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author jiangkun +* @date 2024-01-23 +**/ +@Entity +@Data +@Table(name="data_plan_pick_detail") +public class PlanPickDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "完成品番") + private BigItem bigItem; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "品番") + private Item item; + + @OneToOne + @JoinColumn(name = "`zone_id`") + @ApiModelProperty(value = "收货库区") + private Area zone; + + @OneToOne + @JoinColumn(name = "`bill_type_id`") + @ApiModelProperty(value = "出库类型") + private BillType billType; + + @Column(name = "`order_quantity`") + @ApiModelProperty(value = "计划数量") + private Double orderQuantity=0d; + + @Column(name = "`allocated_quantity`") + @ApiModelProperty(value = "出单数量") + private Double allocatedQuantity=0d; + + @Column(name = "`picked_quantity`") + @ApiModelProperty(value = "备货数量") + private Double pickedQuantity=0d; + + @Column(name = "`shipped_quantity`") + @ApiModelProperty(value = "发货数量") + private Double shippedQuantity=0d; + + @Column(name = "`allocate_time`") + @ApiModelProperty(value = "出单时间") + private Timestamp allocateTime; + + @Column(name = "`ship_time`") + @ApiModelProperty(value = "发货时间") + private Timestamp shipTime; + + @Column(name = "`code`") + @ApiModelProperty(value = "指示单号") + private String code; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status= BizStatus.WCD; + + @Column(name = "`start_no`") + @ApiModelProperty(value = "开始机号") + private String startNo; + + @Column(name = "`end_no`") + @ApiModelProperty(value = "终止机号") + private String endNo; + + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "`px_detail_id`") + @ApiModelProperty(value = "铺线计划明细序号") + private Long pxDetailId; + + @Column(name = "`is_last`") + @ApiModelProperty(value = "是否最后一批计划") + private Boolean isLast=Boolean.FALSE; + + @Column(name = "`batch_time`") + @ApiModelProperty(value = "分批时段") + private Timestamp batchTime; + + @Column(name = "`gc_code`") + @ApiModelProperty(value = "工厂") + private String gcCode; + + public void copy(PlanPickDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/Spareparts.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/Spareparts.java new file mode 100644 index 0000000..39475a7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/Spareparts.java @@ -0,0 +1,102 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.BigItem; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author ShenYinAn +* @date 2024-01-30 +**/ +@Entity +@Data +@Table(name="data_spareparts") +public class Spareparts extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Long id; + + @Column(name = "`station_type`") + @ApiModelProperty(value = "工位") + private String stationType; + + @Column(name = "`date`") + @ApiModelProperty(value = "下线日期") + private Timestamp date; + + @OneToOne + @JoinColumn(name = "`big_item_id`") + @ApiModelProperty(value = "型式名") + private BigItem bigItemId; + + @Column(name = "`order_quantity`") + @ApiModelProperty(value = "数量") + private Integer orderQuantity; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status; + + @Column(name = "`start_number`") + @ApiModelProperty(value = "起始机号") + private String startNumber; + + @Column(name = "`end_number`") + @ApiModelProperty(value = "结束机号") + private String endNumber; + + @Column(name = "`description`") + @ApiModelProperty(value = "备注") + private String description; + + @Column(name = "`hy_by`") + @ApiModelProperty(value = "耗用") + private String hyBy; +// +// @Column(name = "`update_by`") +// @ApiModelProperty(value = "更新人") +// private String updateBy; +// + @Column(name = "`hy_time`") + @ApiModelProperty(value = "耗用时间") + private Timestamp hyTime; +// +// @Column(name = "`update_time`") +// @ApiModelProperty(value = "修改时间") +// private Timestamp updateTime; +// + @Column(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Long deptId; + + public void copy(Spareparts source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/Task.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/Task.java new file mode 100644 index 0000000..4bcc958 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/Task.java @@ -0,0 +1,228 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-16 +**/ +@Entity +@Data +@Table(name="data_task") +public class Task extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "物料序号") + private Item item; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "物料属性") + private ItemKey itemKey; + + @Column(name = "`bill_code`") + @ApiModelProperty(value = "单据号") + private String billCode; + + @Column(name = "`task_type`") + @ApiModelProperty(value = "任务类型") + private String taskType; + + @OneToOne(cascade = CascadeType.PERSIST) + @JoinColumn(name = "asn_detail_id") + @ApiModelProperty(value = "收货明细序号") + private AsnDetail asnDetail; + + @Column(name = "`move_detail_id`") + @ApiModelProperty(value = "移位明细序号") + private Long moveDetailId; + + @Column(name = "`wave_detail_id`") + @ApiModelProperty(value = "波次明细序号") + private Long waveDetailId; + + @OneToOne + @JoinColumn(name = "pick_detail_id") + @ApiModelProperty(value = "发货明细序号") + private PickDetail pickDetail; + + @OneToOne + @JoinColumn(name = "`src_stock_id`") + @ApiModelProperty(value = "源容器") + private Stock srcStock; + + @OneToOne + @JoinColumn(name = "`dst_stock_id`") + @ApiModelProperty(value = "目标容器") + private Stock dstStock; + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "源点位") + private Point srcPoint; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标点位") + private Point dstPoint; + + @Column(name = "`src_stock_code`") + @ApiModelProperty(value = "源容器编码") + private String srcStockCode; + + @Column(name = "`dst_stock_code`") + @ApiModelProperty(value = "目标容器编码") + private String dstStockCode; + + @Column(name = "`src_point_code`") + @ApiModelProperty(value = "源点位编码") + private String srcPointCode; + + @Column(name = "`dst_point_code`") + @ApiModelProperty(value = "目标点位编码") + private String dstPointCode; + + @Column(name = "`inv_status`") + @ApiModelProperty(value = "库存状态") + private String invStatus; + + @Column(name = "`task_status`") + @ApiModelProperty(value = "任务状态") + private String taskStatus; + + @Column(name = "`be_skip`") + @ApiModelProperty(value = "跳过") + private Integer beSkip=0; + + @Column(name = "`be_back`") + @ApiModelProperty(value = "退回") + private Boolean beBack=false; + + @Column(name = "`plan_qty`") + @ApiModelProperty(value = "计划数量") + private Double planQty=0d; + + @Column(name = "`move_qty`") + @ApiModelProperty(value = "移位数量") + private Double moveQty=0d; + + @Column(name = "`put_code`") + @ApiModelProperty(value = "上架号") + private String putCode; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "库存ID") + private Long invId; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`zzkw`") + @ApiModelProperty(value = "制造库位") + private Point zzkw; + + public void copy(Task source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } + + /** + * + * @param item-物料 + * @param itemKey-物料属性 + * @param billCode-单据编号 + * @param taskType-任务类型 + * @param asnDetail-入库明细 + * @param moveDetailId-移位明细ID + * @param waveDetailId-波次明细ID + * @param pickDetail-出库明细 + * @param srcStock-原容器 + * @param dstStock-目标容器 + * @param srcPoint-原点位 + * @param dstPoint-目标点位 + * @param srcStockCode-原容器编号 + * @param dstStockCode-目标容器编号 + * @param srcPointCode-原点位 + * @param dstPointCode-目标点位 + * @param invStatus-库存状态 + * @param taskStatus-任务状态 + * @param planQty-计划数量 + * @param putCode-上架号 + * @param invId-库存ID + * @param dept-仓库 + */ + public Task(Item item, ItemKey itemKey, String billCode, String taskType, AsnDetail asnDetail, Long moveDetailId, Long waveDetailId, PickDetail pickDetail, Stock srcStock, Stock dstStock, Point srcPoint, Point dstPoint, String srcStockCode, String dstStockCode, String srcPointCode, String dstPointCode, String invStatus, String taskStatus, Double planQty, String putCode, Long invId, Dept dept) { + this.item = item; + this.itemKey = itemKey; + this.billCode = billCode; + this.taskType = taskType; + this.asnDetail = asnDetail; + this.moveDetailId = moveDetailId; + this.waveDetailId = waveDetailId; + this.pickDetail = pickDetail; + this.srcStock = srcStock; + this.dstStock = dstStock; + this.srcPoint = srcPoint; + this.dstPoint = dstPoint; + this.srcStockCode = srcStockCode; + this.dstStockCode = dstStockCode; + this.srcPointCode = srcPointCode; + this.dstPointCode = dstPointCode; + this.invStatus = invStatus; + this.taskStatus = taskStatus; + this.planQty = planQty; + this.putCode = putCode; + this.invId = invId; + this.dept = dept; + this.dept = dept; + } + + public Task(){ + + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/TaskLog.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/TaskLog.java new file mode 100644 index 0000000..108e8dd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/TaskLog.java @@ -0,0 +1,225 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2023-08-25 +**/ +@Entity +@Data +@Table(name="data_task_log") +public class TaskLog extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "物料序号") + private Item item; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "物料属性") + private ItemKey itemKey; + + @OneToOne + @JoinColumn(name = "`task_id`") + @ApiModelProperty(value = "任务序号") + private Task task; + + + @OneToOne + @JoinColumn(name = "`src_stock_id`") + @ApiModelProperty(value = "源容器") + private Stock srcStock; + + + @OneToOne + @JoinColumn(name = "`dst_stock_id`") + @ApiModelProperty(value = "目标容器") + private Stock dstStock; + + + @OneToOne + @JoinColumn(name = "`src_point_id`") + @ApiModelProperty(value = "源点位") + private Point srcPoint; + + @OneToOne + @JoinColumn(name = "`dst_point_id`") + @ApiModelProperty(value = "目标点位") + private Point dstPoint; + + @Column(name = "`src_stock_code`") + @ApiModelProperty(value = "源容器编码,现品票") + private String srcStockCode; + + @Column(name = "`dst_stock_code`") + @ApiModelProperty(value = "目标容器编码") + private String dstStockCode; + + @Column(name = "`src_loc_code`") + @ApiModelProperty(value = "源点位编码") + private String srcLocCode; + + @Column(name = "`dst_loc_code`") + @ApiModelProperty(value = "目标点位编码") + private String dstLocCode; + + @Column(name = "`inv_status`") + @ApiModelProperty(value = "属性6") + private String invStatus; + + @Column(name = "`be_back`") + @ApiModelProperty(value = "退回") + private Boolean beBack; + + @Column(name = "`move_qty`") + @ApiModelProperty(value = "拣货数量") + private Double moveQty=0d; + + @Column(name = "`ship_qty`") + @ApiModelProperty(value = "发运数量") + private Double shipQty=0d; + + @Column(name = "`put_code`") + @ApiModelProperty(value = "上架号") + private String putCode; + + @Column(name = "`inv_id`") + @ApiModelProperty(value = "库存ID") + private Long invId; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "仓库ID") + private Dept dept; + + @Column(name = "`ship_by`") + @ApiModelProperty(value = "发运人") + private String shipBy; + + @Column(name = "`ship_time`") + @ApiModelProperty(value = "发运时间") + private Timestamp shipTime; + + @OneToOne + @JoinColumn(name = "`pick_out_id`") + @ApiModelProperty(value = "出库单维护") + private PickOut pickOut; + + @Column(name = "`tl_qty`") + @ApiModelProperty(value = "投料数量") + private Double tlQty=0d; + + @Column(name = "`sl_qty`") + @ApiModelProperty(value = "接收数量") + private Double slQty=0d; + + @Column(name = "`sl_by`") + @ApiModelProperty(value = "接收人") + private String slBy; + + @Column(name = "`tkjs_qty`") + @ApiModelProperty(value = "退库接收数量") + private Double tkjsQty=0d; + + @Column(name = "`tkjs_by`") + @ApiModelProperty(value = "退库接收人") + private String tkjsBy; + + @Column(name = "`tl_by`") + @ApiModelProperty(value = "投料人") + private String tlBy; + + @OneToOne + @JoinColumn(name = "`sh_area_id`") + @ApiModelProperty(value = "收货库区") + private Area shArea; + + /** + * + * @param item + * @param itemKey + * @param task + * @param srcStock + * @param dstStock + * @param srcPoint + * @param dstPoint + * @param srcStockCode + * @param dstStockCode + * @param srcLocCode + * @param dstLocCode + * @param invStatus + * @param beBack + * @param moveQty + * @param shipQty + * @param putCode + * @param invId + * @param dept + */ + public TaskLog(Item item, ItemKey itemKey, Task task, Stock srcStock, Stock dstStock, Point srcPoint, Point dstPoint, String srcStockCode, String dstStockCode, String srcLocCode, String dstLocCode, String invStatus, Boolean beBack, Double moveQty, Double shipQty, String putCode, Long invId, Dept dept) { + this.item = item; + this.itemKey = itemKey; + this.task = task; + this.srcStock = srcStock; + this.dstStock = dstStock; + this.srcPoint = srcPoint; + this.dstPoint = dstPoint; + this.srcStockCode = srcStockCode; + this.dstStockCode = dstStockCode; + this.srcLocCode = srcLocCode; + this.dstLocCode = dstLocCode; + this.invStatus = invStatus; + this.beBack = beBack; + this.moveQty = moveQty; + this.shipQty = shipQty; + this.putCode = putCode; + this.invId = invId; + this.dept = dept; + } + + public TaskLog() { + + } + + + public void copy(TaskLog source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/XppRecord.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/XppRecord.java new file mode 100644 index 0000000..ee29760 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/XppRecord.java @@ -0,0 +1,283 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.utils.BizStatus; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import org.springframework.data.annotation.CreatedBy; + +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @description / + * @date 2024-01-04 + **/ +@Entity +@Data +@Table(name = "data_xpp_record") +public class XppRecord extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`ewm`") + @ApiModelProperty(value = "二维码") + private String ewm; + + @OneToOne + @JoinColumn(name = "`area_id`") + @ApiModelProperty(value = "采集库区") + private Area area; + + @OneToOne + @JoinColumn(name = "`item_id`") + @ApiModelProperty(value = "品番") + private Item item; + + @Column(name = "`ac`") + @ApiModelProperty(value = "ac") + private String ac; + + @Column(name = "`nrs`") + @ApiModelProperty(value = "纳入数") + private Integer nrs; + + @Column(name = "`ddbh`") + @ApiModelProperty(value = "订单编号") + private String ddbh; + + @Column(name = "`zf`") + @ApiModelProperty(value = "制番") + private String zf; + + @Column(name = "`fzh`") + @ApiModelProperty(value = "分支号") + private String fzh; + + @Column(name = "`nr_date`") + @ApiModelProperty(value = "纳入指示日") + private Timestamp nrDate; + + @Column(name = "`sh_quantity`") + @ApiModelProperty(value = "送货数量") + private String shQuantity; + + @OneToOne + @JoinColumn(name = "`asn_detail_id`") + @ApiModelProperty(value = "入库明细") + private AsnDetail asnDetailId; + + @CreatedBy + @Column(name = "`cjr`") + @ApiModelProperty(value = "采集人") + private String cjr; + + @CreatedBy + @Column(name = "`sjr`") + @ApiModelProperty(value = "上架人") + private String sjr; + + @Column(name = "`bhr`") + @ApiModelProperty(value = "备货人") + private String bhr; + + @Column(name = "`fhr`") + @ApiModelProperty(value = "发货人") + private String fhr; + + @Column(name = "`jsr`") + @ApiModelProperty(value = "线边接收人") + private String jsr; + + @OneToOne + @JoinColumn(name = "`jskw`") + @ApiModelProperty(value = "接收库位") + private Point jskw; + + @Column(name = "`zztlr`") + @ApiModelProperty(value = "制造投料人") + private String zztlr; + + @Column(name = "`hctlr`") + @ApiModelProperty(value = "缓存投料人") + private String hctlr; + + @OneToOne + @JoinColumn(name = "`zzkw`") + @ApiModelProperty(value = "制造投料库位") + private Point zzkw; + + @Column(name = "`cj_date`") + @ApiModelProperty(value = "采集时间") + private Timestamp cjDate; + + @Column(name = "`sj_date`") + @ApiModelProperty(value = "上架时间") + private Timestamp sjDate; + + @Column(name = "`bh_date`") + @ApiModelProperty(value = "备货时间") + private Timestamp bhDate; + + @Column(name = "`fh_date`") + @ApiModelProperty(value = "发货时间") + private Timestamp fhDate; + + @Column(name = "`js_date`") + @ApiModelProperty(value = "接收时间") + private Timestamp jsDate; + + @Column(name = "`zztl_date`") + @ApiModelProperty(value = "制造投料时间") + private Timestamp zztlDate; + + @Column(name = "`c_point_code`") + @ApiModelProperty(value = "材管库位") + private String cPointCode; + + @Column(name = "`z_point_code`") + @ApiModelProperty(value = "制造库位") + private String zPointCode; + + @Column(name = "`contents`") + @ApiModelProperty(value = "加工内容") + private String contents; + + @Column(name = "`rela_supplier`") + @ApiModelProperty(value = "供应商") + private String relaSupplier; + + @Column(name = "`rela_door`") + @ApiModelProperty(value = "门号") + private String relaDoor; + + @Column(name = "`rela_code`") + @ApiModelProperty(value = "纳入场所") + private String relaCode; + + @Column(name = "`rela_type`") + @ApiModelProperty(value = "箱种") + private String relaType; + + @Column(name = "`rela_quantity`") + @ApiModelProperty(value = "收容数") + private Double relaQuantity; + + @Column(name = "`area_code`") + @ApiModelProperty(value = "品区") + private String areaCode; + + @Column(name = "`item_code`") + @ApiModelProperty(value = "品番") + private String itemCode; + + @Column(name = "`dept_id`") + @ApiModelProperty(value = "仓库ID") + private Long deptId; + + @Column(name = "`description`") + @ApiModelProperty(value = "描述") + private String description; + + @Column(name = "`enabled`") + @ApiModelProperty(value = "状态:1启用、0禁用") + private Boolean enabled=Boolean.TRUE; + + @Column(name = "`status`") + @ApiModelProperty(value = "状态") + private String status= BizStatus.RECEIVED; + + @OneToOne + @JoinColumn(name = "`rk_task_id`") + @ApiModelProperty(value = "入库任务") + private Task rkTask; + + @OneToOne + @JoinColumn(name = "`item_key_id`") + @ApiModelProperty(value = "物料批次") + private ItemKey itemKey; + + @OneToOne + @JoinColumn(name = "`inv_point_id`") + @ApiModelProperty(value = "库存库位") + private Point invPoint; + + @OneToOne + @JoinColumn(name = "`ck_task_log_id`") + @ApiModelProperty(value = "出库任务日志") + private TaskLog ckTaskLog; + + @Column(name = "`tf_ly`") + @ApiModelProperty(value = "是否留样:1启用、0禁用") + private Boolean tfLy=Boolean.FALSE; + + @Column(name = "`be_fz`") + @ApiModelProperty(value = "是否复制:1复制、0为复制") + private Boolean beFz=Boolean.FALSE; + + @Column(name = "`ly_data`") + @ApiModelProperty(value = "留样日期") + private Timestamp lyData; + + @Column(name = "`hy_data`") + @ApiModelProperty(value = "还样日期") + private Timestamp hyData; + + @Column(name = "`tk_data`") + @ApiModelProperty(value = "退库日期") + private Timestamp tkData; + + @Column(name = "`bd_ewm`") + @ApiModelProperty(value = "补打二维码") + private String bdEwm; + @Column(name = "`bd_fzh`") + @ApiModelProperty(value = "补打分支号") + private String bdFzh; + @Column(name = "`bd_nrs`") + @ApiModelProperty(value = "补打纳入数") + private int bdNrs=0; + + @Column(name = "`ly_code`") + @ApiModelProperty(value = "留样出库单") + private String lyCode; + + @Column(name = "`receipt_code`") + @ApiModelProperty(value = "收货清单号") + private String receiptCode; + + @Column(name = "`count_code`") + @ApiModelProperty(value = "盘点单号") + private String countCode; + + public void copy(XppRecord source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/DelData.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/DelData.java new file mode 100644 index 0000000..fdb057c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/DelData.java @@ -0,0 +1,11 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +@Data +public class DelData { + /** + * xppRecordId + */ + Long id; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPPickDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPPickDetail.java new file mode 100644 index 0000000..6119425 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPPickDetail.java @@ -0,0 +1,8 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +@Data +public class IPPickDetail { + Long pickDetailId; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPTask.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPTask.java new file mode 100644 index 0000000..efcc782 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IPTask.java @@ -0,0 +1,9 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +@Data +public class IPTask { + String itemCode; + Long pickTicketId; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkConfirm.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkConfirm.java new file mode 100644 index 0000000..303c881 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkConfirm.java @@ -0,0 +1,42 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class IRkConfirm { + String mo; + /**物料序号*/ + Long itemId; + /**物料号*/ + String itemCode; + + /**容器序号*/ + Long stockId; + /**容器号*/ + String stockCode; + + /**数量*/ + double qty; + + /**批次号*/ + String pch; + + /**厂家编号*/ + String cjbh; + + public IRkConfirm(String mo, Long itemId, String itemCode, Long stockId, String stockCode, double qty, String pch, String cjbh) { + this.mo = mo; + this.itemId = itemId; + this.itemCode = itemCode; + this.stockId = stockId; + this.stockCode = stockCode; + this.qty = qty; + this.pch = pch; + this.cjbh = cjbh; + } + public IRkConfirm(){ + + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkInv.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkInv.java new file mode 100644 index 0000000..9be4f89 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkInv.java @@ -0,0 +1,28 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +@Data +public class IRkInv { + /**物料*/ + Boolean beAgv; + /**容器号*/ + String stockCode; + /**起点*/ + String srcPointCode; + /**终点*/ + String dstPoinCode; + Long asnDetailId; + Long srcPointId; + + public IRkInv(Boolean beAgv, String stockCode, String srcPointCode, String dstPoinCode) { + this.beAgv = beAgv; + this.stockCode = stockCode; + this.srcPointCode = srcPointCode; + this.dstPoinCode = dstPoinCode; + } + + public IRkInv(){ + + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkPut.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkPut.java new file mode 100644 index 0000000..d55cbfd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IRkPut.java @@ -0,0 +1,21 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +import java.util.List; +import java.util.Set; + +@Data +public class IRkPut { + /**物料*/ + String pointCode; + /**二维码*/ + String ewm; + /**校验序号*/ + int seq=0; + /**数量*/ + int qty=0; + + Set ewms; + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IScanPut.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IScanPut.java new file mode 100644 index 0000000..c698e09 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/IScanPut.java @@ -0,0 +1,20 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +@Data +public class IScanPut { + String scanCode; + Set ewms; + /**库位号*/ + String pointCode; + /**库区号*/ + String areaCode; + Set ids; + String cph; + int type=1; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XppPut.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XppPut.java new file mode 100644 index 0000000..3e9c758 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/XppPut.java @@ -0,0 +1,13 @@ +package com.youchain.businessdata.inputJson; + +import lombok.Data; + +@Data +public class XppPut { + /**二维码*/ + String ewm; + /**已扫描的二维码*/ + String[] ewms; + /**校验序号 1为扫描 2为提交*/ + int seq=0; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/AsnDetailButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/AsnDetailButton.java new file mode 100644 index 0000000..f022e62 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/AsnDetailButton.java @@ -0,0 +1,23 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.AsnDetail; +import lombok.Data; + +import java.util.List; + +@Data +public class AsnDetailButton { + //操作 1、整单入库,2、单一入库,3取消收货 + private int button; + //主表的id + private Long id; + //单一入库的数量 + private Double oneRNumber; + //单一入库的库位 + private Point oneRPoint; + //单一入库的副表 + private AsnDetail asnDetailData; + //取消 + private List asnDetailDataS; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ElTableConfigInput.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ElTableConfigInput.java new file mode 100644 index 0000000..7833853 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ElTableConfigInput.java @@ -0,0 +1,12 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.user.domain.ElTableConfig; +import lombok.Data; + +import java.util.List; + +@Data +public class ElTableConfigInput { + //需改的数据 + private List updateElTableConfigDtoS; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/IPPickOut.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/IPPickOut.java new file mode 100644 index 0000000..e735f91 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/IPPickOut.java @@ -0,0 +1,23 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.businessdata.domain.PickOut; +import lombok.Data; + +@Data +public class IPPickOut { + private Long outId; + private Long ptId; + private Long[] logIds; + //车牌号 + private String cph; + //备货单号 + private String bhdh; + //现品票 + private String xpp; + //托盘号 + private String tph; + //发货人 + private String fhr; + //顺序号 + private int seq; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/InventoryButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/InventoryButton.java new file mode 100644 index 0000000..d056622 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/InventoryButton.java @@ -0,0 +1,10 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.businessdata.inputJson.buttenJson.dataAll.InventoryYW; +import lombok.Data; + +@Data +public class InventoryButton { + //库内移位操作 + private InventoryYW inventoryYW; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ManualGeneration.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ManualGeneration.java new file mode 100644 index 0000000..a91de1e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ManualGeneration.java @@ -0,0 +1,22 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.ProductionPlan; +import lombok.Data; +//手工生成 +@Data +public class ManualGeneration { + //入库库区 + private Area rkAreaId; + //完成品番 + private BigItem bigItem; + //起始机号 + private String startMachineNo; + //工位 + private String workingStation; + //数量 + private int quantity; + //生成数据计划 + private ProductionPlan productionPlan; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickOutButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickOutButton.java new file mode 100644 index 0000000..eec0ec6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickOutButton.java @@ -0,0 +1,25 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.businessdata.domain.PickOut; +import lombok.Data; + +@Data +public class PickOutButton { + //按钮 1、新增功能 2、出库确认 + private int button; + //出库单维护的数据 + private PickOut pickOut; + //选择的tasklog的id + private Long[] taskLogIdS; + //选着的PickOut的id + private Long[] pickOutIdS; + //查询参数 + //PickOutid + private Long pickOutId; + //品番 + private String itemCode; + //起始点位 + private String srcPointCode; + //目标容器 + private String dstStockCode; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickTicketButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickTicketButton.java new file mode 100644 index 0000000..a0ac8b3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PickTicketButton.java @@ -0,0 +1,26 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.businessdata.domain.TaskLog; +import lombok.Data; + +import java.util.List; + +@Data +public class PickTicketButton { + //拣货确认按钮号 1整单拣货 2单一拣货 3批量拣货 4取消拣货 5拣货整单取消 6拣货批量取消 7现品票拣货 + private int pickConfirmNo; + //单一拣货 输入数量 + private int onePickConfirmNumber; + //容器号 + private String stockCode; + //备货人 + private String bhr; + //task表 + private Long[] taskId; + //选着的其他出库数据 + private Long pickTicketId; + //拣货批量取消使用 + private Long[] taskLogId; + //现品票二维码 + private String xppQRCode; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickButton.java new file mode 100644 index 0000000..af29c47 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickButton.java @@ -0,0 +1,16 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.businessdata.domain.PlanPickDetail; +import lombok.Data; + +import java.util.List; + +@Data +public class PlanPickButton { + //新增 + private PlanPickSave planPickSave; + //生成备货操着 备货操着的份数 + private double quantity; + //选着的数据 planPickDetail + private List planPickDetailList; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickSave.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickSave.java new file mode 100644 index 0000000..e60af31 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/PlanPickSave.java @@ -0,0 +1,17 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BigItem; +import lombok.Data; + +@Data +public class PlanPickSave { + //计划 【不填生成单号】 + private String code; + //工位就是传收货库区 + private Area zone; + //BOM清单就是传完成品番 + private BigItem bigItem; + //数量 就是订单数量 + private Double orderQuantity; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ProductionPlanButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ProductionPlanButton.java new file mode 100644 index 0000000..5178f37 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/ProductionPlanButton.java @@ -0,0 +1,11 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import com.youchain.basicdata.domain.BigItem; +import lombok.Data; + +@Data +public class ProductionPlanButton { + //手工生成 + private ManualGeneration manualGeneration; +} + diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/XppRecordButton.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/XppRecordButton.java new file mode 100644 index 0000000..26dcc1e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/XppRecordButton.java @@ -0,0 +1,9 @@ +package com.youchain.businessdata.inputJson.buttenJson; + +import lombok.Data; + +@Data +public class XppRecordButton { + private Long xppRecordId; + private String ewm; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/dataAll/InventoryYW.java b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/dataAll/InventoryYW.java new file mode 100644 index 0000000..8199f84 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/inputJson/buttenJson/dataAll/InventoryYW.java @@ -0,0 +1,16 @@ +package com.youchain.businessdata.inputJson.buttenJson.dataAll; + +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.Inventory; +import lombok.Data; + +@Data +public class InventoryYW { + //要移的库存数据 + private Inventory inventory; + //目标库位 + private Point dstPoint; + //移动数量 + private double rmNumber; + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnDetailRepository.java new file mode 100644 index 0000000..9e1844f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnDetailRepository.java @@ -0,0 +1,35 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.AsnDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author hjl +* @date 2023-08-14 +**/ +public interface AsnDetailRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM `data_asn_detail` asnDetail WHERE asn_id = :id order by create_time DESC", nativeQuery = true) + List queryByAsnId(@Param("id") Long id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnRepository.java new file mode 100644 index 0000000..95f412e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/AsnRepository.java @@ -0,0 +1,42 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.Inventory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-09 +**/ +public interface AsnRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据 Code 查询 + * @param code / + * @return / + */ + Asn findByCode(String code); + + @Query(value = "SELECT * FROM `data_asn` asn ORDER BY asn.create_time DESC LIMIT 0,1", nativeQuery = true) + Asn queryMaxCode(); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/BaseCodeRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/BaseCodeRepository.java new file mode 100644 index 0000000..c443e32 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/BaseCodeRepository.java @@ -0,0 +1,34 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.BaseCode; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-08-22 +**/ +public interface BaseCodeRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据 Code 查询 + * @param code / + * @return / + */ + BaseCode findByCode(String code); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountDetailRepository.java new file mode 100644 index 0000000..17fb50b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountDetailRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.CountDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +public interface CountDetailRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRecordRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRecordRepository.java new file mode 100644 index 0000000..c865915 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRecordRepository.java @@ -0,0 +1,36 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.domain.CountMoveDetailRecord; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +public interface CountMoveDetailRecordRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM data_count_move_detail_record d \n" + + "left join data_count_move m on m.id=d.count_move_id\n" + + "where m.code =?1 and d.xpp_id=?2" , nativeQuery = true) + List queryDetails(String count_code,Long xpp_id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRepository.java new file mode 100644 index 0000000..d21a75d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveDetailRepository.java @@ -0,0 +1,46 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.domain.Inventory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +public interface CountMoveDetailRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "SELECT * FROM data_count_move_detail d where d.count_move_id =?1" , nativeQuery = true) + List queryDetails(Long count_move_id); + + @Query(value = "SELECT * FROM data_count_move_detail d where d.count_move_id =?1 and d.item_key_id=?2 and d.dst_point_id=?3" , nativeQuery = true) + List queryIkPDetails(Long count_move_id,Long item_key_id,Long dst_point_id); + + @Query(value = "SELECT d.count_move_id,d.item_key_id,d.dst_point_id FROM data_count_move_detail d where d.count_move_id =?1 GROUP BY d.item_key_id,d.dst_point_id" , nativeQuery = true) + List queryIkPGroupDetails(Long count_move_id); + + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveRepository.java new file mode 100644 index 0000000..19972db --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountMoveRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.CountMove; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-19 +**/ +public interface CountMoveRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountPlanRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountPlanRepository.java new file mode 100644 index 0000000..138d49a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountPlanRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.CountPlan; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-19 +**/ +public interface CountPlanRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/CountRecordRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountRecordRepository.java new file mode 100644 index 0000000..fb0bf31 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/CountRecordRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.CountRecord; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +public interface CountRecordRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryBakRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryBakRepository.java new file mode 100644 index 0000000..2afc6e9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryBakRepository.java @@ -0,0 +1,38 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.InventoryBak; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-03 +**/ +public interface InventoryBakRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "select sum(inv.quantity-inv.queuedQty) from InventoryBak inv where 1=1 and inv.itemKey.item.id=:itemId and inv.area.id=:areaId and inv.detailId in :detailIds and inv.zzkw.id=:zzkwId") + Double getXbQty(@Param("itemId")Long itemId, @Param("areaId")Long areaId,@Param("detailIds")Long[] detailIds, @Param("zzkwId")Long zzkwId); + + @Query(value = "select sum(inv.quantity) from InventoryBak inv where 1=1 and inv.item.id=:itemId and inv.area.id=:areaId and inv.detailId in :detailIds and inv.zzkw.id=:zzkwId") + Double getXbBhQty(@Param("itemId")Long itemId, @Param("areaId")Long areaId,@Param("detailIds")Long[] detailIds, @Param("zzkwId")Long zzkwId); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryLogRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryLogRepository.java new file mode 100644 index 0000000..b2a8e58 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryLogRepository.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.service.vo.InventoryExcelDto; +import com.youchain.businessdata.service.vo.InventoryExcelVO; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @date 2023-08-31 + **/ +public interface InventoryLogRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "select log.id,area.name as areaName, item.code as itemCode,item.name as itemName,log.log_type as logType, " + + "log.inc_dec as incDec,log.src_point_code as srcPoint,log.dst_point_code as dstPoint, " + + "log.src_qty as srcQty,log.dst_qty as dstQty,log.occur_quantity as occurQuantity, " + + "log.related_bill as relatedBill,log.description,log.create_by as createBy,log.occur_time as occurTime " + + "from data_inventory_log log " + + "join data_item_key ik on ik.id=log.item_key_id " + + "join base_item item on item.id=ik.item_id " + + "join base_area area on area.id=log.area_id " + + "where (:itemCode is null or item.code = :itemCode) " + + "and log.id > :lastId " + + "order by log.id asc ", nativeQuery = true) + List listByInventoryLogs(Long lastId, String itemCode, Pageable pageable); + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryRepository.java new file mode 100644 index 0000000..e3cbedf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/InventoryRepository.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.repository; + +import com.youchain.basicdata.domain.Box; +import com.youchain.businessdata.domain.Inventory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** + * @author huojin + * @website https://eladmin.vip + * @date 2023-08-22 + **/ +public interface InventoryRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据物料查询库存 + * + * @param itemId + * @return + */ + @Query(value = "SELECT * FROM data_inventory inv " + + " WHERE " + + " inv.item_key_id in (select id from data_item_key where item_id = ?1 ) " + + " and inv.quantity-inv.queued_qty>0 " + + " and inv.area_id=?2 " + + " order by inv.item_key_id in (select id from data_item_key where item_id = ?1 ORDER BY prop_d1 ) ", nativeQuery = true) + List queryInventory(long itemId, long areaId); + + @Query(value = "SELECT * from data_inventory inv \n" + + "left join base_point p on inv.point_id=p.id\n" + + "WHERE inv.quantity>0 and inv.area_id=?1 and p.type='CH'" , nativeQuery = true) + List queryInventoryArea(long areaId); + + @Query(value = "SELECT * FROM data_inventory inv " + + "left join base_point p on inv.point_id=p.id " + + " WHERE inv.quantity>0 " + + " and inv.point_id=?1 and inv.item_key_id=?2 and p.type='CH'" , nativeQuery = true) + List queryInventoryPointIk(long area_id,Long item_key_id); + + @Query(value = "SELECT * FROM data_inventory inv " + + "left join base_point p on inv.point_id=p.id " + + " WHERE inv.quantity>0 and inv.area_id=?1" + + " and p.type='CH'" , nativeQuery = true) + List queryInventoryArea2(long areaId); + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/ItemKeyRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/ItemKeyRepository.java new file mode 100644 index 0000000..c91ffbb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/ItemKeyRepository.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.ItemKey; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-21 +**/ +public interface ItemKeyRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM data_item_key ik where ik.item_id =?1 and ik.prop_c1 =?2" , nativeQuery = true) + List queryItemKey(Long item_id,String prop_c1); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PickDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickDetailRepository.java new file mode 100644 index 0000000..1119c65 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickDetailRepository.java @@ -0,0 +1,63 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.PickDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-16 +**/ +public interface PickDetailRepository extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "SELECT * FROM `data_pick_detail` a WHERE pick_ticket_id = :id", nativeQuery = true) + List queryByPickTicketId(@Param("id") Long id); + @Query(value = "SELECT * FROM `data_pick_detail` a WHERE pick_ticket_id = :pickTicketId and item_id = :itemId", nativeQuery = true) + PickDetail queryByPickTicketIdItemId(@Param("pickTicketId")Long pickTicketId,@Param("itemId")Long itemId); + + @Query(value = "SELECT * FROM `data_pick_detail` a WHERE prop_c3 = :propC3 ", nativeQuery = true) + PickDetail queryByPropC3(@Param("propC3")String propC3); + + /** + * 未拣货完成,返回0则全部拣货完成 + * @param id + * @return + */ + @Query(value = "SELECT id FROM `data_pick_detail` a WHERE pick_ticket_id = :id and allocated_qty>0 and allocated_qty>picked_qty", nativeQuery = true) + List queryPickQty(@Param("id") Long id); + /** + * 未发运完成,返回0则全部发运完成 + * @param id + * @return + */ + @Query(value = "SELECT id FROM `data_pick_detail` a WHERE pick_ticket_id = :id and picked_qty>0 and picked_qty>shipped_qty", nativeQuery = true) + List queryShipQty(@Param("id") Long id); + + @Query(value = "SELECT id FROM `data_pick_detail` a WHERE pick_ticket_id = :id and picked_qty>0 and picked_qty>shipped_qty", nativeQuery = true) + List queryBLZsc(@Param("id") Long id); + + @Query(value = "SELECT IFNULL(sum(allocated_qty),0) FROM `data_pick_detail` a WHERE source_id=:id", nativeQuery = true) + Double getBcQty(@Param("id") Long id); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PickInstructionRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickInstructionRepository.java new file mode 100644 index 0000000..22cb8db --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickInstructionRepository.java @@ -0,0 +1,35 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickInstruction; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +public interface PickInstructionRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM `data_pick_instruction` dpi WHERE dpi.id in :ids", nativeQuery = true) + List queryPinckInsAllByLongS(@Param("ids") Long[] ids); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PickKitPlanRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickKitPlanRepository.java new file mode 100644 index 0000000..acb4775 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickKitPlanRepository.java @@ -0,0 +1,53 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.PickKitPlan; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +public interface PickKitPlanRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT distinct plan_number FROM `data_pick_kit_plan` p WHERE p.id in :ids", nativeQuery = true) + List queryYcds(@Param("ids") Long[] ids); + + @Query(value = "SELECT p.work_area_id FROM `data_pick_kit_plan` p WHERE p.plan_number =:code and status='WCD' group by p.work_area_id", nativeQuery = true) + List queryCodeArea(@Param("code") String code); + + @Query(value = "SELECT * FROM `data_pick_kit_plan` p WHERE p.plan_number=:code and p.work_area_id =:areaId and status='WCD'", nativeQuery = true) + List getPickKitPlansCodeArea(@Param("code") String code,@Param("areaId")Long areaId); + + @Query(value = "SELECT * FROM `data_pick_kit_plan` p WHERE p.plan_number =:code", nativeQuery = true) + List queryPickKitPlanCode(@Param("code") String code); + + @Query(value = "SELECT p.workArea.gcCode FROM PickKitPlan p where p.workArea.gcCode is not null and p.planNumber in :codes group by p.workArea.gcCode ") + List groupGc(@Param("codes")String[] codes); + + @Query(value = "select t.cArea.id from BomAccount t,PickKitPlan p where p.planNumber in :codes and p.workArea.gcCode=:gc and t.bigItem.id=p.bigItem.id and t.item.enabled=true group by t.cArea.id order by t.cArea.id") + List groupCArea(@Param("codes")String[] codes,@Param("gc")String gc); + + @Query(value = "select t.rArea.id,max(t.id),sum(t.singles*p.orderQty) from BomAccount t,PickKitPlan p where p.planNumber in :codes and p.workArea.gcCode=:gc and t.cArea.id=:cAreaId and t.bigItem.id=p.bigItem.id and t.item.enabled=true and t.rArea.id=p.workArea.id group by t.rArea.id, t.zPoint.id,t.item.id") + List sumBomSingle(@Param("codes")String[] codes,@Param("gc")String gc,@Param("cAreaId")Long cAreaId); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PickOutRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickOutRepository.java new file mode 100644 index 0000000..6bb233a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickOutRepository.java @@ -0,0 +1,35 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.PickOut; +import com.youchain.businessdata.domain.PickTicket; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-02-21 +**/ +public interface PickOutRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM `data_pick_out` o where o.`order_no` = :code", nativeQuery = true) + List queryCode(@Param("code") String code); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PickTicketRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickTicketRepository.java new file mode 100644 index 0000000..0ef12c1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PickTicketRepository.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.PlanPickDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.sql.Timestamp; +import java.util.List; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @date 2024-01-11 + **/ +public interface PickTicketRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据 BillType 查询 + * + * @param bill_type / + * @return / + */ + PickTicket findByBillType(Long bill_type); + + @Query(value = "SELECT * FROM `data_pick_ticket` pickticket ORDER BY pickticket.create_time DESC LIMIT 0,1", nativeQuery = true) + PickTicket queryMaxCode(); + + @Query(value = "SELECT * FROM `data_pick_ticket` dpt where dpt.`code` = :code", nativeQuery = true) + List queryCode(@Param("code") String code); + + @Query(value = "SELECT dpt.area,dpt.gc_code FROM `data_pick_ticket` dpt where dpt.`code` like 'BH%' and DATE_FORMAT(dpt.order_date,'%Y-%m-%d')=:order_date" + + " group by dpt.area,dpt.gc_code", nativeQuery = true) + List queryBhCkAreas(@Param("order_date") String order_date); + /** + * 根据单号 状态 查询数据 + * + * @return 数据 + */ + @Query(value = "SELECT * FROM `data_pick_ticket` dpt where dpt.`status` = :status and dpt.`related_bill1` like :code", nativeQuery = true) + List queryPickTicketByCodeAll(@Param("status") String status, @Param("code") String code); + + @Transactional //也可以只标注在上层调用者方法上 + @Modifying + @Query(value = "UPDATE data_pick_ticket dpt set dpt.order_quantity = :orderQuantity where dpt.id= :id", nativeQuery = true) + void updataOrderQuantity(@Param("orderQuantity") double orderQuantity, @Param("id") Long id); + + + /** + * 发货确认后修改的值 + */ + @Transactional + @Modifying + @Query(value = "UPDATE data_pick_ticket dpt set dpt.`ship_date` = :shipDate, dpt.`related_bill1` =:relatedBill1 ,dpt.`status`=:status,dpt.shipped_quantity = :shippedQuantity where dpt.id = :id", nativeQuery = true) + void updataPT(@Param("shipDate") String shipDate, @Param("relatedBill1") String relatedBill1, @Param("status")String status,@Param("shippedQuantity")double shippedQuantity, @Param("id") Long id); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/PlanPickDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/PlanPickDetailRepository.java new file mode 100644 index 0000000..5bccd71 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/PlanPickDetailRepository.java @@ -0,0 +1,71 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.businessdata.domain.PlanPickDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-01-23 +**/ +public interface PlanPickDetailRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT * FROM `data_plan_pick_detail` dppd ORDER BY dppd.id DESC LIMIT 0,1", nativeQuery = true) + PlanPickDetail queryMaxCode(); + + /** + * 获取单号 每个单号只查出条记录 + * @return + */ + @Query(value = "SELECT * FROM `data_plan_pick_detail` dppd where dppd.status = 'WCD' GROUP BY dppd.code", nativeQuery = true) + List queryPlanPickDetailByCode(); + + @Query(value = "SELECT DISTINCT code FROM `data_plan_pick_detail` dppd where dppd.status = 'WCD' ", nativeQuery = true) + List queryPlanPickDetailCode(); + + List findByCode(String code); + + /** + * 根据单号 状态 查询数据 + * @return 数据 + */ + List findByStatusAndCode(String status,String code); + + /** + * 根据单号 状态 查询数据 + * @return 数据 + */ + @Query(value = "SELECT * FROM `data_plan_pick_detail` dppd where dppd.code = :code AND dppd.big_item_id = :bigItemId ", nativeQuery = true) + PlanPickDetail findPlanPickData(@Param("code")String code,@Param("bigItemId")Long bigItem); + @Query(value = "SELECT * FROM `data_plan_pick_detail` dppd where dppd.`status` = :status and dppd.`code` in :codes", nativeQuery = true) + List findByStatusAndCodes(@Param("status")String status,@Param("codes")String[] codes); + @Query(value = "SELECT dppd.gc_code,dppd.remark,max(dppd.id) id FROM `data_plan_pick_detail` dppd where dppd.gc_code is not null and dppd.code in :codes group by dppd.gc_code,dppd.remark order by dppd.remark ", nativeQuery = true) + List groupGcPc(@Param("codes")String[] codes); + + @Query(value = "select t.cArea.id from BomAccount t,PlanPickDetail ptd where ptd.code in :codes and ptd.gcCode=:gc and ptd.remark=:pc and t.bigItem.id=ptd.bigItem.id and t.item.enabled=true group by t.cArea.id order by t.cArea.id") + List groupCArea(@Param("codes")String[] codes,@Param("gc")String gc,@Param("pc")String pc); + + @Query(value = "select t.rArea.id,max(t.id),sum(t.singles*ptd.orderQuantity) from BomAccount t,PlanPickDetail ptd where ptd.code in :codes and ptd.gcCode=:gc and ptd.remark=:pc and t.cArea.id=:cAreaId and t.bigItem.id=ptd.bigItem.id and t.item.enabled=true and t.rArea.id=ptd.zone.id group by t.rArea.id, t.zPoint.id,t.item.id") + List sumBomSingle(@Param("codes")String[] codes,@Param("gc")String gc,@Param("pc")String pc,@Param("cAreaId")Long cAreaId); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/SparepartsRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/SparepartsRepository.java new file mode 100644 index 0000000..801107b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/SparepartsRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.Spareparts; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author ShenYinAn +* @date 2024-01-30 +**/ +public interface SparepartsRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskLogRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskLogRepository.java new file mode 100644 index 0000000..4c591b1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskLogRepository.java @@ -0,0 +1,75 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.TaskLog; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * @author huojin + * @website https://eladmin.vip + * @date 2023-08-25 + **/ +public interface TaskLogRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据taskId查询taskLog + * + * @param taskId + * @return + */ + @Query(value = "SELECT * FROM data_task_log log WHERE log.task_id=?1 ", nativeQuery = true) + List getTaskLogbyTaskId(long taskId); + + + /** + * 拣货详情的数据 + * @param pickTicketId + * @return + */ + @Query(value = "select dtl.* from data_task_log dtl where dtl.task_id in (select dt.id from `data_task` dt where dt.pick_detail_id in (select dpd.id from data_pick_detail dpd WHERE dpd.pick_ticket_id = :pickTicketId )) ", nativeQuery = true) + List getTaskLogsByPtId(@Param("pickTicketId") Long pickTicketId); + + /** + * 拣货取消数据 + * @param pickTicketId + * @return + */ + @Query(value = "select dtl.* from data_task_log dtl where dtl.task_id in (select dt.id from `data_task` dt where dt.pick_detail_id in (select dpd.id from data_pick_detail dpd WHERE dpd.pick_ticket_id = :pickTicketId )) and dtl.ship_qty = 0 or dtl.ship_qty is NULL", nativeQuery = true) + List getTaskLogsCancelByPick(@Param("pickTicketId") Long pickTicketId); + + @Query(value = "select l.* from data_task_log l\n" + + "left join data_task t on t.id=l.task_id\n" + + "left join data_pick_detail pd on pd.id=t.pick_detail_id \n" + + "where pd.pick_ticket_id=:pickTicketId and l.ship_qty>0", nativeQuery = true) + List getCancelByShip(@Param("pickTicketId") Long pickTicketId); + + /** + * 根据PickOutId查询TaskLog + */ + @Query(value = "select * from data_task_log dtl where dtl.pick_out_id = :pickOutId", nativeQuery = true) + List getTaskLogByPickOutId(@Param("pickOutId") Long pickOutId); + + @Modifying + @Query(value = "UPDATE data_task_log dtl set dtl.pick_out_id=NULL where dtl.pick_out_id=:pickOutId ", nativeQuery = true) + void delectTaskLogPickOutId(@Param("pickOutId")Long pickOutId); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskRepository.java new file mode 100644 index 0000000..35172d3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/TaskRepository.java @@ -0,0 +1,108 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.Task; +import io.lettuce.core.dynamic.annotation.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +public interface TaskRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT u.id FROM data_task u WHERE u.asn_detail_id=?1", nativeQuery = true) + public List> getAsnTask(Long id); + + /** + * 根据出库单明细查询未完成的Task集合 + * @param id + * @return + */ + @Query(value = "SELECT * FROM data_task t WHERE t.pick_detail_id=?1 and t.plan_qty>t.move_qty ", nativeQuery = true) + List getPickNotAllTask(Long id); + + @Query(value = "SELECT * FROM data_task t WHERE t.pick_detail_id=?1", nativeQuery = true) + List getPickDetailTasks(Long id); + + /*** + * 未拣货完成数据 + * @param id + * @return + */ + @Query(value = "select t.* from data_task t \n" + + "left join data_pick_detail pd on pd.id=t.pick_detail_id \n" + + "where pd.pick_ticket_id=?1 and t.plan_qty>t.move_qty ", nativeQuery = true) + List getNotPickTask(Long id); + + /** + * 根据出库单明细查询已完成的Task集合 + * @param id + * @return + */ + @Query(value = "SELECT * FROM data_task t WHERE t.pick_detail_id=?1 and t.plan_qty=t.move_qty ", nativeQuery = true) + List getPickAllTask(Long id); + + + /** + * 根据AGV ID查询对应Task集合 + * @param id + * @return + */ + @Query(value = "SELECT * FROM data_task t WHERE t.agv_task_id=?1 ", nativeQuery = true) + List getAgvTaskList(Integer id); + + /** + * 根据 收货明细序号 进行删除数据 + */ + @Query(value = "SELECT Id FROM data_task t WHERE t.asn_detail_id =?1", nativeQuery = true) + Long getAsnDetailIdToId(Long id); + + /** + * 查询分配记录 + */ + @Query(value = "SELECT * FROM `data_task` dt where dt.bill_code = :billCode", nativeQuery = true) + List queryByBillCode(@Param("billCode")String billCode); + + /*** + * 查找出库占用数 + * @param item_key_id + * @return + */ + + @Query(value = "SELECT IFNULL( sum( t.plan_qty - t.move_qty ), 0 ) qty " + + " FROM data_task t " + + " LEFT JOIN data_pick_detail ptd on ptd.id=t.pick_detail_id" + + " LEFT JOIN data_pick_ticket pt on pt.id=ptd.pick_ticket_id" + + " WHERE t.plan_qty > t.move_qty and ptd.allocated_qty>ptd.picked_qty AND pt.`status` in ('PICKUP','ALLOCATE')\n" + + " AND t.item_key_id=?1 ", nativeQuery = true) + Double getItemKeyQty(Long item_key_id); + + /** + * 根据出库单明细查询已占用的数据 + * @param id + * @return + */ + @Query(value = "select * from data_task t where t.plan_qty>t.move_qty and t.pick_detail_id is not null and t.item_key_id=1? ", nativeQuery = true) + List getItemKeyTask(Long id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java new file mode 100644 index 0000000..c876b61 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/XppRecordRepository.java @@ -0,0 +1,48 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.XppRecord; +import com.youchain.utils.BizStatus; +import io.lettuce.core.dynamic.annotation.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.QueryHints; + +import javax.persistence.QueryHint; +import java.util.List; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +public interface XppRecordRepository extends JpaRepository, JpaSpecificationExecutor { + @QueryHints(@QueryHint(name = "org.hibernate.cacheMode", value = "REFRESH")) + @Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=?1", nativeQuery = true) + XppRecord findByCode(String qr); + + @Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true) + List queryXppItemKeyPoint(Long itemKeyId, Long invPointId); + + @QueryHints(@QueryHint(name = "org.hibernate.cacheMode", value = "REFRESH")) + @Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.status='PUTAWAY'", nativeQuery = true) + List queryXppItemKeyPoint2(); + + @Query(value = "SELECT IFNULL(sum(xr.nrs),0) nrs FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true) + int queryXppItemKeyPointNrs(Long itemKeyId, Long invPointId); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java new file mode 100644 index 0000000..cda9f3f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnController.java @@ -0,0 +1,127 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.service.dto.BillTypeQueryCriteria; +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.repository.AsnRepository; +import com.youchain.businessdata.service.AsnService; +import com.youchain.businessdata.service.dto.AsnQueryCriteria; +import com.youchain.utils.CodeUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Objects; +import javax.servlet.http.HttpServletResponse; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @date 2024-01-09 + **/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "asn管理") +@RequestMapping("/api/asn") +public class AsnController { + + private final AsnService asnService; + private final AsnRepository asnRepository; + private final CodeUtils codeUtils; + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportAsn(HttpServletResponse response, AsnQueryCriteria criteria) throws Exception { + asnService.download(asnService.queryAll(criteria), response); + } + + @GetMapping(value = "/maxNo") + @Log("查询最大的单号") + @ApiOperation("查询最大单号") + @AnonymousAccess + public ResponseEntity maxNo(@RequestParam("code") String code) { + return new ResponseEntity<>(codeUtils.getCode_yyMMdd(code,3), HttpStatus.OK); + } + + + @GetMapping + @Log("查询asn") + @ApiOperation("查询asn") + @AnonymousAccess + public ResponseEntity queryAsn(AsnQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(asnService.queryAll(criteria, pageable), HttpStatus.OK); + } + + + + @GetMapping("/getIdByAsn") + @Log("查询asn") + @ApiOperation("查询asn") + @AnonymousAccess + public ResponseEntity getIdByAsn(@RequestParam("id") Long id) { + return new ResponseEntity<>(asnService.findById(id), HttpStatus.OK); + } + + @GetMapping("/queryAsnAll") + @Log("查询asn") + @ApiOperation("查询asn") + @AnonymousAccess + public ResponseEntity queryAsnAll(AsnQueryCriteria criteria) { + return new ResponseEntity<>(asnService.queryAll(criteria), HttpStatus.OK); + } + + @PostMapping + @Log("新增asn") + @ApiOperation("新增asn") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createAsn(@Validated @RequestBody Asn resources) { + return new ResponseEntity<>(asnService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改asn") + @ApiOperation("修改asn") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateAsn(@Validated @RequestBody Asn resources) { + asnService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除asn") + @ApiOperation("删除asn") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteAsn(@RequestBody Long[] ids) { + asnService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java new file mode 100644 index 0000000..e73514f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/AsnDetailController.java @@ -0,0 +1,643 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.BigItemRepository; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.repository.StockRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.StockService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.mapstruct.PointMapper; +import com.youchain.businessdata.inputJson.IRkConfirm; +import com.youchain.businessdata.inputJson.IRkInv; +import com.youchain.businessdata.inputJson.IRkPut; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.buttenJson.AsnDetailButton; +import com.youchain.businessdata.repository.AsnDetailRepository; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.XppRecordRepository; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.*; +import com.youchain.businessdata.service.impl.SparepartsServiceImpl; +import com.youchain.businessdata.service.mapstruct.AsnMapper; +import com.youchain.businessdata.service.mapstruct.InventoryMapper; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.beans.Transient; +import java.io.IOException; +import java.sql.Timestamp; +import java.time.format.DateTimeFormatter; +import java.util.*; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.transaction.annotation.Transactional; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author hjl + * @website https://eladmin.vip + * @date 2023-08-14 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "asn_detail管理") +@Slf4j +@RequestMapping("/api/asnDetail") +public class AsnDetailController { + + private final AsnDetailService asnDetailService; + + private final ItemService itemService; + + private final TaskService taskService; + + private final StockService stockService; + private final StockRepository stockRepository; + + private final ItemKeyService itemKeyService; + + private final InventoryService invService; + + private final InventoryLogService invLogService; + + private final PointService pointService; + + private final AreaService areaService; + + private final InventoryRepository inventoryRepository; + private final PointMapper pointMapper; + private final FileProperties properties; + private final AsnService asnService; + private final AsnDetailRepository asnDetailRepository; + private final AsnMapper asnMapper; + private final InventoryMapper inventoryMapper; + private final XppRecordRepository xppRecordRepository; + private final XppRecordService xppRecordService; + private final BigItemRepository bigItemRepository; + private final BomAccountRepository bomAccountRepository; + private final SparepartsServiceImpl sparepartsServiceImpl; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportAsnDetail(HttpServletResponse response, AsnDetailQueryCriteria criteria) throws Exception { + asnDetailService.download(asnDetailService.queryAll(criteria), response); + } + + @PostMapping("/getIdData") + @Log("根据id查询asn_detail") + @ApiOperation("根据id查询asn_detail") + @AnonymousAccess + public ResponseEntity getIdData(@RequestBody Long ids) { + return new ResponseEntity<>(asnDetailRepository.queryByAsnId(ids), HttpStatus.OK); + } + + + @GetMapping + @Log("查询asn_detail") + @ApiOperation("查询asn_detail") + @AnonymousAccess + public ResponseEntity queryAsnDetail(AsnDetailQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(asnDetailService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @GetMapping("/queryAsnDetailAll") + @Log("查询asn_detail全部数据") + @ApiOperation("查询asn_detail全部数据") + @AnonymousAccess + public ResponseEntity queryAsnDetailAll(AsnDetailQueryCriteria criteria) { + return new ResponseEntity<>(asnDetailService.queryAll(criteria), HttpStatus.OK); + } + + @PostMapping + @Log("新增asn_detail") + @ApiOperation("新增asn_detail") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity createAsnDetail(@Validated @RequestBody AsnDetail asnDetail) { + asnDetail.setStatus(BizStatus.OPEN); + asnDetail.setDept(UserUtils.getDept()); + if (asnDetail.getRemark() == null && asnDetail.getAsn().getDescription() != null) { + asnDetail.setRemark(asnDetail.getAsn().getDescription()); + } + asnDetailService.create(asnDetail); +// Stock stock=asnDetail.getStock(); +// stock.setStatus(BaseStatus.USED); +// stockService.update(stock); + //orderQty + //添加订单数量 + if (asnDetail.getOrderQty() != null && asnDetail.getOrderQty() != 0) { + Asn asn = asnDetail.getAsn(); + asn.setOrderQuantity(asn.getOrderQuantity() + asnDetail.getOrderQty()); + asnService.update(asn); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + + + @PutMapping + @Log("修改asn_detail") + @ApiOperation("修改asn_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateAsnDetail(@Validated @RequestBody AsnDetail resources) { + AsnDetailDto byId = asnDetailService.findById(resources.getId()); + AsnDto byId1 = asnService.findById(resources.getAsn().getId()); + byId1.setOrderQuantity((byId1.getOrderQuantity() - byId.getOrderQty()) + resources.getOrderQty()); + asnDetailService.update(resources); + asnService.update(asnMapper.toEntity(byId1)); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + + @DeleteMapping + @Log("删除asn_detail") + @ApiOperation("删除asn_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteAsnDetail(@RequestBody Long[] ids) { + asnDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/putawayInvApp") + @Log("APP现品票上架-单个") + @ApiOperation("APP现品票上架-单个") + @AnonymousAccess + @Transactional + public ResponseEntity putawayInvApp(@RequestBody IRkPut s) { + log.info("s:"+s); + String pointCode = s.getPointCode(); + String ewm = s.getEwm(); + int seq=s.getSeq(); + XppRecord xppRecord =null; + Point point =null; + RRkXpp map = new RRkXpp(); + AsnDetail d=null; + xppRecord = xppRecordRepository.findByCode(ewm); + if(xppRecord==null){ + return new ResponseEntity<>(ewm + "未收货", BAD_REQUEST); + } + d=xppRecord.getAsnDetailId(); + if(d.getReceivedQty()>0){ + return new ResponseEntity<>(ewm + "已上架,不能重复上架", BAD_REQUEST); + } + if(seq==1){ + Item it=d.getItem(); + map.setItemCode(it.getCode()); + map.setItemName(it.getName()); + map.setAc(xppRecord.getAc()); + map.setDdbh(xppRecord.getDdbh()); + map.setNrs(xppRecord.getNrs()); + map.setNrzsr(DateUtil.dateYmd(xppRecord.getNrDate())); + map.setFzh(xppRecord.getFzh()); + map.setTjkw(it.getPoint()==null?null:it.getPoint().getCode()); + return new ResponseEntity<>(map, HttpStatus.OK); + } + if (seq==2) { + if(pointCode==null||!pointCode.equals("")){ + Point dstPoint=d.getItem().getPoint(); + if(dstPoint==null){ + return new ResponseEntity<>(d.getItem().getCode() + "品番未维护库位", BAD_REQUEST); + } + point=dstPoint; + pointCode=dstPoint.getCode(); + }else { + point = pointService.getPoint(pointCode, null, null, null); + if (point == null) { + return new ResponseEntity<>(pointCode + "库位不存在", BAD_REQUEST); + } + } + Area area=point.getArea(); + putawayInv(d.getId(),area.getId(),point.getId(),s.getQty(),ewm); + //直接上架确认 + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/putawayXppApp") + @Log("扫描现品票上架APP") + @ApiOperation("扫描现品票上架APP") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission + public ResponseEntity putawayXppApp(@RequestBody IRkPut s) { + int seq=s.getSeq(); + if(seq==1){ + XppRecord xppRecord =null; + String ewm = s.getEwm(); + xppRecord = xppRecordRepository.findByCode(ewm); + if(xppRecord==null){ + return new ResponseEntity<>(ewm + "二维码未采集", BAD_REQUEST); + } + if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){ + throw new BadRequestException(xppRecord.getItem().getCode()+"现品票状态不正确"); + } + RRkXpp map = xppRecordService.xppAnalysis(xppRecord); + return new ResponseEntity<>(map, HttpStatus.OK); + } + if (seq==2) { + String pointCode = s.getPointCode(); + if (pointCode == null||pointCode.equals("")) { + return new ResponseEntity<>( "库位不能为空", BAD_REQUEST); + } + Point point = pointService.getPoint(pointCode,null, null, null); + if (point == null) { + return new ResponseEntity<>(pointCode + "库位不存在", BAD_REQUEST); + } + Area area=point.getArea(); + for(String ewm:s.getEwms()){ + XppRecord xppRecord=xppRecordRepository.findByCode(ewm); + if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){ + throw new BadRequestException(xppRecord.getItem().getCode()+"现品票状态不正确"); + } + AsnDetail d = xppRecordService.addAsnDetail(xppRecord); + putawayInv(d.getId(), area.getId(), point.getId(), d.getOrderQty(),ewm); + } + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + + @PostMapping("/putawayConfirmXpp") + @Log("现品票上架确认-系统") + @ApiOperation("现品票上架确认-系统") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + @DuplicateSubmission + public ResponseEntity putawayConfirmXpp(@RequestBody HashMap rk) { + Long asnDetailId=Long.parseLong(rk.get("detailId").toString()); + AsnDetailDto dto= asnDetailService.findById(asnDetailId); + Double recQty=dto.getOrderQty()-dto.getReceivedQty(); + putawayInv(asnDetailId, Long.parseLong(rk.get("areaId").toString()) + , Long.parseLong(rk.get("pointId").toString()),recQty,null); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @Log("取消上架") + @ApiOperation("取消上架") + @PostMapping("/cancelPut") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity cancelPut(@RequestBody Long[] ids) { + for (Long id:ids){ + XppRecord xppRecord = xppRecordService.getEntity(id); + AsnDetail ad=xppRecord.getAsnDetailId(); + if(ad==null){ + return new ResponseEntity("找不到上架记录", BAD_REQUEST); + } + if (!xppRecord.getStatus().equals(BizStatus.PUTAWAY)) { + throw new BadRequestException("上架状态才能取消上架"); + } + Task t=xppRecord.getRkTask(); +// List ts=taskService.queryTask(ad.getId(),null,null,null); +// for(Task t:ts) { + asnDetailService.cancelPut(t.getId(), xppRecord); +// } + xppRecordRepository.delete(xppRecord); + } + return new ResponseEntity("取消成功", HttpStatus.OK); + } + @Log("取消收货的操作") + @ApiOperation("取消收货的操作") + @PostMapping("/rkAndQxButtonQX") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ApiResult rkAndQxButtonQX(@RequestBody AsnDetailButton asnDetailButton) { + if (!asnDetailButton.getAsnDetailDataS().isEmpty()) { + for (AsnDetail ad : asnDetailButton.getAsnDetailDataS()) { + Asn asn = ad.getAsn(); + if (Objects.isNull(asn)){ + throw new BadRequestException(HttpStatus.NOT_FOUND, ad.getItem().getCode() + "没有主单(订单序号)"); + } + AsnDto byId = asnMapper.toDto(asn); + //取消收货 + //物料 点位 增加/减少 1 + InventoryLogQueryCriteria inventoryLogQueryCriteria = new InventoryLogQueryCriteria(); + inventoryLogQueryCriteria.setIncDec(1); + inventoryLogQueryCriteria.setItemCode(ad.getItem().getCode()); + inventoryLogQueryCriteria.setSrcPointCode(ad.getPoint().getCode()); + inventoryLogQueryCriteria.setAreaCode(byId.getArea().getCode()); + List inventoryLogDtos = invLogService.queryAll(inventoryLogQueryCriteria); + if (inventoryLogDtos.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, ad.getId() + "未发现库存日志"); + } + //判断库存数量 是否大于取消的数量 +// for (InventoryLogDto inve : inventoryLogDtos) { + InventoryLogDto inve = inventoryLogDtos.get(0); + //目标标点位 + Point dstPoint = inve.getDstPoint(); + //查库存 + InventoryQueryCriteria inventoryQueryCriteria = new InventoryQueryCriteria(); + inventoryQueryCriteria.setPointCode(dstPoint.getCode()); + inventoryQueryCriteria.setItemKey(inve.getItemKey()); + inventoryQueryCriteria.setAreaName(byId.getArea().getName()); + List inventoryDtos = invService.queryAll(inventoryQueryCriteria); + if (!inventoryDtos.isEmpty()) { + InventoryDto inventoryDto = inventoryDtos.get(0); + double pd = inventoryDto.getQuantity()-ad.getReceivedQty(); + if (pd>0){ + inventoryDto.setQuantity((int)pd); + invService.update(inventoryMapper.toEntity(inventoryDto)); + }else if (pd==0d){ + inventoryRepository.deleteById(inventoryDto.getId()); + }else { + throw new BadRequestException(HttpStatus.NOT_FOUND, ad.getItem().getCode()+"库存数量不满,无法取消"); + } + + //生成库存日志 + InventoryLog inventoryLog = invLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL, BizStatus.REDUCE, null, ad.getPoint().getArea(), inve.getItemKey(), + pointMapper.toEntity(inventoryDto.getPoint()) , dstPoint, ad.getStock(), ad.getStock(), ad.getReceivedQty(), ad.getReceivedQty(), null,null,BizStatus.ASN, ad.getId(), inventoryDto.getId(), ad.getRemark()); + } +// } + byId.setReceivedQuantity(byId.getReceivedQuantity()-ad.getReceivedQty()); + ad.setReceivedQty(0d); + asnDetailService.update(ad); + asnService.update(asnMapper.toEntity(byId)); + } + } + return ApiResult.result(200, "操作成功", HttpStatus.OK); + } + /** + * 整单入库、单一入库、取消收货的操作 + * + * @param asnDetailButton + * @return + */ + @Log("整单入库、单一入库、取消收货的操作") + @ApiOperation("整单入库、单一入库、取消收货的操作") + @PostMapping("/rkAndQxButton") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ApiResult rkAndQxButton(@RequestBody AsnDetailButton asnDetailButton) { + if (asnDetailButton.getButton() == 1) { + //整单入库 + long asnId = asnDetailButton.getId(); + AsnDto byId = asnService.findById(asnId); + if (Objects.isNull(byId)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, asnId + "未查到该数据"); + } + //库区的判断 + AreaDto area = byId.getArea(); + if (Objects.isNull(area)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, asnId + "库区未填写"); + } + //查询 那个明细需要确认 + List asnDetails =asnDetailService.findAsnDetails(asnId,"1"); + if (!asnDetails.isEmpty()) { + for (AsnDetail d : asnDetails) { + this.putawayInv(d.getId(), byId.getArea().getId(), d.getPoint()==null?null:d.getPoint().getId(),(d.getOrderQty()-d.getReceivedQty()),null); + byId.setReceivedDate(new Timestamp(System.currentTimeMillis())); + byId.setReceivedQuantity(byId.getReceivedQuantity() + d.getOrderQty()); + + double pd = byId.getOrderQuantity() - byId.getReceivedQuantity(); + if (pd == 0) { + byId.setStatus(BizStatus.RECEIVED); + } else if (pd > 0 && byId.getReceivedQuantity() > 0) { + byId.setStatus(BizStatus.RECEIVING); + } + asnService.update(asnMapper.toEntity(byId)); + } + } + return ApiResult.result(200, "入库确认成功", HttpStatus.OK); + } else if (asnDetailButton.getButton() == 2) { + double qty=asnDetailButton.getOneRNumber(); + long id = asnDetailButton.getId(); + AsnDto byId = asnService.findById(id); + if (Objects.isNull(byId)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "未查到该数据"); + } + //库区的判断 + AreaDto area = byId.getArea(); + if (Objects.isNull(area)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写"); + } + putawayInv(id,area.getId(),asnDetailButton.getOneRPoint().getId(),qty,null); + } else if (asnDetailButton.getButton() == 3) { + long id = asnDetailButton.getId(); + AsnDto byId = asnService.findById(id); + if (!asnDetailButton.getAsnDetailDataS().isEmpty()) { + for (AsnDetail ad : asnDetailButton.getAsnDetailDataS()) { + List ts=taskService.queryTask(ad.getId(),null,null,null,null); + for(Task t:ts) { + asnDetailService.cancelPut(t.getId(),null); + } + } + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, asnDetailButton.getButton() + "的操作码不对 1、整单入库,2、单一入库,3取消收货"); + } + return ApiResult.result(200, "操作成功", HttpStatus.OK); + } + + + @Log("入库确认") + @ApiOperation("入库确认") + @PostMapping(value = "/invVerify") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ApiResult invVerify(@RequestBody Long[] ids) { + for (Long id : ids) { + AsnDto byId = asnService.findById(id); + if (Objects.isNull(byId)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "未查到该数据"); + } + //库区的判断 + AreaDto area = byId.getArea(); + if (Objects.isNull(area)) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "库区未填写"); + } +// if (!area.getBesh()){ +// // 通用异常,使用自定义状态码 +// throw new BadRequestException(HttpStatus.NOT_FOUND,id+"的库区的仓库不是接收仓库"); +// } + //查询 那个明细需要确认 + List asnDetails = asnDetailRepository.queryByAsnId(id); + if (!asnDetails.isEmpty()) { + for (AsnDetail asnDetailData : asnDetails) { + if (asnDetailData.getOrderQty() == asnDetailData.getReceivedQty()) { + continue; + } + //1.库区为接收仓库,库位为每个detail上的库位,如果没有则提示 + //2.库区不为接收仓库,库位取item上维护的库位,如果没有则提示 + if (area.getBexb()) {//判断库区是否为接受仓库 + if (Objects.isNull(asnDetailData.getPoint())) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "是接受仓库 副表" + asnDetailData.getId() + "的库位未填写"); + } + } else { + if (Objects.isNull(asnDetailData.getItem())) { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "是不是接受仓库 副表" + asnDetailData.getId() + "的物料未填写"); + } + } + ApiResult apiResult = null; + if (Objects.isNull( asnDetailData.getPoint())){ +// apiResult = this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), null); + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, asnDetailData.getId() + "没有填写点位"); + }else { + if (asnDetailData.getReceivedQty()>0){ + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, id + "的副表" + asnDetailData.getId() + "的物料已经单一入库无法使用整单入库"); + } + this.putawayInv(asnDetailData.getId(), byId.getArea().getId(), asnDetailData.getPoint().getId(),(asnDetailData.getOrderQty()-asnDetailData.getReceivedQty()),null); + } + + if (apiResult.getStatus() == 200) { + //收货日期改成当前日期 数量累计 + byId.setReceivedDate(new Timestamp(System.currentTimeMillis())); + byId.setReceivedQuantity(byId.getReceivedQuantity() + asnDetailData.getOrderQty()); + } else { + // 通用异常,使用自定义状态码 + throw new BadRequestException(HttpStatus.NOT_FOUND, apiResult.getMessage()); + } + double pd = byId.getOrderQuantity() - byId.getReceivedQuantity(); + if (pd == 0) { + byId.setStatus(BizStatus.RECEIVED); + } else if (pd > 0 && byId.getReceivedQuantity() > 0) { + byId.setStatus(BizStatus.RECEIVING); + } + asnService.update(asnMapper.toEntity(byId)); + } + } + } + return ApiResult.result(200, "入库确认成功", HttpStatus.OK); + } + + + public void putawayInv(@RequestBody Long asnDetailId, Long areaId, Long pointId,double recQty,String ewm) { + AsnDetail d = asnDetailService.getEntity(asnDetailId); + Area area = areaService.findEntityById(areaId); + Point point = null; + if(pointId!=null){ + point = pointService.findEntityById(pointId); + } + Point zzkw=null; + if(area.getBexb()){ + point= pointService.getPoint(area.getPointCode(), null, BaseStatus.HCKW, null);//取默认线边库位 + zzkw=d.getPoint(); + if(zzkw==null){ + //取默认制造库位 + zzkw= pointService.getPoint("ZZKW", null, null, null); + } + } + if(point==null){ + throw new BadRequestException("请选择入库库位"); + } + double unRecQty=d.getOrderQty() - d.getReceivedQty(); + if ( recQty<=unRecQty) { + String pc1=null; + //现品票确认将任务id回写到现品票表中 + XppRecord xppRecord = xppRecordRepository.findByCode(ewm); + ItemKey ik=null; + if(xppRecord!=null){ + if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.RETENTION_IN)){ + throw new BadRequestException(d.getItem().getCode()+"现品票状态不正确"); + } + pc1=DateUtil.dateYmdz();//DateUtil.dateYmd(new Date()); + ik=xppRecord.getItemKey(); + } + if(ik==null){ + ik = itemKeyService.getItemKey(d.getItem(), pc1); + } + Task t = taskService.storeTask(d, null, area, ik, point, point,recQty); + if(xppRecord!=null) { + xppRecord.setRkTask(t); + xppRecord.setInvPoint(point); + xppRecord.setStatus(BizStatus.PUTAWAY); + xppRecord.setItemKey(ik); + xppRecord.setSjr(SecurityUtils.getCurrentUsername()); + xppRecord.setSjDate(new Timestamp(new Date().getTime())); + ewm=xppRecord.getEwm(); + xppRecordService.update(xppRecord); + } + d.setReceivedQty(d.getReceivedQty()+recQty); + if(d.getReceivedQty().intValue()>=d.getOrderQty().intValue()){ + d.setStatus(BizStatus.PUTAWAY); + }else if(d.getReceivedQty().intValue()>0){ + d.setStatus(BizStatus.PUTAWAY); + } + asnDetailService.update(d); + point.setStatus(BaseStatus.USED); + pointService.update(point); + Inventory inv = invService.getInventory(ik, area, point, zzkw, d.getDept(), BizStatus.RECEIVING_UP); + t.setInvId(inv.getId()); + taskService.update(t); + double srcQty = inv.getQuantity(); + inv.addQty(recQty); + invService.update(inv); + String billCode=null; + if(d.getAsn()!=null){ + Asn asn=d.getAsn(); + billCode=asn.getCode(); + asn.setReceivedQuantity(asn.getReceivedQuantity()+recQty); + if(asn.getReceivedQuantity().intValue()>=asn.getOrderQuantity().intValue()) { + asnService.update(asn); + } + } + Point srcPoint = pointService.getPoint(null, null, BaseStatus.SHZC, null); + InventoryLog log=invLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, billCode, area, ik, srcPoint, point, zzkw, srcQty, recQty,ewm, + BizStatus.ASN, d.getId(), inv.getId(), d.getRemark()); + //根据账号增加耗用 + String userName=SecurityUtils.getCurrentUsername(); + if(userName!=null&&(userName.equals("楚友刚")||userName.equals("李栓荣")||userName.equals("颜建斌"))){ + BigItem bigItem=bigItemRepository.findByCode(ik.getItem().getCode()); + if(bigItem!=null){//自动生成耗用计划 + List jsAreaIds=bomAccountRepository.getJsAreaList(bigItem.getId()); + for(Long id:jsAreaIds){ + AreaDto areaDto=areaService.findById(id); + Spareparts spareparts=sparepartsServiceImpl.createSpareparts(areaDto.getWorkingStation(),bigItem,xppRecord.getNrs(),"收货上架耗用"); + sparepartsServiceImpl.hySpareParts(spareparts.getId()); + } + } + } + } else { + throw new BadRequestException(d.getItem().getCode() + "收货数量不能大于未收数量"); + } + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/BaseCodeController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/BaseCodeController.java new file mode 100644 index 0000000..9194adb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/BaseCodeController.java @@ -0,0 +1,99 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.BaseCode; +import com.youchain.businessdata.service.BaseCodeService; +import com.youchain.businessdata.service.dto.BaseCodeQueryCriteria; + +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-08-22 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "baseCode管理") +@RequestMapping("/api/baseCode") +public class BaseCodeController { + + private final BaseCodeService baseCodeService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportBaseCode(HttpServletResponse response, BaseCodeQueryCriteria criteria) throws Exception { + baseCodeService.download(baseCodeService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询baseCode") + @ApiOperation("查询baseCode") + @AnonymousAccess + public ResponseEntity queryBaseCode(BaseCodeQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(baseCodeService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增baseCode") + @ApiOperation("新增baseCode") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createBaseCode(@Validated @RequestBody BaseCode resources){ + return new ResponseEntity<>(baseCodeService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改baseCode") + @ApiOperation("修改baseCode") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateBaseCode(@Validated @RequestBody BaseCode resources){ + baseCodeService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除baseCode") + @ApiOperation("删除baseCode") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteBaseCode(@RequestBody Integer[] ids) { + baseCodeService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 获取baseCode + * @param key_code 单头 + * @param len 流水号 + * @return + */ + public String baseCodeFor(String key_code, int len){ + return baseCodeService.baseCodeFor(key_code,len); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountDetailController.java new file mode 100644 index 0000000..0f70be8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountDetailController.java @@ -0,0 +1,149 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.service.CountDetailService; +import com.youchain.businessdata.service.CountPlanService; +import com.youchain.businessdata.service.CountRecordService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.dto.CountDetailQueryCriteria; +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.BizStatus; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@RestController +@Slf4j +@RequiredArgsConstructor +@Api(tags = "count_detail管理") +@RequestMapping("/api/countDetail") +public class CountDetailController { + + private final CountDetailService countDetailService; + + private final CountPlanService countPlanService; + + private final CountRecordService countRecordService; + + private final InventoryService inventoryService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportCountDetail(HttpServletResponse response, CountDetailQueryCriteria criteria) throws Exception { + countDetailService.download(countDetailService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_detail") + @ApiOperation("查询count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryCountDetail(CountDetailQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(countDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping(value = "/queryPlanCountDetail") + @Log("查询count_detail") + @ApiOperation("查询count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryPlanCountDetail(CountDetailQueryCriteria criteria){ + // log.info(criteria.getPlanId()+"------盘点ID"); + return new ResponseEntity<>(countDetailService.queryAll(criteria),HttpStatus.OK); + } + + @PostMapping + @Log("新增count_detail") + @ApiOperation("新增count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createCountDetail(@Validated @RequestBody CountDetail resources){ + return new ResponseEntity<>(countDetailService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_detail") + @ApiOperation("修改count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateCountDetail(@Validated @RequestBody CountDetail resources){ + countDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_detail") + @ApiOperation("删除count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteCountDetail(@RequestBody Long[] ids) { + countDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("盘点审核") + @ApiOperation("盘点审核") + @PutMapping(value = "/checkCountPlan") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity checkCountPlan(@RequestBody Long[] ids) { + for(Long id:ids) { + log.info(id+""); + CountPlan p =countPlanService.toEntity(countPlanService.findById(id)); + List details=countPlanService.findAllDetail(id); + if(details.size()>0){ + if(p.getType().equals(BizStatus.ZONE)){ + for(CountDetail d:details){ + List invs=inventoryService.getInvForPlan(p.getType(),d.getArea().getId(), null,null); + for(Inventory inv:invs){ + inv.setQueuedQty(inv.getQuantity()); + inventoryService.update(inv); + countRecordService.createCountRecord(d,inv); + d.setPlanQty(d.getPlanQty()+inv.getQuantity()); + countDetailService.update(d); + } + } + } + p.setStatus(BizStatus.ACTIVE); + countPlanService.update(p); + }else{ + ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),"先维护盘点明细"); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + } + } + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveController.java new file mode 100644 index 0000000..5bf06d0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveController.java @@ -0,0 +1,182 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.repository.CountMoveDetailRepository; +import com.youchain.businessdata.repository.CountMoveRepository; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.XppRecordRepository; +import com.youchain.businessdata.service.CountMoveService; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.XppRecordService; +import com.youchain.businessdata.service.dto.CountDetailDto; +import com.youchain.businessdata.service.dto.CountMoveDto; +import com.youchain.businessdata.service.dto.CountMoveQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.BizStatus; +import com.youchain.utils.CodeUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-19 +**/ +@RestController +@RequiredArgsConstructor +@Slf4j +@Api(tags = "count_move管理") +@RequestMapping("/api/countMove") +public class CountMoveController { + + private final CountMoveService countMoveService; + private final CodeUtils codeUtils; + private final CountMoveRepository countMoveRepository; + private final CountMoveDetailRepository countMoveDetailRepository; + private final EntityManager entityManager; + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('countMove:list')") + public void exportCountMove(HttpServletResponse response, CountMoveQueryCriteria criteria) throws Exception { + countMoveService.download(countMoveService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_move") + @ApiOperation("查询count_move") + @PreAuthorize("@el.check('countMove:list')") + public ResponseEntity queryCountMove(CountMoveQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(countMoveService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增count_move") + @ApiOperation("新增count_move") + @PreAuthorize("@el.check('countMove:add')") + public ResponseEntity createCountMove(@Validated @RequestBody CountMove resources) { + if(resources.getDstArea()==null){ + throw new BadRequestException("需填写目标库区"); + } + if(resources.getSrcArea()==null){ + throw new BadRequestException("需填写原库区"); + } + if(resources.getType()==null){ + throw new BadRequestException("需填写盘点类型"); + } + resources.setCode(codeUtils.getCode_yyMMdd("PM", 3)); + return new ResponseEntity<>(countMoveService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_move") + @ApiOperation("修改count_move") + @PreAuthorize("@el.check('countMove:edit')") + public ResponseEntity updateCountMove(@Validated @RequestBody CountMove resources) { + countMoveService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_move") + @ApiOperation("删除count_move") + @PreAuthorize("@el.check('countMove:del')") + public ResponseEntity deleteCountMove(@RequestBody Long[] ids) { + for (Long id:ids){ + CountMoveDto countMove=countMoveService.findById(id); + if(!countMove.getStatus().equals(BizStatus.OPEN)&&!countMove.getStatus().equals(BizStatus.COUNT)){ + throw new BadRequestException(countMove.getCode()+"状态不正确"); + } + } + countMoveService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping("/getIdByCountMove") + @Log("查询CountMove") + @ApiOperation("查询CountMove") + @AnonymousAccess + public ResponseEntity getIdByCountMove(@RequestParam("id") Long id) { + return new ResponseEntity<>(countMoveService.findById(id), HttpStatus.OK); + } + + @PostMapping("/countCheck") + @Log("移位数据审核") + @ApiOperation("移位数据审核") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission(5*60) + public ResponseEntity countCheck(@RequestBody Long[] ids) { + for (Long id : ids) { + CountMove countMove=countMoveRepository.getById(id); + if(!countMove.getStatus().equals(BizStatus.OPEN)){ + throw new BadRequestException(countMove.getCode()+"状态不正确"); + } + if(countMove.getType().equals(BizStatus.COUNT_ALL)) { + List countMoveDetailList=countMoveDetailRepository.queryDetails(id); + if(countMoveDetailList.size()==0) { + countMoveService.countCheck(countMove); + } + } + String sql="INSERT into data_inventory_count_bak(count_id,bill_code,item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,`status`,dept_id,area_id,zzkw,bf_date) \n" + + "select "+countMove.getId()+",'"+countMove.getCode()+"',item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,status,dept_id,area_id,zzkw,SYSDATE() from data_inventory inv where inv.quantity!=0"; + Query query=entityManager.createNativeQuery(sql); + query.executeUpdate(); + countMove.setStatus(BizStatus.COUNT); + countMoveService.update(countMove); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/countFinish") + @Log("移位完成") + @ApiOperation("移位完成") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission(5*60) + public ResponseEntity countFinish(@RequestBody Long[] ids) { + for (Long id : ids) { + CountMove countMove=countMoveRepository.getById(id); + if(!countMove.getStatus().equals(BizStatus.COUNT)&&!countMove.getStatus().equals(BizStatus.OPEN)){ + throw new BadRequestException(countMove.getCode()+"状态不正确"); + } + countMoveService.countXpp(countMove); + countMove.setStatus(BizStatus.CLOSE); + } + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailController.java new file mode 100644 index 0000000..ab8f1df --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailController.java @@ -0,0 +1,112 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.CountMove; +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.repository.CountMoveDetailRepository; +import com.youchain.businessdata.service.CountMoveDetailService; +import com.youchain.businessdata.service.CountMoveService; +import com.youchain.businessdata.service.dto.CountMoveDetailQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.BizStatus; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "count_move_detail管理") +@RequestMapping("/api/countMoveDetail") +public class CountMoveDetailController { + + private final CountMoveDetailService countMoveDetailService; + private final CountMoveDetailRepository countMoveDetailRepository; + private final CountMoveService countMoveService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + public void exportCountMoveDetail(HttpServletResponse response, CountMoveDetailQueryCriteria criteria) throws Exception { + countMoveDetailService.download(countMoveDetailService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_move_detail") + @ApiOperation("查询count_move_detail") + public ResponseEntity queryCountMoveDetail(CountMoveDetailQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(countMoveDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping("/getCountMoveDetailIdData") + @Log("根据id查询count_move_detail") + @ApiOperation("根据id查询count_move_detail") + @AnonymousAccess + public ResponseEntity getCountMoveDetailIdData(@RequestBody Long ids) { + return new ResponseEntity<>(countMoveDetailRepository.queryDetails(ids), HttpStatus.OK); + } + + @PostMapping + @Log("新增count_move_detail") + @ApiOperation("新增count_move_detail") + public ResponseEntity createCountMoveDetail(@Validated @RequestBody CountMoveDetail resources){ + return new ResponseEntity<>(countMoveDetailService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_move_detail") + @ApiOperation("修改count_move_detail") + public ResponseEntity updateCountMoveDetail(@Validated @RequestBody CountMoveDetail resources){ + countMoveDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_move_detail") + @ApiOperation("删除count_move_detail") + @Transactional + @DuplicateSubmission + public ResponseEntity deleteCountMoveDetail(@RequestBody Long[] ids) { +// countMoveDetailService.deleteCountMoveDetail(ids); + for (Long id : ids) { + CountMoveDetail d=countMoveDetailRepository.getById(id); + CountMove m=d.getCountMove(); + if(!m.getStatus().equals(BizStatus.COUNT)&&!m.getStatus().equals(BizStatus.OPEN)){ + throw new BadRequestException(m.getCode()+"状态不正确"); + } + m.setOrderQty(m.getOrderQty()-d.getOrderQty()); + countMoveService.update(m); + countMoveDetailRepository.deleteById(id); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailRecordController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailRecordController.java new file mode 100644 index 0000000..936683b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountMoveDetailRecordController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.CountMoveDetailRecord; +import com.youchain.businessdata.service.CountMoveDetailRecordService; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "count_move_detail_record管理") +@RequestMapping("/api/countMoveDetailRecord") +public class CountMoveDetailRecordController { + + private final CountMoveDetailRecordService countMoveDetailRecordService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('countMoveDetailRecord:list')") + public void exportCountMoveDetailRecord(HttpServletResponse response, CountMoveDetailRecordQueryCriteria criteria) throws Exception { + countMoveDetailRecordService.download(countMoveDetailRecordService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_move_detail_record") + @ApiOperation("查询count_move_detail_record") + @PreAuthorize("@el.check('countMoveDetailRecord:list')") + public ResponseEntity queryCountMoveDetailRecord(CountMoveDetailRecordQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(countMoveDetailRecordService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增count_move_detail_record") + @ApiOperation("新增count_move_detail_record") + @PreAuthorize("@el.check('countMoveDetailRecord:add')") + public ResponseEntity createCountMoveDetailRecord(@Validated @RequestBody CountMoveDetailRecord resources){ + return new ResponseEntity<>(countMoveDetailRecordService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_move_detail_record") + @ApiOperation("修改count_move_detail_record") + @PreAuthorize("@el.check('countMoveDetailRecord:edit')") + public ResponseEntity updateCountMoveDetailRecord(@Validated @RequestBody CountMoveDetailRecord resources){ + countMoveDetailRecordService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_move_detail_record") + @ApiOperation("删除count_move_detail_record") + @PreAuthorize("@el.check('countMoveDetailRecord:del')") + public ResponseEntity deleteCountMoveDetailRecord(@RequestBody Long[] ids) { + countMoveDetailRecordService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountPlanController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountPlanController.java new file mode 100644 index 0000000..30db445 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountPlanController.java @@ -0,0 +1,96 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.CountPlan; +import com.youchain.businessdata.service.CountPlanService; +import com.youchain.businessdata.service.dto.CountPlanQueryCriteria; +import com.youchain.utils.BizStatus; +import com.youchain.utils.CodeUtils; +import com.youchain.utils.SecurityUtils; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-19 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "count_plan管理") +@RequestMapping("/api/countPlan") +public class CountPlanController { + + private final CountPlanService countPlanService; + + private final CodeUtils codeUtils; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportCountPlan(HttpServletResponse response, CountPlanQueryCriteria criteria) throws Exception { + countPlanService.download(countPlanService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_plan") + @ApiOperation("查询count_plan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryCountPlan(CountPlanQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(countPlanService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增count_plan") + @ApiOperation("新增count_plan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createCountPlan(@Validated @RequestBody CountPlan resources){ + resources.setCode(codeUtils.getCode_yyMMdd("CP",3)); + resources.setDept(UserUtils.getDept()); + resources.setStatus(BizStatus.OPEN); + return new ResponseEntity<>(countPlanService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_plan") + @ApiOperation("修改count_plan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateCountPlan(@Validated @RequestBody CountPlan resources){ + countPlanService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_plan") + @ApiOperation("删除count_plan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteCountPlan(@RequestBody Long[] ids) { + countPlanService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/CountRecordController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountRecordController.java new file mode 100644 index 0000000..111e212 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/CountRecordController.java @@ -0,0 +1,110 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.CountRecord; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.CountRecordService; +import com.youchain.businessdata.service.dto.CountDetailQueryCriteria; +import com.youchain.businessdata.service.dto.CountRecordQueryCriteria; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.BizStatus; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@RestController +@RequiredArgsConstructor +@Slf4j +@Api(tags = "count_record管理") +@RequestMapping("/api/countRecord") +public class CountRecordController { + + private final CountRecordService countRecordService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportCountRecord(HttpServletResponse response, CountRecordQueryCriteria criteria) throws Exception { + countRecordService.download(countRecordService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询count_record") + @ApiOperation("查询count_record") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryCountRecord(CountRecordQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(countRecordService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping(value = "/queryPlanCountRecord") + @Log("查询count_detail") + @ApiOperation("查询count_detail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryPlanCountRecord(CountRecordQueryCriteria criteria){ + log.info(criteria.getPlanId()+"------盘点ID"); + return new ResponseEntity<>(countRecordService.queryAll(criteria),HttpStatus.OK); + } + + @PostMapping + @Log("新增count_record") + @ApiOperation("新增count_record") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createCountRecord(@Validated @RequestBody CountRecord resources){ + return new ResponseEntity<>(countRecordService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改count_record") + @ApiOperation("修改count_record") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateCountRecord(@Validated @RequestBody CountRecord resources){ + countRecordService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除count_record") + @ApiOperation("删除count_record") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteCountRecord(@RequestBody Long[] ids) { + countRecordService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryBakController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryBakController.java new file mode 100644 index 0000000..6870970 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryBakController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.InventoryBak; +import com.youchain.businessdata.service.InventoryBakService; +import com.youchain.businessdata.service.dto.InventoryBakQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-03 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "inventoryBak管理") +@RequestMapping("/api/inventoryBak") +public class InventoryBakController { + + private final InventoryBakService inventoryBakService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('super:man')") + public void exportInventoryBak(HttpServletResponse response, InventoryBakQueryCriteria criteria) throws Exception { + inventoryBakService.download(inventoryBakService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询inventoryBak") + @ApiOperation("查询inventoryBak") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryInventoryBak(InventoryBakQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(inventoryBakService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增inventoryBak") + @ApiOperation("新增inventoryBak") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createInventoryBak(@Validated @RequestBody InventoryBak resources){ + return new ResponseEntity<>(inventoryBakService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改inventoryBak") + @ApiOperation("修改inventoryBak") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateInventoryBak(@Validated @RequestBody InventoryBak resources){ + inventoryBakService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除inventoryBak") + @ApiOperation("删除inventoryBak") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteInventoryBak(@RequestBody Long[] ids) { + inventoryBakService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java new file mode 100644 index 0000000..7fabe38 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryController.java @@ -0,0 +1,199 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.appupdate.inputJson.ScanItemCode; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.inputJson.buttenJson.InventoryButton; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.TaskRepository; +import com.youchain.businessdata.returnJson.RInvQuery; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.ItemKeyService; +import com.youchain.businessdata.service.dto.InvQueryCriteria; +import com.youchain.businessdata.service.dto.InventoryDto; +import com.youchain.businessdata.service.dto.InventoryQueryCriteria; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiResult; +import com.youchain.utils.BizStatus; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** + * @author huojin + * @website https://eladmin.vip + * @date 2023-08-22 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "inventory管理") +@RequestMapping("/api/inventory") +@Slf4j +public class InventoryController { + + private final InventoryService inventoryService; + private final InventoryRepository inventoryRepository; + private final InventoryLogService invLogService; + private final TaskRepository taskRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportInventory(HttpServletResponse response, InventoryQueryCriteria criteria) throws Exception { + inventoryService.download(inventoryService.queryAll(criteria), response); + } + + @Log("导出线边数据") + @ApiOperation("导出线边数据") + @GetMapping(value = "/downloadXb") + @AnonymousAccess + public void downloadXb(HttpServletResponse response, InventoryQueryCriteria criteria) throws Exception { + inventoryService.downloadXb(inventoryService.queryAll(criteria), response); + } + @Log("导出协同数据") + @ApiOperation("导出协同数据") + @GetMapping(value = "/downloadXt") + @AnonymousAccess + public void downloadXt(HttpServletResponse response, InventoryQueryCriteria criteria) throws Exception { + inventoryService.downloadXt(inventoryService.queryAll(criteria), response); + } + @Log("导出制造数据") + @ApiOperation("导出制造数据") + @GetMapping(value = "/downloadZz") + @AnonymousAccess + public void downloadZz(HttpServletResponse response, InventoryQueryCriteria criteria) throws Exception { + inventoryService.downloadZz(inventoryService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询inventory") + @ApiOperation("查询inventory") + @AnonymousAccess + public ResponseEntity queryInventory(InventoryQueryCriteria criteria, Pageable pageable) { + if (criteria.getItemCodeOne() != null && criteria.getItemCode() != null) { + criteria.setItemCodeOne(null); + } + return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增inventory") + @ApiOperation("新增inventory") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createInventory(@Validated @RequestBody Inventory resources) { + return new ResponseEntity<>(inventoryService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改inventory") + @ApiOperation("修改inventory") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateInventory(@Validated @RequestBody Inventory resources) { + //库存修改 + Inventory byId = inventoryRepository.getById(resources.getId()); + if (byId.getQuantity()>resources.getQuantity()){//以前的大于现在的 + invLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.REDUCE, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (byId.getQuantity() - resources.getQuantity()), + null,null,BizStatus.INVENTORY_ADJUST, byId.getId(), byId.getId(), resources.getDescription()); + }else { + invLogService.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.ADD, null, byId.getArea(), byId.getItemKey(), byId.getPoint(), byId.getPoint(), byId.getStock(), byId.getStock(), byId.getQuantity(), (resources.getQuantity()-byId.getQuantity()), + null,null,BizStatus.INVENTORY_ADJUST, byId.getId(), byId.getId(), resources.getDescription()); + } + inventoryService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @PostMapping("/updateInvQueuedQty") + @Log("调整占用数") + @ApiOperation("调整占用数") + @PreAuthorize("@el.check('super:man')") + @Transactional + @AnonymousAccess + public ResponseEntity updateInvQueuedQty(@Validated @RequestBody HashMap map) { + //库存修改 + Long id=Long.parseLong(map.get("id").toString()); + Double update_zys=Double.parseDouble(map.get("zys").toString()); + String description=map.get("description").toString(); + Inventory inv = inventoryRepository.getById(id); + double task_zys=taskRepository.getItemKeyQty(inv.getItemKey().getId()); + if(update_zys(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除inventory") + @ApiOperation("删除inventory") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteInventory(@RequestBody Long[] ids) { + inventoryService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping(value = "/queryInv") + @Log("查询inventory") + @ApiOperation("查询inventory") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryInv(InvQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(inventoryService.queryAll(criteria), HttpStatus.OK); + } + + + @PostMapping("/knywInventory") + @Log("库内移位") + @ApiOperation("库内移位") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity knywInventory(@RequestBody InventoryButton resources) { + inventoryService.kuneMovePosition(resources); + return new ResponseEntity<>("库内移位成功", HttpStatus.CREATED); + } + + @PostMapping("/queryInvApp") + @Log("APP查询库存") + @ApiOperation("APP查询库存") + @AnonymousAccess + public ApiResult queryInvApp(@RequestBody ScanItemCode scan) { + String code=scan.getItemCode(); + if(code!=null&&code.length()>=85){ + code=code.substring(3, 13); + } + List qs=inventoryService.queryInvApp(code,scan.getPointCode()); + return ApiResult.result(200, "", qs); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryLogController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryLogController.java new file mode 100644 index 0000000..e3e6302 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/InventoryLogController.java @@ -0,0 +1,98 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.dto.InventoryLogQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @date 2023-08-31 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "inventoryLog管理") +@RequestMapping("/api/inventoryLog") +public class InventoryLogController { + + private final InventoryLogService inventoryLogService; + + /*@Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportInventoryLog(HttpServletResponse response, InventoryLogQueryCriteria criteria) throws Exception { + inventoryLogService.download(inventoryLogService.queryAll(criteria), response); + }*/ + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping("/download") + @AnonymousAccess + public void exportInventoryLogs(HttpServletResponse response, InventoryLogQueryCriteria criteria) throws IOException{ + inventoryLogService.exportInventoryLogs(criteria, response); + } + + @GetMapping + @Log("查询inventoryLog") + @ApiOperation("查询inventoryLog") + @AnonymousAccess + public ResponseEntity queryInventoryLog(InventoryLogQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(inventoryLogService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增inventoryLog") + @ApiOperation("新增inventoryLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createInventoryLog(@Validated @RequestBody InventoryLog resources) { + return new ResponseEntity<>(inventoryLogService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改inventoryLog") + @ApiOperation("修改inventoryLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateInventoryLog(@Validated @RequestBody InventoryLog resources) { + inventoryLogService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除inventoryLog") + @ApiOperation("删除inventoryLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteInventoryLog(@RequestBody Long[] ids) { + inventoryLogService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/ItemKeyController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/ItemKeyController.java new file mode 100644 index 0000000..ac800e3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/ItemKeyController.java @@ -0,0 +1,114 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.alibaba.fastjson.JSON; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.dto.ItemQueryCriteria; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.ItemKeyService; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import com.youchain.businessdata.service.dto.ItemKeyQueryCriteria; +import com.youchain.businessdata.service.mapstruct.ItemKeyMapper; +import com.youchain.exception.handler.ApiError; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.beans.Transient; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-21 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "item_key管理") +@RequestMapping("/api/itemKey") +public class ItemKeyController { + + private final ItemKeyService itemKeyService; + + private final ItemKeyMapper itemKeyMapper; + private final ItemRepository itemRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportItemKey(HttpServletResponse response, ItemKeyQueryCriteria criteria) throws Exception { + itemKeyService.download(itemKeyService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询item_key") + @ApiOperation("查询item_key") + @AnonymousAccess + public ResponseEntity queryItemKey(ItemKeyQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(itemKeyService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @GetMapping("/getItemAll") + @Log("查询item_key中有的item") + @ApiOperation("查询item_key中有的item") + @AnonymousAccess + public ResponseEntity getItemAll(){ + return new ResponseEntity<>(itemRepository.quryOneItemAll(),HttpStatus.OK); + } + + @PostMapping + @Log("新增item_key") + @ApiOperation("新增item_key") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createItemKey(@Validated @RequestBody ItemKey resources){ + return new ResponseEntity<>(itemKeyService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改item_key") + @ApiOperation("修改item_key") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateItemKey(@Validated @RequestBody ItemKey resources){ + itemKeyService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除item_key") + @ApiOperation("删除item_key") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteItemKey(@RequestBody Long[] ids) { + itemKeyService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java new file mode 100644 index 0000000..b828cae --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickDetailController.java @@ -0,0 +1,431 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.*; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BomAccountPointDto; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.inputJson.IPPickDetail; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.*; +import com.youchain.businessdata.service.dto.jsonDto.CxjlDto; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiResult; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.BizStatus; +import com.youchain.utils.DateUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author huojin + * @website https://eladmin.vip + * @date 2023-08-16 + **/ +@RestController +@Slf4j +@RequiredArgsConstructor +@Api(tags = "pickDetail管理") +@RequestMapping("/api/pickDetail") +public class PickDetailController { + + private final PickDetailService pickDetailService; + private final TaskService taskService; + private final PickDetailRepository pickDetailRepository; + private final PickTicketService pickTicketService; + private final InventoryService inventoryService; + private final BillTypeRepository billTypeRepository; + private final AreaRepository areaRepository; + private final ItemRepository itemRepository; + private final PointRepository pointRepository; + private final AutomaticPlanningRepository automaticPlanningRepository; + private final BomAccountRepository bomAccountRepository; + private final PickTicketRepository pickTicketRepository; + private final AreaService areaService; + + @PostMapping("/getIdData") + @Log("根据主表id查询pickDetail的数据") + @ApiOperation("根据主表id查询pickDetail的数据") + @AnonymousAccess + public ResponseEntity getIdData(@RequestBody Long ids) { + return new ResponseEntity<>(pickDetailRepository.queryByPickTicketId(ids), HttpStatus.OK); + } + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/queryPickDetailZsc/download") + @AnonymousAccess + public void exportPickDetail(HttpServletResponse response, PickDetailQueryCriteria criteria) throws Exception { + pickDetailService.download(pickDetailService.queryZscAll(criteria), response); + } + + @GetMapping + @Log("查询pickDetail") + @ApiOperation("查询pickDetail") + @AnonymousAccess + public ResponseEntity queryPickDetail(PickDetailQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(pickDetailService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @GetMapping(value = "/queryPickDetailZsc") + @Log("查询指示残") + @ApiOperation("查询指示残") + @AnonymousAccess + public ResponseEntity queryPickDetailZsc(PickDetailQueryCriteria criteria, Pageable pageable) { + criteria.setPageType("ZSC"); + return new ResponseEntity<>(pickDetailService.queryPickDetailAll(criteria, pageable), HttpStatus.OK); + } + + @GetMapping(value = "/queryPickDetailAll") + @Log("查询pickDetail所有") + @ApiOperation("查询pickDetail所有") + @AnonymousAccess + public ResponseEntity queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable) { + criteria.setPageType("ALL"); + return new ResponseEntity<>(pickDetailService.queryPickDetailAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping + @Log("新增pickDetail") + @ApiOperation("新增pickDetail") + @AnonymousAccess + @Transactional + public ResponseEntity createPickDetail(@Validated @RequestBody PickDetail resources) throws Exception { + //判断库存数量有没有这么多 + InventoryQueryCriteria inventoryQueryCriteria = new InventoryQueryCriteria(); + double quantityNum = 0; + if (resources.getPoint() != null) { + double qty=inventoryService.getInvQty(resources.getItem().getId(),resources.getPickTicket().getArea().getId(), + resources.getPoint().getId()); + if(qty inventoryDtos = inventoryService.queryAll(inventoryQueryCriteria); +// for (InventoryDto inv : inventoryDtos) { +// quantityNum += (inv.getQuantity()-inv.getQueuedQty()); +// } + } + //新增加订单数量 + PickTicket pickTicket = resources.getPickTicket(); + pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() + resources.getOrderQty()); + pickTicketService.update(pickTicket); + resources.setStatus(BizStatus.OPEN); + PickDetailDto pickDetailDto = pickDetailService.create(resources); + return new ResponseEntity<>("操作成功", HttpStatus.CREATED); + } + + @PutMapping + @Log("修改pickDetail") + @ApiOperation("修改pickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePickDetail(@Validated @RequestBody PickDetail resources) { + if(resources.getAllocatedQty()>0){ + throw new BadRequestException("已出单,不能修改"); + } + pickDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除pickDetail") + @ApiOperation("删除pickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePickDetail(@RequestBody Long[] ids) { + //删除时需判断是否有分配 + for(Long id:ids){ + PickDetail pickDetail=pickDetailRepository.getById(id); + if(pickDetail.getAllocatedQty()+pickDetail.getBcQty()>0){ + return new ResponseEntity<>(pickDetail.getItem().getCode()+"已出单,不允许删除",BAD_REQUEST); + }else{ +// pickDetailRepository.deleteById(id); + } + } + pickDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/cxjl") + @Log("产线叫料") + @ApiOperation("产线叫料") + @PreAuthorize("@el.check('super:man')") + @AnonymousAccess + @DuplicateSubmission(5) + public ResponseEntity cxjl(@RequestBody CxjlDto cxjldto) throws Exception { + pickDetailService.cxjlCreate(cxjldto); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/allocatePickDetail") + @Log("拣货分配审核") + @ApiOperation("拣货分配审核") + @AnonymousAccess + public synchronized ResponseEntity allocatePickDetail(@RequestBody Long[] ids) throws Exception { + List picktickIds = Arrays.asList(ids); + Collections.sort(picktickIds);//升序排序 + if (picktickIds.size() > 0) { + try { + for (Long picktickId : picktickIds) { + List pickDetailList = pickDetailService.queryPickDetailList(picktickId); + for (PickDetail pd : pickDetailList) { + pickDetailService.allocate(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty()); + } + } + } catch (Exception e) { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST); + } + } else { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/sbPickdetail") + @Log("设变") + @ApiOperation("设变") + @AnonymousAccess + public ResponseEntity sbPickdetail(@RequestBody HashMap map) { + Long pdId=Long.parseLong(map.get("pdId").toString()); + Double sbQty=Double.parseDouble(map.get("sbQty").toString()); + if(map.get("sbItemCode")==null){ + throw new BadRequestException("无关联设变"); + } + String sbItemCode=map.get("sbItemCode").toString(); + Item sbIt=itemRepository.findByCode(sbItemCode); + PickDetail oldD=pickDetailRepository.getById(pdId); + double unSb=oldD.getOrderQty()-oldD.getAllocatedQty()-oldD.getBcQty(); + if(sbIt==null){ + throw new BadRequestException(sbItemCode+"物料不存在"); + } + if(unSb0){ + throw new BadRequestException(pt.getCode()+"已备货,不能设变"); + } + Area shArea=pt.getShArea(); + List bomList=bomAccountRepository.getItemBomList(sbIt.getId()); + if(bomList.size()<=0){ + throw new BadRequestException(sbIt.getCode()+"找不到对应的Bom工位清单"+sbQty); + } + BomAccount bomAccount=bomList.get(0); + PickDetail newD= pickDetailService.createPickDetail(pt,sbIt,oldD.getPo(),sbQty,oldD.getSupplier()); + newD.setRemark("设变"); + newD.setSourceId(oldD.getId()); + newD.setBomId(bomAccount.getId()); + newD.setAc(bomAccount.getAc()); + newD.setSupplier(bomAccount.getSupplier()); + newD.setPoint(bomAccount.getZPoint()); + pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty()); + oldD.setOrderQty(oldD.getOrderQty()-sbQty); + oldD.setSourceId(newD.getId()); + pickDetailService.update(oldD); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/cancelAllocate") + @Log("取消分配") + @ApiOperation("取消分配") + @AnonymousAccess + public synchronized ResponseEntity cancelAllocate(@RequestBody Long[] ids) { + List pickDetailIds = Arrays.asList(ids); + if (pickDetailIds.size() > 0) { + for (Long id : pickDetailIds) { + pickDetailService.cancelAllocate(id); + } + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/queryTaskApp") + @Log("查询拣货列表") + @ApiOperation("查询拣货列表") + @PreAuthorize("@el.check('super:man')") + @AnonymousAccess + public ResponseEntity queryTaskApp(@RequestBody IScanPut s) { + List t = taskService.queryTaskApp(null); + return new ResponseEntity<>(t, HttpStatus.OK); + } + + @PostMapping("/pickingApp") + @Log("APP拣货确认") + @ApiOperation("APP拣货确认") + @PreAuthorize("@el.check('super:man')") + @AnonymousAccess + public ResponseEntity pickingApp(@RequestBody IPPickDetail d) throws Exception { + return pick_in(d.getPickDetailId()); + } + + @PostMapping("/picking") + @Log("拣货") + @ApiOperation("拣货确认") + @AnonymousAccess + public synchronized ResponseEntity picking(@RequestBody Long pickDetailId) throws Exception { + return pick_in(pickDetailId); + } + + public ResponseEntity pick_in(Long pickDetailId) { + //查询未完成的拣货任务 + List Tasks = taskService.getPickNotAllTask(pickDetailId); + if (Tasks.size() > 0) { + try { + for (Task task : Tasks) { + log.error("正在拣货-----"); + taskService.pickConfirm(task.getId(), task.getPlanQty()); + } + } catch (Exception e) { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST); + } + } else { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "已拣货完成,请勿重复操作!", ""), HttpStatus.BAD_REQUEST); + } + log.error("完成拣货-----"); + return new ResponseEntity(ApiResult.fail(HttpStatus.OK.value(), "已拣货完成,请勿重复操作!", ""), HttpStatus.OK); + + } + + + @PostMapping("/pickBarBack") + @Log("退拣") + @ApiOperation("退拣") + @AnonymousAccess + public synchronized ResponseEntity pickBarBack(@RequestBody Long pickDetailId) throws Exception { + //查询已完成的拣货任务 + List Tasks = taskService.getPickAllTask(pickDetailId); + if (Tasks.size() > 0) { + try { + for (Task task : Tasks) { + taskService.pickBarBack(task.getId(), task.getMoveQty()); + } + } catch (Exception e) { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST); + } + } else { + return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "已退拣完成,请勿重复操作!", ""), HttpStatus.BAD_REQUEST); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/autoBcbl") + @Log("指示残-波次补料") + @ApiOperation("指示残-波次补料") + @PreAuthorize("@el.check('super:man')") + @AnonymousAccess + public ResponseEntity autoBcbl(@RequestBody HashMap map) { + BillType bt=billTypeRepository.findByName(BaseStatus.BT_BCBL); + if(bt==null){ + return new ResponseEntity<>("维护波次补料类型", BAD_REQUEST); + } + if(map.get("bh_date")==null){ + return new ResponseEntity<>("输入日期", BAD_REQUEST); + } + Date blDate=DateUtil.ymd_date(map.get("bh_date").toString()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + Date date2=DateUtil.ymd_date((LocalDate.now()).format(formatter)); + int comparison=DateUtil.dateComparison(blDate,date2); + if(comparison<0){ + return new ResponseEntity<>("补货日期不能小于当前日期", BAD_REQUEST); + } +// List plans=automaticPlanningRepository.getAll(); +// if(plans.size()>0){ +// AutomaticPlanning plan=plans.get(0); +// Date blDate=plan.getJhDate(); +// Date blDate=new Date(); +// for(AutomaticPlanning plan:plans){ + //得到出库单的出库库区 + List outAreaGcs=pickTicketRepository.queryBhCkAreas(DateUtil.dateYmd(blDate)); + for(Object[] outAreaGc:outAreaGcs) { + Long outAreaId=Long.parseLong(outAreaGc[0].toString()); + String gc=outAreaGc[1].toString(); + Area outArea = areaRepository.getById(outAreaId); + log.info(outArea.getName()+"=="+gc); + List objs = pickDetailService.getQueryBcbl(blDate,outAreaId,gc); + if (objs.size() > 0) { + PickTicket pickTicket = pickTicketService.storePick(bt, null, outArea, "大", "波次补料"); + for (Object[] obj : objs) { + PickDetail oldDetail = pickDetailRepository.getById(Long.parseLong(obj[0].toString())); + double orderQty = oldDetail.getOrderQty() - oldDetail.getAllocatedQty() - oldDetail.getBcQty(); + PickDetail pickDetail = pickDetailService.createPickDetail(pickTicket, oldDetail.getItem(), null, orderQty, oldDetail.getSupplier()); + pickDetail.setPoint(oldDetail.getPoint()); + pickDetail.setPropC3(oldDetail.getPropC3()); + pickDetail.setAc(oldDetail.getAc()); + pickDetail.setContents(oldDetail.getContents()); + pickDetail.setBomId(oldDetail.getBomId()); + pickDetail.setSourceId(oldDetail.getId()); + pickDetail.setSourceName(oldDetail.getPickTicket().getCode()); + pickDetail.setArea(oldDetail.getArea()); + pickDetail.setShArea(oldDetail.getShArea()); + pickDetailService.update(pickDetail); + pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty()); + double bcQty = pickDetail.getAllocatedQty(); + //将出单数写入到订单数 + pickDetail.setOrderQty(bcQty); + pickDetailService.update(pickDetail); + //本次出单数量 + pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() + bcQty); + pickTicket.setGcCode(oldDetail.getPickTicket().getGcCode()); + pickTicketService.update(pickTicket); + //回写,刷新补货数量 + oldDetail.setBcQty(pickDetailRepository.getBcQty(oldDetail.getId())); + pickDetailService.update(oldDetail); + } + } + } +// } + return new ResponseEntity<>("补料成功",HttpStatus.OK); + } + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickInstructionController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickInstructionController.java new file mode 100644 index 0000000..3b2d5b6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickInstructionController.java @@ -0,0 +1,117 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.businessdata.domain.PickInstruction; +import com.youchain.businessdata.service.PickInstructionService; +import com.youchain.businessdata.service.dto.PickInstructionQueryCriteria; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.CodeUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "pickInstruction管理") +@RequestMapping("/api/pickInstruction") +public class PickInstructionController { + + private final PickInstructionService pickInstructionService; + private final CodeUtils codeUtil; + private final BillTypeRepository billTypeRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPickInstruction(HttpServletResponse response, PickInstructionQueryCriteria criteria) throws Exception { + pickInstructionService.download(pickInstructionService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询pickInstruction") + @ApiOperation("查询pickInstruction") + @AnonymousAccess + public ResponseEntity queryPickInstruction(PickInstructionQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(pickInstructionService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增pickInstruction") + @ApiOperation("新增pickInstruction") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPickInstruction(@Validated @RequestBody PickInstruction resources){ + if (resources.getAllocationNumber() == null || resources.getAllocationNumber().isEmpty()){ + resources.setAllocationNumber(codeUtil.getCode_yyMMdd("ZS",3)); + } + BillType billType = billTypeRepository.findByName(BaseStatus.BT_SGDD); + resources.setOutKType(billType); + resources.setAllocationDate(new Timestamp(new Date().getTime())); + return new ResponseEntity<>(pickInstructionService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改pickInstruction") + @ApiOperation("修改pickInstruction") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePickInstruction(@Validated @RequestBody PickInstruction resources){ + pickInstructionService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除pickInstruction") + @ApiOperation("删除pickInstruction") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePickInstruction(@RequestBody Long[] ids) { + pickInstructionService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + @PostMapping("/generatePrepFlag") + @Log("手工指示-生成备货操作") + @ApiOperation("手工指示-生成备货操作") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission + public ResponseEntity generatePrepFlag(@RequestBody Long[] ids) throws Exception { + pickInstructionService.generatePrepFlag(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickKitPlanController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickKitPlanController.java new file mode 100644 index 0000000..69daf07 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickKitPlanController.java @@ -0,0 +1,146 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.ItemLis; +import com.youchain.basicdata.repository.ItemLisRepository; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.businessdata.domain.PickKitPlan; +import com.youchain.businessdata.service.PickKitPlanService; +import com.youchain.businessdata.service.dto.PickKitPlanQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.BizStatus; +import com.youchain.utils.CodeUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** + * @author DengJiangKun + * @website https://eladmin.vip + * @date 2024-02-28 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "pickKitPlan管理") +@RequestMapping("/api/pickKitPlan") +public class PickKitPlanController { + + private final PickKitPlanService pickKitPlanService; + private final CodeUtils codeUtil; + private final ItemLisRepository itemLisRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPickKitPlan(HttpServletResponse response, PickKitPlanQueryCriteria criteria) throws Exception { + pickKitPlanService.download(pickKitPlanService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询pickKitPlan") + @ApiOperation("查询pickKitPlan") + @AnonymousAccess + public ResponseEntity queryPickKitPlan(PickKitPlanQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(pickKitPlanService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @GetMapping("/queryPickKitPlanList") + @Log("查询pickKitPlan") + @ApiOperation("查询pickKitPlan") + @AnonymousAccess + public ResponseEntity queryPickKitPlanList(PickKitPlanQueryCriteria criteria) { + return new ResponseEntity<>(pickKitPlanService.queryAll(criteria), HttpStatus.OK); + } + + @PostMapping + @Log("新增pickKitPlan") + @ApiOperation("新增pickKitPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPickKitPlan(@Validated @RequestBody PickKitPlan resources) { + if (resources.getPlanNumber() == null || resources.getPlanNumber().isEmpty()) { + resources.setPlanNumber(codeUtil.getCode_yyMMdd("CT", 3)); + } + resources.setPlanDate(new Timestamp(new Date().getTime())); + String code=codeUtil.getCode_yyMMdd("CT", 3); + Timestamp date=new Timestamp(new Date().getTime()); + List itemLiss= itemLisRepository.findByBigItemCode(resources.getBigItem().getCode()); + if(itemLiss.size()<=0){ + throw new BadRequestException(resources.getBigItem().getCode()+"未找到对应的工位清单"); + } + for(ItemLis itemLis :itemLiss){ + PickKitPlan pickKitPlan=new PickKitPlan(); + pickKitPlan.setPlanNumber(code); + pickKitPlan.setPlanDate(date); + pickKitPlan.setStatus(BizStatus.WCD); + pickKitPlan.setOrderQty(resources.getOrderQty()); + pickKitPlan.setBigItem(resources.getBigItem()); + pickKitPlan.setWorkArea(itemLis.getRArea()); + pickKitPlanService.create(pickKitPlan); + } + + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改pickKitPlan") + @ApiOperation("修改pickKitPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePickKitPlan(@Validated @RequestBody PickKitPlan resources) { + pickKitPlanService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除pickKitPlan") + @ApiOperation("删除pickKitPlan") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePickKitPlan(@RequestBody Long[] ids) { + pickKitPlanService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/audit") + @Log("成套计划审核") + @ApiOperation("成套计划审核") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity audit(@RequestBody Long[] ids) { + pickKitPlanService.audit(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + @PostMapping("/qxAudit") + @Log("成套计划取消审核") + @ApiOperation("成套计划取消审核") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity qxAudit(@RequestBody Long id) { + pickKitPlanService.qxAudit(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickOutController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickOutController.java new file mode 100644 index 0000000..a4bf3a2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickOutController.java @@ -0,0 +1,646 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.PointService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.IPPickOut; +import com.youchain.businessdata.inputJson.buttenJson.PickOutButton; +import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton; +import com.youchain.businessdata.repository.*; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.PickOutDto; +import com.youchain.businessdata.service.dto.PickOutQueryCriteria; +import com.youchain.businessdata.service.dto.PickTicketDto; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.checkerframework.checker.units.qual.Temperature; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.*; +import java.util.logging.Logger; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-02-21 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "pickOut管理") +@RequestMapping("/api/pickOut") +@Slf4j +public class PickOutController { + + private final PickOutService pickOutService; + private final CodeUtils codeUtils; + private final TaskLogService taskLogService; + private final InventoryService inventoryService; + private final InventoryLogService inventoryLogService; + private final TaskService taskService; + private final PickDetailService pickDetailService; + private final PickTicketService pickTicketService; + private final XppRecordRepository xppRecordRepository; + private final XppRecordService xppRecordService; + private final TaskLogRepository taskLogRepository; + private final PointService pointService; + private final ItemKeyService itemKeyService; + private final PickDetailRepository pickDetailRepository; + private final PickTicketRepository pickTicketRepository; + private final PickOutRepository pickOutRepository; + private final DictDetailService dictDetailService; + private final JobRepository jobRepository; + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPickOut(HttpServletResponse response, PickOutQueryCriteria criteria) throws Exception { + pickOutService.download(pickOutService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询pickOut") + @ApiOperation("查询pickOut") + @AnonymousAccess + public ResponseEntity queryPickOut(PickOutQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(pickOutService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping("/queryOutListApp") + @Log("出库列表查询") + @ApiOperation("出库列表查询") + @AnonymousAccess + public ResponseEntity queryOutListApp(@RequestBody IScanPut t){ + List ts= pickOutService.queryOutList(t); + return new ResponseEntity<>(ts,HttpStatus.OK); + } + + @PostMapping("/queryOutTaskListApp") + @Log("备货列表明细查询") + @ApiOperation("备货列表明细查询") + @AnonymousAccess + public ResponseEntity queryTaskListApp(@RequestBody IPTask t){ + List ts= taskLogService.queryTaskLogApp(t); + return new ResponseEntity<>(ts,HttpStatus.OK); + } + + @PostMapping + @Log("新增pickOut") + @ApiOperation("新增pickOut") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPickOut(@Validated @RequestBody PickOut resources){ + resources.setOrderNo(codeUtils.getCode_yyMMdd("CK",3)); + return new ResponseEntity<>(pickOutService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改pickOut") + @ApiOperation("修改pickOut") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePickOut(@Validated @RequestBody PickOut resources){ + pickOutService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除pickOut") + @ApiOperation("删除pickOut") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePickOut(@RequestBody Long[] ids) { + pickOutService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/getPickOutById") + @Log("根据id获取数据") + @ApiOperation("根据id获取数据") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity getPickOutById(@RequestBody Long id) { + return new ResponseEntity<>(pickOutService.findById(id),HttpStatus.OK); + } + + + @PostMapping("/operationAll") + @Log("出库单维护操作") + @ApiOperation("出库单维护操作") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity operationAll(@RequestBody PickOutButton pickOutButton){ + int button = pickOutButton.getButton(); + if (button == 1){ + //新增 + if (pickOutButton.getPickOutId() != null){//向表中加数据 + pickOutService.addData(pickOutButton); + }else {//添加表单数据 + return new ResponseEntity<>( pickOutService.createPickOut(pickOutButton),HttpStatus.OK); + } + return new ResponseEntity<>("新增成功",HttpStatus.OK); + }else if (button == 2){ + //出库确认 + pickOutService.confirmPickOut(pickOutButton); + return new ResponseEntity<>("确认成功",HttpStatus.OK); + } + return new ResponseEntity<>("成功",HttpStatus.OK); + } + + @PostMapping("/pickOutApp") + @Log("APP出库") + @ApiOperation("APP出库") + @AnonymousAccess + @Transactional + public ResponseEntity pickOutApp(@RequestBody IPPickOut po){ + int seq = po.getSeq(); + if (seq == 1){ + //新增 + PickOut out=null; + String cph=po.getCph(); + if(cph==null||cph.equals("")){ + return new ResponseEntity<>("车牌号必填",HttpStatus.BAD_REQUEST); + } + List outs=pickOutService.findByOut(cph); + if(outs.size()>0){ + out=outs.get(0); + }else{ + out=new PickOut(); + out.setOrderNo(codeUtils.getCode_yyMMdd("CK", 3)); + out.setPlateNo(po.getCph()); + pickOutService.create(out); + } + HashMap map=new HashMap<>(); + map.put("outId",out.getId()); + map.put("code",out.getOrderNo()); + map.put("tps",0); + map.put("xs",0); + return new ResponseEntity<>(map,HttpStatus.OK); + }else if (seq == 2){//把托盘追加至车牌号中 + String tph=po.getTph(); + PickOut out=pickOutService.findByEntity(po.getOutId()); + if(tph==null||tph.equals("")){ + return new ResponseEntity<>("托盘号必填",HttpStatus.BAD_REQUEST); + } + if(out==null){ + return new ResponseEntity<>("请选定出库单",HttpStatus.BAD_REQUEST); + } + List logs=taskLogService.findByTph(tph,null); + if(logs.size()<=0){ + return new ResponseEntity<>(tph+"托盘号无数据",HttpStatus.BAD_REQUEST); + }else{ + for (TaskLog l:logs){ + l.setPickOut(out); + taskLogService.update(l); + out.setOrderQty(out.getOrderQty()+l.getMoveQty()); + } + pickOutService.update(out); + } + HashMap map=new HashMap<>(); + map.put("outId",out.getId()); + map.put("tps",0); + map.put("xs",0); + return new ResponseEntity<>(map,HttpStatus.OK); + }else if(seq==3){ + PickOut out=pickOutService.findByEntity(po.getOutId()); + if(out==null){ + return new ResponseEntity<>("请选定出库单",HttpStatus.BAD_REQUEST); + } + List logs=taskLogService.findByTph(null,out.getId()); + for(TaskLog l:logs){ + confirmPickOut(out,l,po.getFhr()); + } + } + return new ResponseEntity<>("成功",HttpStatus.OK); + } + + @PostMapping("/pickOutXppApp") + @Log("APP现品票出库") + @ApiOperation("APP现品票出库") + @AnonymousAccess + @Transactional + public ResponseEntity pickOutXppApp(@RequestBody IPPickOut po){ + int seq = po.getSeq(); + if (seq == 1){ + String code=po.getBhdh(); + if(code==null||code.equals("")){ + return new ResponseEntity<>("备货单号不能为空",HttpStatus.BAD_REQUEST); + } + List pts=pickTicketRepository.queryCode(code); + if(pts.size()<=0){ + return new ResponseEntity<>(code+"找不到备货单号",HttpStatus.BAD_REQUEST); + } + PickTicket pt=pts.get(0); + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String ckAreaCode= jobs.get(0).getAreaCode(); + if(!ckAreaCode.equals(pt.getArea().getCode())){ + return new ResponseEntity<>(code+"没有该库区权限",HttpStatus.BAD_REQUEST); + } + } + if(pt.getShippedQuantity()>=pt.getPickedQuantity()){ + return new ResponseEntity<>(code+"状态错误",HttpStatus.BAD_REQUEST); + } + //查询是否全部备货,如果没有则提示 + List list=pickDetailRepository.queryPickQty(pt.getId()); + if(list.size()>0){ + return new ResponseEntity<>(code+"未全部备货完成",HttpStatus.BAD_REQUEST); + } + HashMap map=new HashMap<>(); + map.put("ptId",pt.getId()); + return new ResponseEntity<>(map,HttpStatus.OK); + }else if (seq == 2){//现品票批量出库 + String xpp=po.getXpp(); + PickTicketDto pickTicket=pickTicketService.findById(po.getPtId()); + String code=pickTicket.getCode(); + if(xpp==null||xpp.equals("")){ + return new ResponseEntity<>("现品票必填",HttpStatus.BAD_REQUEST); + } + List logs=taskLogService.findByLog(xpp,code); + if(logs.size()<=0){ + return new ResponseEntity<>("现品票不属于该备货单或已出库",HttpStatus.BAD_REQUEST); + } + XppRecord xppRecord = xppRecordRepository.findByCode(xpp); + if(xppRecord==null){ + return new ResponseEntity<>("现品票不存在",HttpStatus.BAD_REQUEST); + } + TaskLog log=logs.get(0); + if(log.getShipQty()>0){ + return new ResponseEntity<>("现品票已出库",HttpStatus.BAD_REQUEST); + } + RRkXpp map = new RRkXpp(); + Item it=xppRecord.getItem(); + map.setItemCode(it.getCode()); + map.setItemName(it.getName()); + map.setAc(xppRecord.getAc()); + map.setDdbh(xppRecord.getDdbh()); + map.setNrs(xppRecord.getNrs()); + if(xppRecord.getNrDate()!=null) { + map.setNrzsr(DateUtil.dateYmd(xppRecord.getNrDate())); + }else{ + map.setNrzsr(""); + } + map.setFzh(xppRecord.getFzh()); + map.setCjsj(xppRecord.getCreateTime()); + map.setLogId(logs.get(0).getId()); + Task t=log.getTask(); + PickDetail pd =t.getPickDetail(); + if(pd.getShArea()!=null) { + map.setGw(pd.getShArea().getWorkingStation()); + } + return new ResponseEntity<>(map,HttpStatus.OK); + }else if(seq==3){ + String cph=po.getCph(); + if(cph==null||cph.equals("")){ + return new ResponseEntity<>("车牌号必填",HttpStatus.BAD_REQUEST); + } + cph=cph.replace("\n",""); + PickOut out=new PickOut(); + out.setOrderNo(codeUtils.getCode_yyMMdd("CK", 3)); + out.setPlateNo(cph); + out.setStatus(BizStatus.OPEN); + pickOutService.create(out); + Long[] ids=po.getLogIds(); + for(int i=0;i("已出库",HttpStatus.BAD_REQUEST); + } + log.setPickOut(out); + taskLogService.update(log); + confirmPickOut(out,log,po.getFhr()); + out.setOrderQty(out.getOrderQty()+log.getMoveQty()); + } + pickOutService.update(out); + } + return new ResponseEntity<>("成功",HttpStatus.OK); + } + + //出库确认 + @PostMapping("/pickOutConfirm") + @Log("系统备货出库确认") + @ApiOperation("系统备货出库确认") + @AnonymousAccess + @Transactional + public ResponseEntity pickOutConfirm(@RequestBody Long[] ptIds){ + for(Long id:ptIds){ +// PickOut out=new PickOut(); +// out.setOrderNo(codeUtils.getCode_yyMMdd("CK", 3)); +// out.setPlateNo("系统出库单"); +// out.setStatus(BizStatus.OPEN); +// pickOutService.create(out); + List logs=taskLogRepository.getTaskLogsByPtId(id); + for(TaskLog log:logs){ + if(log.getShipQty()>0){ + return new ResponseEntity<>("已出库",HttpStatus.BAD_REQUEST); + } +// log.setPickOut(out); + taskLogService.update(log); + confirmPickOut(null,log,SecurityUtils.getCurrentUsername()); +// confirmPickOut(out,log,SecurityUtils.getCurrentUsername()); +// out.setOrderQty(out.getOrderQty()+log.getMoveQty()); + } +// pickOutService.update(out); + } + return new ResponseEntity<>("成功",HttpStatus.OK); + } + public void confirmPickOut(PickOut out,TaskLog log,String fhr) { + Task task=log.getTask(); + PickDetail pd=task.getPickDetail(); + if(pd.getPickedQty().intValue()= out.getOrderQty().intValue()) { + out.setStatus(BizStatus.SHIP_ALL); + } else { + out.setStatus(BizStatus.SHIP_PART); + } + out.setBhNo(pt.getCode()); + out.setShArea(pt.getShArea()); + pickOutService.update(out); + } + } + + @PostMapping("/pickOutBack") + @Log("系统出库退回") + @ApiOperation("系统出库退回") + @AnonymousAccess + @Transactional + public ResponseEntity pickOutBack(@RequestBody Long[] ptIds){ + for(Long id:ptIds){ + List logs=taskLogRepository.getCancelByShip(id); + if(logs.size()<=0){ + return new ResponseEntity<>("没有出库数据",HttpStatus.BAD_REQUEST); + } + PickTicket pt=pickTicketRepository.getById(id); + for(TaskLog log:logs){ + pickTicketService.backPickOut(log.getId(),pt.getArea()); + } + } + return new ResponseEntity<>("成功",HttpStatus.OK); + } + @PostMapping("/queryTaskLog") + @Log("查询TaskLog") + @ApiOperation("查询TaskLog") +// @PreAuthorize("@el.check('pickOut:queryTaskLog')") + @AnonymousAccess + public ResponseEntity> queryTaskLog(@RequestBody PickOutButton pickOutButton) { + return new ResponseEntity<>(pickOutService.getTaskLogNotPickOut(pickOutButton),HttpStatus.CREATED); + } + + @PostMapping("/xbjsOut") + @Log("线边接收确认") + @ApiOperation("线边接收确认") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission(10) + public ResponseEntity xbjsOut(@RequestBody Long[] ids) { + String userName=SecurityUtils.getCurrentUsername(); + Dept dept= UserUtils.getDept(); + for (Long id : ids) { + PickOut pickOut=pickOutService.findByEntity(id); + if(pickOut.getSlQty()>0){ + //continue; + throw new BadRequestException(pickOut.getOrderNo()+"状态不正确"); + } + List logs=taskLogRepository.getTaskLogByPickOutId(id); + int tlNum=0; + double shNum = 0d; + for (TaskLog tasklog : logs) { + if (tasklog.getSlQty() > 0) { + shNum += tasklog.getSlQty(); + continue; + } + tasklog.setSlQty(tasklog.getShipQty() - tasklog.getTkjsQty()); + tasklog.setSlBy(userName); + tlNum+=tasklog.getTkjsQty().intValue(); + taskLogService.update(tasklog); + if (tasklog.getSlQty() > 0) { + shNum += tasklog.getSlQty(); + //生成具体的库存信息 + Task task = tasklog.getTask(); + PickDetail pickDetail = task.getPickDetail(); +// Point point=pickOut.getShArea().getPoint(); + Point point = pointService.findEntityById(pickDetail.getShArea().getPointId()); + //线边接收不需要管理到批次,重新生成itemKey + ItemKey itemKey = itemKeyService.getItemKey(tasklog.getItemKey().getItem(), null); + Inventory inventory = inventoryService.getInventory(itemKey, pickDetail.getShArea(), point, pickDetail.getPoint(), dept, BizStatus.SL_ALL); + double srcQty = inventory.getQuantity(); + inventory.setQuantity(inventory.getQuantity() + tasklog.getSlQty()); + inventoryService.update(inventory); + InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.SL_ALL, BizStatus.ADD, pickOut.getOrderNo(), pickDetail.getShArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, tasklog.getSlQty(), null, tasklog.getSrcStockCode(), + BizStatus.SL_ALL, tasklog.getId(), inventory.getId(), "线边接收"); + inventoryLog.setZzkw(pickDetail.getPoint()); + inventoryLogService.update(inventoryLog); + XppRecord xpp = xppRecordRepository.findByCode(tasklog.getSrcStockCode()); + if (xpp != null) { + xpp.setStatus(BizStatus.SL_ALL); + xpp.setJsr(userName); + xpp.setJsDate(new Timestamp(new Date().getTime())); + xpp.setJskw(tasklog.getDstPoint()); + xppRecordService.update(xpp); + } + } + } + pickOut.setSlQty(shNum); + pickOut.setSlBy(userName); + pickOut.setSlDate(new Timestamp(new Date().getTime())); + if(pickOut.getSlQty().intValue()+tlNum>=pickOut.getDispatchQty().intValue()) { + pickOut.setStatus(BizStatus.SL_ALL); + } + pickOutService.update(pickOut); + } + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + @PostMapping("/xbjsQueryApp") + @Log("线边接收App") + @ApiOperation("线边接收App") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity xbjsQueryApp(@RequestBody HashMap js) { + String outCode=js.get("outCode").toString(); + List outs=pickOutRepository.queryCode(outCode); + if(outs.size()<=0){ + return new ResponseEntity<>("未找到对应单号",HttpStatus.BAD_REQUEST); + } + PickOut o=outs.get(0); + HashMap map=new HashMap<>(); + map.put("id",o.getId()); + String status=o.getStatus(); +// DictQueryCriteria dictStatus=new DictQueryCriteria(); +// dictStatus.setBlurry("pick_status"); +// Map status_dic = dictDetailService.getDictDetailByName("pick_status"); +// status=status_dic.get(o.getStatus()).getValue(); + if(o.getStatus().equals(BizStatus.SHIP_ALL)){ + status="发运完成"; + } else if (o.getStatus().equals(BizStatus.SL_ALL)) { + status="接收完成"; + } + map.put("status",status); + map.put("code",outCode); + map.put("outName",o.getArea().getName()); + map.put("gc_code",o.getGcCode()); + List logs=taskLogRepository.getTaskLogByPickOutId(o.getId()); + List list=new ArrayList<>(); + for(TaskLog log:logs){ + HashMap detail=new HashMap<>(); + Task t=log.getTask(); + PickDetail pd=t.getPickDetail(); + String gw=""; + if(pd.getShArea()!=null){ + gw=pd.getShArea().getWorkingStation(); + } + detail.put("gw",gw); + detail.put("itemCode",log.getItemKey().getItem().getCode()); + detail.put("itemName",log.getItemKey().getItem().getName()); + detail.put("qty",log.getMoveQty().intValue()); + detail.put("ddbh",""); + detail.put("fzh",""); + if(log.getSrcStockCode()!=null) { + XppRecord xpp = xppRecordRepository.findByCode(log.getSrcStockCode()); + if(xpp!=null){ + detail.put("ddbh",xpp.getDdbh()); + detail.put("fzh",xpp.getFzh()); + } + } + list.add(detail); + } + map.put("details",list); + map.put("itemCount",list.size()+"/"+o.getOrderQty().intValue()); + log.info(map.toString()); + return new ResponseEntity<>(map,HttpStatus.OK); +} + + @PostMapping("/xbjsQueryDetialApp") + @Log("线边接收明细App") + @ApiOperation("线边接收明细App") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity xbjsQueryDetialApp(@RequestBody Long id) { + PickOut o=pickOutRepository.getById(id); + HashMap map=new HashMap<>(); + List logs=taskLogRepository.getTaskLogByPickOutId(o.getId()); + List list=new ArrayList<>(); + for(TaskLog log:logs){ + HashMap detail=new HashMap<>(); + detail.put("itemCode",log.getItemKey().getItem().getCode()); + detail.put("itemName",log.getItemKey().getItem().getName()); + detail.put("qty",log.getMoveQty().intValue()+"/"+log.getSlQty().intValue()); + detail.put("ddbh",""); + detail.put("fzh",""); + if(log.getSrcStockCode()!=null) { + XppRecord xpp = xppRecordRepository.findByCode(log.getSrcStockCode()); + if(xpp!=null){ + detail.put("ddbh",xpp.getDdbh()); + detail.put("fzh",xpp.getFzh()); + } + } + list.add(detail); + } + map.put("details",list); + log.info(map.toString()); + return new ResponseEntity<>(map,HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java new file mode 100644 index 0000000..2b4da1a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PickTicketController.java @@ -0,0 +1,482 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.PointService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton; +import com.youchain.businessdata.repository.*; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.PickTicketDto; +import com.youchain.businessdata.service.dto.PickTicketQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.security.Security; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-11 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "pickTicket管理") +@RequestMapping("/api/pickTicket") +public class PickTicketController { + private final PickTicketService pickTicketService; + private final PickTicketRepository pickTicketRepository; + private final PickDetailRepository pickDetailRepository; + private final TaskRepository taskRepository; + private final TaskLogRepository taskLogRepository; + private final XppRecordService xppRecordService; + private final XppRecordRepository xppRecordRepository; + private final TaskService taskService; + private final TaskLogService taskLogService; + private final InventoryService inventoryService; + private final InventoryLogService inventoryLogService; + private final PointService pointService; + private final ItemKeyService itemKeyService; + private final CodeUtils codeUtils; + private final PickDetailService pickDetailService; + + + @GetMapping("/getIdByPickTicket") + @Log("查询pickTicket") + @ApiOperation("查询pickTicket") + @AnonymousAccess + public ResponseEntity getIdByPickTicket(@RequestParam("id") Long id) { + return new ResponseEntity<>(pickTicketRepository.findById(id), HttpStatus.OK); + } + + @GetMapping(value = "/createNo") + @Log("出库管理生成单号") + @ApiOperation("出库管理生成单号") + @AnonymousAccess + public ResponseEntity createNo(@RequestParam("code") String code) { + //获取最大单号 + PickTicket pickTicket = pickTicketRepository.queryMaxCode(); + //生成日期 YYMMDD 格式的日期 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYMMDD"); + String formatDate = simpleDateFormat.format(new Date()); + //返回的单号 + String returnNo = null; + //判断是否有数据 + if (Objects.isNull(pickTicket)){ + log.warn("表中还没有数据"); + return new ResponseEntity<>((code+formatDate+"001"), HttpStatus.OK); + } + //获取出库管理的code值 + String pTCode = pickTicket.getCode(); + int i = Integer.parseInt(pTCode.substring(pTCode.length() - 3))+1; + if (i > 999) { + i = 001; + } + returnNo = code + formatDate + String.format("%03d", i); + return new ResponseEntity<>(returnNo, HttpStatus.OK); + } + + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPickTicket(HttpServletResponse response, PickTicketQueryCriteria criteria) throws Exception { + pickTicketService.download(pickTicketService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询pickTicket") + @ApiOperation("查询pickTicket") + @AnonymousAccess + public ResponseEntity queryPickTicket(PickTicketQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(pickTicketService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PutMapping + @Log("修改pickTicket") + @ApiOperation("修改pickTicket") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePickTicket(@Validated @RequestBody PickTicket resources ){ + pickTicketService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除pickTicket") + @ApiOperation("删除pickTicket") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePickTicket(@RequestBody Long[] ids) { + //删除手工备货操作需要进行数量回退 + pickTicketService.deletePickTicket(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + + @PostMapping("/queryPickListApp") + @Log("备货列表查询") + @ApiOperation("备货列表查询") + @AnonymousAccess + public ResponseEntity queryPickListApp(@RequestBody IScanPut t){ + List ts= pickTicketService.queryPickList(t); + return new ResponseEntity<>(ts,HttpStatus.OK); + } + + @PostMapping("/queryPickTaskListApp") + @Log("备货列表明细查询") + @ApiOperation("备货列表明细查询") + @AnonymousAccess + public ResponseEntity queryPickTaskListApp(@RequestBody IPTask t){ + List ts= taskService.queryTaskApp(t); + return new ResponseEntity<>(ts,HttpStatus.OK); + } + + @PostMapping + @Log("新增pickTicket") + @ApiOperation("新增pickTicket") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPickTicket(@Validated @RequestBody PickTicket resources){ + if(resources.getBillType().getName().equals(BaseStatus.BT_QTCK)) { + resources.setCode(codeUtils.getCode_yyMMdd(resources.getBillType().getPrefix(), 3)); + } + return new ResponseEntity<>(pickTicketService.create(resources),HttpStatus.CREATED); + } + + + @PostMapping("/pickingOperations") + @Log("拣货操作") + @ApiOperation("拣货操作") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity pickingOperations(@RequestBody PickTicketButton resources){ + pickTicketService.pickingOperation(resources); + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + @PostMapping("/pickWhole") + @Log("备货操作-整单拣货") + @ApiOperation("备货操作-整单拣货") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity pickWhole(@RequestBody Long ptId){ + String bhr=SecurityUtils.getCurrentUsername(); + List ts=taskRepository.getNotPickTask(ptId); + if(ts.size()<=0){ + return new ResponseEntity<>("没有需要拣货的明细",HttpStatus.BAD_REQUEST); + } + for(Task t:ts) { + pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr); + } + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + + @PostMapping("/pickBatch") + @Log("备货操作-批量拣货") + @ApiOperation("备货操作-批量拣货") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity pickBatch(@RequestBody Long[] taskIds){ + String bhr=SecurityUtils.getCurrentUsername(); + for(Long id:taskIds) { + Task t=taskRepository.getById(id); + pickTicketService.pickForTask(t.getId(), t.getSrcStockCode(), t.getPlanQty()-t.getMoveQty(), null, bhr); + } + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + + @PostMapping("/pickSingle") + @Log("备货操作-单一拣货") + @ApiOperation("备货操作-单一拣货") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity pickSingle(@RequestBody PickTicketButton resources){ + String bhr=SecurityUtils.getCurrentUsername(); + Long taskId=resources.getTaskId()[0]; + double pickQty=resources.getOnePickConfirmNumber(); + pickTicketService.pickForTask(taskId, null, pickQty, null, bhr); + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } + + @PostMapping("/pickForXpp") + @Log("备货操作-现品票拣货") + @ApiOperation("备货操作-现品票拣货") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity pickForXpp(@RequestBody PickTicketButton resources){ + Long ptId=resources.getPickTicketId(); + String xppQRCode=resources.getXppQRCode(); + //现品票二维码 + XppRecord xpp = xppRecordRepository.findByCode(xppQRCode); + if (Objects.isNull(xpp)){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "未找到对应的现品票二维码"); + } + if(xpp.getCkTaskLog()!=null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票已出库"); + } + if(!xpp.getStatus().equals(BizStatus.PUTAWAY)){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票状态不正确"); + } + Task rkT=xpp.getRkTask(); + if(rkT==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票未上架"); + } + ItemKey ik=rkT.getItemKey(); + //取现品票上的库位进行拣货 + Long srcPointId=null; + if(xpp.getInvPoint()!=null){ + srcPointId=xpp.getInvPoint().getId(); + } + List ts=taskService.queryTask(null,null,ik.getId(),ptId,srcPointId); + Task t=null; + for(Task task:ts){ + if(task.getMoveQty()("操作成功",HttpStatus.OK); + } + + @PostMapping("/xppPickGoods") + @Log("App现品票拣货") + @ApiOperation("App现品票拣货") + @Transactional + @DuplicateSubmission + @AnonymousAccess + public ResponseEntity xppPickGoods(@RequestBody PickTicketButton resources){ + //现品票二维码 + String xppQRCode = resources.getXppQRCode(); + XppRecord xpp = xppRecordRepository.findByCode(xppQRCode); + if (Objects.isNull(xpp)){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "未找到对应的现品票二维码"); + } + if(xpp.getCkTaskLog()!=null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票已出库"); + } + Task rkT=xpp.getRkTask(); + if(rkT==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "现品票未上架"); + } + ItemKey ik=rkT.getItemKey(); + //取现品票上的库位进行拣货 + Long srcPointId=null; + if(xpp.getInvPoint()!=null){ + srcPointId=xpp.getInvPoint().getId(); + } + List ts=taskService.queryTask(null,null,ik.getId(),resources.getPickTicketId(),srcPointId); + Task t=null; + for(Task task:ts){ + if(task.getMoveQty() map=new HashMap<>(); + Item it=ik.getItem(); + PickTicket pt=t.getPickDetail().getPickTicket(); + map.put("itemCode",it.getCode()); + map.put("itemName",it.getName()); + map.put("dds",pt.getOrderQuantity()); + map.put("bhs",pt.getPickedQuantity()); + map.put("ddbh",xpp.getDdbh()); + map.put("bcsl",xpp.getNrs()); + map.put("fzh",xpp.getFzh()); + map.put("tjkw",t.getSrcPoint().getCode()); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @PostMapping("/queryTaskLogDataS") + @Log("拣货取消的数据查询") + @ApiOperation("拣货取消的数据查询") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity> queryTaskLogDataS(@RequestBody PickTicketButton resources){ + return new ResponseEntity<>(pickTicketService.queryTaskLogDataS(resources.getPickTicketId()),HttpStatus.CREATED); + } + + @PostMapping("/pickingCancel") + @Log("拣货取消") + @ApiOperation("拣货取消") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity pickingCancel(@RequestBody PickTicketButton resources){ + pickTicketService.pickingCancel(resources); + return new ResponseEntity<>("拣货取消成功",HttpStatus.CREATED); + } + + @PostMapping("/xbjsVerify") + @Log("线边接收确认") + @ApiOperation("线边接收确认") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity xbjsVerify(@RequestBody Long[] ids) { + for (Long id : ids) { + PickTicket pt=pickTicketRepository.getById(id); + List logs=taskLogRepository.getTaskLogsByPtId(id); + double shNum = 0d; + for (TaskLog log : logs) { + log.setSlQty(log.getShipQty()); + log.setSlBy(SecurityUtils.getCurrentUsername()); + taskLogService.update(log); + shNum+=log.getSlQty(); + //生成具体的库存信息 + Task task=log.getTask(); + PickDetail pickDetail=task.getPickDetail(); +// Point point=pt.getShArea().getPoint(); + Point point=pointService.findEntityById(pt.getShArea().getPointId()); + Dept dept= UserUtils.getDept(); + //线边接收不需要管理到批次,重新生成itemKey + ItemKey itemKey=itemKeyService.getItemKey(log.getItemKey().getItem(),null); + Inventory inventory=inventoryService.getInventory(itemKey,pt.getShArea(),point,pickDetail.getPoint(),dept,BizStatus.SL_ALL); + double srcQty=inventory.getQuantity(); + inventory.setQuantity(inventory.getQuantity()+log.getSlQty()); + inventoryService.update(inventory); + inventoryLogService.storeInventoryLog(BizStatus.SL_ALL, BizStatus.ADD, null, pt.getShArea(), log.getItemKey(), inventory.getPoint(), inventory.getPoint(), null,null, srcQty, log.getSlQty(),null,log.getSrcStockCode(), + BizStatus.SL_ALL, log.getId(), inventory.getId(), "线边接收"); + } + pt.setSlQty(shNum); + pt.setSlBy(SecurityUtils.getCurrentUsername()); + pt.setSlDate(new Timestamp(new Date().getTime())); + pt.setStatus(BizStatus.SL_ALL); + pickTicketService.update(pt); + + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/shipmentRegistration") + @Log("发货登记") + @ApiOperation("发货登记") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity shipmentRegistration(@RequestBody Long id) { + pickTicketService.shipmentRegistration(id); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/queryDetails") + @Log("根据pickTicket的id查询详情数据") + @ApiOperation("根据pickTicket的id查询详情数据") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity queryDetails(@RequestBody Long id){ + Map map = new HashMap<>(); + PickTicketDto pickTicketDto = pickTicketService.findById(id); + //查询出库明细 + map.put("pickDetailList",pickDetailRepository.queryByPickTicketId(id)); + //查询分配记录 + map.put("pickDetailAllocateList",taskRepository.queryByBillCode(pickTicketDto.getCode())); + //查询拣货记录 + map.put("pickDetailPickingList",taskLogRepository.getTaskLogsByPtId(id)); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @PostMapping("/pickStatusUpdate") + @Log("备货单状态更新") + @ApiOperation("备货单状态更新") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity pickStatusUpdate(@RequestBody Long[] ids) { + for (Long id : ids) { + PickTicket pt=pickTicketRepository.getById(id); + List ptds=pickDetailRepository.queryByPickTicketId(id); + if(pt.getSlQty()>0){ + break; + } + double orderQty=0; + double cdQty=0; + double pickQty=0; + double shipQty=0; + for(PickDetail ptd:ptds){ + orderQty+=ptd.getOrderQty(); + List ts=taskRepository.getPickDetailTasks(ptd.getId()); + double t_cd_qty=0; + double t_pick_qty=0; + double t_ship_qty=0; + for(Task t:ts){ + t_cd_qty+=t.getPlanQty(); + List logs=taskLogRepository.getTaskLogbyTaskId(t.getId()); + for(TaskLog log:logs){ + t_pick_qty+=log.getMoveQty(); + t_ship_qty+=log.getShipQty(); + } + } + ptd.setAllocatedQty(t_cd_qty); + ptd.setPickedQty(t_pick_qty); + ptd.setShippedQty(t_ship_qty); + cdQty+=ptd.getAllocatedQty(); + pickQty+=ptd.getPickedQty(); + shipQty+=ptd.getShippedQty(); + pickDetailService.update(ptd); + } + pt.setOrderQuantity(orderQty); + pt.setAllocatedQuantity(cdQty); + pt.setPickedQuantity(pickQty); + pt.setShippedQuantity(shipQty); + if(cdQty>0){ + pt.setStatus(BizStatus.ALLOCATE); + } + if(pickQty>0&&pickQty0&&pickQty>=cdQty){ + pt.setStatus(BizStatus.PICK_ALL); + } + if(shipQty>0&&shipQty0&&shipQty==pickQty){ + pt.setStatus(BizStatus.SHIP_ALL); + } + pickTicketService.update(pt); + } + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/PlanPickDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/PlanPickDetailController.java new file mode 100644 index 0000000..5a7948f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/PlanPickDetailController.java @@ -0,0 +1,317 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import com.alibaba.fastjson.JSON; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.AutomaticPlanDetailRepository; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.dto.BomAccountDto; +import com.youchain.basicdata.service.impl.BomAccountServiceImpl; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.inputJson.buttenJson.PlanPickButton; +import com.youchain.businessdata.inputJson.buttenJson.PlanPickSave; +import com.youchain.businessdata.inputJson.buttenJson.ProductionPlanButton; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.repository.PlanPickDetailRepository; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.PickDetailService; +import com.youchain.businessdata.service.PickTicketService; +import com.youchain.businessdata.service.PlanPickDetailService; +import com.youchain.businessdata.service.dto.PlanPickDetailQueryCriteria; +import com.youchain.businessdata.service.impl.PickDetailServiceImpl; +import com.youchain.businessdata.service.impl.PlanPickDetailServiceImpl; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.BizStatus; +import com.youchain.utils.CodeUtils; +import com.youchain.utils.UserUtils; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +/** + * @author jiangkun + * @website https://eladmin.vip + * @date 2024-01-23 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "planPickDetail管理") +@RequestMapping("/api/planPickDetail") +public class PlanPickDetailController { + + private final PlanPickDetailService planPickDetailService; + private final PlanPickDetailRepository planPickDetailRepository; + private final BillTypeRepository billTypeRepository; + private final PickTicketService pickTicketService; + private final PickTicketRepository pickTicketRepository; + private final FileProperties properties; + private final BomAccountService bomAccountService; + private final PickDetailService ptdService; + private final AreaService areaService; + private final CodeUtils codeUtils; + private final PickDetailRepository pickDetailRepository; + private final InventoryService inventoryService; + private final AutomaticPlanDetailRepository automaticPlanDetailRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportPlanPickDetail(HttpServletResponse response, PlanPickDetailQueryCriteria criteria) throws Exception { + planPickDetailService.download(planPickDetailService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询planPickDetail") + @ApiOperation("查询planPickDetail") + @AnonymousAccess + public ResponseEntity queryPlanPickDetail(PlanPickDetailQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(planPickDetailService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @GetMapping("/getAllCode") + @Log("获取全部单号做下拉") + @ApiOperation("获取全部单号做下拉") + @AnonymousAccess + public ResponseEntity getAllCode() { +// //获取单号 +// List planPickDetails = planPickDetailRepository.queryPlanPickDetailByCode(); +// //获取所有的code +// List collect = planPickDetails.stream().map(PlanPickDetail::getCode).collect(Collectors.toList()); + List collect = planPickDetailRepository.queryPlanPickDetailCode(); + return new ResponseEntity<>(collect, HttpStatus.OK); + } + + @PostMapping + @Log("新增planPickDetail") + @ApiOperation("新增planPickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createPlanPickDetail(@Validated @RequestBody PlanPickDetail resources) { + if(resources.getZone()!=null) { + resources.setGcCode(resources.getZone().getGcCode()); + } + return new ResponseEntity<>(planPickDetailService.create(resources), HttpStatus.CREATED); + } + + @PostMapping("/cancelStockOperation") + @Log("取消备货操作") + @ApiOperation("取消备货操作") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity cancelStockOperation(@RequestBody PlanPickButton resources) { + List planPickDetailList = resources.getPlanPickDetailList(); + //去重 获取单号 + List collect = planPickDetailList.stream().map(PlanPickDetail::getCode).distinct().collect(Collectors.toList()); + for (String planPickDetailCode : collect) { + //其他出库的删除 + List pickTickets = pickTicketRepository.queryPickTicketByCodeAll(BizStatus.OPEN, "%"+planPickDetailCode+"%"); + for (PickTicket pt : pickTickets) { + //查明细表的数据 + List pickDetails = pickDetailRepository.queryByPickTicketId(pt.getId()); + for (PickDetail pd : pickDetails) { + pickDetailRepository.delete(pd); + } + pickTicketRepository.deleteById(pt.getId()); + } + //备货计划明细修改 + List planPickDetails = planPickDetailRepository.findByStatusAndCode(BizStatus.YCD, planPickDetailCode); + for (PlanPickDetail ppd : planPickDetails) { + ppd.setStatus(BizStatus.WCD); + planPickDetailService.update(ppd); + } + } + return new ResponseEntity<>("取消备货成功", HttpStatus.OK); + } + + + @PostMapping("/generateStockOperation") + @Log("生成备货操作") + @ApiOperation("生成备货操作") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity generateStockOperation(@RequestBody PlanPickButton resources) { + HashMap map=new HashMap(); + for (PlanPickDetail ppd : resources.getPlanPickDetailList()) { + // planPickDetailService.createAutoPlan(1,ppd.getCode(),ppd.getZone().getId(),null,Boolean.FALSE,ppd.getCreateTime()); + map.put(ppd.getCode(),ppd.getCode()); +// if(codes.size()>=2){ +// throw new BadRequestException(HttpStatus.NOT_FOUND, ppd.getCode() + "请选择相同的单号"); +// }` + if (!ppd.getStatus().equals(BizStatus.WCD)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, ppd.getBigItem().getCode() + "状态不正确"); + } + } +// //选中的数据 +// PlanPickDetail ppd_o = resources.getPlanPickDetailList().get(0); +// //根据code 和 status 查询数据 +// List planPickDetails = planPickDetailService.queryPlanPickDetail(ppd_o.getCode()); +// +// for (PlanPickDetail ppd : planPickDetails) { +// if (!ppd.getStatus().equals(BizStatus.WCD)) { +// throw new BadRequestException(HttpStatus.NOT_FOUND, ppd.getBigItem().getCode() + "状态不正确"); +// } +// List bs = bomAccountService.queryBomAccount(ppd.getBigItem().getId(), ppd.getZone().getId(),ppd.getZone().getWorkingStation()); +// if (bs.size() <= 0) { +// throw new BadRequestException(HttpStatus.NOT_FOUND, ppd.getBigItem().getCode() + "未查到对应工位清单"); +// } +// ppd.setPickedQuantity(ppd.getOrderQuantity()); +// ppd.setStatus(BizStatus.YCD); +// planPickDetailService.update(ppd); +// } + planPickDetailService.createAutoPlan(map.keySet().toArray(new String[map.size()]),null,""); +// //得到所有的物料和明细 +// List objPicks = bomAccountService.queryBomAccountList(ppd_o.getCode(),null, ppd_o.getZone().getId(), null,"0"); +//// String bpType="大"; +// for (Object[] objPick : objPicks) { +// Long oAreaId = (Long) objPick[0]; +// String bpType = (String) objPick[1]; +// Area oArea=areaService.findEntityById(oAreaId); +// //出库数据 pickTicket 其他出库 +// PickTicket pickTicket = pickTicketService.storePick(ppd_o.getBillType(), ppd_o.getZone(),oArea, bpType, ppd_o.getCode()); +// double orderQty = 0; +// List objs = bomAccountService.queryBomAccountList(ppd_o.getCode(),oAreaId, ppd_o.getZone().getId(), bpType, "1"); +// //需求数量 +// double xqty = 0d; +// //纯需求数量 +// double cxqty = 0d; +// double xbsum=0d; +// for (Object[] obj : objs) { +// Long bId = (Long) obj[0]; +// double single = (Double) obj[1]; +// BomAccount ba = bomAccountService.findByEntity(bId); +// PickDetail ptd = new PickDetail(); +// //需求数xq_qty=数量*单用 +// ptd.setXqQty(single); +// //纯需求数orderQty=备货需求-线边数 +// Double xbQty=inventoryService.getInvQty(ba.getItem().getId(),pickTicket.getShArea().getId(),ba.getZPoint().getId()); +// ptd.setXbQty(xbQty); +// xbsum+=xbQty; +// if(xbQty.intValue()>=ptd.getXqQty().intValue()){ +// ptd.setPropC4(0d); +// }else { +// ptd.setPropC4(ptd.getXqQty() - ptd.getXbQty()); +// } +// ptd.setPureXqBz(ptd.getPropC4()); +// //备货需求=(纯需求数/收容数向上取整)*收容数 +// ptd.setOrderQty(Math.ceil(ptd.getPropC4()/ba.getItem().getExtendD3())*ba.getItem().getExtendD3()); +// xqty += ptd.getXqQty(); +// cxqty += ptd.getPropC4(); +// ptd.setPoint(ba.getZPoint()); +// ptd.setItem(ba.getItem()); +// ptd.setPickTicket(pickTicket); +// ptd.setContents(ba.getContents()); +// ptd.setAc(ba.getAc()); +// ptd.setSupplier(ba.getSupplier()); +// ptdService.create(ptd); +// orderQty += ptd.getOrderQty(); +// } +// pickTicket.setOrderQuantity(orderQty); +// pickTicket.setBhQty(orderQty); +// //纯需求数 +// pickTicket.setPureReqQty(cxqty); +// //需求数量 +// pickTicket.setXqQty(xqty); +// pickTicket.setXbQty(xbsum); +//// pickTicket.setStockingDate(new Timestamp(new Date().getTime())); +// pickTicketRepository.save(pickTicket); +// } + return new ResponseEntity<>("备货成功", HttpStatus.OK); + } + + @PostMapping("/savePlanPickDetail") + @Log("新增planPickDetail") + @ApiOperation("新增planPickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity savePlanPickDetail(@RequestBody PlanPickButton resources) { + PlanPickSave planPickSave = resources.getPlanPickSave(); + if (planPickSave.getCode() == null||planPickSave.getCode().equals("")) { + planPickSave.setCode(codeUtils.getCode_yyMMdd("JH", 3)); + } + String code=planPickSave.getCode(); +// //判断是否在一个工位 +// List ls=planPickDetailService.queryGwList(code,planPickSave.getZone().getCode()); +// if(ls.size()>0){ +// throw new BadRequestException(HttpStatus.NOT_FOUND, planPickSave.getCode() + "请选择相同工位"); +// } + //判断是否在一个工位 + List statuss=planPickDetailService.queryStatusList(code); + if(statuss.size()>0){ + throw new BadRequestException(HttpStatus.NOT_FOUND,code + "仅未出单才可新增"); + } + //插入bigitem,数量,单据类型为CKD单点,JH+年月日+3位流水 + PlanPickDetail planPickDetail = new PlanPickDetail(); + planPickDetail.setBigItem(planPickSave.getBigItem()); + //备货数量 + planPickDetail.setPickedQuantity(planPickSave.getOrderQuantity()); + //起始机号 +// planPickDetail.setStartNo(manualGeneration.getStartMachineNo()); + planPickDetail.setStatus(BizStatus.WCD); + planPickDetail.setShippedQuantity(0d); + planPickDetail.setAllocatedQuantity(0d); + planPickDetail.setOrderQuantity(planPickSave.getOrderQuantity()); + //入库库区 + planPickDetail.setZone(planPickSave.getZone()); + planPickDetail.setGcCode(planPickSave.getZone().getGcCode()); + //单据类型(出库类型) + BillType billType = billTypeRepository.findByName(BaseStatus.BT_DD); + planPickDetail.setBillType(billType); + planPickDetail.setRemark("手工维护"); + //存单号 + planPickDetail.setCode(code); + planPickDetailService.create(planPickDetail); + return new ResponseEntity<>("新增成功", HttpStatus.CREATED); + } + + @PutMapping + @Log("修改planPickDetail") + @ApiOperation("修改planPickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updatePlanPickDetail(@Validated @RequestBody PlanPickDetail resources) { + planPickDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除planPickDetail") + @ApiOperation("删除planPickDetail") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deletePlanPickDetail(@RequestBody Long[] ids) { + planPickDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/SparepartsController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/SparepartsController.java new file mode 100644 index 0000000..34c6ccd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/SparepartsController.java @@ -0,0 +1,190 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.ProductionPlan; +import com.youchain.basicdata.repository.ProductionPlanRepository; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.ProductionPlanService; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.repository.SparepartsRepository; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.ItemKeyService; +import com.youchain.businessdata.service.SparepartsService; +import com.youchain.businessdata.service.dto.SparepartsDto; +import com.youchain.businessdata.service.dto.SparepartsQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiResult; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.BizStatus; +import com.youchain.utils.SecurityUtils; +import com.youchain.utils.UserUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.catalina.security.SecurityUtil; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.*; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; + +/** +* @website https://eladmin.vip +* @author ShenYinAn +* @date 2024-01-30 +**/ +@RestController +@RequiredArgsConstructor +@Slf4j +@Api(tags = "spareparts管理") +@RequestMapping("/api/spareparts") +public class SparepartsController { + + private final SparepartsService sparepartsService; + private final ProductionPlanRepository productionPlanRepository; + private final ProductionPlanService productionPlanService; + private final SparepartsRepository sparepartsRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportSpareparts(HttpServletResponse response, SparepartsQueryCriteria criteria) throws Exception { + sparepartsService.download(sparepartsService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询spareparts") + @ApiOperation("查询spareparts") + @AnonymousAccess + public ResponseEntity querySpareparts(SparepartsQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(sparepartsService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增spareparts") + @ApiOperation("新增spareparts") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createSpareparts(@Validated @RequestBody Spareparts resources){ + resources.setStatus("UN_CONSUME"); + return new ResponseEntity<>(sparepartsService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改spareparts") + @ApiOperation("修改spareparts") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateSpareparts(@Validated @RequestBody Spareparts resources){ + if(resources.getStatus().equals("CONSUME")){ + return new ResponseEntity(ApiResult.success("已耗用,无法修改",""), HttpStatus.BAD_REQUEST); + } + sparepartsService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除spareparts") + @ApiOperation("删除spareparts") + @Transactional + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteSpareparts(@RequestBody Long[] ids) { + for(Long id : ids){ + SparepartsDto sparepartsDto = sparepartsService.findById(id); + if(sparepartsDto.getStatus().equals("CONSUME")){ + return new ResponseEntity(ApiResult.success("已耗用,无法删除",""), HttpStatus.BAD_REQUEST); + } + } + sparepartsService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/hySpareParts") + @Log("零件耗用") + @ApiOperation("零件耗用") + @Transactional + @PreAuthorize("@el.check('super:man')") + public ResponseEntity hySpareParts(@RequestBody HashMap map) { + if (map.size() > 0) { + List list = (List) map.get("ids"); + for (int i = 0; i < list.size(); i++) { + Long id = Long.parseLong(list.get(i).toString()); + sparepartsService.hySpareParts(id); + } + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/copySpareParts") + @Log("零件耗用复制") + @ApiOperation("零件耗用复制") + @Transactional + @PreAuthorize("@el.check('super:man')") + public ResponseEntity copySpareParts(@RequestBody HashMap map) { + if(map.size()>0){ + List list= (List) map.get("ids"); + for(int i=0;i(HttpStatus.OK); + } + + @PostMapping("/autoAddHy") + @Log("零件耗用") + @ApiOperation("零件耗用") + @Transactional + @PreAuthorize("@el.check('super:man')") + public ResponseEntity autoAddHy(@RequestBody String idno) { + List whyGwList = productionPlanRepository.getIdNoWhyGw(idno); + if(whyGwList.size()<=0){ + throw new BadRequestException("未找到需要耗用数据"); + } + for (String gw:whyGwList){ + List whyList = productionPlanRepository.getIdNoAllData(gw,idno); + productionPlanService.scsxHaoyong(whyList,gw,"截止IDNO自动耗用"); + } + //自动创建 + return new ResponseEntity<>("操作成功",HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java new file mode 100644 index 0000000..1932a5c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskController.java @@ -0,0 +1,115 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.PointQueryCriteria; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.service.TaskService; +import com.youchain.businessdata.service.dto.TaskQueryCriteria; +import com.youchain.utils.BaseStatus; +import lombok.extern.slf4j.Slf4j; +import org.apache.catalina.util.StandardSessionIdGenerator; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "task管理") +@RequestMapping("/api/task") +@Slf4j +public class TaskController { + + private final TaskService taskService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportTask(HttpServletResponse response, TaskQueryCriteria criteria) throws Exception { + taskService.download(taskService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询task") + @ApiOperation("查询task") + @AnonymousAccess + public ResponseEntity queryTask(TaskQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(taskService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @GetMapping(value = "/queryAsnTask") + @Log("查询task") + @ApiOperation("查询task") + @AnonymousAccess + public ResponseEntity queryAsnTask(TaskQueryCriteria criteria){ + log.info(criteria.getAsnDetailId()+""); +// TaskQueryCriteria tq=new TaskQueryCriteria(); +// tq.setAsnDetailId(id); + return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK); + } + + @GetMapping("/queryPickTask") + @Log("拣货确认-拣货记录") + @ApiOperation("拣货确认-拣货记录") + @AnonymousAccess + public ResponseEntity queryPickTask(TaskQueryCriteria criteria){ + return new ResponseEntity<>(taskService.queryAll(criteria),HttpStatus.OK); + } + + @PostMapping + @Log("新增task") + @ApiOperation("新增task") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createTask(@Validated @RequestBody Task resources){ + return new ResponseEntity<>(taskService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改task") + @ApiOperation("修改task") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateTask(@Validated @RequestBody Task resources){ + taskService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除task") + @ApiOperation("删除task") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteTask(@RequestBody Long[] ids) { + taskService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskLogController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskLogController.java new file mode 100644 index 0000000..20a77ac --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/TaskLogController.java @@ -0,0 +1,89 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.service.TaskLogService; +import com.youchain.businessdata.service.dto.TaskLogQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-25 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "taskLog管理") +@RequestMapping("/api/taskLog") +public class TaskLogController { + + private final TaskLogService taskLogService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportTaskLog(HttpServletResponse response, TaskLogQueryCriteria criteria) throws Exception { + taskLogService.download(taskLogService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询taskLog") + @ApiOperation("查询taskLog") + @AnonymousAccess + public ResponseEntity queryTaskLog(TaskLogQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(taskLogService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增taskLog") + @ApiOperation("新增taskLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createTaskLog(@Validated @RequestBody TaskLog resources){ + + return new ResponseEntity<>(taskLogService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改taskLog") + @ApiOperation("修改taskLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateTaskLog(@Validated @RequestBody TaskLog resources){ + taskLogService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除taskLog") + @ApiOperation("删除taskLog") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteTaskLog(@RequestBody Long[] ids) { + taskLogService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java new file mode 100644 index 0000000..83eca60 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/XppRecordController.java @@ -0,0 +1,892 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.rest; + +import cn.hutool.json.JSONArray; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.youchain.DuplicateSubmission.DuplicateSubmission; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.PointService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IRkPut; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.XppPut; +import com.youchain.businessdata.inputJson.buttenJson.XppRecordButton; +import com.youchain.businessdata.repository.CountMoveDetailRecordRepository; +import com.youchain.businessdata.repository.XppRecordRepository; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.XppRecordDto; +import com.youchain.businessdata.service.dto.XppRecordQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.*; +import javax.servlet.http.HttpServletResponse; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @date 2024-01-04 + **/ +@RestController +@RequiredArgsConstructor +@Api(tags = "xppRecord管理") +@RequestMapping("/api/xppRecord") +@Slf4j +public class XppRecordController { + + private final XppRecordService xppRecordService; + private final AsnDetailService asnDetailService; + private final ItemRepository itemRepository; + private final XppRecordRepository xppRecordRepository; + private final InventoryLogService inventoryLogService; + private final InventoryService inventoryService; + private final PointService pointService; + private final AreaService areaService; + private final ItemKeyService itemKeyService; + private final RedisUtils redisUtils; + private final PickTicketService pickTicketService; + private final BillTypeRepository billTypeRepository; + private final PickDetailService pickDetailService; + private final TaskLogService taskLogService; + private final JobRepository jobRepository; + private final AreaRepository areaRepository; + private final CodeUtils codeUtils; + private final CountMoveDetailRecordRepository countMoveDetailRecordRepository; + private final CountMoveDetailRecordService countMoveDetailRecordService; + + @Log("导出数据XppRecord") + @ApiOperation("导出数据XppRecord") + @GetMapping(value = "/download") + @AnonymousAccess + public void exportXppRecord(HttpServletResponse response, XppRecordQueryCriteria criteria) throws Exception { + xppRecordService.download(xppRecordService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询xppRecord") + @ApiOperation("查询xppRecord") + @AnonymousAccess + public ResponseEntity queryXppRecord(XppRecordQueryCriteria criteria, Pageable pageable) { + return new ResponseEntity<>(xppRecordService.queryAll(criteria, pageable), HttpStatus.OK); + } + + @PostMapping("/changeFz") + @Log("复制Apros") + @ApiOperation("复制Apros") + @AnonymousAccess + @Transactional(rollbackFor = Exception.class) + public ResponseEntity changeFz( @RequestBody Long[] ids) { + for (Long id : ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + xppRecord.setBeFz(Boolean.TRUE); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + @PostMapping("/cancelReceiv") + @Log("现品票取消收货") + @ApiOperation("现品票取消收货") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity cancelReceiv(@RequestBody Long[] ids) { + Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA); + for (Long id : ids) { + //判断现品票是否已收货 + XppRecord xppRecord = xppRecordRepository.getById(id); + //现品票已收货未上架 + if (!xppRecord.getStatus().equals(BizStatus.RECEIVED)) { + throw new BadRequestException("收货状态才能取消收货"); + } + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL, BizStatus.REDUCE, "现品票取消收货", area, xppRecord.getItemKey(), null, null, null, + 0d, xppRecord.getNrs() + 0d, xppRecord.getEwm(), BizStatus.RECEIVING_CANCEL, xppRecord.getId(), null, "现品票取消收货"); + xppRecordRepository.delete(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + @PostMapping("/xppLyOut") + @Log("现品票留样出库") + @ApiOperation("现品票留样出库") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission + public ResponseEntity xppLyOut(@RequestBody Long[] ids) { + Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA); + //生成备货操作 + BillType bt=billTypeRepository.findByName(BaseStatus.BT_LYCK); + if(bt==null){ + throw new BadRequestException("维护留样出库类型"); + } + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + area=areaRepository.getByCode(areaCode); + if(area==null){ + throw new BadRequestException("维护用户岗位对应的库区"); + } + } + Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null); + if(zzkw==null){ + return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST); + } + PickTicket pt=pickTicketService.storePick(bt,null,area,"大","系统留样出库"); + for (Long id : ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + if(xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + //上架现品票走出库流程 + xppRecordService.xppShipOut(id,area,xppRecord.getInvPoint(),zzkw,BizStatus.RETENTION_OUT,pt.getCode(),"现品票留样(已上架)"); + }else { + //现品票已收货未上架 + if (!xppRecord.getStatus().equals(BizStatus.RECEIVED)) { + throw new BadRequestException("收货状态才能留样出库"); + } + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.RETENTION_OUT, BizStatus.REDUCE, "现品票留样", area, xppRecord.getItemKey(), null, null, null, null, + 0d, xppRecord.getNrs() + 0d, null, xppRecord.getEwm(), BizStatus.RETENTION_OUT, xppRecord.getId(), null, "现品票留样"); + + PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier()); + detail.setRemark(xppRecord.getEwm()); + pickDetailService.update(detail); + pt.setOrderQuantity(pt.getOrderQuantity() + detail.getOrderQty()); + } + //生成出库记录 + xppRecord.setStatus(BizStatus.RETENTION_OUT); + xppRecord.setLyData(new Timestamp(new Date().getTime())); + xppRecord.setTfLy(true); + xppRecord.setLyCode(pt.getCode()); + xppRecordService.update(xppRecord); + } + pt.setStatus(BizStatus.SHIP_ALL); + pt.setShipDate(new Timestamp(new Date().getTime())); + pickTicketService.update(pt); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + + + @PostMapping("/xpphybf") + @Log("现品票还样部分") + @ApiOperation("现品票还样部分") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity xpphybf(@RequestBody XppRecordButton xppRecordButton) { + xppRecordService.xpphybf(xppRecordButton); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppHyIn") + @Log("现品票还样整票") + @ApiOperation("现品票还样整票") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity xppHyIn(@RequestBody Long[] ids) { + for (Long id :ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + Area area=xppRecord.getArea(); + if(area==null){ + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + area=areaRepository.getByCode(areaCode); + if(area==null){ + throw new BadRequestException("维护岗位对应的库区"); + } + xppRecord.setArea(area); + } + } + if (!xppRecord.getStatus().equals(BizStatus.RETENTION_OUT)) { + throw new BadRequestException("留样出库状态才能还样"); + } + xppRecord.setStatus(BizStatus.RETENTION_IN); + xppRecord.setHyData(new Timestamp(new Date().getTime())); + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.RETENTION_IN, BizStatus.ADD, "现品票还样", area, xppRecord.getItemKey(), null, null, null, + 0d, xppRecord.getNrs() + 0d, xppRecord.getEwm(), BizStatus.RETENTION_IN, xppRecord.getId(), null, "现品票还样"); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppBacKIn") + @Log("现品票退库接收") + @ApiOperation("现品票退库接收") + @PreAuthorize("@el.check('super:man')") + @Transactional + @DuplicateSubmission + public ResponseEntity xppBacKIn(@RequestBody Long[] ids) { + Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA); + String username=SecurityUtils.getCurrentUsername(); + Point srcPoint = pointService.getPoint(null, null, BaseStatus.SHZC, null); + for (Long id :ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + if (!xppRecord.getStatus().equals(BizStatus.SHIP_ALL)&&!xppRecord.getStatus().equals(BizStatus.SL_ALL)) { + throw new BadRequestException("未出库不能退库"); + } + AsnDetail d=xppRecord.getAsnDetailId(); + String billCode="现品票退库接收"; + if(d!=null){ + d.setReceivedQty(0d); + d.setStatus(BizStatus.RECEIVED); + asnDetailService.update(d); + TaskLog tl=xppRecord.getCkTaskLog(); + tl.setTkjsQty(tl.getShipQty()); + tl.setTkjsBy(username); + taskLogService.update(tl); + Task task=tl.getTask(); + billCode=task.getBillCode(); + if(tl.getSlQty()>0){ + //扣减线边库存 + PickDetail pickDetail=task.getPickDetail(); + List inventorys=inventoryService.getXbHyInv(pickDetail.getItem(),pickDetail.getShArea(),pickDetail.getShArea().getWorkingStation(),pickDetail.getPoint(),"退库接收"); + if(inventorys.size()>0){ + Inventory inv= inventorys.get(0); + double srcQty=inv.getQuantity(); + inv.setQuantity(inv.getQuantity()-tl.getSlQty()); + inventoryService.update(inv); + InventoryLog log= inventoryLogService.storeInventoryLog(BizStatus.TK_JS,BizStatus.REDUCE,billCode,pickDetail.getShArea(),inv.getItemKey(), + inv.getPoint(),inv.getPoint(),null,null,srcQty,tl.getSlQty(),null,null,task.getBillCode(), + tl.getId(),inv.getId(),"退库接收"); + log.setZzkw(pickDetail.getPoint()); + inventoryLogService.update(log); + } + } + xppRecord.setCkTaskLog(null); + xppRecord.setBhr(null); + xppRecord.setBhDate(null); + xppRecord.setFhr(null); + xppRecord.setFhDate(null); + + } + xppRecord.setStatus(BizStatus.RECEIVED); + xppRecord.setTkData(new Timestamp(new Date().getTime())); + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.TK_JS, BizStatus.ADD, billCode, area, xppRecord.getItemKey(), srcPoint, srcPoint, null, + 0d, xppRecord.getNrs() + 0d, xppRecord.getEwm(), BizStatus.BACK_IN, xppRecord.getId(), null, "现品票退库接收"); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppXbTl") + @Log("现品票投料") + @ApiOperation("现品票投料") + @PreAuthorize("@el.check('super:man')") + @Transactional + public ResponseEntity xppXbTl(@RequestBody IScanPut iPut) { + String username=SecurityUtils.getCurrentUsername(); +// String pointCode = iPut.getPointCode(); +// if (pointCode == null||pointCode.equals("")) { +// return new ResponseEntity<>( "库位不能为空", BAD_REQUEST); +// } +// Point dstPoint = pointService.findByCode(pointCode, null, null, null, null); +// if (dstPoint == null) { +// return new ResponseEntity<>(pointCode + "库位不存在", BAD_REQUEST); +// } + for(Long id:iPut.getIds()){ + XppRecord xppRecord=xppRecordRepository.getById(id); + TaskLog taskLog=xppRecord.getCkTaskLog(); + if (taskLog==null||taskLog.getSlQty()<=0) { + throw new BadRequestException(xppRecord.getDdbh()+"现品票状态不正确"); + } + if(xppRecord.getZzkw()!=null){ + throw new BadRequestException(xppRecord.getDdbh()+"现品票状态不正确"); + } + Task task=taskLog.getTask(); + PickDetail pickDetail=task.getPickDetail(); + PickTicket pickTicket=pickDetail.getPickTicket(); + Point dstPoint=pickDetail.getPoint(); + Point zzkw=pickDetail.getPoint(); + xppRecord.setZzkw(zzkw); + xppRecord.setZztlDate(new Timestamp(new Date().getTime())); + xppRecord.setZztlr(username); + xppRecord.setStatus(BizStatus.ZZKW_TL); + xppRecordService.update(xppRecord); + //查找库存 + //扣除线边暂存库位库存,增加线边制造库位库存 + Area shArea=pickTicket.getShArea(); +// Point srcPoint=shArea.getPoint(); + Point srcPoint=pointService.findEntityById(shArea.getPointId()); + List inventorys=inventoryService.getInventoryXbTl(pickDetail.getItem(),shArea,srcPoint,zzkw); + if(inventorys.size()<=0){ + return new ResponseEntity<>(pickDetail.getItem().getCode()+"暂存区无库存", HttpStatus.BAD_REQUEST); + } + double occurQty=taskLog.getSlQty(); + Inventory srcInv=inventorys.get(0); + double srcQty1=srcInv.getQuantity(); + srcInv.reduce(occurQty); + inventoryService.update(srcInv); + taskLog.setTlBy(username); + taskLog.setTlQty(occurQty); + taskLogService.update(taskLog); + inventoryLogService.storeInventoryLog(BizStatus.ZZKW_TL, BizStatus.REDUCE, "制造库位投料", shArea, srcInv.getItemKey(), srcPoint, dstPoint, + zzkw,srcQty1, occurQty, xppRecord.getEwm(), BizStatus.ZZKW_TL, xppRecord.getId(), srcInv.getId(), "制造库位投料"); + //制造库位增加库存 + Inventory dstInv=inventoryService.getInventory(srcInv.getItemKey(),shArea,dstPoint,zzkw,srcInv.getDept(),BizStatus.ZZKW_TL); + double srcQty2=dstInv.getQuantity(); + dstInv.addQty(occurQty); + inventoryService.update(dstInv); + inventoryLogService.storeInventoryLog(BizStatus.ZZKW_TL, BizStatus.ADD, "制造库位投料", shArea, srcInv.getItemKey(), srcPoint, dstPoint, + zzkw,srcQty2, occurQty, xppRecord.getEwm(), BizStatus.ZZKW_TL, xppRecord.getId(), srcInv.getId(), "制造库位投料"); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/collectFromPass") + @Log("现品票采集表") + @ApiOperation("现品票采集表") + @AnonymousAccess + @Transactional(rollbackFor = Exception.class) + public ResponseEntity collectFromPass(@RequestBody String resources) { + XppRecord xppRecord = xppRecordService.collectFromPass(resources); + // AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppCollectApp") + @Log("APP现品票采集表") + @ApiOperation("APP现品票采集表") + @AnonymousAccess + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppCollectApp(@RequestBody String resources) { + JSONObject jsonObject = JSONObject.parseObject(resources); + String ewm=jsonObject.getString("ewm"); + if (ewm.length()<85){ + throw new BadRequestException("二维码格式错误"); + } + int i=0; + String gc=ewm.substring(i, i+=2); + String pq=ewm.substring(i, i+=1); + String pf=ewm.substring(i, i+=10); + String ac=ewm.substring(i, i+=3); + String jgnr=ewm.substring(i, i+=3); + String zf=ewm.substring(i, i+=10); + String ddbh=ewm.substring(i, i+=8); + String nrzsr=ewm.substring(i, i+=8); + String nrs=ewm.substring(i, i+=7); + String gys=ewm.substring(i, i+=12); + String nrcs=ewm.substring(i, i+=6); + String zzkw=ewm.substring(i, i+=6); + String cgkw=ewm.substring(i, i+=6); + String fzh=ewm.substring(i, i+=3); + Item item = itemRepository.findByCode(pf); + if (item==null){ + throw new BadRequestException("部品品番不存在"); + } + XppRecord xppRecord = xppRecordRepository.findByCode(ewm); + if (xppRecord==null){ + xppRecord=new XppRecord(); + xppRecord.setEwm(ewm); + }else{ + throw new BadRequestException("二维码已采集"); + } + RRkXpp xpp = new RRkXpp(); + xpp.setItemCode(item.getCode()); + xpp.setItemName(item.getName()); + xpp.setAc(ac); + xpp.setDdbh(ddbh); + xpp.setNrs(Integer.valueOf(nrs)); + xpp.setNrzsr(nrzsr); + xpp.setFzh(fzh); + xpp.setGys(gys); + xpp.setCjsj(new Date()); + return new ResponseEntity<>(xpp, HttpStatus.OK); + } + @PostMapping("/confirmCollectApp") + @Log("APP现品票采集表") + @ApiOperation("APP现品票采集表") + @PreAuthorize("@el.check('app:list')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity confirmCollectApp(@RequestBody IScanPut iPut) { + Set ewms=iPut.getEwms(); + int type=iPut.getType(); + for(String ewm:ewms){ + XppRecord xppRecord = xppRecordService.collectFromPass(ewm); + Point srcPoint = pointService.getPoint(null, null, BaseStatus.SHZC, null); + Area area=xppRecord.getArea(); + if(area==null) { + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + area=areaRepository.getByCode(areaCode); + if(area==null){ + throw new BadRequestException("维护用户岗位对应的库区"); + } + xppRecord.setArea(area); + } + } + String pc1=DateUtil.dateYmd(new Date()); + ItemKey ik = itemKeyService.getItemKey(xppRecord.getItem(), DateUtil.dateYmdz()); + xppRecord.setItemKey(ik); + if(type==1) { + inventoryLogService.storeInventoryLog(BizStatus.RECEIVING, BizStatus.ADD, "现品票采集", area, ik, srcPoint, srcPoint, null, 0d, xppRecord.getNrs() + 0d, ewm, + BizStatus.ASN, xppRecord.getId(), null, "现品票采集"); + } else if (type==2) { + inventoryLogService.storeInventoryLog(BizStatus.RETENTION_IN, BizStatus.ADD, "现品票部分还样入库", area, ik, srcPoint, srcPoint, null, 0d, xppRecord.getNrs() + 0d, ewm, + BizStatus.RETENTION_IN, xppRecord.getId(), null, "现品票部分还样入库"); + xppRecord.setStatus(BizStatus.RETENTION_IN); + xppRecord.setHyData(new Timestamp(new Date().getTime())); + xppRecord.setHctlr(SecurityUtils.getCurrentUsername()); + } + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + @PostMapping("/xppAnalysisApp") + @Log("APP现品票解析") + @ApiOperation("APP现品票解析") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppAnalysisApp(@RequestBody String resources) { + JSONObject jsonObject = JSONObject.parseObject(resources); + String ewm=jsonObject.getString("ewm"); + String type=jsonObject.getString("type"); + XppRecord xppRecord = xppRecordRepository.findByCode(ewm); + String gw=""; + if (xppRecord==null){ + throw new BadRequestException("现品票未采集"); + }else{ + if(type.equals("1")) {//留样出库 + if(!xppRecord.getStatus().equals(BizStatus.RECEIVED)&&!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + throw new BadRequestException("现品票状态不正确"); + } + } else if (type.equals("2")) {//还样入库 + if(!xppRecord.getStatus().equals(BizStatus.RETENTION_OUT)){ + throw new BadRequestException("现品票状态不正确"); + } + }else if (type.equals("3")) {//现品票出库 + if(!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + throw new BadRequestException("现品票状态不正确"); + } + }else if (type.equals("4")) {//现品票退库接收 + if(!xppRecord.getStatus().equals(BizStatus.SHIP_ALL)&&!xppRecord.getStatus().equals(BizStatus.SL_ALL)){ + throw new BadRequestException("现品票状态不正确"); + } + }else if (type.equals("5")) {//现品票投料 + if(xppRecord.getCkTaskLog()==null){ + throw new BadRequestException("现品票未出库"); + } + if(xppRecord.getCkTaskLog().getSlQty()<=0){ + throw new BadRequestException("现品票未接收"); + } + + Task t=xppRecord.getCkTaskLog().getTask(); + PickDetail pd =t.getPickDetail(); + if(pd.getShArea()!=null) { + gw=pd.getShArea().getWorkingStation(); + } + }else if (type.equals("6")) {//现品票移位 + if(xppRecord.getCkTaskLog()!=null){ + throw new BadRequestException("现品票已备货"); + } + } + + } + RRkXpp xpp = xppRecordService.xppAnalysis(xppRecord); + xpp.setGw(gw); + return new ResponseEntity<>(xpp, HttpStatus.OK); + } + @PostMapping("/xppLyOutApp") + @Log("APP现品票留样出库") + @ApiOperation("APP现品票留样出库") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppLyOutApp(@RequestBody IScanPut iPut) { + + Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA); + //生成备货操作 + BillType bt=billTypeRepository.findByName(BaseStatus.BT_LYCK); + if(bt==null){ + throw new BadRequestException("维护留样出库类型"); + } + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + area=areaRepository.getByCode(areaCode); + if(area==null){ + throw new BadRequestException("维护用户岗位对应的库区"); + } + } + Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null); + if(zzkw==null){ + return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST); + } + PickTicket pt=pickTicketService.storePick(bt,null,area,"大",iPut.getCph()); + for (Long id : iPut.getIds()) { + XppRecord xppRecord = xppRecordRepository.getById(id); + if(xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + //上架现品票走出库流程 + xppRecordService.xppShipOut(id,area,xppRecord.getInvPoint(),zzkw,BizStatus.RETENTION_OUT,pt.getCode(),"现品票留样(已上架)"); + }else { + //现品票已收货未上架 + if (!xppRecord.getStatus().equals(BizStatus.RECEIVED)) { + throw new BadRequestException("收货状态才能留样出库"); + } + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.RETENTION_OUT, BizStatus.REDUCE, "现品票留样", area, xppRecord.getItemKey(), null, null, null, null, + 0d, xppRecord.getNrs() + 0d, null, xppRecord.getEwm(), BizStatus.RETENTION_OUT, xppRecord.getId(), null, "现品票留样"); + } + PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier()); + detail.setRemark(xppRecord.getEwm()); + pickDetailService.update(detail); + pt.setOrderQuantity(pt.getOrderQuantity() + detail.getOrderQty()); + //生成出库记录 + xppRecord.setStatus(BizStatus.RETENTION_OUT); + xppRecord.setLyData(new Timestamp(new Date().getTime())); + xppRecord.setTfLy(true); + xppRecord.setLyCode(pt.getCode()); + xppRecordService.update(xppRecord); + } + pt.setStatus(BizStatus.SHIP_ALL); + pt.setShipDate(new Timestamp(new Date().getTime())); + pickTicketService.update(pt); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + + } + + @PostMapping("/xppShipOutApp") + @Log("APP现品票出库") + @ApiOperation("APP现品票出库") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppShipOutApp(@RequestBody IScanPut iPut) { + Set ids=iPut.getIds(); + String pointCode=iPut.getPointCode(); + if(pointCode==null||pointCode.equals("")){ + return new ResponseEntity<>("出库库位必填", BAD_REQUEST); + } + Point srcPoint=pointService.getPoint(pointCode,null,null,null); + if(srcPoint==null){ + return new ResponseEntity<>(srcPoint + "库位不存在", BAD_REQUEST); + } + Area area=srcPoint.getArea(); + Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null); + if(zzkw==null){ + return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST); + } + for(Long id:ids){ + XppRecord xppRecord = xppRecordRepository.getById(id); + if(!srcPoint.getId().equals(xppRecord.getInvPoint().getId())){ + return new ResponseEntity<>(srcPoint + "库位和现品票对应不匹配"+xppRecord.getInvPoint().getCode(), BAD_REQUEST); + } + xppRecordService.xppShipOut(id,area,srcPoint,zzkw,BizStatus.SHIPPING,"现品票直接出库","现品票直接出库"); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/queryAreaCode") + @Log("APP现品票移库库区校验") + @ApiOperation("APP现品票移库库区校验") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity queryAreaCode(@RequestBody String resources) { + JSONObject jsonObject = JSONObject.parseObject(resources); + String areaCode=jsonObject.getString("areaCode"); + if (areaCode == null || areaCode.equals("")) { + return new ResponseEntity<>("库区不存在", BAD_REQUEST); + } + Area area=areaRepository.getJsKq(areaCode); + if(area==null){ + return new ResponseEntity<>(areaCode + "库区不存在", BAD_REQUEST); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + @PostMapping("/xppMoveOutApp") + @Log("APP现品票移库") + @ApiOperation("APP现品票移库") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppMoveOutApp(@RequestBody IScanPut iPut) { + Set ids=iPut.getIds(); + String pointCode=iPut.getPointCode(); + if(pointCode==null||pointCode.equals("")){ + return new ResponseEntity<>("出库库位必填", BAD_REQUEST); + } + Point jskw=pointService.getPoint(pointCode,null,null,null); + if(jskw==null){ + return new ResponseEntity<>(pointCode + "库位不存在", BAD_REQUEST); + } + String areaCode=iPut.getAreaCode(); + if (areaCode == null || areaCode.equals("")) { + return new ResponseEntity<>("库区不存在", BAD_REQUEST); + } + Area shArea=areaRepository.getJsKq(areaCode); + if(shArea==null){ + return new ResponseEntity<>(areaCode + "库区不存在", BAD_REQUEST); + } + Point zzkw=null; +// Point hcwk=null; + if(jskw.getType().equals(BaseStatus.ZZKW)){ + zzkw=jskw; +// hcwk=pointService.findEntityById(shArea.getPointId()); + }else{ +// hcwk=jskw; + //取默认制造库位 + zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null); + if(zzkw==null){ + return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST); + } + } + Dept dept= UserUtils.getDept(); + for(Long id:ids){ + XppRecord xppRecord = xppRecordRepository.getById(id); + ItemKey ik=xppRecord.getItemKey(); + //扣除库存 + xppRecordService.xppShipOut(id,xppRecord.getInvPoint().getArea(),xppRecord.getInvPoint(),zzkw,BizStatus.YK_OUT,"现品票直接移库接收","现品票直接移库接收"); + //增加库存,线边接收不需要管理到批次,重新生成itemKey + ItemKey itemKey=itemKeyService.getItemKey(ik.getItem(),null); + Inventory inventory=inventoryService.getInventory(itemKey,shArea,jskw,zzkw,dept,BizStatus.YK_JS); + double srcQty=inventory.getQuantity(); + inventory.setQuantity(inventory.getQuantity()+xppRecord.getNrs()); + inventoryService.update(inventory); + InventoryLog inventoryLog=inventoryLogService.storeInventoryLog(BizStatus.YK_JS, BizStatus.ADD, "现品票直接移库接收", shArea, itemKey, inventory.getPoint(), inventory.getPoint(), null,null, srcQty, xppRecord.getNrs()+0d,null,xppRecord.getEwm(), + BizStatus.YK_JS, xppRecord.getId(), inventory.getId(), "现品票直接移库接收"); + inventoryLog.setZzkw(zzkw); + if(shArea.getPointId()!=null) { + inventoryLog.setZckw(pointService.findEntityById(shArea.getPointId())); + } + inventoryLogService.update(inventoryLog); + xppRecord.setJsDate(new Timestamp(new Date().getTime())); + xppRecord.setFhr(SecurityUtils.getCurrentUsername()); + xppRecord.setJskw(jskw); + xppRecord.setStatus(BizStatus.YK_JS); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppInvMoveApp") + @Log("APP现品票移位") + @ApiOperation("APP现品票移位") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppInvMoveApp(@RequestBody IScanPut iPut) { + Set ids=iPut.getIds(); + String pointCode=iPut.getPointCode(); + if(pointCode==null||pointCode.equals("")){ + return new ResponseEntity<>("移位库位必填", BAD_REQUEST); + } + Point dstPoint=pointService.getPoint(pointCode,null,null,null); + if(dstPoint==null){ + return new ResponseEntity<>(dstPoint + "库位不存在", BAD_REQUEST); + } + Area dstArea=dstPoint.getArea(); + Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null); + if(zzkw==null){ + return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST); + } + for(Long id:ids){ + XppRecord xppRecord = xppRecordRepository.getById(id); + String itemCode=xppRecord.getItem().getCode(); + if(!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + throw new BadRequestException(itemCode+"现品票状态不正确"); + } + ItemKey ik = xppRecord.getItemKey(); + Point srcPoint=xppRecord.getInvPoint(); + Area srcArea=srcPoint.getArea(); + Inventory inventory=inventoryService.getInventory(ik,srcArea,srcPoint,zzkw,srcArea.getDept(),BizStatus.MOVE); + if(inventory==null){ + throw new BadRequestException(itemCode+"该库位无该批次库存"); + } + int invQty=(int)(inventory.getQuantity()- inventory.getQueuedQty()); + if(invQty rs= countMoveDetailRecordRepository.queryDetails(xppRecord.getCountCode(),xppRecord.getId()); + for(CountMoveDetailRecord r:rs){ + r.setDstPoint(dstPoint); + countMoveDetailRecordService.update(r); + } + xppRecord.setCountCode(null); + } + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/xppRecordQX") + @Log("现品票取消") + @ApiOperation("现品票取消") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity xppRecordQX(@RequestBody Long id) { + xppRecordService.xppRecordQX(id); + return new ResponseEntity<>("取消成功", HttpStatus.OK); + } + + + @PostMapping + @Log("新增xppRecord") + @ApiOperation("新增xppRecord") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity createXppRecord(@Validated @RequestBody XppRecord resources) { + return new ResponseEntity<>(xppRecordService.create(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改xppRecord") + @ApiOperation("修改xppRecord") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity updateXppRecord(@Validated @RequestBody XppRecord resources) { + xppRecordService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除xppRecord") + @ApiOperation("删除xppRecord") + @PreAuthorize("@el.check('super:man')") + public ResponseEntity deleteXppRecord(@RequestBody Long[] ids) { + for (Long id : ids) { + //查找对应的入库明细是否收货 + XppRecordDto xpp = xppRecordService.findById(id); + AsnDetail d = asnDetailService.getEntity(xpp.getAsnDetailId().getId()); + if (d.getReceivedQty() == 0) { + asnDetailService.delete(xpp.getAsnDetailId().getId()); + } else { + return new ResponseEntity(xpp.getItemCode() + "已收货,不能删除", HttpStatus.BAD_REQUEST); + } + } + xppRecordService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/xppBd") + @Log("现品票补打") + @ApiOperation("现品票补打") + @PreAuthorize("@el.check('super:man')") + @Transactional(rollbackFor = Exception.class) + public ResponseEntity xppBd( @RequestBody HashMap map) { + Long id=Long.parseLong(map.get("id").toString()); + String fzh=map.get("fzh").toString(); + String nrs=map.get("nrs").toString(); + XppRecord xpp=xppRecordRepository.getById(id); + xpp.setBdNrs(Integer.parseInt(nrs)); + xpp.setBdFzh(fzh); + if(fzh.length()!=3){ + throw new BadRequestException("分支号必须三位数"); + } + String ewm=xpp.getEwm(); + //替换后三位 + ewm=ewm.substring(0,ewm.length()-3)+fzh; + //替换数量 + String formatted = String.format("%0" + 7 + "d", xpp.getBdNrs()); + String bd_ewm=ewm.substring(0,45)+formatted+ewm.substring(52,ewm.length()); + xpp.setBdEwm(bd_ewm); + log.info(bd_ewm); + xppRecordService.update(xpp); + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/createReceipt") + @Log("现品票-生成收货清单") + @ApiOperation("现品票-生成收货清单") + @PreAuthorize("@el.check('super:man')") + @Transactional + @AnonymousAccess + public ResponseEntity createReceipt(@RequestBody Long[] ids) { + String shqdh=codeUtils.getCode_yyMMdd("SH", 3); + for (Long id : ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + if (xppRecord.getReceiptCode()!=null) { + throw new BadRequestException("现品票已生成收货清单"); + }else{ + xppRecord.setReceiptCode(shqdh); + } + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>(ApiResult.success("操作成功",shqdh), HttpStatus.OK); + } + + @PostMapping("/cancelReceipt") + @Log("现品票-取消收货清单") + @ApiOperation("现品票-取消收货清单") + @PreAuthorize("@el.check('super:man')") + @Transactional + @AnonymousAccess + public ResponseEntity cancelReceipt(@RequestBody Long[] ids) { + for (Long id : ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + xppRecord.setReceiptCode(null); + xppRecordService.update(xppRecord); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } + + @PostMapping("/adjustOut") + @Log("现品票-现品票调整出库") + @ApiOperation("现品票-现品票调整出库") + @PreAuthorize("@el.check('super:man')") + @Transactional + @AnonymousAccess + public ResponseEntity adjustOut(@RequestBody Long[] ids) { + for (Long id : ids) { + XppRecord xppRecord = xppRecordRepository.getById(id); + xppRecordService.xppShipOut(id,xppRecord.getInvPoint().getArea(),xppRecord.getInvPoint(),null,BizStatus.ADJUST_OUT,"现品票调整出库","现品票调整出库"); + } + return new ResponseEntity<>("操作成功", HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RInvQuery.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RInvQuery.java new file mode 100644 index 0000000..d10ce26 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RInvQuery.java @@ -0,0 +1,20 @@ +package com.youchain.businessdata.returnJson; + +import lombok.Data; + +import java.util.Date; + +@Data +public class RInvQuery { + Long invId; + /**物料号*/ + String itemCode; + /**物料名称*/ + String itemName; + /**库位号*/ + String pointCode; + /**数量*/ + int qty; + /**批次*/ + String propD1; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPPickList.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPPickList.java new file mode 100644 index 0000000..c04349b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPPickList.java @@ -0,0 +1,28 @@ +package com.youchain.businessdata.returnJson; + +import lombok.Data; + +@Data +public class RPPickList { + Long pickTicketId; + Long outId; + String cph; + /**单号*/ + String code; + /**工位*/ + String gw; + /**工厂*/ + String gc_code; + /**出库库区*/ + String ck_area; + /**状态*/ + String status; + /**订单数*/ + double dds; + /**备货数*/ + double bhs; + /**日期*/ + String orderDate; + + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPTaskList.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPTaskList.java new file mode 100644 index 0000000..b6441be --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RPTaskList.java @@ -0,0 +1,27 @@ +package com.youchain.businessdata.returnJson; + +import lombok.Data; + +@Data +public class RPTaskList { + Long pickDetailId; + /**工位*/ + String gw; + /**物料号*/ + String itemCode; + /**物料名称*/ + String itemName; + /**数量*/ + double qty; + /**备货数*/ + double bhs; + /**批次号*/ + String pch; + /**容器号*/ + String stockCode; + /**起点*/ + String srcPointCode; + /**终点*/ + String dstPointCode; + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RRkXpp.java b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RRkXpp.java new file mode 100644 index 0000000..326c74f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/returnJson/RRkXpp.java @@ -0,0 +1,39 @@ +package com.youchain.businessdata.returnJson; + +import lombok.Data; + +import java.util.Date; + +@Data +public class RRkXpp { + Long asnDetailId; + Long logId; + Long itemId; + /**物料号*/ + String itemCode; + /**物料名称*/ + String itemName; + /**A/C*/ + String ac; + /**订单编号*/ + String ddbh; + /**纳入数*/ + int nrs; + /**纳入日*/ + String nrzsr; + /**分支号*/ + String fzh; + /**推荐库位*/ + String tjkw; + /**供应商*/ + String gys; + /**采集时间*/ + Date cjsj; + /**现品票id*/ + Long xppRecordId; + /**现品票id*/ + Long id; + /**工位*/ + String gw; + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/AsnDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/AsnDetailService.java new file mode 100644 index 0000000..5a7de33 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/AsnDetailService.java @@ -0,0 +1,131 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.XppRecord; +import com.youchain.businessdata.service.dto.AsnDetailDto; +import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author hjl +* @date 2023-08-14 +**/ +public interface AsnDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(AsnDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(AsnDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return AsnDetailDto + */ + AsnDetailDto findById(Long id); + + AsnDetail getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return AsnDetailDto + */ + AsnDetailDto create(AsnDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(AsnDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + /** + * 删除一条数据 + * @param id / + */ + void delete(Long id); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + *dto转实体 + * @param detailDto + * @return + */ + AsnDetail toEntity(AsnDetailDto detailDto); + + /** + * 根据code查找容器 + * @param code + * @return + */ + AsnDetail findByStock(String code); + + /** + * 自动生成AsnDetail + * @param item + * @return + */ + AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint,String propC1,String gdh); + + /** + * 取消上架 + * @param taskId + * @param xppRecord + */ + + void cancelPut(Long taskId, XppRecord xppRecord); + /** + * 查询符合条件的收货明细 + * @param asnId + * @param type + * @return + */ + List findAsnDetails(Long asnId,String type); +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/AsnService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/AsnService.java new file mode 100644 index 0000000..01d4314 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/AsnService.java @@ -0,0 +1,85 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.service.dto.AsnDto; +import com.youchain.businessdata.service.dto.AsnQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author JiangKun +* @date 2024-01-09 +**/ +public interface AsnService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(AsnQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(AsnQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return AsnDto + */ + AsnDto findById(Long id); + + Asn getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return AsnDto + */ + AsnDto create(Asn resources); + + /** + * 编辑 + * @param resources / + */ + void update(Asn resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/BaseCodeService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/BaseCodeService.java new file mode 100644 index 0000000..123d0f4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/BaseCodeService.java @@ -0,0 +1,91 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.BaseCode; +import com.youchain.businessdata.service.dto.BaseCodeDto; +import com.youchain.businessdata.service.dto.BaseCodeQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2023-08-22 +**/ +public interface BaseCodeService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(BaseCodeQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BaseCodeQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return BaseCodeDto + */ + BaseCodeDto findById(Integer id); + + /** + * 创建 + * @param resources / + * @return BaseCodeDto + */ + BaseCodeDto create(BaseCode resources); + + /** + * 编辑 + * @param resources / + */ + void update(BaseCode resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Integer[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 获取BaseCode + * @param key_code 表头 + * @param len 流水号 + * @return + */ + String baseCodeFor(String key_code, int len); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountDetailService.java new file mode 100644 index 0000000..a932956 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountDetailService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.service.dto.CountDetailDto; +import com.youchain.businessdata.service.dto.CountDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-10-20 +**/ +public interface CountDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountDetailDto + */ + CountDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountDetailDto + */ + CountDetailDto create(CountDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailRecordService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailRecordService.java new file mode 100644 index 0000000..238fb51 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailRecordService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.CountMoveDetailRecord; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordDto; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-11-21 +**/ +public interface CountMoveDetailRecordService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountMoveDetailRecordQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountMoveDetailRecordQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountMoveDetailRecordDto + */ + CountMoveDetailRecordDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountMoveDetailRecordDto + */ + CountMoveDetailRecordDto create(CountMoveDetailRecord resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountMoveDetailRecord resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailService.java new file mode 100644 index 0000000..604c2f9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveDetailService.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.service.dto.CountMoveDetailDto; +import com.youchain.businessdata.service.dto.CountMoveDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-11-21 +**/ +public interface CountMoveDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountMoveDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountMoveDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountMoveDetailDto + */ + CountMoveDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountMoveDetailDto + */ + CountMoveDetailDto create(CountMoveDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountMoveDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveService.java new file mode 100644 index 0000000..82911e2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountMoveService.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.CountMove; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.dto.CountMoveDto; +import com.youchain.businessdata.service.dto.CountMoveQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-11-19 +**/ +public interface CountMoveService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountMoveQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountMoveQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountMoveDto + */ + CountMoveDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountMoveDto + */ + CountMoveDto create(CountMove resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountMove resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; + void countCheck(CountMove countMove) ; + void createCountDetail(CountMove countMove, Inventory inv, ItemKey itemKey,Point dstPoint) ; + void countXpp(CountMove countMove); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountPlanService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountPlanService.java new file mode 100644 index 0000000..686b554 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountPlanService.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.CountPlan; +import com.youchain.businessdata.service.dto.AsnDetailDto; +import com.youchain.businessdata.service.dto.CountPlanDto; +import com.youchain.businessdata.service.dto.CountPlanQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-10-19 +**/ +public interface CountPlanService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountPlanQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountPlanQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountPlanDto + */ + CountPlanDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountPlanDto + */ + CountPlanDto create(CountPlan resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountPlan resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + CountPlan toEntity(CountPlanDto planDto); + + List findAllDetail(Long planId); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/CountRecordService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/CountRecordService.java new file mode 100644 index 0000000..bb1c523 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/CountRecordService.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.CountRecord; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.service.dto.CountRecordDto; +import com.youchain.businessdata.service.dto.CountRecordQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-10-20 +**/ +public interface CountRecordService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(CountRecordQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(CountRecordQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return CountRecordDto + */ + CountRecordDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return CountRecordDto + */ + CountRecordDto create(CountRecord resources); + + /** + * 编辑 + * @param resources / + */ + void update(CountRecord resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + CountRecord createCountRecord(CountDetail d, Inventory inv); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryBakService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryBakService.java new file mode 100644 index 0000000..32b5a4a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryBakService.java @@ -0,0 +1,103 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.InventoryBak; +import com.youchain.businessdata.service.dto.InventoryBakDto; +import com.youchain.businessdata.service.dto.InventoryBakQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2024-04-03 +**/ +public interface InventoryBakService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(InventoryBakQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(InventoryBakQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return InventoryBakDto + */ + InventoryBakDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return InventoryBakDto + */ + InventoryBakDto create(InventoryBak resources); + + /** + * 编辑 + * @param resources / + */ + void update(InventoryBak resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception; + + /** + * 批量插入线边库存 + * @param areaId + */ + void insertBatch(Long detailId,Long areaId); + /** + * 批量插入线边备货库存 + * @param areaId + */ + void insertBhBatch(Long detailId,Long areaId); + + /** + * 获取线边历史库存 + * @param itemId + * @param areaId + * @param zzkwId + * @return + */ + Double getXbQty(long itemId, long areaId,Long zzkwId,Long detailId); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java new file mode 100644 index 0000000..6a39670 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryLogService.java @@ -0,0 +1,112 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.dto.InventoryLogDto; +import com.youchain.businessdata.service.dto.InventoryLogQueryCriteria; +import com.youchain.businessdata.service.vo.InventoryExcelDto; +import com.youchain.businessdata.service.vo.InventoryExcelVO; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-08-31 +**/ +public interface InventoryLogService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(InventoryLogQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(InventoryLogQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return InventoryLogDto + */ + InventoryLogDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return InventoryLogDto + */ + InventoryLogDto create(InventoryLog resources); + + /** + * 编辑 + * @param resources / + */ + void update(InventoryLog resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area,ItemKey itemKey, Point srcPoint, Point dstPoint, Stock srcStock, Stock dstStock, + Double srcQty, Double occurQty, String stockCode,String xpp,String refObj, Long refObjId, Long invId, String description); + InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area, ItemKey itemKey, Point srcPoint, Point dstPoint, + Point zzkw, Double srcQty, Double occurQty,String xpp, String refObj, Long refObjId, Long invId, String description); + + /** + * 游标分页 + * + * @param lastId 每页的最后一个id + * @param pageSize 每页数量 + * @param criteria 查询参数 + * @return List + */ + List listByInventoryLogs(Long lastId, int pageSize, InventoryLogQueryCriteria criteria); + + /** + * 导出 + * @param criteria 查询参数 + * @param response 请求 + */ + void exportInventoryLogs(InventoryLogQueryCriteria criteria, HttpServletResponse response) throws IOException; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java new file mode 100644 index 0000000..b78b168 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/InventoryService.java @@ -0,0 +1,145 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.inputJson.buttenJson.InventoryButton; +import com.youchain.businessdata.returnJson.RInvQuery; +import com.youchain.businessdata.service.dto.InvQueryCriteria; +import com.youchain.businessdata.service.dto.InventoryDto; +import com.youchain.businessdata.service.dto.InventoryQueryCriteria; +import com.youchain.modules.system.domain.Dept; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author huojin +* @date 2023-08-22 +**/ +public interface InventoryService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(InventoryQueryCriteria criteria, Pageable pageable); + + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(InventoryQueryCriteria criteria); + + List queryAll(InvQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return InventoryDto + */ + InventoryDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return InventoryDto + */ + InventoryDto create(Inventory resources); + + /** + * 编辑 + * @param resources / + */ + void update(Inventory resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + void downloadXb(List all, HttpServletResponse response) throws Exception, Exception; + + + void downloadXt(List all, HttpServletResponse response) throws Exception, Exception; + + + void downloadZz(List all, HttpServletResponse response) throws Exception, Exception; + + List queryInventoryAllocate(long itemId,long areaId,Long zzkwId); + + /** + * 得到线边库存数量 + * @param itemId + * @param areaId + * @param zzkwId + * @return + */ + Double getInvQty(long itemId, long areaId,Long zzkwId); + + List queryInventory(Long areaId,Long pointId,Long itemKeyId); + + Inventory getInventory(ItemKey itemKey, Area area, Point point,Point zzkw, Dept dept, String type); + + /** + * 满足线边耗用库存 + * @param item + * @param area + * @param gw + * @param zzkw + * @param type + * @return + */ + List getXbHyInv(Item item, Area area, String gw,Point zzkw,String type); + List getInventoryXbTl(Item item, Area area, Point point,Point zzkw); + List queryInventory(Stock stock); + + List getInvForPlan(String type,Long areaId,Long itemId,Long deptId); + + /** + * 库内移位 + * @param inventoryButton 页面操作数据 + */ + void kuneMovePosition(InventoryButton inventoryButton); + + /** + * 查询库存 + * @return + */ + List queryInvApp(String code,String pointCode); +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/ItemKeyService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/ItemKeyService.java new file mode 100644 index 0000000..60ba3da --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/ItemKeyService.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Item; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import com.youchain.businessdata.service.dto.ItemKeyQueryCriteria; +import com.youchain.modules.system.domain.Dept; +import org.springframework.data.domain.Pageable; + +import java.util.Date; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-08-21 +**/ +public interface ItemKeyService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ItemKeyQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ItemKeyQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ItemKeyDto + */ + ItemKeyDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return ItemKeyDto + */ + ItemKeyDto create(ItemKey resources); + + /** + * 编辑 + * @param resources / + */ + void update(ItemKey resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + ItemKey getItemKey(Item item, String propC1); + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java new file mode 100644 index 0000000..d3747b3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickDetailService.java @@ -0,0 +1,171 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.AutomaticPlanning; +import com.youchain.basicdata.domain.Box; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.dto.BoxDto; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.service.dto.PickDetailDto; +import com.youchain.businessdata.service.dto.PickDetailQueryCriteria; +import com.youchain.businessdata.service.dto.PickDetailZscDto; +import com.youchain.businessdata.service.dto.jsonDto.CxjlDto; +import org.springframework.data.domain.Pageable; + +import java.util.Date; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author huojin +* @date 2023-08-16 +**/ +public interface PickDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PickDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PickDetailQueryCriteria criteria); + + List queryZscAll(PickDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return PickDetailDto + */ + PickDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return PickDetailDto + */ + PickDetailDto create(PickDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(PickDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 删除出库明细更新数据 + * @param id + */ + void deletePickDetail(Long id); + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 产线叫料保存 + * @param cxjldto + * @return + */ + PickDetail cxjlCreate(CxjlDto cxjldto); + /** + * 分配 + */ + void allocate(long id,double quantity); + + /** + * 取消分配 + */ + void cancelAllocate(long id); + + /** + * 统计数量 + * @return + */ + long count(); + + /** + * Dto转实体 + * @param pickDetailDto + * @return + */ + PickDetail toEntity(PickDetailDto pickDetailDto); + + /** + * 自动生成明细 + * @param pt + * @param item + * @param po + * @param qty + * @param supplier + * @return + */ + PickDetail createPickDetail(PickTicket pt, Item item, String po, double qty,String supplier); + + /** + * 未分配的出库明细集合 + * @param picktickId + * @return + */ + List queryPickDetailList(long picktickId); + + Map queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable); + + /** + * 获取补货需求明细 + * @return + */ + List getQueryBcbl(Date blDate, Long ckAreaId, String gc); + + /** + * 得到组合最大的备货需求数 + * @param picktickId + * @param largeClass + * @return + */ + Double getMaxBomQty(long picktickId,String largeClass); + + /** + * 得到组合所有叫料明细 + * @param picktickId + * @param largeClass + * @return + */ + List getBomList(long picktickId,String largeClass); +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickInstructionService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickInstructionService.java new file mode 100644 index 0000000..6e5cd0c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickInstructionService.java @@ -0,0 +1,88 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.PickInstruction; +import com.youchain.businessdata.service.dto.PickInstructionDto; +import com.youchain.businessdata.service.dto.PickInstructionQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author DengJiangKun +* @date 2024-02-28 +**/ +public interface PickInstructionService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PickInstructionQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PickInstructionQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return PickInstructionDto + */ + PickInstructionDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return PickInstructionDto + */ + PickInstructionDto create(PickInstruction resources); + + /** + * 编辑 + * @param resources / + */ + void update(PickInstruction resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 生成备货操作 + */ + void generatePrepFlag(Long[] ids) throws Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickKitPlanService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickKitPlanService.java new file mode 100644 index 0000000..ef739ba --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickKitPlanService.java @@ -0,0 +1,96 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.PickKitPlan; +import com.youchain.businessdata.service.dto.PickKitPlanDto; +import com.youchain.businessdata.service.dto.PickKitPlanQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author DengJiangKun +* @date 2024-02-28 +**/ +public interface PickKitPlanService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PickKitPlanQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PickKitPlanQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return PickKitPlanDto + */ + PickKitPlanDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return PickKitPlanDto + */ + PickKitPlanDto create(PickKitPlan resources); + + /** + * 编辑 + * @param resources / + */ + void update(PickKitPlan resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 成套计划审核 + */ + void audit(Long[] ids); + + /** + * 成套计划取消审核 + */ + void qxAudit(Long id); + + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickOutService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickOutService.java new file mode 100644 index 0000000..a0d3c09 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickOutService.java @@ -0,0 +1,129 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.PickOut; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.PickOutButton; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.service.dto.PickOutDto; +import com.youchain.businessdata.service.dto.PickOutQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author jiangkun +* @date 2024-02-21 +**/ +public interface PickOutService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PickOutQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PickOutQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return PickOutDto + */ + PickOutDto findById(Long id); + + PickOut findByEntity(Long id); + + /** + * 创建 + * @param resources / + * @return PickOutDto + */ + PickOutDto create(PickOut resources); + + /** + * 编辑 + * @param resources / + */ + void update(PickOut resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 查询未绑定出库单的的数据 + */ + List getTaskLogNotPickOut(PickOutButton pickOutButton); + + /** + * 新政出库单维护 + */ + PickOut createPickOut(PickOutButton pickOutButton); + + /** + * 向PickOut表中追加数据 + */ + void addData(PickOutButton pickOutButton); + + + + PickOut createPickOutDto(PickOutButton pickOutButton); + + /** + * 出库确认 + */ + void confirmPickOut(PickOutButton pickOutButton); + + /** + * 发货登记 + */ + void confirmPickOutNotLog(Long pickOutId,Long pickTicketId); + /** + * 查询出库单列表 + */ + List queryOutList(IScanPut t); + + /*** + * 通过车牌号查询出库单 + * @param cph + * @return + */ + List findByOut(String cph); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PickTicketService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PickTicketService.java new file mode 100644 index 0000000..8de73d6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PickTicketService.java @@ -0,0 +1,168 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.domain.XppRecord; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.service.dto.PickTicketDto; +import com.youchain.businessdata.service.dto.PickTicketQueryCriteria; +import com.youchain.businessdata.service.dto.TaskLogDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; + +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author JiangKun +* @date 2024-01-11 +**/ +public interface PickTicketService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PickTicketQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PickTicketQueryCriteria criteria); + + /** + * 备货列表查询 + * @param t + * @return + */ + List queryPickList(IScanPut t); + + /** + * 根据ID查询 + * @param id ID + * @return PickTicketDto + */ + PickTicketDto findById(Long id); + + /** + * 根据ID查询 + * @param id ID + * @return PickTicketDto + */ + PickTicket getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return PickTicketDto + */ + PickTicketDto create(PickTicket resources); + + /** + * 编辑 + * @param resources / + */ + void update(PickTicket resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 删除出库单逻辑校验 + * @param ids + */ + void deletePickTicket(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /*** + * 根据备货计划生成备货操作 + * @param bt + * @param shArea + * @param outArea + * @param bpType + * @param jhCode + * @return + */ + PickTicket storePick( BillType bt, Area shArea, Area outArea, String bpType, String jhCode); + + /** + * 拣货操作 + */ + void pickingOperation(PickTicketButton pickTicketButton); + /** + * 查询已经完成的拣货操作的数据 + */ + List queryTaskLogDataS(Long pickTicketId); + /** + * 拣货取消操作 + */ + void pickingCancel(PickTicketButton pickTicketButton); + + /** + * 出库退回 + * @param taskLogId + * @param area + */ + void backPickOut(Long taskLogId, Area area); + + /** + * 发货登记 + * @param pickTicketId + */ + void shipmentRegistration(Long pickTicketId); + + /*** + * 单一拣货确认 + * @param taskId + * @param stockCode + * @param pickQty + * @param xpp + * @param bhr + */ + void pickForTask(Long taskId, String stockCode, double pickQty, XppRecord xpp, String bhr); + + + /** + * 线边接收确认 + * @param ids + */ + void xbjsVerify(Long[] ids); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/PlanPickDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/PlanPickDetailService.java new file mode 100644 index 0000000..bb5578e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/PlanPickDetailService.java @@ -0,0 +1,114 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.service.dto.PlanPickDetailDto; +import com.youchain.businessdata.service.dto.PlanPickDetailQueryCriteria; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author jiangkun +* @date 2024-01-23 +**/ +public interface PlanPickDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(PlanPickDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(PlanPickDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return PlanPickDetailDto + */ + PlanPickDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return PlanPickDetailDto + */ + PlanPickDetailDto create(PlanPickDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(PlanPickDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 是否有不一致工位 + * @param code + * @param gw + * @return + */ + List queryGwList(String code, String gw); + + public List queryPlanPickDetail(String code); + /** + * 是否有已出单数据 + * @param code + * @return + */ + List queryStatusList(String code); + + /** + * 自动分批备货计划 + * @param pcNum + * @param code + * @param shAreaId + * @param detail + */ + void createAutoPlan(int pcNum, String code, Long shAreaId, AutomaticPlanDetail detail, Boolean isLast, Timestamp batchTime); + + void createAutoPlan(String[] codes,Long[] detailIds,String type); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/ScreenMdService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/ScreenMdService.java new file mode 100644 index 0000000..bee43f8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/ScreenMdService.java @@ -0,0 +1,30 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import java.util.List; + + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-12-21 +**/ +public interface ScreenMdService { + List queryLayout(String zoneType); + List getLocXy(String zoneType); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/SparepartsService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/SparepartsService.java new file mode 100644 index 0000000..cf00a41 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/SparepartsService.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.service.dto.SparepartsDto; +import com.youchain.businessdata.service.dto.SparepartsQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author ShenYinAn +* @date 2024-01-30 +**/ +public interface SparepartsService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(SparepartsQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(SparepartsQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return SparepartsDto + */ + SparepartsDto findById(Long id); + + Spareparts getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return SparepartsDto + */ + SparepartsDto create(Spareparts resources); + + /** + * 编辑 + * @param resources / + */ + void update(Spareparts resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + /** + * 创建耗用记录 + * @param gw + */ + Spareparts createSpareparts(String gw, BigItem bigItem, int qty, String des); + + /** + * 零件耗用 + * @param id + */ + void hySpareParts(Long id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/TaskLogService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/TaskLogService.java new file mode 100644 index 0000000..8881be6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/TaskLogService.java @@ -0,0 +1,115 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.service.dto.TaskDto; +import com.youchain.businessdata.service.dto.TaskLogDto; +import com.youchain.businessdata.service.dto.TaskLogQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author huojin +* @date 2023-08-25 +**/ +public interface TaskLogService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TaskLogQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TaskLogQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TaskLogDto + */ + TaskLogDto findById(Long id); + + TaskLog findEntityId(Long id); + + /** + * 创建 + * @param resources / + * @return TaskLogDto + */ + TaskLogDto create(TaskLog resources); + + /** + * 编辑 + * @param resources / + */ + void update(TaskLog resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + /** + * 根据Task生成taskLog 拣货 + * @param task + * @param planQty + */ + void createTaskLogData(TaskDto task, double planQty); + + TaskLog createTaskLog(Task task, double planQty, String stockCode,String xpp,String bhr) ; + + /** + * 查询出库列表 + * @param t + * @return + */ + List queryTaskLogApp(IPTask t); + + /** + * 查找托盘号未装在的出库明细 + * @param tph + * @return + */ + List findByTph(String tph,Long outId); + + List findByLog(String xpp,String billCode); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/TaskService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/TaskService.java new file mode 100644 index 0000000..210421d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/TaskService.java @@ -0,0 +1,143 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.service.dto.TaskDto; +import com.youchain.businessdata.service.dto.TaskQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author houjianlan +* @date 2023-08-16 +**/ +public interface TaskService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TaskQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TaskQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TaskDto + */ + TaskDto findById(Long id); + + Task getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return TaskDto + */ + TaskDto create(Task resources); + + /** + * 编辑 + * @param resources / + */ + void update(Task resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + void delete(Long id); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + Task toEntity(TaskDto taskDto); + + /** + * + * */ + Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty); + /** + * 根据出库单明细查询未完成的Task集合 + * @param id + * @return + */ + List getPickNotAllTask(Long id); + + /** + * 根据出库单明细查询已完成的Task集合 + * @param id + * @return + */ + List getPickAllTask(Long id); + + /** + * 拣货 + * @param taskId + * @throws Exception + */ + void pickConfirm(long taskId,double pickedQuantity) throws Exception; + + /** + * 退货 + * @param taskId + * @throws Exception + */ + void pickBarBack(long taskId,double pickedQuantity) throws Exception; + + + /** + * 查询待拣货任务 + * @param t 条件参数 + * @return List + */ + List queryTaskApp(IPTask t); + + List getAgvTaskList(Integer id); + + List findbyPointCode(Long boxId); + + List queryTask(Long asnDetailId,Long pickDetailId,Long ikId,Long pickId,Long srcPointId); + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java new file mode 100644 index 0000000..f2338ab --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/XppRecordService.java @@ -0,0 +1,124 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.XppRecord; +import com.youchain.businessdata.inputJson.buttenJson.XppRecordButton; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.dto.XppRecordDto; +import com.youchain.businessdata.service.dto.XppRecordQueryCriteria; +import com.youchain.businessdata.service.dto.XppRecordViewDto; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author baobinglin +* @date 2024-01-04 +**/ +public interface XppRecordService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(XppRecordQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * + * @param criteria 条件参数 + * @return List + */ + List queryAll(XppRecordQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return XppRecordDto + */ + XppRecordDto findById(Long id); + + XppRecord getEntity(Long id); + + /** + * 创建 + * @param resources / + * @return XppRecordDto + */ + XppRecordDto create(XppRecord resources); + + /** + * 编辑 + * @param resources / + */ + void update(XppRecord resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; + + XppRecord collectFromPass(String resources); + + AsnDetail addAsnDetail(XppRecord xpp); + + /** + * 现品票取消 + */ + + void xppRecordQX(Long id); + + /** + * 现品票还样部分 + */ + void xpphybf(XppRecordButton xppRecordButton); + + /** + * 现品票解析 + * @param xppRecord + * @return + */ + RRkXpp xppAnalysis(XppRecord xppRecord) ; + + /** + * 现品票出库 + * @param id + * @param area + * @param srcPoint + * @param zzkw + * @param type + */ + void xppShipOut(Long id, Area area, Point srcPoint, Point zzkw, String type,String billCode,String des); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailDto.java new file mode 100644 index 0000000..07491ff --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailDto.java @@ -0,0 +1,129 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.ItemSmallDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author hjl +* @date 2023-08-14 +**/ +@Data +public class AsnDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 订单序号 */ + private AsnDto asn; + + /** 物料 */ + private ItemSmallDto item; + + /** 容器 */ + private StockDto stock; + + /** 点位 */ + private PointDto point; + + /** 行号 */ + private Long lineNo; + + /** MO票 */ + private String po; + + /** 状态 */ + private String status; + + /** 订单数量 */ + private Double orderQty; + + /** 收货数量 */ + private Double receivedQty; + + /** 移位数量 */ + private Double moveQty; + + /** 上架数量 */ + private Double putQty; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double volume; + + /** 备注 */ + private String remark; + + /** 批次号 */ + private String propC1; + + /** 序列号 */ + private String propC2; + + /** 属性3 */ + private String propC3; + + /** 属性4 */ + private String propC4; + + /** 属性5 */ + private String propC5; + + /** 属性6 */ + private String propC6; + + /** 生产日期 */ + private Timestamp propD1; + + /** 到期日期 */ + private Timestamp propD2; + + /** 仓库ID */ + private DeptSmallDto dept; + + /** 来源名称 */ + private String sourceName; + + /** 来源序号 */ + private Long sourceId; + + private String orderNumber; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailQueryCriteria.java new file mode 100644 index 0000000..b37aafd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDetailQueryCriteria.java @@ -0,0 +1,62 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author hjl +* @date 2023-08-14 +**/ +@Data +public class AsnDetailQueryCriteria{ + + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "item", propName="code",type = Query.Type.INNER_LIKE) + private String itemCode; + + /** 模糊 */ + @Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + /** 模糊 */ + @Query(joinName = "item", propName="goodType",type = Query.Type.IN) + private Set goodType = new HashSet<>(); + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String po; + + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String status; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + /** 模糊 */ + @Query(joinName = "asn", propName="id",type = Query.Type.EQUAL) + private Long asnId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDto.java new file mode 100644 index 0000000..b7a5a33 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnDto.java @@ -0,0 +1,113 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-09 +**/ +@Data +public class AsnDto implements Serializable { + + /** ID */ + private Long id; + + /** 单号 */ + private String code; + + /** 库区 */ + private AreaDto area; + + /** 状态 */ + private String status; + + /** 客户订单号 */ + private String cusCode; + + /** 相关单号1 */ + private String relatedBill1; + + /** 相关单号2 */ + private String relatedBill2; + + /** 相关单号3 */ + private String relatedBill3; + + /** 订单日期 */ + private Timestamp orderDate; + + /** 预计到货日期 */ + private Timestamp estimateDate; + + /** 收货日期 */ + private Timestamp receivedDate; + + /** 发货方 */ + private String fromName; + + /** 发货地址 */ + private String fromAddress; + + /** 发货联系人 */ + private String fromMan; + + /** 发货电话 */ + private String fromTel; + + /** 订单数量 */ + private Double orderQuantity; + + /** 收货数量 */ + private Double receivedQuantity; + + /** 上架数量 */ + private Double putawayQuantity; + + /** 车牌号 */ + private String vehicle; + + /** 单据类型 */ + private BillTypeDto billType; + + /** 仓库ID */ + private DeptDto dept; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnQueryCriteria.java new file mode 100644 index 0000000..250ca5e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/AsnQueryCriteria.java @@ -0,0 +1,43 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.security.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-09 +**/ +@Data +public class AsnQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "area", propName="code",type = Query.Type.EQUAL) + private String areaCode; + + /** 模糊 */ + @Query(type = Query.Type.EQUAL) + private String status; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeDto.java new file mode 100644 index 0000000..915e294 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeDto.java @@ -0,0 +1,37 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author baobinglin +* @date 2023-08-22 +**/ +@Data +public class BaseCodeDto implements Serializable { + + private String code; + + private Integer id; + + private String key; + + private String value; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeQueryCriteria.java new file mode 100644 index 0000000..d0b93c7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/BaseCodeQueryCriteria.java @@ -0,0 +1,39 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-08-22 +**/ +@Data +public class BaseCodeQueryCriteria{ + /** 精确 */ + @Query + private String code; + /** 精确 */ + @Query + private String key; + + /** 精确 */ + @Query + private String value; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailDto.java new file mode 100644 index 0000000..5fc6f02 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailDto.java @@ -0,0 +1,79 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.businessdata.domain.CountPlan; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-20 +**/ +@Data +public class CountDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 盘点 */ + private CountPlanDto plan; + + /** 物料 */ + private ItemDto item; + + /** 库区 */ + private AreaDto area; + + /** 仓库 */ + private DeptDto warehouse; + + /** 库存 */ + private Long invId; + + /** 计划数量 */ + private Double planQty; + + /** 盘点数量 */ + private Double countQty; + + /** 备注 */ + private String remark; + + /** 仓库ID */ + private Dept dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailQueryCriteria.java new file mode 100644 index 0000000..869553f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountDetailQueryCriteria.java @@ -0,0 +1,31 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@Data +public class CountDetailQueryCriteria{ + @Query(joinName = "plan", propName="id",type = Query.Type.EQUAL) + private Long planId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailDto.java new file mode 100644 index 0000000..8e87e9e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailDto.java @@ -0,0 +1,76 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.PointDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-21 +**/ +@Data +public class CountMoveDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料 */ + private ItemKeyDto itemKey; + + /** 库存 */ + private Long invId; + + /** 原库位 */ + private PointDto srcPoint; + + /** 目标库位 */ + private PointDto dstPoint; + + /** 盘点数量 */ + private Double countQty; + + /** 盘点状态 */ + private String status; + + /** 备注 */ + private String remark; + + /** 仓库ID */ + private Long deptId; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 盘点序号 */ + private CountMoveDto countMove; + + /** 订单数量 */ + private Double orderQty; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailQueryCriteria.java new file mode 100644 index 0000000..fc3111b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailQueryCriteria.java @@ -0,0 +1,31 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@Data +public class CountMoveDetailQueryCriteria{ + @Query(joinName = "countMove", propName="id",type = Query.Type.EQUAL) + private Long countMoveId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordDto.java new file mode 100644 index 0000000..133f644 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordDto.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.businessdata.domain.CountMove; +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-21 +**/ +@Data +public class CountMoveDetailRecordDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料 */ + private ItemKeyDto itemKey; + + /** 原库位 */ + private PointDto srcPoint; + + /** 盘点库位 */ + private PointDto countPoint; + + /** 目标库位 */ + private PointDto dstPoint; + + /** 计划数量 */ + private Double planQty; + + /** 现品票序号 */ + private XppRecordDto xpp; + + /** 现品票二维码 */ + private String xppEwm; + + /** 现品票数量 */ + private Double xppQty; + + /** 盘点数量 */ + private Double countQty; + + /** 盘点状态 */ + private String status; + + /** 备注 */ + private String remark; + + /** 仓库ID */ + private DeptDto dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 盘点明细序号 */ + private CountMoveDetail countMoveDetail; + + /** 盘点序号 */ + private CountMove countMove; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordQueryCriteria.java new file mode 100644 index 0000000..b1e2999 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDetailRecordQueryCriteria.java @@ -0,0 +1,46 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@Data +public class CountMoveDetailRecordQueryCriteria{ + + @Query(joinName = "countMove", propName="code" ,type = Query.Type.INNER_LIKE) + private String countMoveCode; + + @Query(joinName = "itemKey>item>", propName="code" ,type = Query.Type.INNER_LIKE) + private String itemCode; + + @Query(joinName = "itemKey>item>", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + @Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE) + private String propC1; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDto.java new file mode 100644 index 0000000..6f57d87 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveDto.java @@ -0,0 +1,88 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-11-19 +**/ +@Data +public class CountMoveDto implements Serializable { + + /** 序号 */ + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 移出库区 */ + private AreaDto srcArea; + + /** 目标库区 */ + private AreaDto dstArea; + + /** 目标库位 */ + private PointDto dstPoint; + + /** 仓库ID */ + private DeptDto dept; + + /** 状态 */ + private String status; + + /** 类型 */ + private String type; + + /** 订单数量 */ + private Double orderQty; + + /** 盘点数量 */ + private Double countQty; + + /** 备注 */ + private String remark; + + /** 来源名称 */ + private String sourceName; + + /** 来源序号 */ + private Long sourceId; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveQueryCriteria.java new file mode 100644 index 0000000..0f4b27d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountMoveQueryCriteria.java @@ -0,0 +1,45 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-19 +**/ +@Data +public class CountMoveQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 精确 */ + @Query + private Long srcAreaId; + + /** 精确 */ + @Query + private Long dstAreaId; + + /** 精确 */ + @Query + private String status; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanDto.java new file mode 100644 index 0000000..f1940b2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanDto.java @@ -0,0 +1,80 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.serializer.ToStringSerializer; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-19 +**/ +@Data +public class CountPlanDto implements Serializable { + + /** 序号 */ + /** 防止精度丢失 */ + @JSONField(serializeUsing = ToStringSerializer.class) + private Long id; + + /** 代码 */ + private String code; + + /** 名称 */ + private String name; + + /** 仓库ID */ + private Dept dept; + + /** 状态 */ + private String status; + + /** 类型 */ + private String type; + + /** 订单数量 */ + private Double orderQty; + + /** 盘点数量 */ + private Double countQty; + + /** 备注 */ + private String remark; + + /** 来源名称 */ + private String sourceName; + + /** 来源序号 */ + private Long sourceId; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanQueryCriteria.java new file mode 100644 index 0000000..fe791ff --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountPlanQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-19 +**/ +@Data +public class CountPlanQueryCriteria{ + + /** 精确 */ + @Query + private String type; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordDto.java new file mode 100644 index 0000000..4fd2e16 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordDto.java @@ -0,0 +1,111 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-10-20 +**/ +@Data +public class CountRecordDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料序号 */ + private Item item; + + /** 物料序号 */ + private ItemKey itemKey; + + /** 单据号 */ + private String billCode; + + /** 盘点明细ID */ + private CountDetail countDetail; + + /** 源容器 */ + private Stock srcStock; + + /** 目标容器 */ + private Stock dstStock; + + /** 源点位 */ + private Point srcPoint; + + /** 目标点位 */ + private Point dstPoint; + + /** 源容器编码 */ + private String srcStockCode; + + /** 目标容器编码 */ + private String dstStockCode; + + /** 源点位编码 */ + private String srcPointCode; + + /** 目标点位编码 */ + private String dstPointCode; + + /** 属性6 */ + private String invStatus; + + /** 属性6 */ + private String taskStatus; + + /** 跳过 */ + private Boolean beSkip; + + /** 退回 */ + private Boolean beBack; + + /** 计划数量 */ + private Double planQty; + + /** 移位数量 */ + private Double countQty; + + /** 库存ID */ + private Long invId; + + /** 仓库ID */ + private Dept dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordQueryCriteria.java new file mode 100644 index 0000000..4147e8f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/CountRecordQueryCriteria.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@Data +public class CountRecordQueryCriteria{ + + @Query(joinName = "countDetail>plan>", propName="id",type = Query.Type.EQUAL) + private String planId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InvQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InvQueryCriteria.java new file mode 100644 index 0000000..99d0963 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InvQueryCriteria.java @@ -0,0 +1,42 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.annotation.Query; +import lombok.Data; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-22 +**/ +@Data +public class InvQueryCriteria { + + @Query(joinName = "itemKey", propName="id") + + private long itemKeyId; + + @Query(joinName = "point", propName="id") + private long pointId; + + @Query(joinName = "stock", propName="id") + private long stockId; + + @Query(joinName = "dept", propName="id") + private long deptId; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakDto.java new file mode 100644 index 0000000..dbfb000 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakDto.java @@ -0,0 +1,114 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2024-04-03 +**/ +@Data +public class InventoryBakDto implements Serializable { + + /** ID */ + private Long id; + + /** 单据号 */ + private String billCode; + + /** 物料属性 */ + private ItemKey itemKey; + + /** 物料属性 */ + private Item item; + + /** 点位 */ + private PointDto point; + + /** 点位号 */ + private String pointCode; + + /** 容器 */ + private StockDto stock; + + /** 容器号 */ + private String stockCode; + + /** 大容器 */ + private StockDto bigStock; + + /** 数量 */ + private Double quantity; + + /** 分配数 */ + private Double queuedQty; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double volume; + + /** 描述 */ + private String description; + + /** 是否锁定 */ + private Boolean beLock; + + /** 是否不良品 */ + private Boolean beReject; + + /** 状态 */ + private String status; + + /** 存货日期 */ + private Timestamp storageDate; + + /** 仓库ID */ + private DeptDto dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 库区 */ + private AreaDto area; + + /** 制造库位 */ + private PointDto zzkw; + + /** 备份日期 */ + private Timestamp bfDate; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakQueryCriteria.java new file mode 100644 index 0000000..dd8686f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryBakQueryCriteria.java @@ -0,0 +1,29 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-03 +**/ +@Data +public class InventoryBakQueryCriteria{ +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryDto.java new file mode 100644 index 0000000..8e7eab7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryDto.java @@ -0,0 +1,107 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.service.dto.DeptDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2023-08-22 +**/ +@Data +public class InventoryDto implements Serializable { + + /** ID */ + private Long id; + + /** 单据号 */ + private String billCode; + + /** 物料属性 */ + private ItemKeyDto itemKey; + + /** 点位 */ + private PointDto point; + + /** 点位号 */ + private String pointCode; + + /** 容器 */ + private StockDto stock; + + /** 容器号 */ + private String stockCode; + + /** 大容器 */ + private StockDto bigStock; + + /** 数量 */ + private int quantity; + + /** 分配数 */ + private int queuedQty; + + /** 重量 */ + private Double weight; + + /** 体积 */ + private Double volume; + + /** 描述 */ + private String description; + + /** 是否锁定 */ + private Boolean beLock; + + /** 是否不良品 */ + private Boolean beReject; + + /** 状态 */ + private String status; + + /** 存货日期 */ + private Timestamp storageDate; + + /** 仓库ID */ + private DeptDto dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 库区 */ + private AreaDto area; + + /** 制造库位 */ + private PointDto zzkw; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogDto.java new file mode 100644 index 0000000..da8d9e5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogDto.java @@ -0,0 +1,128 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-31 +**/ +@Data +public class InventoryLogDto implements Serializable { + + /** ID */ + private Long id; + + /** 操作类型 */ + private String logType; + + /** 增加/减少 */ + private String incDec; + + /** 单据号 */ + private String relatedBill; + + /** 点位 */ + private ItemKey itemKey; + + /** 存货日期 */ + private Timestamp storagedate; + + /** 入库单号 */ + private String soi; + + /** 发生数量 */ + private Double occurQuantity; + + /** 发生时间 */ + private Timestamp occurTime; + + /** 状态 */ + private String status; + + /** 引用对象 */ + private String refObj; + + /** 引用ID */ + private Long refObjId; + + /** 描述 */ + private String description; + + /** 仓库ID */ + private Dept dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 源点位 */ + private Point srcPoint; + + /** 源点位号 */ + private String srcPointCode; + + /** 源容器 */ + private Stock srcStock; + + /** 源容器号 */ + private String srcStockCode; + + /** 点位 */ + private Point dstPoint; + + /** 目标点位号 */ + private String dstPointCode; + + /** 目标容器 */ + private Stock dstStock; + + /** 目标容器号 */ + private String dstStockCode; + + /** 源数量 */ + private Double srcQty; + + /** 目标数量 */ + private Double dstQty; + + /** 库区 */ + private AreaDto area; + + /** 制造库位 */ + private PointDto zzkw; + + private PointDto zckw; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogQueryCriteria.java new file mode 100644 index 0000000..29c5917 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryLogQueryCriteria.java @@ -0,0 +1,65 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-31 +**/ +@Data +public class InventoryLogQueryCriteria{ + /** 操作类型 */ + @Query(type = Query.Type.EQUAL) + private String logType; + + @Query(type = Query.Type.LEFT_LIKE) + private String relatedBill; + + + /** 增加/减少 */ + @Query(type = Query.Type.EQUAL) + private Integer incDec; + + @Query(joinName = "itemKey>item>", propName="code" ,type = Query.Type.INNER_LIKE) + private String itemCode; + + @Query(joinName = "itemKey>item>", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + @Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE) + private String propC1; + + + /** 源点位号 */ + @Query(type = Query.Type.EQUAL) + private String srcPointCode; + + @Query(joinName = "area",propName = "code",type = Query.Type.EQUAL) + private String areaCode; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryQueryCriteria.java new file mode 100644 index 0000000..9236a66 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/InventoryQueryCriteria.java @@ -0,0 +1,89 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Item; +import com.youchain.businessdata.domain.ItemKey; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.validation.constraints.NotBlank; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-22 +**/ +@Data +public class InventoryQueryCriteria{ + + /*@Query(joinName = "itemKey>item>", propName="code" ,type = Query.Type.INNER_LIKE) + private String itemCode;*/ + + @Query(joinName = "itemKey>item>", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + @Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE) + private String propC1; + + @Query(joinName = "itemKey>item>", propName="code",type = Query.Type.IN) + private List itemCode; + + @Query(joinName = "itemKey>item>", propName="code" ,type = Query.Type.INNER_LIKE) + private String itemCodeOne; + + + /** + * 生成日期 + */ + @Query(joinName = "itemKey>", propName="propD1",type = Query.Type.EQUAL) + private Timestamp propD1; + + // NOT_EQUAL 不等于 + @Query(type = Query.Type.NOT_EQUAL) + private Double quantity; + + @Query(joinName = "stock", propName="name",type = Query.Type.INNER_LIKE) + private String stockName; + + @Query(joinName = "area",propName = "name",type = Query.Type.INNER_LIKE) + private String areaName; + + @Query(joinName = "area",propName = "name",type = Query.Type.IN) + private List areaNames; + + @Query(joinName = "point",propName = "code",type = Query.Type.INNER_LIKE) + private String pointCode; + + @Query(joinName = "point",propName = "type",type = Query.Type.EQUAL) + private String pointType; + + + @Query(type = Query.Type.EQUAL) + /** 物料属性 */ + private ItemKey itemKey; + + @Query(joinName = "area",propName = "bexb",type = Query.Type.EQUAL) + private Boolean bexb; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyDto.java new file mode 100644 index 0000000..4106acc --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyDto.java @@ -0,0 +1,80 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Item; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-21 +**/ +@Data +public class ItemKeyDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料序号 */ + private Item item; + + /** 批次号 */ + private String propC1; + + /** 序列号 */ + private String propC2; + + /** 属性3 */ + private String propC3; + + /** 属性4 */ + private String propC4; + + /** 属性5 */ + private String propC5; + + /** 属性6 */ + private String propC6; + + /** 生产日期 */ + private Timestamp propD1; + + /** 到期日期 */ + private Timestamp propD2; + + /** 仓库ID */ + private Dept dept; + + /** 工单号 */ + private String orderNumber; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyQueryCriteria.java new file mode 100644 index 0000000..2214315 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/ItemKeyQueryCriteria.java @@ -0,0 +1,47 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-21 +**/ +@Data +public class ItemKeyQueryCriteria{ + /** 等于批次号 */ + @Query(type = Query.Type.EQUAL) + private String propC1; + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String propC2; + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String propC3; + + @Query(joinName = "item", propName="id",type = Query.Type.EQUAL) + private long itemId; + + @Query(joinName = "dept", propName="id",type = Query.Type.EQUAL) + private long deptId; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailDto.java new file mode 100644 index 0000000..948467c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailDto.java @@ -0,0 +1,259 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.ItemSmallDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.modules.system.domain.Dept; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author huojin + * @website https://eladmin.vip + * @description / + * @date 2023-08-16 + **/ +@Data +public class PickDetailDto implements Serializable { + + /** + * ID + */ + private Long id; + + /** + * 订单序号 + */ + private Long pickId; + + /** + * 物料序号 + */ + private ItemDto item; + + /** + * 行号 + */ + private Long lineNo; + + /** + * po订单号 + */ + private String po; + + /** + * 状态 + */ + private String status; + + /** + * 订单数量 + */ + private Double orderQty; + + /** + * 分配数量 + */ + private Double allocatedQty; + + /** + * 拣货数量 + */ + private Double pickedQty; + + /** + * 发运数量 + */ + private Double shippedQty; + + /** + * 重量 + */ + private Double weight; + + /** + * 体积 + */ + private Double volume; + + /** + * 备注 + */ + private String remark; + + /** + * 批次号 + */ + private String propC1; + + /** + * 序列号 + */ + private String propC2; + + /** + * 属性3 + */ + private String propC3; + + /** + * 纯需求 + */ + private Double propC4; + + /** + * 属性5 + */ + private String propC5; + + /** + * 属性6 + */ + private String propC6; + + /** + * 生产日期 + */ + private Timestamp propD1; + + /** + * 到期日期 + */ + private Timestamp propD2; + + /** + * 仓库ID + */ + private Dept dept; + + /** + * 来源名称 + */ + private String sourceName; + + /** + * 来源序号 + */ + private Long sourceId; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建时间 + */ + private Timestamp createTime; + + /** + * 修改时间 + */ + private Timestamp updateTime; + /** + * 出库管理主表 + */ + private PickTicketDto pickTicket; + + /** + * 点位 + */ + private PointDto point; + + /** + * 需求数量 + */ + private Double xqQty; + + /** + * 纯需求数量 + */ + private Double pureReqQty; + + /** + * 纯需求不足 + */ + private Double pureXqBz; + + /** + * 线边数量 + */ + private Double xbQty; + /** + * 线边备货数量 + */ + private Double xbBhQty; + + /** + * 原备货需求数量 + */ + private Double yStkDemandQty; + + /** + * 原纯需求数 + */ + private Double yReqQty; + + /** + * 加工内容 + */ + private String contents; + + /** + * AC + */ + private String ac; + + /** + * 供应商名 + */ + private String supplier; + + /** + * 投料数量 + */ + private Double tlQty; + + /** + * 接收数量 + */ + private Double jsQty; + + private String invQty; + + /** BOM序号 */ + private Long bomId; + + private Double bcQty=0d; + /** 出库库区 */ + private AreaDto area; + + /** 收货库区 */ + private AreaDto shArea; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailQueryCriteria.java new file mode 100644 index 0000000..d2a26a3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailQueryCriteria.java @@ -0,0 +1,78 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-16 +**/ +@Data +public class PickDetailQueryCriteria{ + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "item", propName="code",type = Query.Type.INNER_LIKE) + private String itemCode; + + /** 模糊 */ + @Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + /** 入库库区 */ + @Query(joinName = "shArea", propName="code",type = Query.Type.INNER_LIKE) + private String rkAreaCode; + @Query(joinName = "area", propName="code",type = Query.Type.INNER_LIKE) + private String ckAreaCode; + + /** 接收工厂 */ + @Query(joinName = "pickTicket", propName="gcCode",type = Query.Type.INNER_LIKE) + private String gcCode; + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String po; + /** 需求不足*/ + @Query(type = Query.Type.GREATER_THAN) + private Double pureXqBz; + /** 可用库存数*/ + @Query(type = Query.Type.GREATER_THAN) + private Double invQty; + + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String status; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + /** 模糊 */ + @Query(joinName = "pickTicket", propName="id",type = Query.Type.EQUAL) + private Long pickTicketId; + + /** 备货单号 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 页面类型 ZSC指示残 ALL明细 */ + @Query(type = Query.Type.EQUAL) + private String pageType; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailZscDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailZscDto.java new file mode 100644 index 0000000..49bad4f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickDetailZscDto.java @@ -0,0 +1,173 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author huojin + * @website https://eladmin.vip + * @description / + * @date 2023-08-16 + **/ +@Data +public class PickDetailZscDto implements Serializable { + + /** + * ID + */ + private Long id; + + /** + * 出库管理主表 + */ + private String code; + private String gc_code; + private String rk_name; + private String rk_code; + private String ck_name; + private String ck_code; + private String pc; + /** + * 状态 + */ + private String status; + + /** 订单日期 */ + private Timestamp order_date; + + /** + * 物料序号 + */ + private String item_code; + + private String item_name; + private String unit; + + /** + * 需求数量 + */ + private Double xq_qty; + /** + * 收容数 + */ + private String extend_d3; + /** + * 纯需求 + */ + private Double prop_c4; + /** + * 纯需求不足 + */ + private Double pure_xq_bz; + + /** + * 订单数量 + */ + private Double order_qty; + + /** + * 分配数量 + */ + private Double allocated_qty; + + /** + * 拣货数量 + */ + private Double picked_qty; + + /** + * 发运数量 + */ + private Double shipped_qty; + /** + * 线边数量 + */ + private Double xb_qty; + + /** + * 未出单数 + */ + private Double wcd_qty; + /** + * 供应商名 + */ + private String supplier; + + /** + * 加工内容 + */ + private String contents; + + /** + * AC + */ + private String ac; + + /** + * 库存数 + */ + private String inv_qty; + + /** + * 波次补料数量 + */ + private String bc_qty; + /** + * 制造库位 + */ + private String zzkw_code; + /** + * 设变品番号 + */ + private String sb_item_code; + + /** + * 备注 + */ + private String remark; + + /** + * 仓库ID + */ + private Dept dept; + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建时间 + */ + private Timestamp createTime; + + /** + * 修改时间 + */ + private Timestamp updateTime; + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionDto.java new file mode 100644 index 0000000..d795426 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionDto.java @@ -0,0 +1,105 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Data +public class PickInstructionDto implements Serializable { + + /** ID */ + private Long id; + + /** 指示单号 */ + private String allocationNumber; + + /** 指示日期 */ + private Timestamp allocationDate; + + /** 入库库区 */ + private AreaDto rkArea; + + /** 品番 */ + private ItemDto item; + + /** A/C */ + private String ac; + + /** 加工内容 */ + private String processContent; + + /** 税别 */ + private String taxCategory; + + /** 出库类型 */ + private BillTypeDto outKType; + + /** 状态 */ + private String status; + + /** 指示数量 */ + private Double indicatedQty; + + /** 出单数量 */ + private Double allocatedQty; + + /** 本次出单数 */ + private Double bcAllocatedQty; + + /** 备货数量 */ + private Double pickedQty; + + /** 在途数量 */ + private Double ztQty; + + /** 制造库位 */ + private PointDto zzkwPoint; + + /** 出库库区 */ + private AreaDto ckArea; + + /** 成套单号 */ + private String kitNumber; + + /** 备注 */ + private String remark; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + /** BOM序号 */ + private Long bomId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionQueryCriteria.java new file mode 100644 index 0000000..330f702 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickInstructionQueryCriteria.java @@ -0,0 +1,43 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Data +public class PickInstructionQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String allocationNumber; + /** 成套单号 */ + @Query(type = Query.Type.INNER_LIKE) + private String kitNumber; + @Query(joinName = "workArea", propName = "workingStation", type = Query.Type.INNER_LIKE) + private String workAreaCode; + @Query(joinName = "item", propName = "code", type = Query.Type.INNER_LIKE) + private String itemCode; + @Query(joinName = "item", propName = "name", type = Query.Type.INNER_LIKE) + private String itemName; + @Query(type = Query.Type.EQUAL) + private String status; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanDto.java new file mode 100644 index 0000000..ad6bfae --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanDto.java @@ -0,0 +1,72 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BigItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Data +public class PickKitPlanDto implements Serializable { + + /** ID */ + private Long id; + + /** 计划号 */ + private String planNumber; + + /** 工位 */ + private AreaDto workArea; + + /** 计划日期 */ + private Timestamp planDate; + + /** Bom完成品工位清单 */ + private BigItemDto bigItem; + + /** 状态 */ + private String status; + + /** 备注 */ + private String remark; + + /** 订单数量 */ + private Double orderQty; + + /** 出单数量 */ + private Double allocatedQty; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanQueryCriteria.java new file mode 100644 index 0000000..e3c8a70 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickKitPlanQueryCriteria.java @@ -0,0 +1,45 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Data +public class PickKitPlanQueryCriteria{ + /** + * 状态 + */ + @Query(type = Query.Type.EQUAL) + private String status; + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String planNumber; + + @Query(joinName = "workArea", propName = "workingStation", type = Query.Type.INNER_LIKE) + private String workAreaWorkingStation; + + @Query(joinName = "bigItem", propName = "name", type = Query.Type.INNER_LIKE) + private String bigItemName; + @Query(joinName = "bigItem", propName = "code", type = Query.Type.INNER_LIKE) + private String bigItemCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutDto.java new file mode 100644 index 0000000..18f5cb6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutDto.java @@ -0,0 +1,92 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.service.dto.AreaDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author jiangkun +* @date 2024-02-21 +**/ +@Data +public class PickOutDto implements Serializable { + + /** ID */ + private Long id; + + /** 单号 */ + private String orderNo; + + /** 车牌号 */ + private String plateNo; + + /** 订单数量 */ + private Double orderQty; + + /** 出库数量 */ + private Double dispatchQty; + + /** 是否启用 */ + private Boolean enabled; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改日期 */ + private Timestamp updateTime; + + /** 状态 */ + private String status; + /**备货单号*/ + private String bhNo; + /**出库库区*/ + private AreaDto area; + /**入库库区*/ + private AreaDto shArea; + + private String slBy; + + private Double slQty=0d; + + private Timestamp slDate; + + private Timestamp tlDate; + + private String tlBy; + + private Double tlQty=0d; + + /**接收工厂*/ + private String gcCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutQueryCriteria.java new file mode 100644 index 0000000..04082b7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickOutQueryCriteria.java @@ -0,0 +1,54 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-02-21 +**/ +@Data +public class PickOutQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String orderNo; + + @Query(type = Query.Type.INNER_LIKE) + private String gcCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String plateNo; + /** 模糊 */ + @Query(type = Query.Type.EQUAL) + private String status; + + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "shArea", propName="code",type = Query.Type.EQUAL) + private String shAreaCode; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketDto.java new file mode 100644 index 0000000..793f4c9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketDto.java @@ -0,0 +1,174 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BillType; +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; + +import java.sql.Time; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author JiangKun +* @date 2024-01-11 +**/ +@Data +public class PickTicketDto implements Serializable { + + /** ID */ + private Long id; + + /** 出库库区 */ + private AreaDto area; + + /** 收货库区 */ + private AreaDto shArea; + /**工厂*/ + private String gcCode; + + /** 单号 */ + private String code; + + /** 状态 */ + private String status; + + /** 客户订单号 */ + private String cusCode; + + /** 相关单号1 */ + private String relatedBill1; + + /** 相关单号2 */ + private String relatedBill2; + + /** 相关单号3 */ + private String relatedBill3; + + /** 订单日期 */ + private Timestamp orderDate; + + /** 发货日期 */ + private Timestamp shipDate; + + /** 发货人 */ + private String fhBy; + + /** 到达日期 */ + private Timestamp receivedDate; + + /** 接收人 */ + private String slBy; + + /** 收料数量 */ + private Double slQty; + + /** 投料日期 */ + private Timestamp tlDate; + private Timestamp slDate; + /** 投料人 */ + private String tlBy; + + /** 投料数量 */ + private Double tlQty; + + /** 收货方 */ + private String shipToName; + + /** 收货地址 */ + private String shipAddress; + + /** 收货联系人 */ + private String shipMan; + + /** 收货电话 */ + private String shipTel; + + /** 订单数量 */ + private Double orderQuantity; + + /** 出单数量 */ + private Double allocatedQuantity; + + /** 拣货数量 */ + private Double pickedQuantity; + + /** 发运数量 */ + private Double shippedQuantity; + + /** 线边数量 */ + private Double xbQty; + + /** 在途数量 */ + private Double ztQty; + + /** 需求数量 */ + private Double xqQty; + + /** 备货数量 */ + private Double bhQty; + + /** 车牌号 */ + private String vehicle; + + /** 单据类型 */ + private BillTypeDto billType; + + /** 部品种类 */ + private String bpType; + + /** 仓库ID */ + private DeptSmallDto deptId; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + + /** 纯需求数量 */ + private Double pureReqQty; + + /** 备货需求数量 */ + private Double prepRe; + + /** 出单日期 */ + private Timestamp outOrderDate; + + /** 备货日期 */ + private Timestamp stockingDate; + + private Double bcQty=0d; + private String pc; + private Timestamp batchTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketQueryCriteria.java new file mode 100644 index 0000000..8b10b17 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PickTicketQueryCriteria.java @@ -0,0 +1,77 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-11 +**/ +@Data +public class PickTicketQueryCriteria{ + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE,propName="code") + private String code; + + @Query(type = Query.Type.INNER_LIKE) + private String gcCode; + /** 模糊 */ + @Query(type = Query.Type.EQUAL,propName="code") + private String code1; + + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "area", propName="code",type = Query.Type.EQUAL) + private String areaCode; + + /** 模糊 */ + // 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段 + @Query(joinName = "shArea", propName="code",type = Query.Type.EQUAL) + private String shAreaCode; + + /** 模糊 */ + @Query(type = Query.Type.EQUAL) + private String status; + + /** 模糊 */ + @Query(type = Query.Type.IN) + private String statusList; + + @Query(joinName = "billType", propName="code",type = Query.Type.IN) + private List billTypeCode; + + /** + * 备货计划单号 + */ + @Query(type = Query.Type.INNER_LIKE) + private String relatedBill1; + + @Query(type = Query.Type.BETWEEN) + private List orderDate; + + @Query(type = Query.Type.GREATER_THAN) + private Double allocatedQuantity; + + /** 批次 */ + @Query(type = Query.Type.INNER_LIKE) + private String pc; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailDto.java new file mode 100644 index 0000000..ab78b9c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailDto.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.BigItemDto; +import com.youchain.basicdata.service.dto.BillTypeDto; +import com.youchain.basicdata.service.dto.ItemDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author jiangkun +* @date 2024-01-23 +**/ +@Data +public class PlanPickDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 完成品番 */ + private BigItemDto bigItem; + + /** 品番 */ + private ItemDto item; + + /** 收货库区 */ + private AreaDto zone; + + /** 出库类型 */ + private BillTypeDto billType; + + /** 计划数量 */ + private Double orderQuantity; + + /** 出单数量 */ + private Double allocatedQuantity; + + /** 备货数量 */ + private Double pickedQuantity; + + /** 发货数量 */ + private Double shippedQuantity; + + /** 出单时间 */ + private Timestamp allocateTime; + + /** 发货时间 */ + private Timestamp shipTime; + + /** 指示单号 */ + private String code; + + /** 状态 */ + private String status; + + /** 开始机号 */ + private String startNo; + + /** 终止机号 */ + private String endNo; + + /** 备注 */ + private String remark; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + private Timestamp batchTime; + /**工厂*/ + private String gcCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailQueryCriteria.java new file mode 100644 index 0000000..d428840 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/PlanPickDetailQueryCriteria.java @@ -0,0 +1,61 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-01-23 +**/ +@Data +public class PlanPickDetailQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 品番 */ + @Query(propName = "code",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemCode; + + /** 品番 */ + @Query(propName = "name",joinName = "bigItem",type = Query.Type.INNER_LIKE) + private String bigItemName; + + /** + * 工位 zone.workingStation + */ + @Query(propName = "workingStation",joinName = "zone",type = Query.Type.INNER_LIKE) + private String workingStation; + /** + * 起始机号 startNo + */ + @Query(type = Query.Type.INNER_LIKE) + private String startNo; + /** + * 终止机号 endNo + */ + @Query(type = Query.Type.INNER_LIKE) + private String endNo; + + @Query(type = Query.Type.INNER_LIKE) + private String gcCode; + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsDto.java new file mode 100644 index 0000000..e5411bd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsDto.java @@ -0,0 +1,73 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.service.dto.BigItemDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author ShenYinAn +* @date 2024-01-30 +**/ +@Data +public class SparepartsDto implements Serializable { + + private Long id; + + /** 工位 */ + private String stationType; + + /** 下线日期 */ + private Timestamp date; + + /** 型式名 */ + private BigItem bigItemId; + + /** 数量 */ + private Integer orderQuantity; + + /** 状态 */ + private String status; + + /** 起始机号 */ + private String startNumber; + + /** 结束机号 */ + private String endNumber; + + /** 备注 */ + private String description; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 仓库ID */ + private Long deptId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsQueryCriteria.java new file mode 100644 index 0000000..dd45c31 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/SparepartsQueryCriteria.java @@ -0,0 +1,66 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.domain.BigItem; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; + +import com.youchain.annotation.Query; + +/** + * @author ShenYinAn + * @website https://eladmin.vip + * @date 2024-01-30 + **/ +@Data +public class SparepartsQueryCriteria { + + + /** + * 型式品番 + */ + @Query(joinName = "bigItemId", propName = "code", type = Query.Type.INNER_LIKE) + private String bigItemIdModes; + + /** + * 工位 + */ + @Query(type = Query.Type.EQUAL) + private String stationType; + @Query(type = Query.Type.INNER_LIKE) + private String startNumber; + @Query(type = Query.Type.INNER_LIKE) + private String endNumber; + + /** + * 耗用状态 + */ + @Query(type = Query.Type.EQUAL) + private String status; + /** + * 型式名 + */ + @Query(joinName = "bigItemId", propName = "name", type = Query.Type.INNER_LIKE) + private String bigItemIdModesName; + + @Query(type = Query.Type.BETWEEN) + private List updateTime; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskDto.java new file mode 100644 index 0000000..73a68b6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskDto.java @@ -0,0 +1,129 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.*; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author houjianlan +* @date 2023-08-16 +**/ +@Data +public class TaskDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料序号 */ + private ItemSmallDto item; + + /** 物料序号 */ + private ItemKeyDto itemKey; + + /** 单据号 */ + private String billCode; + + /** 任务类型 */ + private String taskType; + + /** 收货明细序号 */ + private AsnDetailDto asnDetail; + + /** 移位明细序号 */ + private Long moveDetailId; + + /** 波次明细序号 */ + private Long waveDetailId; + + /** 发货明细序号 */ + private PickDetailDto pickDetail; + + /** 源容器 */ + private StockDto srcStock; + + /** 目标容器 */ + private StockDto dstStock; + + /** 源点位 */ + private PointDto srcPoint; + + /** 目标点位 */ + private PointDto dstPoint; + + /** 源容器编码 */ + private String srcStockCode; + + /** 目标容器编码 */ + private String dstStockCode; + + /** 源点位编码 */ + private String srcPointCode; + + /** 目标点位编码 */ + private String dstPointCode; + + /** 属性6 */ + private String invStatus; + + /** 任务状态 */ + private String taskStatus; + + /** 跳过 */ + private Integer beSkip; + + /** 退回 */ + private Boolean beBack; + + /** 计划数量 */ + private Double planQty; + + /** 移位数量 */ + private Double moveQty; + + /** 上架号 */ + private String putCode; + + /** 库存ID */ + private Long invId; + + /** 仓库ID */ + private DeptDto dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 库区 */ + private AreaDto area; + + /** 制造库位 */ + private PointDto zzkw; +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogDto.java new file mode 100644 index 0000000..f258298 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogDto.java @@ -0,0 +1,130 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.ItemSmallDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.basicdata.service.dto.StockDto; +import com.youchain.businessdata.domain.PickOut; +import com.youchain.modules.system.service.dto.DeptDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2023-08-25 +**/ +@Data +public class TaskLogDto implements Serializable { + + /** ID */ + private Long id; + + /** 物料序号 */ + private ItemSmallDto item; + + /** 物料属性序号 */ + private ItemKeyDto itemKey; + + /** 任务序号 */ + private TaskDto task; + + /**收货库区*/ + private AreaDto area; + + /** 源容器 */ + private StockDto srcStock; + + /** 目标容器 */ + private StockDto dstStock; + + /** 源点位 */ + private PointDto srcPoint; + + /** 目标点位 */ + private PointDto dstPoint; + + /** 源容器编码 */ + private String srcStockCode; + + /** 目标容器编码 */ + private String dstStockCode; + + /** 源点位编码 */ + private String srcLocCode; + + /** 目标点位编码 */ + private String dstLocCode; + + /** 属性6 */ + private String invStatus; + + /** 退回 */ + private Boolean beBack; + + /** 拣货数量 */ + private Double moveQty; + + /** 发运数量 */ + private Double shipQty; + + /** 上架号 */ + private String putCode; + + /** 库存ID */ + private Long invId; + + /** 仓库ID */ + private DeptDto dept; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 发运人 */ + private String shipBy; + + /** 发运时间 */ + private Timestamp shipTime; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 出库单维护 */ + private PickOutDto pickOut; + + /** + * 投料数量 + */ + private Double tlQty; + + /** + * 接收数量 + */ + private Double jsQty; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogQueryCriteria.java new file mode 100644 index 0000000..ec979ef --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskLogQueryCriteria.java @@ -0,0 +1,29 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-25 +**/ +@Data +public class TaskLogQueryCriteria{ +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskQueryCriteria.java new file mode 100644 index 0000000..c6c5da3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/TaskQueryCriteria.java @@ -0,0 +1,76 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import com.youchain.businessdata.domain.PickDetail; +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@Data +public class TaskQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String srcPointCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String dstPointCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String dstStockCode; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String dstLocCode; + + @Query(joinName = "item", propName="code",type = Query.Type.INNER_LIKE) + private String itemCode; + + @Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE) + private String itemName; + + @Query(joinName = "asnDetail", propName="id",type = Query.Type.EQUAL) + private Long asnDetailId; + + @Query(joinName = "pickDetail", propName="id",type = Query.Type.EQUAL) + private Long pickDetailId; + + /** 精确 */ + @Query + private String taskStatus; + + @Query + private String taskType; + + /** BETWEEN */ + @Query(type = Query.Type.BETWEEN) + private List createTime; + + /** + * 单据号 + */ + @Query + private String billCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordDto.java new file mode 100644 index 0000000..77bc2fb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordDto.java @@ -0,0 +1,285 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.AreaDto; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.domain.TaskLog; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import java.sql.Timestamp; +import java.io.Serializable; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @description / + * @date 2024-01-04 + **/ +@Data +public class XppRecordDto implements Serializable { + + /** + * ID + */ + private Long id; + + /** + * 二维码 + */ + private String ewm; + /** + * 采集库区 + */ + private AreaDto area; + /** + * 品番 + */ + private ItemDto item; + + /** + * ac + */ + private String ac; + + /** + * 纳入书 + */ + private Integer nrs; + + /** + * 定单编号 + */ + private String ddbh; + + /** + * 制番 + */ + private String zf; + + /** + * 分支号 + */ + private String fzh; + + /** + * 纳入指示日 + */ + private Timestamp nrDate; + + /** + * 送货数量 + */ + private String shQuantity; + + /** + * 入库明细 + */ + private AsnDetailDto asnDetailId; + + /** + * 采集人 + */ + private String cjr; + + /** + * 上架人 + */ + private String sjr; + + /** + * 备货人 + */ + private String bhr; + + /** + * 发货人 + */ + private String fhr; + + /** + * 线边接收人 + */ + private String jsr; + + /** + * 接收库位 + */ + private PointDto jskw; + + /** + * 制造投料人 + */ + private String zztlr; + + /** + * 缓存投料人 + */ + private String hctlr; + + /** + * 制造投料库位 + */ + private PointDto zzkw; + + /** + * 采集时间 + */ + private Timestamp cjDate; + + /** + * 上架时间 + */ + private Timestamp sjDate; + + /** + * 备货时间 + */ + private Timestamp bhDate; + + /** + * 发货时间 + */ + private Timestamp fhDate; + + /** + * 接收时间 + */ + private Timestamp jsDate; + + /** + * 制造投料时间 + */ + private Timestamp zztlDate; + + /** + * 材管库位 + */ + private String cPointCode; + + /** + * 制造库位 + */ + private String zPointCode; + + /** + * 加工内容 + */ + private String contents; + + /** + * 供应商 + */ + private String relaSupplier; + + /** + * 门号 + */ + private String relaDoor; + + /** + * 纳入场所 + */ + private String relaCode; + + /** + * 箱种 + */ + private String relaType; + + /** + * 收容数 + */ + private Double relaQuantity; + + /** + * 品区 + */ + private String areaCode; + + /** + * 品番 + */ + private String itemCode; + + /** + * 仓库ID + */ + private Long deptId; + + /** + * 描述 + */ + private String description; + + /** + * 状态:1启用、0禁用 + */ + private Boolean enabled; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建时间 + */ + private Timestamp createTime; + + /** + * 修改时间 + */ + private Timestamp updateTime; + + /** + * 状态 + */ + private String status; + + private TaskDto rkTask; + private PointDto invPoint; + private TaskLogDto ckTaskLog; + + + /** + * 是否留样 + */ + private Boolean tfLy; + /**留样日期*/ + private Timestamp lyData; + /** + * 还样日期 + */ + private Timestamp hyData; + /** + * 收货清单号 + */ + private String receiptCode; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordQueryCriteria.java new file mode 100644 index 0000000..1c8b0d2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordQueryCriteria.java @@ -0,0 +1,65 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; + +import java.sql.Timestamp; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +@Data +public class XppRecordQueryCriteria{ + /** 品番 */ + @Query(propName = "code",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemCode; + @Query(propName = "name",joinName = "item",type = Query.Type.INNER_LIKE) + private String itemName; + + @Query(type = Query.Type.INNER_LIKE) + private String relaSupplier; + + @Query(type = Query.Type.INNER_LIKE) + private String receiptCode; + /** 等于 */ + @Query(type = Query.Type.EQUAL) + private String status; + @Query(type = Query.Type.INNER_LIKE) + private String ddbh; + @Query(type = Query.Type.INNER_LIKE) + private String inv_point_code; + @Query(type = Query.Type.INNER_LIKE) + private String ewm; + @Query(type = Query.Type.BETWEEN) + private List createTime; + /**备货时间*/ + @Query(type = Query.Type.BETWEEN) + private List bhTime; + /** 是否留样 */ + @Query(type = Query.Type.EQUAL) + private Boolean beLy; + /** 是否复制 */ + @Query(type = Query.Type.EQUAL) + private Boolean beFz; + + @Query(type = Query.Type.EQUAL) + private String prop_c1; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordViewDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordViewDto.java new file mode 100644 index 0000000..ba0c243 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/XppRecordViewDto.java @@ -0,0 +1,244 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.dto; + +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.basicdata.service.dto.PointDto; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @description / + * @date 2024-01-04 + **/ +@Data +public class XppRecordViewDto implements Serializable { + + /** + * ID + */ + private Long id; + + /** + * 二维码 + */ + private String ewm; + private String rela_supplier; + + /** + * 品番 + */ + private String item_code; + + private String item_name; + /** + * 状态 + */ + private String status; + + /** + * ac + */ + private String ac; + /** + * 加工内容 + */ + private String contents; + + /** + * 纳入数 + */ + private Integer nrs; + + /** + * 定单编号 + */ + private String ddbh; + + + /** + * 分支号 + */ + private String fzh; + + /** + * 纳入指示日 + */ + private Timestamp nr_date; + + /** + * 采集人 + */ + private String cjr; + + /** + * 采集时间 + */ + private Timestamp cj_date; + + /** + * 批次号 + */ + private String prop_c1; + + /** + * 库位 + */ + private String inv_point_code; + + /** + * 备货单号 + */ + private String bh_code; + + /** + * 备货人 + */ + private String bhr; + + /** + * 发货人 + */ + private String fhr; + + /** + * 线边接收人 + */ + private String jsr; + /** + * 制造投料人 + */ + private String zztlr; + + /** + * 缓存投料人 + */ + private String hctlr; + /** + * 备货时间 + */ + private Timestamp bh_date; + + /** + * 发货时间 + */ + private Timestamp fh_date; + + /** + * 接收时间 + */ + private Timestamp js_date; + /** + * 接收库位 + */ + private String jskw; + + /** + * 制造投料时间 + */ + private Timestamp zztl_date; + + /** + * 制造投料库位 + */ + private String zzkw; + /** + * 是否留样 + */ + private Boolean tf_ly; + /**留样日期*/ + private Timestamp ly_data; + /** + * 还样日期 + */ + private Timestamp hy_data; + + + + + /** + * 材管库位 + */ + private String c_point_code; + + /** + * 制造库位 + */ + private String z_point_code; + /** + * 收容数 + */ + private Double srs; + + /** + * 品区 + */ + private String areaCode; + + + /** + * 仓库ID + */ + private Long deptId; + + /** + * 描述 + */ + private String description; + + /** + * 状态:1启用、0禁用 + */ + private Boolean enabled; + private Boolean be_fz; + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建时间 + */ + private Timestamp createTime; + + /** + * 修改时间 + */ + private Timestamp updateTime; + /** + * 留样出库单号 + */ + private String ly_code; + + /** + * 收货清单号 + */ + private String receipt_code; + + /** + * 盘点单号 + */ + private String count_code; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java new file mode 100644 index 0000000..1153f8c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/jsonDto/CxjlDto.java @@ -0,0 +1,36 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto.jsonDto; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-07-17 +**/ +@Data +public class CxjlDto implements Serializable { + private Long bom_account_id; + private Long item_id; + private Long zzkw_id; + private Long rk_id; + private double order_qty; + private String remark; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java new file mode 100644 index 0000000..5a5e2c7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnDetailServiceImpl.java @@ -0,0 +1,218 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.StockService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.repository.TaskRepository; +import com.youchain.businessdata.service.AsnService; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.dto.AsnDto; +import com.youchain.businessdata.service.mapstruct.AsnMapper; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.AsnDetailRepository; +import com.youchain.businessdata.service.AsnDetailService; +import com.youchain.businessdata.service.dto.AsnDetailDto; +import com.youchain.businessdata.service.dto.AsnDetailQueryCriteria; +import com.youchain.businessdata.service.mapstruct.AsnDetailMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author hjl +* @date 2023-08-14 +**/ +@Service +@RequiredArgsConstructor +public class AsnDetailServiceImpl implements AsnDetailService { + + private final AsnDetailRepository asnDetailRepository; + private final AsnDetailMapper asnDetailMapper; + private final EntityManager entityMapper; + private final TaskRepository taskRepository; + private final AsnService asnService; + private final AsnMapper asnMapper; + private final InventoryService inventoryService; + private final InventoryLogService inventoryLogService; + + @Override + public Map queryAll(AsnDetailQueryCriteria criteria, Pageable pageable){ + Page page = asnDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(asnDetailMapper::toDto)); + } + + @Override + public List queryAll(AsnDetailQueryCriteria criteria){ + return asnDetailMapper.toDto(asnDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public AsnDetailDto findById(Long id) { + AsnDetail asnDetail = asnDetailRepository.findById(id).orElseGet(AsnDetail::new); + ValidationUtil.isNull(asnDetail.getId(),"AsnDetail","id",id); + return asnDetailMapper.toDto(asnDetail); + } + + @Override + @Transactional + public AsnDetail getEntity(Long id) { + AsnDetail asnDetail = asnDetailRepository.findById(id).orElseGet(AsnDetail::new); + return asnDetail; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AsnDetailDto create(AsnDetail resources) { + return asnDetailMapper.toDto(asnDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(AsnDetail resources) { + AsnDetail asnDetail = asnDetailRepository.findById(resources.getId()).orElseGet(AsnDetail::new); + ValidationUtil.isNull( asnDetail.getId(),"AsnDetail","id",resources.getId()); + asnDetail.copy(resources); + asnDetailRepository.save(asnDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + AsnDetail asnDetail = asnDetailRepository.getById(id); + if (asnDetail.getStatus().equals("OPEN")){ + //修改容器状态 + //删除关联表的数据 入库单明细(data_asn_detail) + if (taskRepository.getAsnDetailIdToId(id)!=null){ + taskRepository.deleteById(taskRepository.getAsnDetailIdToId(id)); + } + //扣入库表的订单数量 + Double orderQty = asnDetail.getOrderQty(); + AsnDto byId = asnService.findById(asnDetail.getAsn().getId()); + byId.setOrderQuantity(byId.getOrderQuantity()-orderQty); + asnService.update(asnMapper.toEntity(byId)); + } + asnDetailRepository.deleteById(id); + } + } + @Override + @Transactional(rollbackFor = Exception.class) + public void cancelPut(Long taskId, XppRecord xppRecord) { + Task t=taskRepository.getById(taskId); + AsnDetail d=t.getAsnDetail(); + Asn asn=d.getAsn(); + String ewm=null; + if(t.getPlanQty()>0){ + Point srcPoint=t.getDstPoint(); + if(xppRecord!=null){ + ewm=xppRecord.getEwm(); + srcPoint=xppRecord.getInvPoint(); + } + Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL); + if(inventory==null){ + throw new BadRequestException("找不到对应库存"); + } + if((inventory.getQuantity().intValue()- inventory.getQueuedQty().intValue()) all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"AsnDetail"); + FileUtil.downloadExcel(list, response); + } + + @Override + public AsnDetail toEntity(AsnDetailDto detailDto) { + return asnDetailMapper.toEntity(detailDto); + } + @Override + public AsnDetail findByStock(String code){ + String hql="select d from AsnDetail d where d.stock.code='"+code+"' and d.status='"+ BizStatus.OPEN+"'"; + Query query=entityMapper.createQuery(hql); + List ts=query.getResultList(); + if(ts.size()>0){ + return ts.get(0); + } + return null; + } + + + @Override + public AsnDetail createAsnDetail(Item item, Stock stock, Point srcPoint,String propC1,String gdh){ + AsnDetail asnDetail = new AsnDetail(); + asnDetail.setItem(item); + asnDetail.setLineNo(1l); + asnDetail.setStatus(BizStatus.OPEN); + asnDetail.setOrderQty(item.getExtendD1()); + asnDetail.setDept(item.getDept()); + asnDetail.setStock(stock); + asnDetail.setPoint(srcPoint); + asnDetail.setPropC1(propC1); + asnDetail.setOrderNumber(gdh); + return asnDetail; + } + + @Override + public List findAsnDetails(Long asnId,String type) { + String hql =" from AsnDetail ad where ad.asn.id="+asnId; + if(type.equals("1")){//整单收货,查询未收货数据 + hql+=" and ad.receivedQty ds=query.getResultList(); + return ds; + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnServiceImpl.java new file mode 100644 index 0000000..41186d3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/AsnServiceImpl.java @@ -0,0 +1,150 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.repository.AsnDetailRepository; +import com.youchain.businessdata.service.AsnDetailService; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.AsnRepository; +import com.youchain.businessdata.service.AsnService; +import com.youchain.businessdata.service.dto.AsnDto; +import com.youchain.businessdata.service.dto.AsnQueryCriteria; +import com.youchain.businessdata.service.mapstruct.AsnMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-01-09 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class AsnServiceImpl implements AsnService { + + private final AsnRepository asnRepository; + private final AsnMapper asnMapper; + private final AsnDetailRepository asnDetailRepository; + private final CodeUtils codeUtils; + + + @Override + public Map queryAll(AsnQueryCriteria criteria, Pageable pageable) { + Page page = asnRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(asnMapper::toDto)); + } + + @Override + public List queryAll(AsnQueryCriteria criteria) { + return asnMapper.toDto(asnRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public AsnDto findById(Long id) { + Asn asn = asnRepository.findById(id).orElseGet(Asn::new); + ValidationUtil.isNull(asn.getId(), "Asn", "id", id); + return asnMapper.toDto(asn); + } + + @Override + @Transactional + public Asn getEntity(Long id) { + Asn asn = asnRepository.findById(id).orElseGet(Asn::new); + return asn; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AsnDto create(Asn resources) { + resources.setCode(codeUtils.getCode_yyMMdd(resources.getBillType().getCode(), 3)); + return asnMapper.toDto(asnRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Asn resources) { + Asn asn = asnRepository.findById(resources.getId()).orElseGet(Asn::new); + ValidationUtil.isNull(asn.getId(), "Asn", "id", resources.getId()); + asn.copy(resources); + asnRepository.save(asn); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + //删除附表 +// AsnDto byId = this.findById(id); + List asnDetails = asnDetailRepository.queryByAsnId(id); + if (!asnDetails.isEmpty()) { + for (AsnDetail a : asnDetails) { + asnDetailRepository.deleteById(a.getId()); + } + } + asnRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (AsnDto asn : all) { + Map map = new LinkedHashMap<>(); + map.put("单号", asn.getCode()); + map.put("库区", asn.getArea().getCode()); + map.put("状态", asn.getStatus()); + map.put("客户订单号", asn.getCusCode()); + map.put("相关单号1", asn.getRelatedBill1()); + map.put("相关单号2", asn.getRelatedBill2()); + map.put("相关单号3", asn.getRelatedBill3()); + map.put("订单日期", asn.getOrderDate()); + map.put("预计到货日期", asn.getEstimateDate()); + map.put("收货日期", asn.getReceivedDate()); + map.put("发货方", asn.getFromName()); + map.put("发货地址", asn.getFromAddress()); + map.put("发货联系人", asn.getFromMan()); + map.put("发货电话", asn.getFromTel()); + map.put("订单数量", asn.getOrderQuantity()); + map.put("收货数量", asn.getReceivedQuantity()); + map.put("上架数量", asn.getPutawayQuantity()); + map.put("车牌号", asn.getVehicle()); + map.put("单据类型", asn.getBillType().getCode()); + map.put("仓库ID", asn.getDept().getName()); + map.put("备注", asn.getDescription()); + map.put("创建人", asn.getCreateBy()); + map.put("修改人", asn.getUpdateBy()); + map.put("创建时间", asn.getCreateTime()); + map.put("修改时间", asn.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/BaseCodeServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/BaseCodeServiceImpl.java new file mode 100644 index 0000000..8d869ad --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/BaseCodeServiceImpl.java @@ -0,0 +1,139 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.BaseCode; +import com.youchain.exception.EntityExistException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.BaseCodeRepository; +import com.youchain.businessdata.service.BaseCodeService; +import com.youchain.businessdata.service.dto.BaseCodeDto; +import com.youchain.businessdata.service.dto.BaseCodeQueryCriteria; +import com.youchain.businessdata.service.mapstruct.BaseCodeMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author baobinglin +* @date 2023-08-22 +**/ +@Service +@RequiredArgsConstructor +public class BaseCodeServiceImpl implements BaseCodeService { + + private final BaseCodeRepository baseCodeRepository; + private final BaseCodeMapper baseCodeMapper; + + @Override + public Map queryAll(BaseCodeQueryCriteria criteria, Pageable pageable){ + Page page = baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(baseCodeMapper::toDto)); + } + + @Override + public List queryAll(BaseCodeQueryCriteria criteria){ + return baseCodeMapper.toDto(baseCodeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public BaseCodeDto findById(Integer id) { + BaseCode baseCode = baseCodeRepository.findById(id).orElseGet(BaseCode::new); + ValidationUtil.isNull(baseCode.getId(),"BaseCode","id",id); + return baseCodeMapper.toDto(baseCode); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BaseCodeDto create(BaseCode resources) { + if(baseCodeRepository.findByCode(resources.getCode()) != null){ + throw new EntityExistException(BaseCode.class,"code",resources.getCode()); + } + return baseCodeMapper.toDto(baseCodeRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BaseCode resources) { + BaseCode baseCode = baseCodeRepository.findById(resources.getId()).orElseGet(BaseCode::new); + ValidationUtil.isNull( baseCode.getId(),"BaseCode","id",resources.getId()); + baseCode = baseCodeRepository.findById(resources.getId()).get(); + /*if(baseCode != null && !baseCode.getId().equals(baseCode.getId())){ + throw new EntityExistException(BaseCode.class,"code",resources.getCode()); + }*/ + baseCode.copy(resources); + baseCodeRepository.save(baseCode); + } + + @Override + public void deleteAll(Integer[] ids) { + for (Integer id : ids) { + baseCodeRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (BaseCodeDto baseCode : all) { + Map map = new LinkedHashMap<>(); + map.put(" code", baseCode.getCode()); + map.put(" key", baseCode.getKey()); + map.put(" value", baseCode.getValue()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + private static String key_time_type="yyMMdd";//时间 + @Override + public synchronized String baseCodeFor(String key_code, int len){ + String code=""; + String key_time = new SimpleDateFormat(key_time_type).format(Calendar.getInstance().getTime()); + String key=key_code+key_time; + + String value; + BaseCodeQueryCriteria queryBaseCode=new BaseCodeQueryCriteria(); + queryBaseCode.setKey(key); + List baseCodeDtos = queryAll(queryBaseCode); + BaseCode baseCode = new BaseCode(); + if (baseCodeDtos.size()<1){ + baseCode.setKey(key); + baseCode.setValue("0"); + create(baseCode); + }else { + baseCode=baseCodeMapper.toEntity(baseCodeDtos.get(0)); + } + value = (Integer.valueOf(baseCode.getValue().toString())+1)+""; + baseCode.setValue(value); + while (value.length() queryAll(CountDetailQueryCriteria criteria, Pageable pageable){ + Page page = countDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countDetailMapper::toDto)); + } + + @Override + public List queryAll(CountDetailQueryCriteria criteria){ + return countDetailMapper.toDto(countDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountDetailDto findById(Long id) { + CountDetail countDetail = countDetailRepository.findById(id).orElseGet(CountDetail::new); + ValidationUtil.isNull(countDetail.getId(),"CountDetail","id",id); + return countDetailMapper.toDto(countDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountDetailDto create(CountDetail resources) { + return countDetailMapper.toDto(countDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountDetail resources) { + CountDetail countDetail = countDetailRepository.findById(resources.getId()).orElseGet(CountDetail::new); + ValidationUtil.isNull( countDetail.getId(),"CountDetail","id",resources.getId()); + countDetail.copy(resources); + countDetailRepository.save(countDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countDetailRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"CountDetail"); + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailRecordServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailRecordServiceImpl.java new file mode 100644 index 0000000..07971e9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailRecordServiceImpl.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.CountMoveDetailRecord; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.CountMoveDetailRecordRepository; +import com.youchain.businessdata.service.CountMoveDetailRecordService; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordDto; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordQueryCriteria; +import com.youchain.businessdata.service.mapstruct.CountMoveDetailRecordMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-11-21 +**/ +@Service +@RequiredArgsConstructor +public class CountMoveDetailRecordServiceImpl implements CountMoveDetailRecordService { + + private final CountMoveDetailRecordRepository countMoveDetailRecordRepository; + private final CountMoveDetailRecordMapper countMoveDetailRecordMapper; + + @Override + public Map queryAll(CountMoveDetailRecordQueryCriteria criteria, Pageable pageable){ + Page page = countMoveDetailRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countMoveDetailRecordMapper::toDto)); + } + + @Override + public List queryAll(CountMoveDetailRecordQueryCriteria criteria){ + return countMoveDetailRecordMapper.toDto(countMoveDetailRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountMoveDetailRecordDto findById(Long id) { + CountMoveDetailRecord countMoveDetailRecord = countMoveDetailRecordRepository.findById(id).orElseGet(CountMoveDetailRecord::new); + ValidationUtil.isNull(countMoveDetailRecord.getId(),"CountMoveDetailRecord","id",id); + return countMoveDetailRecordMapper.toDto(countMoveDetailRecord); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountMoveDetailRecordDto create(CountMoveDetailRecord resources) { + return countMoveDetailRecordMapper.toDto(countMoveDetailRecordRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountMoveDetailRecord resources) { + CountMoveDetailRecord countMoveDetailRecord = countMoveDetailRecordRepository.findById(resources.getId()).orElseGet(CountMoveDetailRecord::new); + ValidationUtil.isNull( countMoveDetailRecord.getId(),"CountMoveDetailRecord","id",resources.getId()); + countMoveDetailRecord.copy(resources); + countMoveDetailRecordRepository.save(countMoveDetailRecord); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countMoveDetailRecordRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"CountMoveDetailRecord"); + FileUtil.downloadExcel(list, response); + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailServiceImpl.java new file mode 100644 index 0000000..595c703 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveDetailServiceImpl.java @@ -0,0 +1,102 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.CountMove; +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.service.CountMoveService; +import com.youchain.businessdata.service.dto.CountMoveDto; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.CountMoveDetailRepository; +import com.youchain.businessdata.service.CountMoveDetailService; +import com.youchain.businessdata.service.dto.CountMoveDetailDto; +import com.youchain.businessdata.service.dto.CountMoveDetailQueryCriteria; +import com.youchain.businessdata.service.mapstruct.CountMoveDetailMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-11-21 +**/ +@Service +@RequiredArgsConstructor +public class CountMoveDetailServiceImpl implements CountMoveDetailService { + + private final CountMoveDetailRepository countMoveDetailRepository; + private final CountMoveDetailMapper countMoveDetailMapper; + + @Override + public Map queryAll(CountMoveDetailQueryCriteria criteria, Pageable pageable){ + Page page = countMoveDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countMoveDetailMapper::toDto)); + } + + @Override + public List queryAll(CountMoveDetailQueryCriteria criteria){ + return countMoveDetailMapper.toDto(countMoveDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountMoveDetailDto findById(Long id) { + CountMoveDetail countMoveDetail = countMoveDetailRepository.findById(id).orElseGet(CountMoveDetail::new); + ValidationUtil.isNull(countMoveDetail.getId(),"CountMoveDetail","id",id); + return countMoveDetailMapper.toDto(countMoveDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountMoveDetailDto create(CountMoveDetail resources) { + return countMoveDetailMapper.toDto(countMoveDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountMoveDetail resources) { + CountMoveDetail countMoveDetail = countMoveDetailRepository.findById(resources.getId()).orElseGet(CountMoveDetail::new); + ValidationUtil.isNull( countMoveDetail.getId(),"CountMoveDetail","id",resources.getId()); + countMoveDetail.copy(resources); + countMoveDetailRepository.save(countMoveDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countMoveDetailRepository.deleteById(id); + } + } + + + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"CountMoveDetail"); + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveServiceImpl.java new file mode 100644 index 0000000..5f35a69 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountMoveServiceImpl.java @@ -0,0 +1,329 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.repository.CountMoveDetailRepository; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.XppRecordRepository; +import com.youchain.businessdata.service.*; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.CountMoveRepository; +import com.youchain.businessdata.service.dto.CountMoveDto; +import com.youchain.businessdata.service.dto.CountMoveQueryCriteria; +import com.youchain.businessdata.service.mapstruct.CountMoveMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-11-19 +**/ +@Service +@Slf4j +@RequiredArgsConstructor +public class CountMoveServiceImpl implements CountMoveService { + + private final CountMoveRepository countMoveRepository; + private final CountMoveMapper countMoveMapper; + private final InventoryRepository inventoryRepository; + private final InventoryLogService inventoryLogService; + private final InventoryService inventoryService; + private final XppRecordRepository xppRecordRepository; + private final XppRecordService xppRecordService; + private final CountMoveDetailService countMoveDetailService; + private final CountMoveDetailRecordService countMoveDetailRecordService; + private final CountMoveDetailRepository countMoveDetailRepository; + private final EntityManager entityManager; + + @Override + public Map queryAll(CountMoveQueryCriteria criteria, Pageable pageable){ + Page page = countMoveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countMoveMapper::toDto)); + } + + @Override + public List queryAll(CountMoveQueryCriteria criteria){ + return countMoveMapper.toDto(countMoveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountMoveDto findById(Long id) { + CountMove countMove = countMoveRepository.findById(id).orElseGet(CountMove::new); + ValidationUtil.isNull(countMove.getId(),"CountMove","id",id); + return countMoveMapper.toDto(countMove); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountMoveDto create(CountMove resources) { + return countMoveMapper.toDto(countMoveRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountMove resources) { + CountMove countMove = countMoveRepository.findById(resources.getId()).orElseGet(CountMove::new); + ValidationUtil.isNull( countMove.getId(),"CountMove","id",resources.getId()); + countMove.copy(resources); + countMoveRepository.save(countMove); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countMoveRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all, "CountMove"); + FileUtil.downloadExcel(list, response); + } + + @Override + public void countCheck(CountMove countMove) { + if(countMove.getDstPoint()==null){ + throw new BadRequestException(countMove.getCode() + "需填写目标库位"); + } + List inventoryList=inventoryRepository.queryInventoryArea(countMove.getSrcArea().getId()); + for(Inventory inv:inventoryList) { + ItemKey itemKey = inv.getItemKey(); + int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId()); + if (inv.getQueuedQty() > 0) { + throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数"); + } + if(inv.getQuantity().intValue()!=nrs){ + inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.INVARIANT, countMove.getCode(), countMove.getDstArea(), itemKey, inv.getPoint(), inv.getPoint(), null, inv.getQuantity()+0d, nrs+0d, null, + BizStatus.COUNT, null, inv.getId(), "调整库存数量,和现品票匹配"); + inv.setQuantity(nrs+0d); + inventoryService.update(inv); + } + createCountDetail(countMove,inv,itemKey,countMove.getDstPoint()); + } + + } + + @Override + public void createCountDetail(CountMove countMove,Inventory inv,ItemKey itemKey,Point dstPoint) { + CountMoveDetail countMoveDetail=new CountMoveDetail(); + countMoveDetail.setStatus(BizStatus.OPEN); + countMoveDetail.setCountMove(countMove); + countMoveDetail.setInvId(inv.getId()); + countMoveDetail.setItemKey(itemKey); + countMoveDetail.setSrcPoint(inv.getPoint()); + countMoveDetail.setOrderQty(inv.getQuantity()); + countMoveDetail.setCountQty(0d); + countMoveDetail.setDstPoint(dstPoint); + countMoveDetailService.create(countMoveDetail); + countMove.setOrderQty(countMove.getOrderQty()+inv.getQuantity()); + this.update(countMove); + + } + static int iii_ok=0; + + public void countXpp2(CountMove countMove) { + Dept dept=UserUtils.getDept(); + List countMoveDetailList=countMoveDetailRepository.queryDetails(countMove.getId()); + log.info("countMoveDetailList:"+countMoveDetailList.size()); + int i=0; + for(CountMoveDetail d:countMoveDetailList){ + log.info(i+++"===="+new Date()); + List inventoryList=inventoryRepository.queryInventoryPointIk(d.getSrcPoint().getId(),d.getItemKey().getId()); + for(Inventory inv:inventoryList) { + ItemKey itemKey = inv.getItemKey(); + List xppRecordList = xppRecordRepository.queryXppItemKeyPoint(itemKey.getId(), inv.getPoint().getId()); + if (inv.getQueuedQty() > 0) { + throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数"); + } + log.info("现品票处理==="+i+"===="+new Date()+"===="+xppRecordList.size()); + for (XppRecord xpp : xppRecordList) { + xpp.setInvPoint(d.getDstPoint()); + xpp.setCountCode(countMove.getCode()); + xppRecordService.update(xpp); + inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.REDUCE, countMove.getCode(), inv.getArea(), itemKey,d.getSrcPoint(), d.getDstPoint(), inv.getZzkw(), xpp.getNrs() + 0d, xpp.getNrs() + 0d, xpp.getEwm(), + BizStatus.COUNT, xpp.getId(), inv.getId(), "盘点移位"+d.getDstPoint().getArea().getCode()); + d.setCountQty(d.getCountQty()+xpp.getNrs()); + countMoveDetailService.update(d); + CountMoveDetailRecord countMoveDetailRecord=new CountMoveDetailRecord(); + countMoveDetailRecord.setCountMove(countMove); + countMoveDetailRecord.setCountMoveDetail(d); + countMoveDetailRecord.setXppEwm(xpp.getEwm()); + countMoveDetailRecord.setCountQty(xpp.getNrs()+0d); + countMoveDetailRecord.setXpp(xpp); + countMoveDetailRecord.setSrcPoint(d.getSrcPoint()); + countMoveDetailRecord.setCountPoint(d.getDstPoint()); + countMoveDetailRecord.setItemKey(d.getItemKey()); + countMoveDetailRecord.setStatus(BizStatus.OPEN); + countMoveDetailRecordService.create(countMoveDetailRecord); + //查找目标库位是否有库存,有则数量累加,没有新建 + Inventory newInv=inventoryService.getInventory(itemKey,d.getDstPoint().getArea(),d.getDstPoint(),inv.getZzkw(),dept,BizStatus.COUNT_MOVE); + newInv.setQuantity(newInv.getQuantity()+xpp.getNrs()); + inventoryService.update(newInv); + inv.setQuantity(inv.getQuantity()-xpp.getNrs()); + inventoryService.update(inv); + } + + } + } + countMove.setStatus(BizStatus.COUNT_ALL); + this.update(countMove); + } + + @Override + public void countXpp(CountMove countMove) { + Long st_time=System.currentTimeMillis(); + Dept dept=UserUtils.getDept(); + + List countMoveDetailCount=countMoveDetailRepository.queryDetails(countMove.getId()); + log.info("countMoveDetailList:"+countMoveDetailCount.size()); + + + List countMoveDetailObjs=countMoveDetailRepository.queryIkPGroupDetails(countMove.getId()); + log.info("countMoveDetailList:"+countMoveDetailObjs.size()); + + + List inventoryListAll=inventoryRepository.queryInventoryArea2(countMove.getSrcArea().getId()); + log.info("inventoryListAll:"+inventoryListAll.size()); + Map> map_inventory=new HashMap<>(); + for (Inventory inv :inventoryListAll ) { + String key=inv.getItemKey().getId()+""+inv.getPoint().getId(); + List ll=map_inventory.get(Integer.parseInt(key)); + if(ll!=null && ll.size()>0){ + ll.add(inv); + map_inventory.put(Integer.parseInt(key),ll); + }else{ + List list_aa=new ArrayList<>(); + list_aa.add(inv); + map_inventory.put(Integer.parseInt(key),list_aa); + } + } + log.info("map_inventory:"+map_inventory.keySet().size()); + + log.info("xppRecordListAll:"); + List xppRecordListAll = xppRecordRepository.queryXppItemKeyPoint2(); + Map> map_xppRecord=new HashMap<>(); + log.info("xppRecordListAll:"+xppRecordListAll.size()); + for (XppRecord xpp :xppRecordListAll ) { + String key=xpp.getItemKey().getId()+""+xpp.getInvPoint().getId(); + List ll=map_xppRecord.get(Integer.parseInt(key)); + if(ll!=null && ll.size()>0){ + ll.add(xpp); + map_xppRecord.put(Integer.parseInt(key),ll); + }else{ + List list_aa=new ArrayList<>(); + list_aa.add(xpp); + map_xppRecord.put(Integer.parseInt(key),list_aa); + } + } + log.info("map_xppRecord:"+map_xppRecord.keySet().size()); + + + + iii_ok=0; + + for(Object[] objs:countMoveDetailObjs){ + Long itemKeyId=Long.parseLong(objs[1].toString()); + Long dstPointId=Long.parseLong(objs[2].toString()); + new Thread(new Runnable() { + @Override + public void run() { + List countMoveDetailList=countMoveDetailRepository.queryIkPDetails(countMove.getId(),itemKeyId,dstPointId); + for (CountMoveDetail d:countMoveDetailList){ + //log.info(++iii +""); + String key1=d.getItemKey().getId()+""+d.getSrcPoint().getId(); + List inventoryList=map_inventory.get(Integer.parseInt(key1)); + //log.info("Inventory======="+new Date()+"===="); + for(Inventory inv:inventoryList) { + ItemKey itemKey = inv.getItemKey(); + String key2 = itemKey.getId() + "" + inv.getPoint().getId(); + List xppRecordList = map_xppRecord.get(Integer.parseInt(key2)); + //log.info("XppRecord=======" + new Date() + "===="); + if (inv.getQueuedQty() > 0) { + throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数"); + } + //log.info("现品票处理===" + iii + "====" + new Date() + "====" + xppRecordList.size()); + for (XppRecord xpp : xppRecordList) { + xpp.setInvPoint(d.getDstPoint()); + xpp.setArea(d.getDstPoint().getArea()); + xpp.setCountCode(countMove.getCode()); + xppRecordService.update(xpp); + inventoryLogService.storeInventoryLog(BizStatus.COUNT_MOVE, BizStatus.REDUCE, countMove.getCode(), inv.getArea(), itemKey, d.getSrcPoint(), d.getDstPoint(), inv.getZzkw(), xpp.getNrs() + 0d, xpp.getNrs() + 0d, xpp.getEwm(), + BizStatus.COUNT, xpp.getId(), inv.getId(), "盘点移位" + d.getDstPoint().getArea().getCode()); + d.setCountQty(d.getCountQty() + xpp.getNrs()); + countMoveDetailService.update(d); + CountMoveDetailRecord countMoveDetailRecord = new CountMoveDetailRecord(); + countMoveDetailRecord.setCountMove(countMove); + countMoveDetailRecord.setCountMoveDetail(d); + countMoveDetailRecord.setXppEwm(xpp.getEwm()); + countMoveDetailRecord.setCountQty(xpp.getNrs() + 0d); + countMoveDetailRecord.setXpp(xpp); + countMoveDetailRecord.setSrcPoint(d.getSrcPoint()); + countMoveDetailRecord.setCountPoint(d.getDstPoint()); + countMoveDetailRecord.setItemKey(d.getItemKey()); + countMoveDetailRecord.setStatus(BizStatus.OPEN); + countMoveDetailRecordService.create(countMoveDetailRecord); + //查找目标库位是否有库存,有则数量累加,没有新建 + Inventory newInv = inventoryService.getInventory(itemKey, d.getDstPoint().getArea(), d.getDstPoint(), inv.getZzkw(), dept, BizStatus.COUNT_MOVE); + newInv.setQuantity(newInv.getQuantity() + xpp.getNrs()); + inventoryService.update(newInv); + inv.setQuantity(inv.getQuantity() - xpp.getNrs()); + inventoryService.update(inv); + } + } + log.info(++iii_ok +""); + } + } + }).start(); + + try{ + Thread.sleep(100); + }catch (Exception e){ + + } + + } + + while(countMoveDetailCount.size()!=iii_ok && System.currentTimeMillis()-st_time<(1000*60*5)){ + try{ + Thread.sleep(1000); + }catch (Exception e){ + + } + + continue; + } + countMove.setStatus(BizStatus.COUNT_ALL); + this.update(countMove); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountPlanServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountPlanServiceImpl.java new file mode 100644 index 0000000..32ecfaf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountPlanServiceImpl.java @@ -0,0 +1,141 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Point; +import com.youchain.businessdata.domain.AsnDetail; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.CountPlan; +import com.youchain.businessdata.service.dto.AsnDetailDto; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.CountPlanRepository; +import com.youchain.businessdata.service.CountPlanService; +import com.youchain.businessdata.service.dto.CountPlanDto; +import com.youchain.businessdata.service.dto.CountPlanQueryCriteria; +import com.youchain.businessdata.service.mapstruct.CountPlanMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2023-10-19 +**/ +@Service +@RequiredArgsConstructor +public class CountPlanServiceImpl implements CountPlanService { + + private final CountPlanRepository countPlanRepository; + private final CountPlanMapper countPlanMapper; + private final EntityManager entityMapper; + + @Override + public Map queryAll(CountPlanQueryCriteria criteria, Pageable pageable){ + Page page = countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countPlanMapper::toDto)); + } + + @Override + public List queryAll(CountPlanQueryCriteria criteria){ + return countPlanMapper.toDto(countPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountPlanDto findById(Long id) { + CountPlan countPlan = countPlanRepository.findById(id).orElseGet(CountPlan::new); + ValidationUtil.isNull(countPlan.getId(),"CountPlan","id",id); + return countPlanMapper.toDto(countPlan); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountPlanDto create(CountPlan resources) { + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + resources.setId(snowflake.nextId()); + return countPlanMapper.toDto(countPlanRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountPlan resources) { + CountPlan countPlan = countPlanRepository.findById(resources.getId()).orElseGet(CountPlan::new); + ValidationUtil.isNull( countPlan.getId(),"CountPlan","id",resources.getId()); + countPlan.copy(resources); + countPlanRepository.save(countPlan); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countPlanRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (CountPlanDto countPlan : all) { + Map map = new LinkedHashMap<>(); + map.put("代码", countPlan.getCode()); + map.put("名称", countPlan.getName()); + map.put("仓库ID", countPlan.getDept()); + map.put("状态", countPlan.getStatus()); + map.put("类型", countPlan.getType()); + map.put("订单数量", countPlan.getOrderQty()); + map.put("盘点数量", countPlan.getCountQty()); + map.put("备注", countPlan.getRemark()); + map.put("来源名称", countPlan.getSourceName()); + map.put("来源序号", countPlan.getSourceId()); + map.put("创建人", countPlan.getCreateBy()); + map.put("修改人", countPlan.getUpdateBy()); + map.put("创建时间", countPlan.getCreateTime()); + map.put("修改时间", countPlan.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public CountPlan toEntity(CountPlanDto planDto) { + return countPlanMapper.toEntity(planDto); + } + + @Override + public List findAllDetail(Long planId){ + String hql=" from CountDetail d where d.plan.id= "+planId; + Query query=entityMapper.createQuery(hql); + List detailList=query.getResultList(); + return detailList; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountRecordServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountRecordServiceImpl.java new file mode 100644 index 0000000..89167e4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/CountRecordServiceImpl.java @@ -0,0 +1,150 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.CountRecord; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.CountRecordRepository; +import com.youchain.businessdata.service.CountRecordService; +import com.youchain.businessdata.service.dto.CountRecordDto; +import com.youchain.businessdata.service.dto.CountRecordQueryCriteria; +import com.youchain.businessdata.service.mapstruct.CountRecordMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2023-10-20 +**/ +@Service +@RequiredArgsConstructor +public class CountRecordServiceImpl implements CountRecordService { + + private final CountRecordRepository countRecordRepository; + private final CountRecordMapper countRecordMapper; + + @Override + public Map queryAll(CountRecordQueryCriteria criteria, Pageable pageable){ + Page page = countRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(countRecordMapper::toDto)); + } + + @Override + public List queryAll(CountRecordQueryCriteria criteria){ + return countRecordMapper.toDto(countRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public CountRecordDto findById(Long id) { + CountRecord countRecord = countRecordRepository.findById(id).orElseGet(CountRecord::new); + ValidationUtil.isNull(countRecord.getId(),"CountRecord","id",id); + return countRecordMapper.toDto(countRecord); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CountRecordDto create(CountRecord resources) { + return countRecordMapper.toDto(countRecordRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CountRecord resources) { + CountRecord countRecord = countRecordRepository.findById(resources.getId()).orElseGet(CountRecord::new); + ValidationUtil.isNull( countRecord.getId(),"CountRecord","id",resources.getId()); + countRecord.copy(resources); + countRecordRepository.save(countRecord); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + countRecordRepository.deleteById(id); + } + } + + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (CountRecordDto countRecord : all) { + Map map = new LinkedHashMap<>(); + map.put("物料序号", countRecord.getItem()); + map.put("物料序号", countRecord.getItemKey()); + map.put("单据号", countRecord.getBillCode()); + map.put("盘点明细ID", countRecord.getCountDetail()); + map.put("源容器", countRecord.getSrcStock()); + map.put("目标容器", countRecord.getDstStock()); + map.put("源点位", countRecord.getSrcPoint()); + map.put("目标点位", countRecord.getDstPoint()); + map.put("源容器编码", countRecord.getSrcStockCode()); + map.put("目标容器编码", countRecord.getDstStockCode()); + map.put("源点位编码", countRecord.getSrcPointCode()); + map.put("目标点位编码", countRecord.getDstPointCode()); + map.put("属性6", countRecord.getInvStatus()); + map.put("属性6", countRecord.getTaskStatus()); + map.put("跳过", countRecord.getBeSkip()); + map.put("退回", countRecord.getBeBack()); + map.put("计划数量", countRecord.getPlanQty()); + map.put("移位数量", countRecord.getCountQty()); + map.put("库存ID", countRecord.getInvId()); + map.put("仓库ID", countRecord.getDept()); + map.put("创建人", countRecord.getCreateBy()); + map.put("修改人", countRecord.getUpdateBy()); + map.put("创建时间", countRecord.getCreateTime()); + map.put("修改时间", countRecord.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public CountRecord createCountRecord(CountDetail d, Inventory inv) { + CountRecord cr = new CountRecord(); + cr.setItemKey(inv.getItemKey()); + cr.setItem(inv.getItemKey().getItem()); + cr.setCountDetail(d); + cr.setPlanQty(inv.getQuantity()); + cr.setSrcPoint(inv.getPoint()); + cr.setSrcPointCode(inv.getPointCode()); + cr.setSrcStock(inv.getStock()); + cr.setSrcStockCode(inv.getStockCode()); + cr.setBillCode(d.getPlan().getCode()); + cr.setBillCode(d.getPlan().getCode()); + cr.setDept(inv.getDept()); + create(cr); + return cr; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryBakServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryBakServiceImpl.java new file mode 100644 index 0000000..7f865b4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryBakServiceImpl.java @@ -0,0 +1,138 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.InventoryBak; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.InventoryBakRepository; +import com.youchain.businessdata.service.InventoryBakService; +import com.youchain.businessdata.service.dto.InventoryBakDto; +import com.youchain.businessdata.service.dto.InventoryBakQueryCriteria; +import com.youchain.businessdata.service.mapstruct.InventoryBakMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2024-04-03 +**/ +@Service +@RequiredArgsConstructor +public class InventoryBakServiceImpl implements InventoryBakService { + + private final InventoryBakRepository inventoryBakRepository; + private final InventoryBakMapper inventoryBakMapper; + private final EntityManager entityManager; + + @Override + public Map queryAll(InventoryBakQueryCriteria criteria, Pageable pageable){ + Page page = inventoryBakRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(inventoryBakMapper::toDto)); + } + + @Override + public List queryAll(InventoryBakQueryCriteria criteria){ + return inventoryBakMapper.toDto(inventoryBakRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public InventoryBakDto findById(Long id) { + InventoryBak inventoryBak = inventoryBakRepository.findById(id).orElseGet(InventoryBak::new); + ValidationUtil.isNull(inventoryBak.getId(),"InventoryBak","id",id); + return inventoryBakMapper.toDto(inventoryBak); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public InventoryBakDto create(InventoryBak resources) { + return inventoryBakMapper.toDto(inventoryBakRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(InventoryBak resources) { + InventoryBak inventoryBak = inventoryBakRepository.findById(resources.getId()).orElseGet(InventoryBak::new); + ValidationUtil.isNull( inventoryBak.getId(),"InventoryBak","id",resources.getId()); + inventoryBak.copy(resources); + inventoryBakRepository.save(inventoryBak); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + inventoryBakRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"InventoryBak"); + FileUtil.downloadExcel(list, response); + } + @Override + public void insertBatch(Long detailId,Long areaId) { + String sql="INSERT into data_inventory_bak(detail_id,bill_code,item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,`status`,dept_id,area_id,zzkw,bf_date) \n" + + "select "+detailId+",bill_code,item_key_id,point_id,quantity,queued_qty,be_lock,be_reject,status,dept_id,area_id,zzkw,SYSDATE() from data_inventory where area_id="+areaId; + Query query=entityManager.createNativeQuery(sql); + query.executeUpdate(); + } + + @Override + public void insertBhBatch(Long detailId,Long areaId) { + String sql="INSERT into data_inventory_bak(detail_id,pick_detail_id,bill_code,item_id,point_id,quantity,queued_qty,be_lock,be_reject,`status`,dept_id,area_id,zzkw,bf_date) \n" + + "select "+detailId+",pd.id, pt.code,pd.item_id,pd.point_id,pd.allocated_qty,0,0,0,pt.`status`,pt.dept_id,pd.sh_area_id,pd.point_id,SYSDATE() from data_pick_detail pd \n" + + "left join data_pick_ticket pt on pt.id=pd.pick_ticket_id\n" + + "where pt.`status` in ('PICKUP','PICK_ALL','ALLOCATE') and pd.point_id is not null and pd.allocated_qty>0 and pd.sh_area_id is not null and pd.sh_area_id="+areaId; + Query query=entityManager.createNativeQuery(sql); + query.executeUpdate(); + } + + public Double getXbQty(long itemId, long areaId,Long zzkwId,Long detailId) { + String hql = "select sum(inv.quantity-inv.queuedQty) from InventoryBak inv where 1=1 " + + " and inv.itemKey.item.id=" + itemId + + " and inv.area.id=" + areaId + + " and inv.detailId="+detailId+ + " and inv.quantity!=0 "; + if(zzkwId!=null) { + hql += " and inv.zzkw.id=" + zzkwId; + } + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + if(inventoryList.size()>0){ + Object obj=inventoryList.get(0); + if(obj==null){ + return 0d; + }else{ + return (Double)obj; + } + } + return 0d; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryLogServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryLogServiceImpl.java new file mode 100644 index 0000000..bdc8f6a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryLogServiceImpl.java @@ -0,0 +1,256 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import cn.hutool.core.date.DateTime; +import cn.idev.excel.FastExcel; +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.dto.StockQueryCriteria; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.vo.InventoryExcelDto; +import com.youchain.businessdata.service.vo.InventoryExcelVO; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.InventoryLogRepository; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.dto.InventoryLogDto; +import com.youchain.businessdata.service.dto.InventoryLogQueryCriteria; +import com.youchain.businessdata.service.mapstruct.InventoryLogMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.servlet.http.HttpServletResponse; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-31 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class InventoryLogServiceImpl implements InventoryLogService { + + private final InventoryLogRepository inventoryLogRepository; + private final InventoryLogMapper inventoryLogMapper; + private final EntityManager entityMapper; + private final DictDetailService dictDetailService; + + @Override + public Map queryAll(InventoryLogQueryCriteria criteria, Pageable pageable) { + Page page = inventoryLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(inventoryLogMapper::toDto)); + } + + @Override + public List queryAll(InventoryLogQueryCriteria criteria) { + return inventoryLogMapper.toDto(inventoryLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public InventoryLogDto findById(Long id) { + InventoryLog inventoryLog = inventoryLogRepository.findById(id).orElseGet(InventoryLog::new); + ValidationUtil.isNull(inventoryLog.getId(), "InventoryLog", "id", id); + return inventoryLogMapper.toDto(inventoryLog); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public InventoryLogDto create(InventoryLog resources) { + return inventoryLogMapper.toDto(inventoryLogRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(InventoryLog resources) { + InventoryLog inventoryLog = inventoryLogRepository.findById(resources.getId()).orElseGet(InventoryLog::new); + ValidationUtil.isNull(inventoryLog.getId(), "InventoryLog", "id", resources.getId()); + inventoryLog.copy(resources); + inventoryLogRepository.save(inventoryLog); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + inventoryLogRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all, "InventoryLog"); + FileUtil.downloadExcel(list, response); + } + + /** + * @Description + * @Author Houjianlan + * @Date + */ + @Override + public InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area, ItemKey itemKey, Point srcPoint, Point dstPoint, Stock srcStock, Stock dstStock, + Double srcQty, Double occurQty, String stockCode, String xpp, String refObj, Long refObjId, Long invId, String description) { + InventoryLog log = new InventoryLog(); + log.setLogType(logType); + log.setIncDec(incDec); + log.setRelatedBill(relatedBill); + log.setItemKey(itemKey); + if (area != null) { + log.setArea(area); + } + if (srcPoint != null) { + log.setSrcPointCode(srcPoint.getCode()); + log.setSrcPoint(srcPoint); + } + if (dstPoint != null) { + log.setDstPoint(dstPoint); + log.setDstPointCode(dstPoint.getCode()); + } + if (srcStock != null) { + log.setSrcStock(srcStock); + } + if (dstStock != null) { + log.setDstStock(dstStock); + } + log.setSrcStockCode(xpp); + log.setDstStockCode(stockCode); + log.setSrcQty(srcQty); + log.setOccurQuantity(occurQty); + if (incDec == BizStatus.ADD) { + log.setDstQty(srcQty + occurQty); + } else if (incDec == BizStatus.INVARIANT) { + log.setDstQty(srcQty); + } else if (incDec == BizStatus.REDUCE) { + log.setDstQty(srcQty - occurQty); + } + log.setOccurTime(new Timestamp(System.currentTimeMillis())); + log.setRefObj(refObj); + log.setRefObjId(refObjId); + log.setInvId(invId); + log.setDescription(description); + create(log); + return log; + } + + public InventoryLog storeInventoryLog(String logType, String incDec, String relatedBill, Area area, ItemKey itemKey, Point srcPoint, Point dstPoint, Point zzkw, + Double srcQty, Double occurQty, String xpp, String refObj, Long refObjId, Long invId, String description) { + InventoryLog log = new InventoryLog(); + log.setLogType(logType); + log.setIncDec(incDec); + log.setRelatedBill(relatedBill); + log.setItemKey(itemKey); + if (area != null) { + log.setArea(area); + } + if (srcPoint != null) { + log.setSrcPointCode(srcPoint.getCode()); + log.setSrcPoint(srcPoint); + } + if (dstPoint != null) { + log.setDstPoint(dstPoint); + log.setDstPointCode(dstPoint.getCode()); + } + log.setZzkw(zzkw); +// if(srcStock!=null){ +// log.setSrcStock(srcStock); +// } +// if(dstStock!=null){ +// log.setDstStock(dstStock); +// } + log.setSrcStockCode(xpp); + log.setSrcQty(srcQty); + log.setOccurQuantity(occurQty); + if (incDec == BizStatus.ADD) { + log.setDstQty(srcQty + occurQty); + } else if (incDec == BizStatus.INVARIANT) { + log.setDstQty(occurQty); + log.setOccurQuantity(log.getDstQty() - log.getSrcQty()); + } else if (incDec == BizStatus.REDUCE) { + log.setDstQty(srcQty - occurQty); + } + log.setOccurTime(new Timestamp(System.currentTimeMillis())); + log.setRefObj(refObj); + log.setRefObjId(refObjId); + log.setInvId(invId); + log.setDescription(description); + create(log); + return log; + } + + @Override + public List listByInventoryLogs(Long lastId, int pageSize, InventoryLogQueryCriteria criteria) { + long startTime = System.currentTimeMillis(); + Pageable pageable = PageRequest.of(0, pageSize); + String itemCode = criteria.getItemCode(); + List list = inventoryLogRepository.listByInventoryLogs(lastId, itemCode, pageable); + log.info("SQL耗时: {}ms", System.currentTimeMillis() - startTime); + return list; + } + + @Override + public void exportInventoryLogs(InventoryLogQueryCriteria criteria, HttpServletResponse response) throws IOException { + Map logDic = dictDetailService.getDictDetailByNameForValue("inv_log_type"); + Map incDic = dictDetailService.getDictDetailByNameForValue("inc_dec"); + FastExcelUtil.batchExportExcel( + response, + "库存日志.xlsx", + "库存日志", + InventoryExcelVO.class, + (lastId, pageSize) -> this.listByInventoryLogs(lastId, pageSize, criteria), + dto -> InventoryExcelVO.builder() + .id(dto.getId()) + .areaName(dto.getAreaName()) + .itemCode(dto.getItemCode()) + .itemName(dto.getItemName()) + .logType(logDic.get(dto.getLogType())==null?null:logDic.get(dto.getLogType()).getLabel()) + .incDec(incDic.get(dto.getIncDec())==null?null:incDic.get(dto.getIncDec()).getLabel()) + .srcPointCode(dto.getSrcPoint()) + .dstPointCode(dto.getDstPoint()) + .srcQty(dto.getSrcQty()) + .dstQty(dto.getDstQty()) + .occurQuantity(dto.getOccurQuantity()) + .relatedBill(dto.getRelatedBill()) + .description(dto.getDescription()) + .createBy(dto.getCreateBy()) + .occurTime(dto.getOccurTime()) + .build(), + InventoryExcelDto::getId, + 2000 + ); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java new file mode 100644 index 0000000..a7b217d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/InventoryServiceImpl.java @@ -0,0 +1,402 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.sun.jna.platform.win32.WinDef; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.service.PointService; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.inputJson.buttenJson.InventoryButton; +import com.youchain.businessdata.inputJson.buttenJson.dataAll.InventoryYW; +import com.youchain.businessdata.returnJson.RInvQuery; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.dto.*; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.mapstruct.InventoryMapper; +import lombok.extern.slf4j.Slf4j; +import net.dreamlu.mica.core.utils.JsonUtil; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.criteria.Join; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Predicate; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** + * @author huojin + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-22 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class InventoryServiceImpl implements InventoryService { + + private final InventoryRepository inventoryRepository; + private final InventoryMapper inventoryMapper; + private final EntityManager entityManager; + private final InventoryLogService invLogService; + private final PointService pointService; + + @Override + public Map queryAll(InventoryQueryCriteria criteria, Pageable pageable) { + Page page = inventoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(inventoryMapper::toDto)); + } + + @Override + public List queryAll(InventoryQueryCriteria criteria) { + return inventoryMapper.toDto(inventoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + public List queryAll(InvQueryCriteria criteria) { + return inventoryMapper.toDto(inventoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public InventoryDto findById(Long id) { + Inventory inventory = inventoryRepository.findById(id).orElseGet(Inventory::new); + ValidationUtil.isNull(inventory.getId(), "Inventory", "id", id); + return inventoryMapper.toDto(inventory); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public InventoryDto create(Inventory resources) { + return inventoryMapper.toDto(inventoryRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Inventory resources) { + Inventory inventory = inventoryRepository.findById(resources.getId()).orElseGet(Inventory::new); + ValidationUtil.isNull(inventory.getId(), "Inventory", "id", resources.getId()); + inventory.copy(resources); + inventoryRepository.save(inventory); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + inventoryRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"Inventory"); + FileUtil.downloadExcel(list, response); + } + + @Override + public void downloadXb(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"InvXb"); + FileUtil.downloadExcel(list, response); + } + + @Override + public void downloadXt(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"InvXt"); + FileUtil.downloadExcel(list, response); + } + + @Override + public void downloadZz(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"InvZz"); + FileUtil.downloadExcel(list, response); + } + + @Override + public List queryInventoryAllocate(long itemId, long areaId,Long zzkwId) { + String hql = " from Inventory inv where 1=1 " + + " and inv.itemKey.item.id=" + itemId + " " + + " and inv.area.id=" + areaId + " " + + " and inv.quantity-inv.queuedQty>0 and inv.quantity>0 and inv.point.code !='BH_ZC'"; + if(zzkwId!=null){ + hql+=" and inv.zzkw.id="+zzkwId; + hql+="and inv.point.type in ('"+BaseStatus.HCKW+"','"+BaseStatus.ZZKW+"')"; + }else{ + hql+="and inv.point.type='"+BaseStatus.CH+"' "; + } + hql+= " order by inv.itemKey.propC1 asc "; + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + return inventoryList; + } + + public Double getInvQty(long itemId, long areaId,Long zzkwId) { + String hql = "select sum(inv.quantity-inv.queuedQty) from Inventory inv where 1=1 " + + " and inv.itemKey.item.id=" + itemId + " " + + " and inv.area.id=" + areaId + " " + + " and inv.quantity>0 "; + if(zzkwId!=null){ + hql+=" and inv.zzkw.id="+zzkwId; + hql+="and inv.point.type in ('"+BaseStatus.HCKW+"','"+BaseStatus.ZZKW+"')"; + }else{ + hql+="and inv.point.type='"+BaseStatus.CH+"'"; + } + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + if(inventoryList.size()>0){ + Object obj=inventoryList.get(0); + if(obj==null){ + return 0d; + }else{ + return (Double)obj; + } + } + return 0d; + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public Inventory getInventory(ItemKey itemKey, Area area, Point point, Point zzkw, Dept dept, String type) { + //生成Inventory + String hql = " from Inventory inv where 1=1 "; + if(type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.ZZKW_TL)||type.equals(BizStatus.YK_JS)){ + if(zzkw==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "制造库位必填"); + } + if(!area.getBexb()){ + throw new BadRequestException(HttpStatus.NOT_FOUND, area.getCode()+"接收库区必须为线边仓"); + } +// if(area.getPoint()==null){ + if(area.getPointId()==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "接收库区线边库位必填"); + } + } + if(type.equals(BizStatus.SL_ALL)){ + //取库区默认 + hql += " and inv.point.id=" + area.getPointId() + " "; + }else{ + if (point != null) { + hql += " and inv.point.id=" + point.getId() + " "; + } + } + if (itemKey != null) { + hql += " and inv.itemKey.id=" + itemKey.getId() + " "; + } + hql += " and inv.area.id=" + area.getId() + " "; + if (dept != null) { + hql += " and inv.dept.id=" + dept.getId() + " "; + } + if(area.getBexb()) { + if (zzkw != null) { + hql += " and inv.zzkw.id=" + zzkw.getId() + " "; + }else{ + throw new BadRequestException(HttpStatus.NOT_FOUND, "线边仓制造库位必填"); + } + } + + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + Inventory inventory = null; + if (inventoryList.size() > 0) { + inventory = inventoryList.get(0); + } else { + //创建Inventory + if (type.equals(BizStatus.ZZKW_TL) ||type.equals(BizStatus.RECEIVING_UP) || type.equals(BizStatus.MOVE)||type.equals(BizStatus.PICK_DOWN)||type.equals(BizStatus.PICK_CANCEL)||type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.COUNT_MOVE)||type.equals(BizStatus.YK_JS)) { + inventory = new Inventory(); + inventory.setItemKey(itemKey); + inventory.setPoint(point); + inventory.setPointCode(point.getCode()); + if(zzkw==null){ + zzkw=pointService.getPoint("ZZKW",null,null,null); + } + inventory.setZzkw(zzkw); +// inventory.setStock(stock); +// inventory.setStockCode(stock.getCode()); + inventory.setDept(dept); + inventory.setArea(area); + create(inventory); + } + } + return inventory; + } + + + @Override + public List getXbHyInv(Item item, Area area, String gw, Point zzkw,String type) { + //生成Inventory + String hql = " from Inventory inv where 1=1 and inv.point.type not in ('"+BaseStatus.BHZC+"','"+BaseStatus.SHZC+"')"; + if (item != null) { + hql += " and inv.itemKey.item.id=" + item.getId() + " "; + } + hql += " and inv.area.workingStation='" + gw + "'"; + if (zzkw != null) { + hql += " and inv.zzkw.id=" + zzkw.getId(); + } + if(type.equals("耗用")){//目前只能从暂存库位耗用 + hql += " and inv.point.id=" + area.getPointId(); + } + hql+=" order by inv.itemKey.propC1 asc"; + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + return inventoryList; + } + + @Override + public List getInventoryXbTl(Item item, Area area,Point point,Point zzkw) { + //生成Inventory + String hql = " from Inventory inv where 1=1 and inv.point.id ="+point.getId(); + hql += " and inv.itemKey.item.id=" + item.getId() + " "; + hql += " and inv.area.id="+area.getId(); + hql += " and inv.zzkw.id=" + zzkw.getId(); + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + return inventoryList; + } + + @Override + public List queryInventory(Stock stock) { + String hql = " from Inventory inv where inv.stock.id=" + stock.getId() + " and inv.quantity>0 "; + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + return inventoryList; + } + + public List queryInventory(Long areaId, Long pointId, Long itemKeyId) { + String hql = " from Inventory inv where inv.area.id=" + areaId + " and inv.point.id=" + pointId + " and inv.itemKey.id=" + itemKeyId; + Query query = entityManager.createQuery(hql); + List inventoryList = query.getResultList(); + return inventoryList; + } + + @Override + public List getInvForPlan(String type, Long areaId, Long itemId, Long deptId) { + String hql = " from Inventory inv where 1=1 and inv.queuedQty<=0 and inv.quantity>=0"; + if (type.equals(BizStatus.ZONE)) { + hql += " and inv.point.area.id=" + areaId; + } else if (type.equals(BizStatus.ITEM)) { + hql += " and inv.itemKey.item.id=" + itemId; + } else if (type.equals(BizStatus.WAREHOUSE)) { + hql += " and 1=1"; + } + Query query = entityManager.createQuery(hql); + List list = query.getResultList(); + return list; + } + + @Override + public void kuneMovePosition(InventoryButton inventoryButton) { + //操作类型=移位,增加/减少=减少 , + //原点位=之前记录的库位,目标库位=选择的库位 库区、品番、暂存库位、制造库位都取inv上的。 原数量取原纪录,目标数量取移出后的数量, 发生数量=输入的移位数量 + //操作类型=库存调整,增加/减少=根据实际数量判断,大于原数量为增加,小于原数量为减少,其他的类似上面数据 + //移位时,加入目标库位之前没有这个记录,则自动生成 + //库存唯一键:area,point,itemKey,zzkw + //位移所需要的数据 + InventoryYW inventoryYW = inventoryButton.getInventoryYW(); + //原数据 + Inventory inventoryOld = inventoryYW.getInventory(); + // 位移数量 + double rmNumber = inventoryYW.getRmNumber(); + //判断 库存-要移动的数量 + double rmNum = inventoryOld.getQuantity() - rmNumber; + if (rmNum > 0) {//移除数量小于库存数量 + //生成库存或生成记录 + Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE); + //生成移除的日志 + invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber, + null,null, BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); + //生成目标点位的日志 + invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventory.getStock(), inventory.getQuantity(), rmNumber, + null,null, BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); + //减库存 + inventoryOld.setQuantity(rmNum); + this.update(inventoryOld); + //加库存 + inventory.setQuantity(inventory.getQuantity() + rmNumber); + this.update(inventory); + } else if (rmNum < 0) {//移除数量大于库存数量 + throw new BadRequestException(HttpStatus.NOT_FOUND, "移除数量大于库存数量"); + } else {//移除数量等于库存数量 + //生成库存或生成记录 + Inventory inventory = this.getInventory(inventoryOld.getItemKey(), inventoryOld.getArea(), inventoryYW.getDstPoint(), inventoryOld.getZzkw(), inventoryOld.getDept(), BizStatus.MOVE); + //生成移除的日志 + invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, null, inventoryOld.getArea(), inventoryOld.getItemKey(), inventoryOld.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventoryOld.getStock(), inventoryOld.getQuantity(), rmNumber, + null,null,BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); + //生成目标点位的日志 + invLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), inventoryYW.getDstPoint(), inventoryOld.getStock(), inventory.getStock(), inventory.getQuantity(), rmNumber, + null,null,BizStatus.MOVE, inventoryOld.getId(), inventoryOld.getId(), inventoryOld.getDescription()); + inventoryRepository.delete(inventoryOld); + //加库存 + inventory.setQuantity(inventory.getQuantity() + rmNumber); + this.update(inventory); + } + } + + public List queryItemStock() { + String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " + + " from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code"; + Query query = entityManager.createQuery(hql); + List list = query.getResultList(); + return list; + } + + public List queryInvApp(String code,String pointCode) { + String sql = "SELECT inv.id invId,it.`code` itemCode,it.name itemName,inv.quantity qty,ik.prop_C1 propD1,p.code pointCode FROM `data_inventory` inv \n" + + "left join data_item_key ik on ik.id=inv.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n" + + "left join base_point p on p.id=inv.point_id \n" + + "left join base_area area on area.id=inv.area_id\n" + + "where 1=1 and area.besh=1 and p.code!='BH_ZC' and inv.quantity!=0 " ; + if(code!=null&&!code.equals("")){ + sql+=" and it.code='"+code+"'"; + } + if(pointCode!=null&&!pointCode.equals("")){ + sql+=" and p.code='"+pointCode+"'"; + } + sql+=" order by it.code"; + List ts= entityManager.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List list = JSON.parseArray(JSON.toJSONString(ts),RInvQuery.class); + return list; + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ItemKeyServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ItemKeyServiceImpl.java new file mode 100644 index 0000000..2bd44cb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ItemKeyServiceImpl.java @@ -0,0 +1,157 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Item; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.ItemKeyRepository; +import com.youchain.businessdata.service.ItemKeyService; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import com.youchain.businessdata.service.dto.ItemKeyQueryCriteria; +import com.youchain.businessdata.service.mapstruct.ItemKeyMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author houjianlan +* @date 2023-08-21 +**/ +@Service +@RequiredArgsConstructor +@Slf4j +public class ItemKeyServiceImpl implements ItemKeyService { + + private final ItemKeyRepository itemKeyRepository; + private final ItemKeyMapper itemKeyMapper; + private final EntityManager entityManager; + + @Override + public Map queryAll(ItemKeyQueryCriteria criteria, Pageable pageable) { + Page page = itemKeyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(itemKeyMapper::toDto)); + } + + @Override + public List queryAll(ItemKeyQueryCriteria criteria) { + return itemKeyMapper.toDto(itemKeyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public ItemKeyDto findById(Long id) { + ItemKey itemKey = itemKeyRepository.findById(id).orElseGet(ItemKey::new); + ValidationUtil.isNull(itemKey.getId(), "ItemKey", "id", id); + return itemKeyMapper.toDto(itemKey); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ItemKeyDto create(ItemKey resources) { + return itemKeyMapper.toDto(itemKeyRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ItemKey resources) { + ItemKey itemKey = itemKeyRepository.findById(resources.getId()).orElseGet(ItemKey::new); + ValidationUtil.isNull(itemKey.getId(), "ItemKey", "id", resources.getId()); + itemKey.copy(resources); + itemKeyRepository.save(itemKey); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + itemKeyRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (ItemKeyDto itemKey : all) { + Map map = new LinkedHashMap<>(); + map.put("物料序号", itemKey.getItem()); + map.put("批次号", itemKey.getPropC1()); + map.put("序列号", itemKey.getPropC2()); + map.put("属性3", itemKey.getPropC3()); + map.put("属性4", itemKey.getPropC4()); + map.put("属性5", itemKey.getPropC5()); + map.put("属性6", itemKey.getPropC6()); + map.put("生产日期", itemKey.getPropD1()); + map.put("到期日期", itemKey.getPropD2()); + map.put("仓库ID", itemKey.getDept()); + map.put("创建人", itemKey.getCreateBy()); + map.put("修改人", itemKey.getUpdateBy()); + map.put("创建时间", itemKey.getCreateTime()); + map.put("修改时间", itemKey.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ItemKey getItemKey(Item item, String propC1) { + //生成itemKey + String hql = " from ItemKey ik where 1=1 "; + if (item != null) { + hql += " and ik.item.id=" + item.getId() + " "; + } + if (propC1 != null && propC1.length() > 0) { + hql += " and ik.propC1='" + propC1 + "' "; + }else{ + hql += " and ik.propC1 is null"; + } +// if (propD1 != null) { +// hql += " and DATE(ik.propD1) ='" + propD1 +"'"; +// }else{ +// hql += " and ik.propD1 is null"; +// } + Query query = entityManager.createQuery(hql); + List itemKeyList = query.getResultList(); + ItemKey itemKey = null; + if (itemKeyList.size() > 0) { + itemKey = itemKeyList.get(0); + } else { + //创建ItemKey + itemKey = new ItemKey(); + itemKey.setItem(item); + itemKey.setDept(item.getDept()); + itemKey.setPropC1(propC1); + this.create(itemKey); + } + return itemKey; + } + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java new file mode 100644 index 0000000..87a8571 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickDetailServiceImpl.java @@ -0,0 +1,494 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.*; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.ItemService; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.dto.ItemDto; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.repository.TaskRepository; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.PickDetailZscDto; +import com.youchain.businessdata.service.dto.PickTicketDto; +import com.youchain.businessdata.service.dto.jsonDto.CxjlDto; +import com.youchain.businessdata.service.mapstruct.PickTicketMapper; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.service.dto.PickDetailDto; +import com.youchain.businessdata.service.dto.PickDetailQueryCriteria; +import com.youchain.businessdata.service.mapstruct.PickDetailMapper; +import lombok.extern.slf4j.Slf4j; +import net.dreamlu.mica.core.utils.JsonUtil; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.math.BigInteger; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author huojin + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-16 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class PickDetailServiceImpl implements PickDetailService { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + private final PickDetailRepository pickDetailRepository; + private final PickDetailMapper pickDetailMapper; + private final InventoryRepository inventoryRepository; + private final TaskRepository taskRepository; + private final ItemService itemService; + private final TaskService taskService; + private final AreaService areaService; + private final ItemRepository itemRepository; + private final PointRepository pointRepository; + private final EntityManager entityMapper; + private final PickTicketRepository pickTicketRepository; + private final PointService pointService; + private final InventoryService inventoryService; + private final EntityManager entityManager; + private final AutomaticPlanningRepository automaticPlanningRepository; + private final JobRepository jobRepository; + private final AreaRepository areaRepository; + private final InventoryLogService inventoryLogService; + + @Override + public Map queryAll(PickDetailQueryCriteria criteria, Pageable pageable) { + Page page = pickDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(pickDetailMapper::toDto)); + } + + @Override + public List queryAll(PickDetailQueryCriteria criteria) { + return pickDetailMapper.toDto(pickDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public PickDetailDto findById(Long id) { + PickDetail pickDetail = pickDetailRepository.findById(id).orElseGet(PickDetail::new); + ValidationUtil.isNull(pickDetail.getId(), "PickDetail", "id", id); + return pickDetailMapper.toDto(pickDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickDetailDto create(PickDetail resources) { + return pickDetailMapper.toDto(pickDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PickDetail resources) { + PickDetail pickDetail = pickDetailRepository.findById(resources.getId()).orElseGet(PickDetail::new); + ValidationUtil.isNull(pickDetail.getId(), "PickDetail", "id", resources.getId()); + //订单数量的调整 + PickTicket pickTicket = resources.getPickTicket(); + PickDetailDto byId = this.findById(resources.getId()); + pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() - byId.getOrderQty() + resources.getOrderQty()); + pickTicketRepository.updataOrderQuantity(pickTicket.getOrderQuantity(),pickTicket.getId()); + pickDetail.copy(resources); + pickDetailRepository.save(pickDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + deletePickDetail(id); + } + } + + public void deletePickDetail(Long id){ + //扣主表的订单数量 + PickDetail detail = pickDetailRepository.getById(id); + PickTicket pt=detail.getPickTicket(); + Boolean bcbl=Boolean.FALSE; + if(pt.getBillType().getName().equals(BaseStatus.BT_BCBL)){ + bcbl=Boolean.TRUE; + } + if(detail.getAllocatedQty()+detail.getBcQty()>0){ + throw new BadRequestException("已出单,不能删除"); + } + if(bcbl){ + PickDetail oldDetail=pickDetailRepository.getById(detail.getSourceId()); + if(oldDetail!=null){ + oldDetail.setBcQty(oldDetail.getBcQty()- detail.getOrderQty()); + this.update(oldDetail); + } + } + pt.setOrderQuantity(pt.getOrderQuantity()-detail.getOrderQty()); + // pickTicketService.update(pt); + pickTicketRepository.save(pt); + pickDetailRepository.deleteById(id); + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"ViewPickDetailZsc"); + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickDetail cxjlCreate(CxjlDto cxjldto){ + PickDetail pd=new PickDetail(); + Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA); + Area sharea=areaRepository.getById(cxjldto.getRk_id()); + Item it=itemRepository.getById(cxjldto.getItem_id()); + Point zzkw= pointRepository.getById(cxjldto.getZzkw_id()); + pd.setArea(area); + pd.setShArea(sharea); + pd.setItem(it); + pd.setPoint(zzkw); + pd.setStatus(BizStatus.OPEN); + pd.setOrderQty(cxjldto.getOrder_qty()); + pd.setRemark(cxjldto.getRemark()); + pd.setSourceName("CXJL"); + this.create(pd); + return pd; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public synchronized void allocate(long id, double quantity){ + PickDetailDto pickDetailDto = findById(id); + PickDetail pd = toEntity(pickDetailDto);//Dto转实体 + PickTicket pickTicket = pd.getPickTicket(); + ItemDto itemDto = pickDetailDto.getItem(); + Item item = itemService.toEntity(itemDto); + if (pd.getOrderQty() > pd.getAllocatedQty()) { + Long zzkwId=null; + if(pd.getPoint()!=null&&pickTicket.getArea().getBexb()){ + zzkwId=pd.getPoint().getId(); + } + List invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(),zzkwId); + if (invs.size() > 0) { + double allocateQty = 0; + double unQty = quantity;//未分配数量 + double srs=item.getExtendD3(); + for (Inventory inv : invs) { + Point startPoint = inv.getPoint();//原库位 + String areaCode="S仓"; + if(startPoint.getArea().equals("A仓")){ + areaCode="A仓"; + } + Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位 + if(endPoint==null){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "请维护备货暂存区"); + } + if (unQty <= 0) { + break; + } + allocateQty = inv.getQuantity() - inv.getQueuedQty();//库存可用数量 + if (allocateQty <= 0) { + continue; + } + //本次拣货数小于收容数则按照收容数进行分配,只有正常备货单才走该逻辑 + if(pickTicket.getCode().indexOf("BH")>=0||pickTicket.getCode().indexOf("BC")>=0) { + if (unQty < srs) { + if (allocateQty >= srs) { + unQty = srs; + } else { + //unQty = allocateQty; + } + } + } + if (unQty < allocateQty) { + allocateQty = unQty; + } + inv.setQueuedQty(inv.getQueuedQty() + allocateQty); + inventoryRepository.save(inv); + + unQty -= allocateQty; + pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty); + pickDetailRepository.save(pd); + pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty); + if (pickTicket.getAllocatedQuantity()>0) { + pickTicket.setStatus(BizStatus.ALLOCATE); + } + //备货表上出单日期(审核写) + pickTicket.setOutOrderDate(new Timestamp(new Date().getTime())); + pickTicketRepository.save(pickTicket); + Task task = taskService.storeTask(null,pd,pickTicket.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty); + //修改占用数,写入日志 + inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, pickTicket.getCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(), + inv.getPoint(), inv.getZzkw(), (inv.getQueuedQty()-allocateQty), allocateQty, null, BizStatus.PICK, + pd.getId(), inv.getId(), task.getId()+"备货占用"); + } + } + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND,"已分配,请勿重复操作!"); + } + + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public synchronized void cancelAllocate(long id){ + PickDetailDto pickDetailDto = findById(id); + PickDetail pd = toEntity(pickDetailDto); + List Tasks = taskRepository.getPickNotAllTask(id); + for (Task task : Tasks) { + if(task.getMoveQty()>0){ + //throw new BadRequestException(HttpStatus.NOT_FOUND,"已拣货,请勿重复操作!"); + continue; + } + log.info(task.getId()+"==="+task.getItemKey().getItem().getCode()+"==="+task.getPlanQty()); + //根据Taskz找到对应的库存 + double quantity=task.getPlanQty(); +// Inventory inv = inventoryRepository.findById(task.getInvId()).get(); + Inventory inv=inventoryService.getInventory(task.getItemKey(),pd.getPickTicket().getArea(),task.getSrcPoint(),task.getZzkw(),pd.getPickTicket().getDept(),BizStatus.CANCEL); + //修改占用数,写入日志 + inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, task.getBillCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(), + inv.getPoint(), inv.getZzkw(), inv.getQueuedQty(), quantity, null, BizStatus.PICK, + pd.getId(), inv.getId(), task.getId()+"取消占用"); + inv.setQueuedQty(inv.getQueuedQty() - quantity); + inventoryRepository.save(inv); + //删除Task + taskRepository.delete(task); + pd.setAllocatedQty(pd.getAllocatedQty() - quantity); + pd.setPureXqBz(pd.getPropC4()-pd.getAllocatedQty()); + if (pd.getAllocatedQty() <= 0) { + pd.setAllocatedQty(0d); + pd.setStatus(BizStatus.OPEN); + } + this.update(pd); + pickDetailRepository.save(pd); + + } + + } + + @Override + public long count() { + return pickDetailRepository.count(); + } + + @Override + public PickDetail toEntity(PickDetailDto pickDetailDto) { + return pickDetailMapper.toEntity(pickDetailDto); + } + + public List queryOut(String type, String date) { + String hql = ""; + if (type.equals("Day")) { + hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " + + " where DATE_FORMAT(d.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')"; + } else if (type.equals("Month")) { + hql = "select sum(d.orderQty),sum(d.pickedQty) from PickDetail d " + + " where DATE_FORMAT(d.createTime,'%Y-%m')=DATE_FORMAT(now(),'%Y-%m')"; + } else if (type.equals("InOutDay")) { + hql = "select DATE_FORMAT(d.createTime,'%Y-%m-%d'),sum(d.pickedQty) from PickDetail d " + + " where DATE_FORMAT(d.createTime,'%Y-%m-%d')>='" + date + "' " + + " group by DATE_FORMAT(d.createTime,'%Y-%m-%d')"; + } + Query query = entityMapper.createQuery(hql); + List ts = query.getResultList(); + return ts; + } + + @Override + public PickDetail createPickDetail(PickTicket pt,Item item, String po,double qty,String supplier) { + PickDetail d = new PickDetail(); + d.setItem(item); + d.setLineNo(1l); + d.setStatus(BizStatus.OPEN); + d.setOrderQty(qty); + d.setDept(item.getDept()); + d.setPo(po); + d.setPickTicket(pt); + d.setSupplier(supplier); + pickDetailRepository.save(d); + return d; + } + + @Override + public List queryPickDetailList(long picktickId) { + String hql = " from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.orderQty-pd.allocatedQty>0 "; + Query query = entityMapper.createQuery(hql); + List queryResultList = query.getResultList(); + return queryResultList; + } + public List queryZscAll(PickDetailQueryCriteria criteria) { + Query query = getQuery(criteria,BizStatus.QUERY_PAGE); + List ts= query + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List list = JSON.parseArray(JSON.toJSONString(ts),PickDetailZscDto.class); + return list; + } + + + public Map queryPickDetailAll(PickDetailQueryCriteria criteria, Pageable pageable) { + int pageNum=pageable.getPageNumber();//当前页 + int pageSize=pageable.getPageSize();//条数 + Query queryTotal = getQuery(criteria,BizStatus.QUERY_TOTAL); + List l=queryTotal.getResultList(); + int pageCount=((BigInteger)l.get(0)).intValue(); + + Query queryPage = getQuery(criteria,BizStatus.QUERY_PAGE); + queryPage.setFirstResult((pageNum)*pageSize); + queryPage.setMaxResults((pageNum+1)*pageSize); + long st=System.currentTimeMillis(); + List queryResultList = queryPage.unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + log.error("查询指示残用时:"+(System.currentTimeMillis()-st)); + Map map=new HashMap<>(); + map.put("content",queryResultList); + map.put("totalElements",pageCount); + return map; + } + public Query getQuery(PickDetailQueryCriteria criteria,String type){ + String midSql="SELECT * " ; + if(type.equals(BizStatus.QUERY_TOTAL)){ + midSql="SELECT count(`id`) "; + } + String sql =midSql+" from (select pd.id,pt.id pt_id,pt.`code`,rk.gc_code,rk.name rk_name,rk.code rk_code,ck.code ck_code,ck.name ck_name,pt.pc,pt.`status`,pt.order_date,it.code item_code,it.name item_name,it.unit,\n" + + "pd.xq_qty,it.extend_d3,pd.prop_c4,(pd.order_qty-pd.allocated_qty-pd.bc_qty) as pure_xq_bz,pd.order_qty,pd.bc_qty," + + "(pd.order_qty-pd.allocated_qty) wcd_qty,pd.allocated_qty,pd.picked_qty,pd.shipped_qty,pd.xb_qty,\n" + + "pd.supplier,pd.contents,pd.ac,zzkw.`code` zzkw_code,pd.remark,\n" + + "(select max(dl.new_item_code) from data_design_list dl where dl.old_item_id=it.id and dl.new_item_code is not null and pd.allocated_qty=0 and pd.bc_qty=0 and SUBSTR(dl.implementation_date,1,6)=DATE_FORMAT(pt.order_date,'%Y%m')) as sb_item_code,\n" + + "(select IFNULL(sum(inv.quantity-inv.queued_qty),0) from data_inventory inv left join data_item_key ik on ik.id=inv.item_key_id where ik.item_id=it.id and inv.area_id=pt.area and inv.point_id not in (144,145)) as inv_qty "+ + " FROM `data_pick_detail` pd \n" + + "left join data_pick_ticket pt on pt.id=pd.pick_ticket_id\n" + + "left join base_item it on it.id=pd.item_id\n" + + "left join base_area rk on rk.id=pd.sh_area_id\n" + + "left join base_area ck on ck.id=pd.area_id\n" + + "left join base_point zzkw on zzkw.id=pd.point_id " + + "where 1=1 and DATE_FORMAT(pt.order_date,'%Y%m%d')>=DATE_FORMAT(NOW(),'%Y%m%d') and pt.code like 'B%'" + + " )t where 1=1 " ; +// } + if(criteria!=null) { + if (criteria.getCode()!=null &&!criteria.getCode().equals("") ) { + sql += " and t.code like '%" + criteria.getCode() + "%'"; + } + if (criteria.getItemCode()!=null &&!criteria.getItemCode().equals("") ) { + sql += " and t.item_code like '%" + criteria.getItemCode() + "%'"; + } + if (criteria.getItemName()!=null &&!criteria.getItemName().equals("") ) { + sql += " and t.item_name like '%" + criteria.getItemName() + "%'"; + } + if (criteria.getRkAreaCode()!=null &&!criteria.getRkAreaCode().equals("") ) { + sql += " and t.rk_code like '%" + criteria.getRkAreaCode() + "%'"; + } + if (criteria.getGcCode()!=null &&!criteria.getGcCode().equals("") ) { + sql += " and t.gc_code like '%" + criteria.getGcCode() + "%'"; + } + if (criteria.getCkAreaCode()!=null &&!criteria.getCkAreaCode().equals("") ) { + sql += " and t.ck_code like '%" + criteria.getCkAreaCode() + "%'"; + } + if (criteria.getPureXqBz()!=null &&!criteria.getPureXqBz().equals("") ) { + sql += " and t.pure_xq_bz>="+criteria.getPureXqBz(); + } + if (criteria.getStatus()!=null &&!criteria.getStatus().equals("") ) { + sql += " and t.status='"+criteria.getStatus()+"'"; + } + if (criteria.getInvQty()!=null &&!criteria.getInvQty().equals("") ) { + sql += " and t.inv_qty>="+criteria.getInvQty(); + } + if (criteria.getCreateTime()!=null) { + sql += " and t.order_date BETWEEN '"+criteria.getCreateTime().get(0)+"' and '"+criteria.getCreateTime().get(1)+"'"; + } + } + sql+=" order by t.pt_id desc"; + Query query = entityManager.createNativeQuery(sql); + return query; + } + + public List getQueryBcbl(Date blDate,Long ckAreaId,String gc){ + String sql="select pd.id,ck.id ck_id," + + "(select IFNULL(sum(inv.quantity-inv.queued_qty),0) from data_inventory inv left join data_item_key ik on ik.id=inv.item_key_id where ik.item_id=it.id and inv.area_id=pt.area and inv.quantity>0) as inv_qty\n" + + " FROM `data_pick_detail` pd \n" + + "left join data_pick_ticket pt on pt.id=pd.pick_ticket_id\n" + + "left join base_item it on it.id=pd.item_id\n" + + "left join base_area rk on rk.id=pt.sh_area\n" + + "left join base_area ck on ck.id=pt.area\n" + + " where 1=1 and DATE_FORMAT(pt.order_date,'%Y%m%d')>=DATE_FORMAT(NOW(),'%Y%m%d') and (pd.allocated_qty+pd.bc_qty)0 "; + //查找工位最后的上线计划修改日期 +// sql+=" and pt.order_date>=(CURDATE() - INTERVAL 1 DAY) "; + sql+=" and DATE_FORMAT(pt.order_date,'%Y-%m-%d')='"+DateUtil.dateYmd(blDate)+"'"; + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + Area area=areaRepository.getByCode(areaCode); + sql+=" and ck.id="+ area.getId(); + } +// sql+=" and rk.id="+ automaticPlanning.getShArea().getId(); + String split_sql = "SELECT t.id,t.ck_id from ("+sql+") t " + + " where 1=1 and t.inv_qty>0 order by t.id asc"; + log.info("query:"+split_sql); + Query query = entityManager.createNativeQuery(split_sql); + List queryResultList = query.getResultList(); +// List queryResultList = query.unwrap(SQLQuery.class) +// .setResultTransformer( +// AliasToEntityMapResultTransformer.INSTANCE +// ) +// .list(); + return queryResultList; + } + public Double getMaxBomQty(long picktickId,String largeClass) { + String hql = "select max(pd.orderQty) from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item.largeClass='"+largeClass+"'"; + Query query = entityMapper.createQuery(hql); + Double result =(Double)query.getResultList().get(0); + return result; + } + + public List getBomList(long picktickId,String largeClass) { + String hql = " from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.item.largeClass='"+largeClass+"'"; + Query query = entityMapper.createQuery(hql); + List queryResultList = query.getResultList(); + return queryResultList; + } + +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickInstructionServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickInstructionServiceImpl.java new file mode 100644 index 0000000..d714160 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickInstructionServiceImpl.java @@ -0,0 +1,205 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickInstruction; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.PickDetailService; +import com.youchain.businessdata.service.PickTicketService; +import com.youchain.businessdata.service.dto.PickDetailDto; +import com.youchain.businessdata.service.dto.PickTicketDto; +import com.youchain.businessdata.service.mapstruct.PickTicketMapper; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.PickInstructionRepository; +import com.youchain.businessdata.service.PickInstructionService; +import com.youchain.businessdata.service.dto.PickInstructionDto; +import com.youchain.businessdata.service.dto.PickInstructionQueryCriteria; +import com.youchain.businessdata.service.mapstruct.PickInstructionMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** + * @author DengJiangKun + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-02-28 + **/ +@Service +@RequiredArgsConstructor +public class PickInstructionServiceImpl implements PickInstructionService { + + private final PickInstructionRepository pickInstructionRepository; + private final PickInstructionMapper pickInstructionMapper; + private final BillTypeRepository billTypeRepository; + private final PickTicketService pickTicketService; + private final PickTicketRepository pickTicketRepository; + private final PickTicketMapper pickTicketMapper; + private final PickDetailService pickDetailService; + private final PickDetailRepository pickDetailRepository; + private final CodeUtils codeUtils; + private final BomAccountRepository bomAccountRepository; + private final InventoryService inventoryService; + + @Override + public Map queryAll(PickInstructionQueryCriteria criteria, Pageable pageable) { + Page page = pickInstructionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(pickInstructionMapper::toDto)); + } + + @Override + public List queryAll(PickInstructionQueryCriteria criteria) { + return pickInstructionMapper.toDto(pickInstructionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public PickInstructionDto findById(Long id) { + PickInstruction pickInstruction = pickInstructionRepository.findById(id).orElseGet(PickInstruction::new); + ValidationUtil.isNull(pickInstruction.getId(), "PickInstruction", "id", id); + return pickInstructionMapper.toDto(pickInstruction); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickInstructionDto create(PickInstruction resources) { + return pickInstructionMapper.toDto(pickInstructionRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PickInstruction resources) { + PickInstruction pickInstruction = pickInstructionRepository.findById(resources.getId()).orElseGet(PickInstruction::new); + ValidationUtil.isNull(pickInstruction.getId(), "PickInstruction", "id", resources.getId()); + pickInstruction.copy(resources); + pickInstructionRepository.save(pickInstruction); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + pickInstructionRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"PickInstruction"); + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional + public void generatePrepFlag(Long[] ids) throws Exception { + List pickInstructions = pickInstructionRepository.queryPinckInsAllByLongS(ids); + if (pickInstructions.isEmpty()) { + throw new BadRequestException("未查到数据"); + } + List details=new ArrayList(); + Area ckArea = null; + Area rkArea = null; + //全部的订单数 + Double allNum = 0d; + String code=null; + for (PickInstruction pickInstruction : pickInstructions) { + if (ckArea == null) { + ckArea = pickInstruction.getCkArea(); + } else { + if (!Objects.equals(ckArea.getId(), pickInstruction.getCkArea().getId())) { + throw new BadRequestException("你选的出库库区不同"); + } + } + if (rkArea == null) { + rkArea = pickInstruction.getRkArea(); + } else { + if (!Objects.equals(rkArea.getId(), pickInstruction.getRkArea().getId())) { + throw new BadRequestException("你选的入库库区不同"); + } + } + allNum += pickInstruction.getIndicatedQty() - pickInstruction.getAllocatedQty(); + if(pickInstruction.getIndicatedQty() - pickInstruction.getAllocatedQty()>0){ + details.add(pickInstruction); + } + code=pickInstruction.getAllocationNumber(); + } + if(details.size()<=0){ + throw new BadRequestException("已全部出单"); + } + //生成pickTicket + PickTicket pickTicket = pickTicketService.storePick(billTypeRepository.findByName(BaseStatus.BT_DD), rkArea,ckArea, "大", code); + pickTicket.setOrderQuantity(allNum); + pickTicket.setGcCode(rkArea.getGcCode()); + //成功的订单数据 + Double cgNumber = 0d; + for (PickInstruction pickInstruction : details) { + //出单数量 + Double bcAllocatedQty = 0d; + Double invQty=inventoryService.getInvQty(pickInstruction.getItem().getId(),ckArea.getId(),null); + if(invQty.intValue()<=0){ + continue; + } + double xqQty=pickInstruction.getIndicatedQty()- pickInstruction.getAllocatedQty(); + if(xqQty>invQty){ + xqQty=invQty; + } + //已出单数量 + PickDetail pickDetail = new PickDetail(); + pickDetail.setShArea(rkArea); + pickDetail.setArea(ckArea); + pickDetail.setItem(pickInstruction.getItem()); + pickDetail.setOrderQty(xqQty); + pickDetail.setPickTicket(pickTicket); + pickDetail.setPoint(pickInstruction.getZzkwPoint()); + pickDetail.setPropC3(pickInstruction.getAllocationNumber()); + pickDetail.setStatus(BizStatus.OPEN); + pickDetail.setPickId(pickInstruction.getId()); + if(pickInstruction.getBomId()!=null) { + BomAccount bomAccount = bomAccountRepository.getById(pickInstruction.getBomId()); + if (bomAccount != null) { + pickDetail.setAc(bomAccount.getAc()); + pickDetail.setSupplier(bomAccount.getSupplier()); + pickDetail.setContents(bomAccount.getContents()); + } + } + PickDetail pickDetailDto = pickDetailRepository.save(pickDetail); + pickDetailService.allocate(pickDetailDto.getId(), pickDetailDto.getOrderQty()); + bcAllocatedQty = pickDetail.getAllocatedQty(); + //回写 + pickInstruction.setAllocatedQty(pickInstruction.getAllocatedQty()+bcAllocatedQty); + //本次出单数量 + pickInstruction.setBcAllocatedQty(bcAllocatedQty); + pickInstruction.setStatus(BizStatus.YCD); + this.update(pickInstruction); + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickKitPlanServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickKitPlanServiceImpl.java new file mode 100644 index 0000000..76cd895 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickKitPlanServiceImpl.java @@ -0,0 +1,304 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.BillTypeRepository; +import com.youchain.basicdata.service.BillTypeService; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.repository.PickInstructionRepository; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.PickInstructionDto; +import com.youchain.businessdata.service.dto.PickInstructionQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.PickKitPlanRepository; +import com.youchain.businessdata.service.dto.PickKitPlanDto; +import com.youchain.businessdata.service.dto.PickKitPlanQueryCriteria; +import com.youchain.businessdata.service.mapstruct.PickKitPlanMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.web.bind.annotation.RequestBody; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Service +@RequiredArgsConstructor +public class PickKitPlanServiceImpl implements PickKitPlanService { + + private final PickKitPlanRepository pickKitPlanRepository; + private final PickKitPlanMapper pickKitPlanMapper; + private final BomAccountService bomAccountService; + private final PickInstructionService pickInstructionService; + private final CodeUtils codeUtil; + private final BillTypeRepository billTypeRepository; + private final PickTicketService pickTicketService; + private final PickDetailService pickDetailService; + private final AreaRepository areaRepository; + private final PickTicketRepository pickTicketRepository; + private final PickDetailRepository pickDetailRepository; + private final InventoryService inventoryService; + + @Override + public Map queryAll(PickKitPlanQueryCriteria criteria, Pageable pageable){ + Page page = pickKitPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(pickKitPlanMapper::toDto)); + } + + @Override + public List queryAll(PickKitPlanQueryCriteria criteria){ + return pickKitPlanMapper.toDto(pickKitPlanRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public PickKitPlanDto findById(Long id) { + PickKitPlan pickKitPlan = pickKitPlanRepository.findById(id).orElseGet(PickKitPlan::new); + ValidationUtil.isNull(pickKitPlan.getId(),"PickKitPlan","id",id); + return pickKitPlanMapper.toDto(pickKitPlan); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickKitPlanDto create(PickKitPlan resources) { + return pickKitPlanMapper.toDto(pickKitPlanRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PickKitPlan resources) { + PickKitPlan pickKitPlan = pickKitPlanRepository.findById(resources.getId()).orElseGet(PickKitPlan::new); + ValidationUtil.isNull( pickKitPlan.getId(),"PickKitPlan","id",resources.getId()); + pickKitPlan.copy(resources); + pickKitPlanRepository.save(pickKitPlan); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + pickKitPlanRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all,"PickKitPlan"); + FileUtil.downloadExcel(list, response); + } + + @Override + @Transactional + public void audit(Long[] ids) {//成套计划审核 + List list = pickKitPlanRepository.queryYcds(ids); + String[] codes = list.toArray(new String[list.size()]); + for(String code:codes) { + List areaIds=pickKitPlanRepository.queryCodeArea(code); + for (Long areaId : areaIds) { + List plans = pickKitPlanRepository.getPickKitPlansCodeArea(code, areaId); + for (PickKitPlan pickKitPlan : plans) { + if (pickKitPlan.getStatus().equals(BizStatus.YCD)) { + throw new BadRequestException("选择记录已出单!"); + } + List bomAccounts = bomAccountService.queryBomAccount(pickKitPlan.getBigItem().getId(), areaId, null); + if (bomAccounts.isEmpty()) { + throw new BadRequestException("该成套计划未配置BOM,不能审核!"); + } + pickKitPlan.setAllocatedQty(pickKitPlan.getOrderQty()); + pickKitPlan.setStatus(BizStatus.YCD); + this.update(pickKitPlan); + } + } + } + //直接生成备货操作 + //按照所属工厂+批次查找对应数据 + List gcs = pickKitPlanRepository.groupGc(codes); + for (String gc : gcs) { + //查找出库库区是否有多个 + List cAreaIds = pickKitPlanRepository.groupCArea(codes,gc); + for (Long cAreaId : cAreaIds) { + Area oArea=areaRepository.getById(cAreaId); + PickTicket pickTicket = pickTicketService.storePick(billTypeRepository.findByName(BaseStatus.BT_SGDD), null,oArea, "大", Arrays.toString(codes)); + pickTicket.setGcCode(gc); + pickTicket.setOrderDate(new Timestamp(new Date().getTime())); + double orderQty = 0; + List objs = pickKitPlanRepository.sumBomSingle(codes,gc,cAreaId); + //需求数量 + double xqty = 0d; + + //纯需求数量 + double cxqty = 0d; + for (Object[] obj : objs) { + Long rAreaId = (Long) obj[1]; + Long bId = (Long) obj[1]; + double xqQty = (Double) obj[2]; + BomAccount ba = bomAccountService.findByEntity(bId); + PickDetail ptd = new PickDetail(); + ptd.setPoint(ba.getZPoint()); + ptd.setItem(ba.getItem()); + ptd.setPickTicket(pickTicket); + ptd.setContents(ba.getContents()); + ptd.setAc(ba.getAc()); + ptd.setSupplier(ba.getSupplier()); + ptd.setArea(pickTicket.getArea()); + ptd.setShArea(ba.getRArea()); + //查询线边数量 + double xbQty=inventoryService.getInvQty(ba.getItem().getId(),ba.getRArea().getId(),ba.getZPoint().getId()); + //需求数xq_qty=数量*单用 + ptd.setXqQty(xqQty); + ptd.setXbQty(xbQty); + ptd.setBomId(ba.getId()); + ptd.setPropC4(xqQty-ptd.getPureReqQty()-ptd.getXbQty()); + if(ptd.getPropC4().intValue()<=0){ + ptd.setPropC4(0d); + }else{ + //备货需求=(纯需求数/收容数向上取整)*收容数 + ptd.setOrderQty(Math.ceil(ptd.getPropC4()/ba.getItem().getExtendD3())*ba.getItem().getExtendD3()); + } + ba.setPcQty(ptd.getOrderQty()+ba.getPcQty()); + bomAccountService.update(ba); + xqty += ptd.getXqQty(); + cxqty += ptd.getPropC4(); + + pickDetailService.create(ptd); + orderQty += ptd.getOrderQty(); + //查询组合物料,数量是否一致,不一致改成一致 + String largeClass=ba.getItem().getLargeClass(); + if(largeClass!=null&&!largeClass.equals("")){ + int maxQty=pickDetailService.getMaxBomQty(pickTicket.getId(),largeClass).intValue(); + if(maxQty>0) { + List ptds = pickDetailService.getBomList(pickTicket.getId(), largeClass); + for (PickDetail d : ptds) { + if (d.getOrderQty().intValue() != maxQty) { + orderQty -= d.getOrderQty(); + d.setRemark("原" + d.getOrderQty() + "调整到" + maxQty); + d.setOrderQty(maxQty + 0d); + pickDetailService.update(d); + orderQty += d.getOrderQty(); + } + } + } + } + } + pickTicket.setOrderQuantity(orderQty); + pickTicket.setBhQty(orderQty); + //纯需求数 + pickTicket.setPureReqQty(cxqty); + //需求数量 + pickTicket.setXqQty(xqty); + pickTicket.setPc("成套指示"); + pickTicketService.update(pickTicket); + } + + } + +// for(String code:codes) { +// List areaIds=pickKitPlanRepository.queryCodeArea(code); +// for (Long areaId : areaIds) { +// List plans = pickKitPlanRepository.getPickKitPlansCodeArea(code, areaId); +// String zscode = codeUtil.getCode_yyMMdd("ZS", 3); +// for (PickKitPlan pickKitPlan : plans) { +// if (pickKitPlan.getStatus().equals(BizStatus.YCD)) { +// throw new BadRequestException("选择记录已出单!"); +// } +// List bomAccounts = bomAccountService.queryBomAccount(pickKitPlan.getBigItem().getId(), areaId, null); +// if (bomAccounts.isEmpty()) { +// throw new BadRequestException("该成套计划未配置BOM,不能审核!"); +// } +// for (BomAccount bomAccount : bomAccounts) { +// //生成手指示数据 +// PickInstruction pickInstruction = new PickInstruction(); +// //单号 +// pickInstruction.setAllocationNumber(zscode); +// pickInstruction.setAllocationDate(new Timestamp(new Date().getTime())); +// //成套单号 +// pickInstruction.setKitNumber(pickKitPlan.getPlanNumber()); +// pickInstruction.setIndicatedQty((Double.valueOf(bomAccount.getSingles()) * pickKitPlan.getOrderQty())); +// pickInstruction.setItem(bomAccount.getItem()); +// pickInstruction.setOutKType(billTypeRepository.findByName(BaseStatus.BT_SGDD)); +// pickInstruction.setRkArea(bomAccount.getRArea()); +// pickInstruction.setCkArea(bomAccount.getCArea()); +// pickInstruction.setZzkwPoint(bomAccount.getZPoint()); +// pickInstruction.setAc(bomAccount.getAc()); +// pickInstruction.setProcessContent(bomAccount.getContents()); +// pickInstruction.setTaxCategory(bomAccount.getBonded()); +// pickInstructionService.create(pickInstruction); +// } +// pickKitPlan.setAllocatedQty(pickKitPlan.getOrderQty()); +// pickKitPlan.setStatus(BizStatus.YCD); +// this.update(pickKitPlan); +// } +// } +// } + } + + @Override + public void qxAudit(Long id) {//取消成套审核 + PickKitPlan pickKitPlan = pickKitPlanRepository.getById(id); + //其他出库的删除 + List pickTickets = pickTicketRepository.queryPickTicketByCodeAll(BizStatus.OPEN, "%"+pickKitPlan.getPlanNumber()+"%"); + for (PickTicket pt : pickTickets) { + //查明细表的数据 + List pickDetails = pickDetailRepository.queryByPickTicketId(pt.getId()); + for (PickDetail pd : pickDetails) { + pickDetailRepository.delete(pd); + } + pickTicketRepository.deleteById(pt.getId()); + } + List ds = pickKitPlanRepository.queryPickKitPlanCode(pickKitPlan.getPlanNumber()); + for (PickKitPlan d : ds) { + d.setStatus(BizStatus.WCD); + this.update(d); + } + +// PickInstructionQueryCriteria pickInstructionQueryCriteria = new PickInstructionQueryCriteria(); +// pickInstructionQueryCriteria.setKitNumber(pickKitPlan.getPlanNumber()); +// List pickInstructionDtos = pickInstructionService.queryAll(pickInstructionQueryCriteria); +// for (PickInstructionDto pickInstructionDto : pickInstructionDtos) { +// if(!pickInstructionDto.getStatus().equals(BizStatus.WCD)){ +// throw new BadRequestException("指示已出单,不能撤回"); +// } +// pickInstructionService.deleteAll(new Long[]{pickInstructionDto.getId()}); +// } +// pickKitPlan.setStatus(BizStatus.WCD); +// pickKitPlan.setAllocatedQty(0d); +// this.update(pickKitPlan); +// List plans=pickKitPlanRepository.queryPickKitPlanCode(pickKitPlan.getPlanNumber()); +// for (PickKitPlan p:plans){ +// p.setStatus(BizStatus.WCD); +// p.setAllocatedQty(0d); +// this.update(p); +// } + + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickOutServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickOutServiceImpl.java new file mode 100644 index 0000000..f9ac105 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickOutServiceImpl.java @@ -0,0 +1,401 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.PickOutButton; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.PickTicketRepository; +import com.youchain.businessdata.repository.TaskLogRepository; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.service.*; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.PickOutRepository; +import com.youchain.businessdata.service.dto.PickOutDto; +import com.youchain.businessdata.service.dto.PickOutQueryCriteria; +import com.youchain.businessdata.service.mapstruct.PickOutMapper; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author jiangkun + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-02-21 + **/ +@Service +@RequiredArgsConstructor +public class PickOutServiceImpl implements PickOutService { + + private final PickOutRepository pickOutRepository; + private final PickOutMapper pickOutMapper; + private final TaskLogRepository taskLogRepository; + //生成单号工具 + private final CodeUtils codeUtils; + private final TaskLogService taskLogService; + private final PickDetailService pickDetailService; + // private final PickTicketService pickTicketService; + private final PickTicketRepository pickTicketRepository; + private final InventoryLogService inventoryLogService; + private final InventoryService inventoryService; + private final InventoryRepository inventoryRepository; + private final EntityManager entityManager; + + @Override + public Map queryAll(PickOutQueryCriteria criteria, Pageable pageable) { + Page page = pickOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(pickOutMapper::toDto)); + } + + @Override + public List queryAll(PickOutQueryCriteria criteria) { + return pickOutMapper.toDto(pickOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public PickOutDto findById(Long id) { + PickOut pickOut = pickOutRepository.findById(id).orElseGet(PickOut::new); + ValidationUtil.isNull(pickOut.getId(), "PickOut", "id", id); + return pickOutMapper.toDto(pickOut); + } + + @Override + @Transactional + public PickOut findByEntity(Long id) { + PickOut pickOut = pickOutRepository.findById(id).orElseGet(PickOut::new); + return pickOut; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickOutDto create(PickOut resources) { + return pickOutMapper.toDto(pickOutRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PickOut resources) { + PickOut pickOut = pickOutRepository.findById(resources.getId()).orElseGet(PickOut::new); + ValidationUtil.isNull(pickOut.getId(), "PickOut", "id", resources.getId()); + pickOut.copy(resources); + pickOutRepository.save(pickOut); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(Long[] ids) { + for (Long id : ids) { + taskLogRepository.delectTaskLogPickOutId(id); + pickOutRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all, "PickOut"); + FileUtil.downloadExcel(list, response); + } + + @Override + public List getTaskLogNotPickOut(PickOutButton pickOutButton) { + String hql = ""; + if (pickOutButton.getPickOutId() != null) { + hql = " from TaskLog tl where tl.pickOut.id = " + pickOutButton.getPickOutId(); + } else { + hql = " from TaskLog tl where tl.pickOut = NULL and tl.task.pickDetail.pickTicket != null "; + } + if (pickOutButton.getItemCode() != null && !pickOutButton.getItemCode().isEmpty()) { + hql = hql + " and tl.item.code = '" + pickOutButton.getItemCode() + "'"; + } + if (pickOutButton.getSrcPointCode() != null && !pickOutButton.getSrcPointCode().isEmpty()) { + hql = hql + " and tl.srcPoint.code = '" + pickOutButton.getSrcPointCode() + "'"; + } + if (pickOutButton.getDstStockCode() != null && !pickOutButton.getDstStockCode().isEmpty()) { + hql = hql + " and tl.dstStockCode = '" + pickOutButton.getDstStockCode() + "'"; + } + Query query = entityManager.createQuery(hql); + List taskLogs = query.getResultList(); + return taskLogs; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickOut createPickOut(PickOutButton pickOutButton) { + //新政填写的数据 + PickOut pickOut = pickOutButton.getPickOut(); + pickOut.setOrderNo(codeUtils.getCode_yyMMdd("CK", 3)); + return pickOutRepository.save(pickOut); + } + + @Override + public void addData(PickOutButton pickOutButton) { + //向那张表添加数据 + PickOut pickOut = pickOutRepository.getById(pickOutButton.getPickOutId()); + //选择的tasklog要绑定pickOut的数据 + Long[] taskLogIdS = pickOutButton.getTaskLogIdS(); + //添加成功,订单数量对应累计 + double orderQuantity = 0d; + if (taskLogIdS.length > 0) { + for (Long taskLogId : taskLogIdS) { + TaskLog taskLog = taskLogRepository.getById(taskLogId); + taskLog.setPickOut(pickOut); + taskLogService.update(taskLog); + orderQuantity += taskLog.getMoveQty(); + } + } + pickOut.setOrderQty(pickOut.getOrderQty() + orderQuantity); + this.update(pickOut); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickOut createPickOutDto(PickOutButton pickOutButton) { + //新政填写的数据 + String ck = codeUtils.getCode_yyMMdd("CK", 3); + PickOut pickOut = new PickOut(); + pickOut.setOrderNo(ck); + //新保存 + PickOut save = pickOutRepository.save(pickOut); + //添加成功,订单数量对应累计 + double orderQuantity = 0d; + //选择的tasklog要绑定pickOut的数据 + Long[] taskLogIdS = pickOutButton.getTaskLogIdS(); + //容器码 + String stockCode = taskLogRepository.getById(taskLogIdS[0]).getDstStockCode(); + if (taskLogIdS.length > 0) { + for (Long taskLogId : taskLogIdS) { + if (stockCode != null) { + TaskLog taskLog = taskLogRepository.getById(taskLogId); + if (stockCode.equals(taskLog.getDstStockCode())) { + taskLog.setPickOut(save); + taskLogRepository.save(taskLog); + orderQuantity += taskLog.getMoveQty(); + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, "容器码不一致"); + } + } else { + TaskLog taskLog = taskLogRepository.getById(taskLogId); + if (!Objects.isNull(taskLog.getDstStockCode())) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "容器码不一致"); + } + taskLog.setPickOut(save); + taskLogRepository.save(taskLog); + orderQuantity += taskLog.getMoveQty(); + } + } + } + save.setOrderQty(orderQuantity); + this.update(save); + return save; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void confirmPickOut(PickOutButton pickOutButton) { + Long[] pickOutIdS = pickOutButton.getPickOutIdS(); + for (Long pickOutId : pickOutIdS) { + PickOut pickOut = pickOutRepository.getById(pickOutId); + if (pickOut.getStatus().equals(BizStatus.SHIP_ALL)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, pickOut.getOrderNo() + "该单已全部发运"); + } + List taskLogs = taskLogRepository.getTaskLogByPickOutId(pickOutId); + if (!taskLogs.isEmpty()) { + //判断是不是部分出库 + Long[] taskLogIdS = pickOutButton.getTaskLogIdS(); + if (taskLogIdS.length > 0) { + List taskLogList = new ArrayList<>(); + for (Long taskLogId : taskLogIdS) { + TaskLog taskLog = taskLogRepository.getById(taskLogId); + taskLog.setPickOut(pickOut); + taskLogList.add(taskLog); + } + taskLogs = taskLogList; + } + for (TaskLog taskLog : taskLogs) { + if ((taskLog.getMoveQty() - taskLog.getShipQty()) == 0d) { + continue; + } + //出库明细 + PickDetail pickDetail = taskLog.getTask().getPickDetail(); + if (Objects.isNull(pickDetail)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现明细数据" + taskLog.getId()); + } + //出库主表 + PickTicket pickTicket = taskLog.getTask().getPickDetail().getPickTicket(); + if (Objects.isNull(pickTicket)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现主单" + taskLog.getId()); + } + //tasklog的出库数量回写 + taskLog.setShipQty(taskLog.getMoveQty()); + //pickdetail的出库数量回写 + double shippedQtyF = Objects.isNull(pickDetail.getShippedQty()) ? 0d : pickDetail.getShippedQty() + taskLog.getShipQty(); + pickDetail.setShippedQty(shippedQtyF); + //picktick的出库数量及状态回写 + double shippedQtyZ = Objects.isNull(pickTicket.getShippedQuantity()) ? 0d : (pickTicket.getShippedQuantity() + taskLog.getShipQty()); + pickTicket.setShipDate(new Timestamp(new Date().getTime())); + //发货单号 relatedBill2 + if (Objects.isNull(pickTicket.getRelatedBill2())) { + pickTicket.setRelatedBill2(pickOut.getOrderNo()); + } else { + pickTicket.setRelatedBill2(pickTicket.getRelatedBill2() + "," + pickOut.getOrderNo()); + } +// pickTicket.setRelatedBill2(pickOut.getOrderNo()); + pickTicket.setShippedQuantity(shippedQtyZ); + if (pickTicket.getPickedQuantity().intValue() - pickTicket.getShippedQuantity().intValue() <= 0) { + pickTicket.setStatus(BizStatus.SHIP_ALL); + } else { + pickTicket.setStatus(BizStatus.SHIP_PART); + } + //回写 + taskLogService.update(taskLog); + pickDetailService.update(pickDetail); + +// pickTicketService.update(pickTicket); + pickTicketRepository.updataPT(DateUtil.now(), pickTicket.getRelatedBill1(), pickTicket.getStatus(), pickTicket.getShippedQuantity(), pickTicket.getId()); + pickOut.setDispatchQty(pickOut.getDispatchQty() + taskLog.getMoveQty()); + if ((pickOut.getOrderQty() - pickOut.getDispatchQty()) == 0) { + pickOut.setStatus(BizStatus.SHIP_ALL); + } else { + pickOut.setStatus(BizStatus.SHIP_PART); + } + this.update(pickOut); + //扣库存 + List inventories = inventoryService.queryInventory(pickTicket.getArea().getId(), taskLog.getDstPoint().getId(), taskLog.getItemKey().getId()); + if (inventories.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现库存数据"); + } + Inventory inventory = inventories.get(0); + if (inventory.getQuantity() < taskLog.getMoveQty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "库存不足单子出现问题"); + } + inventoryLogService.storeInventoryLog(BizStatus.SHIPPING, BizStatus.REDUCE, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), inventory.getPoint(), inventory.getStock(), inventory.getStock(), inventory.getQuantity(), taskLog.getMoveQty(), + null, null, BizStatus.SHIPPING, inventory.getId(), inventory.getId(), inventory.getDescription()); + inventory.setQuantity(inventory.getQuantity() - taskLog.getMoveQty()); + inventory.setQueuedQty(inventory.getQueuedQty() - taskLog.getMoveQty()); + if (inventory.getQuantity() > 0) { + inventoryService.update(inventory); + } else { + inventoryRepository.delete(inventory); + } + } + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void confirmPickOutNotLog(Long pickOutId, Long pickTicketId) {//发货登记 + PickOut pickOut = pickOutRepository.getById(pickOutId); + if (pickOut.getStatus().equals(BizStatus.SHIP_ALL)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, pickOut.getOrderNo() + "该单已全部发运"); + } + List taskLogs = taskLogRepository.getTaskLogByPickOutId(pickOutId); + PickTicket pickTicket = pickTicketRepository.getById(pickTicketId); + if (!taskLogs.isEmpty()) { + for (TaskLog taskLog : taskLogs) { + if ((taskLog.getMoveQty() - taskLog.getShipQty()) == 0d) { + continue; + } + //出库明细 + PickDetail pickDetail = taskLog.getTask().getPickDetail(); + if (Objects.isNull(pickDetail)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现明细数据" + taskLog.getId()); + } + //出库主表 + PickTicket pickTicket1 = taskLog.getTask().getPickDetail().getPickTicket(); + if (Objects.isNull(pickTicket1)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现主单" + taskLog.getId()); + } + if (!Objects.equals(pickTicket.getId(), pickTicket1.getId())) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "主单不对"); + } + //tasklog的出库数量回写 + taskLog.setShipQty(taskLog.getMoveQty()); + //pickdetail的出库数量回写 + double shippedQtyF = Objects.isNull(pickDetail.getShippedQty()) ? 0d : pickDetail.getShippedQty() + taskLog.getShipQty(); + pickDetail.setShippedQty(shippedQtyF); + //picktick的出库数量及状态回写 + double shippedQtyZ = Objects.isNull(pickTicket.getShippedQuantity()) ? 0d : (pickTicket.getShippedQuantity() + taskLog.getShipQty()); + pickTicket.setShipDate(new Timestamp(new Date().getTime())); + //发货单号 relatedBill2 + if (Objects.isNull(pickTicket.getRelatedBill2())) { + pickTicket.setRelatedBill2(pickOut.getOrderNo()); + } + pickTicket.setShippedQuantity(shippedQtyZ); + if (pickTicket.getPickedQuantity().intValue() - pickTicket.getShippedQuantity().intValue() <= 0) { + pickTicket.setStatus(BizStatus.SHIP_ALL); + } else { + pickTicket.setStatus(BizStatus.SHIP_PART); + } + //回写 + taskLogService.update(taskLog); + pickDetailService.update(pickDetail); + pickTicketRepository.updataPT(DateUtil.now(), pickTicket.getRelatedBill1(), pickTicket.getStatus(), pickTicket.getShippedQuantity(), pickTicket.getId()); + pickOut.setDispatchQty(pickOut.getDispatchQty() + taskLog.getMoveQty()); + if ((pickOut.getOrderQty() - pickOut.getDispatchQty()) == 0d) { + pickOut.setStatus(BizStatus.SHIP_ALL); + } else { + pickOut.setStatus(BizStatus.SHIP_PART); + } + this.update(pickOut); + } + } + } + + public List queryOutList(IScanPut t) { + String sql = "select o.id outId, o.order_no code,o.plate_no cph,o.order_qty dds,o.dispatch_qty bhs,\n" + + "DATE_FORMAT(o.create_time, '%Y-%m-%d') orderDate \n" + + "from data_pick_out o \n" + + "where 1=1 and (o.dispatch_qty l = JSON.parseArray(JSON.toJSONString(ts), RPPickList.class); + return l; + } + + public List findByOut(String cph) { + String hql = " from PickOut t where t.plateNo='" + cph + "' and (t.dispatchQty=0 or t.dispatchQty outs = query.getResultList(); + return outs; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java new file mode 100644 index 0000000..fa62ad9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PickTicketServiceImpl.java @@ -0,0 +1,850 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.sun.org.apache.xpath.internal.operations.Bool; +import com.youchain.basicdata.domain.*; +import com.youchain.basicdata.repository.StockRepository; +import com.youchain.basicdata.service.PointService; +import com.youchain.basicdata.service.StockService; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.inputJson.IScanPut; +import com.youchain.businessdata.inputJson.buttenJson.PickOutButton; +import com.youchain.businessdata.inputJson.buttenJson.PickTicketButton; +import com.youchain.businessdata.repository.*; +import com.youchain.businessdata.returnJson.RPPickList; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.*; +import com.youchain.businessdata.service.dto.*; +import com.youchain.businessdata.service.mapstruct.TaskLogMapper; +import com.youchain.businessdata.service.mapstruct.TaskMapper; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.service.mapstruct.PickTicketMapper; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author JiangKun + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-01-11 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class PickTicketServiceImpl implements PickTicketService { + + private final PickTicketRepository pickTicketRepository; + private final PickTicketMapper pickTicketMapper; + private final PickDetailRepository pickDetailRepository; + private final CodeUtils codeUtils; + private final TaskService taskService; + private final InventoryService inventoryService; + private final TaskLogService taskLogService; + private final InventoryLogService invLogService; + private final PickDetailService pickDetailService; + private final InventoryRepository inventoryRepository; + private final TaskMapper taskMapper; + private final TaskLogRepository taskLogRepository; + private final TaskLogMapper taskLogMapper; + private final StockRepository stockRepository; + private final XppRecordRepository xppRecordRepository; + private final XppRecordService xppService; + private final PickOutService pickOutService; + private final EntityManager entityManager; + private final XppRecordService xppRecordService; + private final PointService pointService; + private final JobRepository jobRepository; + + @Override + public Map queryAll(PickTicketQueryCriteria criteria, Pageable pageable) { + Page page = pickTicketRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(pickTicketMapper::toDto)); + } + + @Override + public List queryAll(PickTicketQueryCriteria criteria) { + return pickTicketMapper.toDto(pickTicketRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public PickTicketDto findById(Long id) { + PickTicket pickTicket = pickTicketRepository.findById(id).orElseGet(PickTicket::new); + ValidationUtil.isNull(pickTicket.getId(), "PickTicket", "id", id); + return pickTicketMapper.toDto(pickTicket); + } + + @Override + @Transactional + public PickTicket getEntity(Long id) { + PickTicket pickTicket = pickTicketRepository.findById(id).orElseGet(PickTicket::new); + return pickTicket; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PickTicketDto create(PickTicket resources) { + return pickTicketMapper.toDto(pickTicketRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PickTicket resources) { + PickTicket pickTicket = pickTicketRepository.findById(resources.getId()).orElseGet(PickTicket::new); + ValidationUtil.isNull(pickTicket.getId(), "PickTicket", "id", resources.getId()); + pickTicket.copy(resources); + pickTicketRepository.save(pickTicket); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + PickTicketDto byId = this.findById(id); + //删除管理字段 + List pickDetails = pickDetailRepository.queryByPickTicketId(id); + if (pickDetails.isEmpty()) { + for (PickDetail p : pickDetails) { + if(p.getAllocatedQty()>0){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "已出单,不能删除"); + } + if (p.getPickTicket().getBillType().equals(BaseStatus.BT_QTCK) && p.getPickTicket().getStatus().equals(BizStatus.ALLOCATE)) { + //调用取消分配 + PickTicketButton pickTicketButton = new PickTicketButton(); + pickTicketButton.setPickConfirmNo(4); + pickTicketButton.setPickTicketId(p.getPickTicket().getId()); + this.pickingOperation(pickTicketButton); + } + if (byId.getStatus().equals(BizStatus.OPEN)) { + pickDetailRepository.deleteById(p.getId()); + } else { + throw new BadRequestException(HttpStatus.NOT_FOUND, "单号:" + byId.getCode() + "打开状态才能删除"); + } + } + } + pickTicketRepository.deleteById(id); + } + } + + public void deletePickTicket(Long[] ids) { + for (Long id : ids) { + //循环明细进行删除 + List ds=pickDetailRepository.queryByPickTicketId(id); + for(PickDetail d:ds) { + pickDetailService.deletePickDetail(d.getId()); + } + pickTicketRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"PickTicket"); + FileUtil.downloadExcel(list, response); + } + + + @Override + public PickTicket storePick(BillType bt, Area shArea, Area outArea, String bpType, String jhCode) { + PickTicket p = new PickTicket(); + p.setCode(codeUtils.getCode_yyMMdd(bt.getPrefix()+'-', 3)); + p.setBillType(bt); + p.setShArea(shArea); + p.setArea(outArea); + p.setDept(UserUtils.getDept()); + p.setOrderDate(new Timestamp(System.currentTimeMillis())); + p.setBpType(bpType); + p.setRelatedBill1(jhCode); + p.setStatus(BizStatus.OPEN); + pickTicketRepository.save(p); + return p; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void pickingOperation(PickTicketButton pickTicketButton) { + //拣货按钮 + int pickConfirmNo = pickTicketButton.getPickConfirmNo(); + PickTicketDto pickTicketDto = this.findById(pickTicketButton.getPickTicketId()); + switch (pickConfirmNo) { + case 1: + //整单拣货 + //根据单号查全部的task数据 + TaskQueryCriteria taskQueryCriteria = new TaskQueryCriteria(); + taskQueryCriteria.setBillCode(pickTicketDto.getCode()); + List taskDtos = taskService.queryAll(taskQueryCriteria); + if (taskDtos.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, pickTicketDto.getCode() + "单子,未查到分配的任务"); + } + //总拣货数量 + double planQtySum = 0d; + for (TaskDto taskDto : taskDtos) {//所有的数据 + if (taskDto.getMoveQty() > 0) { + //剩余数量 + double syNum = taskDto.getPlanQty() - taskDto.getMoveQty(); + if (syNum == 0) { + break; + } else { + PickTicketButton pickTicketButton1 = new PickTicketButton(); + pickTicketButton1.setPickConfirmNo(2); + Long[] longs = new Long[1]; + longs[0] = taskDto.getId(); + pickTicketButton1.setTaskId(longs); + pickTicketButton1.setOnePickConfirmNumber((int) syNum); + pickTicketButton1.setPickTicketId(pickTicketButton.getPickTicketId()); + this.pickingOperation(pickTicketButton1); + break; + } + } + //根据task扣除库存(srcpoint,itemkey,pick表上的库区三个字段查找库存),找到则减少相应的数量及占用数量。生成对应的taskLog表, + List inventories = inventoryService.queryInventory(pickTicketDto.getArea().getId(), taskDto.getSrcPoint().getId(), taskDto.getItemKey().getId()); + if (inventories.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto.getItem().getCode() + "未发现库存数据"); + } + //减少相应的数量及占用数量 减分配数量planQty + Inventory inventory = inventories.get(0); + //扣除后的数量 + double subNum = inventory.getQuantity() - taskDto.getPlanQty(); + double kcNum = taskDto.getPlanQty(); + if (subNum < 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于库存数量"); + } + if (subNum > 0) { + //库存扣除后还要 inventoryLog + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), inventory.getPoint(), inventory.getStock(), inventory.getStock(), inventory.getQuantity(), taskDto.getPlanQty(), + null, null, BizStatus.PICK_DOWN, inventory.getId(), inventory.getId(), inventory.getDescription()); + //生成taskLog 日志 + taskLogService.createTaskLogData(taskDto, taskDto.getPlanQty()); + //task的修改 + //拣货数量 + taskDto.setMoveQty(taskDto.getPlanQty()); + taskDto.setTaskStatus(BizStatus.PICK_ALL); + taskService.update(taskMapper.toEntity(taskDto)); + //库存的修改 + inventory.setQuantity(subNum); + inventory.setQueuedQty(inventory.getQueuedQty() - taskDto.getPlanQty()); + //存储拣货确认的库存数据 + Task task = taskMapper.toEntity(taskDto); + Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP); + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum, + null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); + inventory1.setQuantity(inventory1.getQuantity() + kcNum); + inventory1.setQueuedQty(inventory1.getQueuedQty() + kcNum); + inventoryService.update(inventory1); + inventoryService.update(inventory); + } else { + //库存扣除完 + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), inventory.getPoint(), inventory.getStock(), inventory.getStock(), inventory.getQuantity(), taskDto.getPlanQty(), + null, null, BizStatus.PICK_DOWN, inventory.getId(), inventory.getId(), inventory.getDescription()); + //生成taskLog 日志 + taskDto.setMoveQty(taskDto.getPlanQty()); + taskDto.setTaskStatus(BizStatus.PICK_ALL); + taskService.update(taskMapper.toEntity(taskDto)); + taskLogService.createTaskLogData(taskDto, taskDto.getPlanQty()); + //存储拣货确认的库存数据 + Task task = taskMapper.toEntity(taskDto); + Inventory inventory1 = inventoryService.getInventory(inventory.getItemKey(), inventory.getArea(), task.getDstPoint(), task.getZzkw(), inventory.getDept(), BizStatus.RECEIVING_UP); + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, task.getBillCode(), inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), kcNum, + null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); + inventory1.setQuantity(inventory1.getQuantity() + kcNum); + inventory1.setQueuedQty(inventory1.getQueuedQty() + kcNum); + inventoryService.update(inventory1); + inventoryRepository.delete(inventory); + } +// PickDetail pickDetail = pickDetailRepository.queryByPickTicketIdItemId(pickTicketDto.getId(), taskDto.getItem().getId()); + PickDetail pickDetail = pickDetailRepository.getById(taskDto.getPickDetail().getId()); + if (Objects.isNull(pickDetail)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto.getItem().getCode() + "未查到明细数据"); + } + pickDetail.setPickedQty(taskDto.getPlanQty()); + //回写 pickdetail 上的拣货数量 + pickDetailService.update(pickDetail); + planQtySum += taskDto.getPlanQty(); + } + // 数量按照实际扣减数量写入,并生成inventoryLog记录。pickdetail和pick上的拣货数量相应增加 + //拣货数量 + pickTicketDto.setPickedQuantity(pickTicketDto.getPickedQuantity() + planQtySum); + pickTicketDto.setBhQty(pickTicketDto.getBhQty() + planQtySum); + //发运数量 + //pickTicketDto.setShippedQuantity(planQtySum); +// pickTicketDto.setStatus(BizStatus.PICK_ALL); + if ((pickTicketDto.getOrderQuantity() - pickTicketDto.getPickedQuantity()) == 0) { + pickTicketDto.setStatus(BizStatus.PICK_ALL); + } else { + pickTicketDto.setStatus(BizStatus.PICKUP); + } + //备货日期(拣货写) + pickTicketDto.setStockingDate(new Timestamp(new Date().getTime())); + this.update(pickTicketMapper.toEntity(pickTicketDto)); + break; + case 2: + //单一拣货 + //输入的容器 + String stockCode = null; + if (pickTicketButton.getStockCode() != null && !pickTicketButton.getStockCode().isEmpty()) { + stockCode = pickTicketButton.getStockCode(); + } + //单一收货输入的数量 + double pickQty = pickTicketButton.getOnePickConfirmNumber(); + pickForTask(pickTicketButton.getTaskId()[0], stockCode, pickQty, null, null); + break; + case 3: + //批量拣货 + Long[] taskIds = pickTicketButton.getTaskId(); + for (Long taskId1 : taskIds) { + TaskDto taskDto1 = taskService.findById(taskId1); + if (taskDto1.getMoveQty() > 0) { + //剩余数量 + double syNum = taskDto1.getPlanQty() - taskDto1.getMoveQty(); + if (syNum == 0) { + break; + } else { + PickTicketButton pickTicketButton1 = new PickTicketButton(); + pickTicketButton1.setPickConfirmNo(2); + Long[] longs = new Long[1]; + longs[0] = taskDto1.getId(); + pickTicketButton1.setTaskId(longs); + pickTicketButton1.setOnePickConfirmNumber((int) syNum); + pickTicketButton1.setPickTicketId(pickTicketButton.getPickTicketId()); + this.pickingOperation(pickTicketButton1); + break; +// throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto.getItem().getCode() + "已经单一拣货"); + } + } +// if (taskDto1.getMoveQty()>0){ +// throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto1.getItem().getCode() + "已经单一拣货"); +// } + //根据task扣除库存(srcpoint,itemkey,pick表上的库区三个字段查找库存),找到则减少相应的数量及占用数量。生成对应的taskLog表, + List inventories1 = inventoryService.queryInventory(pickTicketDto.getArea().getId(), taskDto1.getSrcPoint().getId(), taskDto1.getItemKey().getId()); + if (inventories1.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto1.getItem().getCode() + "未发现库存数据"); + } + //减少相应的数量及占用数量 减分配数量planQty + Inventory inventory1 = inventories1.get(0); + //扣除后的数量 + double subNum1 = inventory1.getQuantity() - taskDto1.getPlanQty(); + double kcNum1 = taskDto1.getPlanQty(); + if (subNum1 < 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于库存数量"); + } + if (subNum1 > 0) { + //库存扣除后还要 inventoryLog + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, null, inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), taskDto1.getPlanQty(), + null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); + //生成taskLog 日志 + taskLogService.createTaskLogData(taskDto1, taskDto1.getPlanQty()); + //task的修改 + taskDto1.setMoveQty(taskDto1.getPlanQty()); + taskDto1.setTaskStatus(BizStatus.PICK_ALL); + taskService.update(taskMapper.toEntity(taskDto1)); + //库存的修改 + inventory1.setQuantity(subNum1); + inventory1.setQueuedQty(inventory1.getQueuedQty() - taskDto1.getPlanQty()); + //存储拣货确认的库存数据 + Task task = taskMapper.toEntity(taskDto1); + Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP); + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1, + null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription()); + inventory11.setQuantity(inventory11.getQuantity() + kcNum1); + inventory11.setQueuedQty(inventory11.getQueuedQty() + kcNum1); + inventoryService.update(inventory11); + inventoryService.update(inventory1); + } else { + //库存扣除完 + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, null, inventory1.getArea(), inventory1.getItemKey(), inventory1.getPoint(), inventory1.getPoint(), inventory1.getStock(), inventory1.getStock(), inventory1.getQuantity(), taskDto1.getPlanQty(), + null, null, BizStatus.PICK_DOWN, inventory1.getId(), inventory1.getId(), inventory1.getDescription()); + //生成taskLog 日志 + taskDto1.setMoveQty(taskDto1.getPlanQty()); + taskDto1.setTaskStatus(BizStatus.PICK_ALL); + taskService.update(taskMapper.toEntity(taskDto1)); + taskLogService.createTaskLogData(taskDto1, taskDto1.getPlanQty()); + //存储拣货确认的库存数据 + Task task = taskMapper.toEntity(taskDto1); + Inventory inventory11 = inventoryService.getInventory(inventory1.getItemKey(), inventory1.getArea(), task.getDstPoint(), task.getZzkw(), inventory1.getDept(), BizStatus.RECEIVING_UP); + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, null, inventory11.getArea(), inventory11.getItemKey(), inventory11.getPoint(), inventory11.getPoint(), inventory11.getStock(), inventory11.getStock(), inventory11.getQuantity(), kcNum1, + null, null, BizStatus.PICK_DOWN, inventory11.getId(), inventory11.getId(), inventory11.getDescription()); + inventory11.setQuantity(inventory11.getQuantity() + kcNum1); + inventory11.setQueuedQty(inventory11.getQueuedQty() + kcNum1); + inventoryService.update(inventory11); + inventoryRepository.delete(inventory1); + } +// PickDetail pickDetail1 = pickDetailRepository.queryByPickTicketIdItemId(pickTicketDto.getId(), taskDto1.getItem().getId()); + PickDetail pickDetail1 = pickDetailRepository.getById(taskDto1.getPickDetail().getId()); + if (Objects.isNull(pickDetail1)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto1.getItem().getCode() + "未查到明细数据"); + } + pickDetail1.setPickedQty(taskDto1.getPlanQty()); + //回写 pickdetail 上的拣货数量 + pickDetailService.update(pickDetail1); + //拣货数量 + pickTicketDto.setPickedQuantity(pickTicketDto.getPickedQuantity() + taskDto1.getPlanQty()); + pickTicketDto.setBhQty(pickTicketDto.getBhQty() + taskDto1.getPlanQty()); + //发运数量 + //pickTicketDto.setShippedQuantity(planQtySum); + if ((pickTicketDto.getOrderQuantity() - pickTicketDto.getPickedQuantity()) == 0) { + pickTicketDto.setStatus(BizStatus.PICK_ALL); + } else { + pickTicketDto.setStatus(BizStatus.PICKUP); + } + //备货日期(拣货写) + pickTicketDto.setStockingDate(new Timestamp(new Date().getTime())); + this.update(pickTicketMapper.toEntity(pickTicketDto)); + } + break; + case 4: + //取消分配 + TaskQueryCriteria taskQueryCriteria1 = new TaskQueryCriteria(); + taskQueryCriteria1.setBillCode(pickTicketDto.getCode()); + List taskDtos1 = taskService.queryAll(taskQueryCriteria1); + if (taskDtos1.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, pickTicketDto.getCode() + "单子,未查到分配的任务"); + } + for (TaskDto taskDto1 : taskDtos1) {//所有分配的任务 + List inventoriesData = inventoryService.queryInventory(pickTicketDto.getArea().getId(), taskDto1.getSrcPoint().getId(), taskDto1.getItemKey().getId()); + if (inventoriesData.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto1.getItem().getCode() + "未发现库存数据"); + } + Inventory inventory1 = inventoriesData.get(0); + //已分配的还原回去 + inventory1.setQueuedQty(inventory1.getQueuedQty() - taskDto1.getPlanQty()); + inventoryService.update(inventory1); + //查明细 删除对应的task记录,pickdetail和pick上的占用数量相应扣减 +// PickDetail pickDetail1 = pickDetailRepository.queryByPickTicketIdItemId(pickTicketDto.getId(), taskDto1.getItem().getId()); + PickDetail pickDetail1 = pickDetailRepository.getById(taskDto1.getPickDetail().getId()); + pickDetail1.setAllocatedQty(0d); + pickDetailService.update(pickDetail1); + pickTicketDto.setStatus(BizStatus.OPEN); + pickTicketDto.setAllocatedQuantity(0d); + this.update(pickTicketMapper.toEntity(pickTicketDto)); + taskService.delete(taskDto1.getId()); + } + break; + case 7: + //7现品票拣货 + //this.xppPickGoods(pickTicketButton); + break; + default: + log.error("没有{}这个按钮的操作功能", pickConfirmNo); + throw new BadRequestException(HttpStatus.NOT_FOUND, "操作出现问题"); + } + } + + public void pickForTask(Long taskId, String stockCode, double pickQty, XppRecord xpp, String bhr) { + Task task = taskService.getEntity(taskId); + String barCode = xpp == null ? null : xpp.getEwm(); + double kcNum = pickQty; + double fpQty = pickQty; + if (pickQty == 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量不能为0"); + } + if (xpp == null || xpp.equals("")) { + if ((task.getPlanQty() - task.getMoveQty() - pickQty) < 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于分配数量"); + } + } + Boolean isCf= Boolean.FALSE; + double cfQty=0; + if (pickQty > (task.getPlanQty() - task.getMoveQty())) { + fpQty = task.getPlanQty() - task.getMoveQty(); + isCf=Boolean.TRUE; + cfQty=pickQty-fpQty; + } + + PickDetail pd = task.getPickDetail(); + PickTicket pt = pd.getPickTicket(); + Point zzkw=pd.getPoint(); + //大部品的库存不能进去 + Inventory srcInv = inventoryService.getInventory(task.getItemKey(),pt.getArea(),task.getSrcPoint(),zzkw,pt.getArea().getDept(),BizStatus.PICK_DOWN); + if (srcInv==null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, task.getItem().getCode() + "未发现库存数据"); + } + //扣除后的数量 + double srcQty = srcInv.getQuantity(); + if (srcQty < pickQty) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于库存数量"); + } + //超发则需要判断库存是否还有足够未分配数量 + if(isCf){ + double wfp=srcInv.availableQty(); + if((int)wfp<(int)cfQty){ + throw new BadRequestException( "超发数"+cfQty+"大于可用库存数"+wfp); + } + } + //库存扣除后还要 inventoryLog + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.REDUCE, pt.getCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(), + srcInv.getPoint(), zzkw, srcQty, pickQty, barCode, BizStatus.PICK_DOWN, + task.getId(), srcInv.getId(), pd.getRemark()); + //生成taskLog 日志 + TaskLog taskLog = taskLogService.createTaskLog(task, pickQty, stockCode, barCode, bhr); + if (xpp != null) { + xpp.setCkTaskLog(taskLog); + xpp.setBhr(SecurityUtils.getCurrentUsername()); + xpp.setBhDate(new Timestamp(new Date().getTime())); + xppService.update(xpp); + } + task.setMoveQty(task.getMoveQty() + pickQty); + if (task.getPlanQty() > task.getMoveQty()) { + task.setTaskStatus(BizStatus.PICKUP); + } else { + task.setTaskStatus(BizStatus.PICK_ALL); + } + taskService.update(task); + srcInv.reduce(pickQty); + double srcQue=srcInv.getQueuedQty(); + srcInv.setQueuedQty(srcInv.getQueuedQty() - fpQty); + if (srcInv.getQueuedQty().intValue()< 0) { + srcInv.setQueuedQty(0d); + } + inventoryService.update(srcInv); + + //修改占用数,写入日志 + InventoryLog invLog=invLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.REDUCE, pt.getCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(), + srcInv.getPoint(), srcInv.getZzkw(),srcQue, fpQty, null, BizStatus.PICK, + pd.getId(), srcInv.getId(), taskLog.getId()+"拣货确认"); + invLog.setDstQty(srcInv.getQueuedQty()); + invLogService.update(invLog); + + //生成备货库存,备货库存也不需要线边 + Inventory dstInv = inventoryService.getInventory(srcInv.getItemKey(), srcInv.getArea(), task.getDstPoint(), zzkw, srcInv.getDept(), BizStatus.PICK_DOWN); + invLogService.storeInventoryLog(BizStatus.PICK_DOWN, BizStatus.ADD, pt.getCode(), dstInv.getArea(), dstInv.getItemKey(), dstInv.getPoint(), dstInv.getPoint(), + zzkw, dstInv.getQuantity(), kcNum, barCode, BizStatus.PICK_DOWN, taskLog.getId(), + dstInv.getId(), pd.getRemark()); + dstInv.setQuantity(dstInv.getQuantity() + kcNum); + inventoryService.update(dstInv); + pd.setPickedQty(pd.getPickedQty() + pickQty); + pickDetailService.update(pd); + //拣货数量 + pt.setPickedQuantity(pt.getPickedQuantity() + pickQty); + pt.setBhQty(pt.getBhQty() + pickQty); +// if ((pt.getOrderQuantity() - pt.getPickedQuantity()) <= 0) { +// pt.setStatus(BizStatus.PICK_ALL); +// } else { +// pt.setStatus(BizStatus.PICKUP); +// } + if(pickDetailRepository.queryPickQty(pt.getId()).size()>0){ + pt.setStatus(BizStatus.PICKUP); + }else{ + pt.setStatus(BizStatus.PICK_ALL); + } + this.update(pt); + if (xpp != null) { + xpp.setStatus(BizStatus.PICK_ALL); + xpp.setBhr(SecurityUtils.getCurrentUsername()); + xpp.setBhDate(new Timestamp(new Date().getTime())); + xppRecordService.update(xpp); + } + } + + + @Override + public void xbjsVerify(Long[] ids) { + for (Long id : ids) { + List pickDetails = pickDetailRepository.queryByPickTicketId(id); + double shNum = 0d; + double tlNum = 0d; + if (!pickDetails.isEmpty()) { + for (PickDetail pickDetail : pickDetails) { + shNum += pickDetail.getJsQty(); + tlNum += pickDetail.getTlQty(); + } + } + PickTicket pickTicket = pickTicketRepository.getById(id); + pickTicket.setTlQty(tlNum); + pickTicket.setXbQty(shNum); + pickTicket.setShipDate(new Timestamp(new Date().getTime())); + this.update(pickTicket); + } + } + + @Override + public List queryTaskLogDataS(Long pickTicketId) { + List taskLogList = taskLogRepository.getTaskLogsByPtId(pickTicketId); + return taskLogList; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void pickingCancel(PickTicketButton pickTicketButton) { + // 5拣货整单取消 6拣货批量取消 + int pickConfirmNo = pickTicketButton.getPickConfirmNo(); + PickTicket pickTicket = pickTicketRepository.getById(pickTicketButton.getPickTicketId()); + if (pickTicket.getShippedQuantity()>0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "状态不正确"); + } + //要取消的数量 + double pickedQuantityNum = 0d; + if (pickConfirmNo == 5) { //拣货整单取消 + List taskLogList = taskLogRepository.getTaskLogsCancelByPick(pickTicket.getId()); + if (taskLogList.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "没有要取消的任务"); + } + for (TaskLog taskLog : taskLogList) { + pickedQuantityNum += taskLog.getMoveQty(); + this.backPick(taskLog.getId(), pickTicket.getArea()); + } + } else if (pickConfirmNo == 6) {//拣货批量取消 + Long[] taskLogIdS = pickTicketButton.getTaskLogId(); + for (Long taskLogId : taskLogIdS) { + TaskLog taskLog = taskLogRepository.getById(taskLogId); + pickedQuantityNum += taskLog.getMoveQty(); + this.backPick(taskLogId, pickTicket.getArea()); + } + } else { + log.error("没有{}这个按钮的操作功能", pickConfirmNo); + throw new BadRequestException(HttpStatus.NOT_FOUND, "操作出现问题"); + } + pickTicket.setPickedQuantity(pickTicket.getPickedQuantity() - pickedQuantityNum); + pickTicket.setBhQty(pickTicket.getBhQty() - pickedQuantityNum); + pickTicket.setStatus(BizStatus.ALLOCATE); + this.update(pickTicket); + } + + @Override + @Transactional + public void shipmentRegistration(Long pickTicketId) { + //其他出库直接发货登记,需记录具体日志轨迹(少了一步拣货的日志,出单状态下支持直接发货) + //查询pickTicket 的数据 + PickTicketDto pickTicketDto = this.findById(pickTicketId); + //判断 + if (!pickTicketDto.getStatus().equals(BizStatus.ALLOCATE)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "只有已匹配状态的数据才能进行直接发货"); + } + //主表总拣货数量 + double planQtySum = pickTicketDto.getOrderQuantity() - pickTicketDto.getPickedQuantity(); + double wcPlanQtySum = 0d; + //查询对应的全部task数据 + TaskQueryCriteria taskQueryCriteria = new TaskQueryCriteria(); + taskQueryCriteria.setBillCode(pickTicketDto.getCode()); + List taskDtos = taskService.queryAll(taskQueryCriteria); + if (taskDtos.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, pickTicketDto.getCode() + "单子,未查到分配的任务"); + } + Long[] taskLogIds = new Long[taskDtos.size()]; + int i = 0; + for (TaskDto taskDto : taskDtos) { + //要拣的数量 + double jhNum = taskDto.getPlanQty() - taskDto.getMoveQty(); + if (jhNum == 0) { + continue; + } + //根据task扣除库存 + List inventoryList = inventoryService.queryInventory(pickTicketDto.getArea().getId(), taskDto.getSrcPoint().getId(), taskDto.getItemKey().getId()); + if (inventoryList.isEmpty()) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto.getItem().getCode() + "未发现库存数据"); + } + Inventory inventory = inventoryList.get(0); + //库存扣除后的数量 + double subNum = inventory.getQuantity() - taskDto.getPlanQty(); + double kcNum = taskDto.getPlanQty(); + if (subNum < 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于库存数量"); + } + //库存扣除后还要 inventoryLog + invLogService.storeInventoryLog(BizStatus.SHIPPING, BizStatus.REDUCE, null, inventory.getArea(), inventory.getItemKey(), inventory.getPoint(), + inventory.getPoint(), inventory.getStock(), inventory.getStock(), inventory.getQuantity(), kcNum, null, null, BizStatus.SHIPPING, inventory.getId(), + inventory.getId(), pickTicketDto.getDescription()); + //生成taskLog 日志 + TaskLog taskLog = taskLogService.createTaskLog(taskMapper.toEntity(taskDto), kcNum, null, null, "直接出库"); + taskLogIds[i++] = taskLog.getId(); + //拣货数量 + taskDto.setMoveQty(kcNum); + taskDto.setTaskStatus(BizStatus.PICK_ALL); + taskService.update(taskMapper.toEntity(taskDto)); + //库存的修改 + inventory.setQuantity(subNum); + inventory.setQueuedQty(inventory.getQueuedQty() - taskDto.getPlanQty()); + if (subNum > 0) {//判断是否还有库存 + inventoryService.update(inventory); + } else { + inventoryRepository.delete(inventory); + } + PickDetail pickDetail = pickDetailRepository.getById(taskDto.getPickDetail().getId()); + if (Objects.isNull(pickDetail)) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskDto.getItem().getCode() + "未查到明细数据"); + } + pickDetail.setPickedQty(kcNum); + wcPlanQtySum += kcNum; + } + if ((planQtySum - wcPlanQtySum) != 0) { + throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货失败"); + } + pickTicketDto.setPickedQuantity(wcPlanQtySum); + pickTicketDto.setBhQty(wcPlanQtySum); + pickTicketDto.setStatus(BizStatus.PICK_ALL); + this.update(pickTicketMapper.toEntity(pickTicketDto)); + //创建出库单维护 + PickOutButton pickOutButton = new PickOutButton(); + pickOutButton.setTaskLogIdS(taskLogIds); + PickOut pickOutDto = pickOutService.createPickOutDto(pickOutButton); + //发货 + pickOutService.confirmPickOutNotLog(pickOutDto.getId(), pickTicketId); + } + + //刷新状态 + public void refreshSatus(Long pick){ + + } + + public void backPick(Long taskLogId, Area area) { + //日志数据 + TaskLog taskLog = taskLogRepository.getById(taskLogId); + if(taskLog.getShipQty()>0){ + throw new BadRequestException(HttpStatus.NOT_FOUND, "已发运,不能退"); + } + double cancelNum = taskLog.getMoveQty();//取消的数量 + //task表数据 + Task task = taskLog.getTask(); + PickDetail pd = task.getPickDetail(); + Point zzkw = pd.getPoint();//pointService.findByCode("ZZKW",null,null,null,null); + //源库存增加,目标减少 + Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getSrcPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL); + //添加物料 + srcInv.setQuantity(srcInv.getQuantity() + cancelNum); + //修改占用数,写入日志 + invLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, task.getBillCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(), + srcInv.getPoint(), srcInv.getZzkw(),srcInv.getQueuedQty(), cancelNum, null, BizStatus.PICK, + pd.getId(), srcInv.getId(), taskLogId+"拣货退回"); + srcInv.setQueuedQty(srcInv.getQueuedQty() + cancelNum); + inventoryService.update(srcInv); + //生成日志 + invLogService.storeInventoryLog(BizStatus.PICK_CANCEL, BizStatus.ADD, task.getBillCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(), + srcInv.getPoint(), zzkw, (srcInv.getQuantity() - cancelNum), cancelNum, taskLog.getSrcStockCode(), + BizStatus.PICK_CANCEL, taskLog.getId(), srcInv.getId(), srcInv.getDescription()); + //task表的修改 + task.setMoveQty(task.getMoveQty() - cancelNum); + if (task.getMoveQty() == 0) { + task.setTaskStatus(BizStatus.OPEN); + } else { + task.setTaskStatus(BizStatus.PICK); + } + pd.setPickedQty(pd.getPickedQty() - cancelNum); + pickDetailService.update(pd); + //扣库存 + Inventory dstInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.PICK_CANCEL); + if (dstInv==null) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "未发现库存数据"); + } + if (dstInv.getQuantity() < cancelNum) { + throw new BadRequestException(HttpStatus.NOT_FOUND, taskLog.getItem().getCode() + "库存不足单子出现问题"); + } + invLogService.storeInventoryLog(BizStatus.PICK_CANCEL, BizStatus.REDUCE, task.getBillCode(), dstInv.getArea(), dstInv.getItemKey(), dstInv.getPoint(), dstInv.getPoint(), zzkw, dstInv.getQuantity(), cancelNum, + taskLog.getSrcStockCode(), BizStatus.PICK_CANCEL, taskLog.getId(), dstInv.getId(), dstInv.getDescription()); + dstInv.setQuantity(dstInv.getQuantity() - cancelNum); + if (dstInv.getQuantity() > 0) { + inventoryService.update(dstInv); + } + taskService.update(task); + if (taskLog.getSrcStockCode() != null) { + XppRecord xpp = xppRecordRepository.findByCode(taskLog.getSrcStockCode()); + if (xpp != null) { + xpp.setCkTaskLog(null); + xpp.setBhDate(null); + xpp.setBhr(null); + xpp.setStatus(BizStatus.PUTAWAY); + xppService.update(xpp); + } + } + //删除task日志数据 + taskLogRepository.delete(taskLog); + } + + public void backPickOut(Long taskLogId, Area area) { + //日志数据 + TaskLog taskLog = taskLogRepository.getById(taskLogId); + double cancelNum = taskLog.getShipQty();//发货取消,从出库到分配 + //task表数据 + Task task = taskLog.getTask(); + PickDetail pd = task.getPickDetail(); + Point zzkw = pd.getPoint(); + //源库存增加 + Inventory srcInv = inventoryService.getInventory(taskLog.getItemKey(), area, taskLog.getDstPoint(), zzkw, taskLog.getDept(), BizStatus.SHIP_CANCEL); + srcInv.setQuantity(srcInv.getQuantity() + cancelNum); + srcInv.setQueuedQty(srcInv.getQueuedQty() + cancelNum); + inventoryService.update(srcInv); + //生成日志 + invLogService.storeInventoryLog(BizStatus.SHIP_CANCEL, BizStatus.ADD, task.getBillCode(), srcInv.getArea(), srcInv.getItemKey(), srcInv.getPoint(), + srcInv.getPoint(), zzkw, (srcInv.getQuantity() - cancelNum), cancelNum, taskLog.getSrcStockCode(), + BizStatus.SHIP_CANCEL, taskLog.getId(), srcInv.getId(), "出库退回"); + pd.setPickedQty(pd.getPickedQty() - cancelNum); + pickDetailService.update(pd); + PickTicket pickTicket=pd.getPickTicket(); + pickTicket.setStatus(BizStatus.PICK_ALL); + pickTicket.setShippedQuantity(pickTicket.getShippedQuantity()-cancelNum); + taskService.update(task); + if (taskLog.getSrcStockCode() != null) { + XppRecord xpp = xppRecordRepository.findByCode(taskLog.getSrcStockCode()); + if (xpp != null) { + xpp.setCkTaskLog(null); + xpp.setBhDate(null); + xpp.setBhr(null); +// xpp.setFhr(null); +// xpp.setFhDate(null); + xpp.setStatus(BizStatus.PICK_ALL); + xppService.update(xpp); + } + } + taskLog.setShipQty(0d); + taskLogService.update(taskLog); + } + + public List queryPickList(IScanPut t) { + String sql = "SELECT pt.code ,pt.gc_code,ck.code ck_area, pt.id pickTicketId,pt.`status`,DATE_FORMAT(pt.order_date, '%Y-%m-%d') orderDate,ck.working_station gw,pt.order_quantity dds,pt.picked_quantity bhs\n" + + " FROM `data_pick_ticket` pt\n" + + "left join base_area ck on ck.id=pt.area\n" + + "where 1=1 and pt.status in ('ALLOCATE','PICKUP') " + + " and pt.allocated_quantity>0 and (pt.code like 'B%' or pt.code like 'ZS%')" ; + //" and pt.id in (select d.pick_ticket_id from data_Pick_Detail d where d.picked_Qty jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + sql += " and ck.code ='" + jobs.get(0).getAreaCode() + "'"; + } + sql += " ORDER BY pt.code desc"; + List ts = entityManager.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List l = JSON.parseArray(JSON.toJSONString(ts), RPPickList.class); + return l; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PlanPickDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PlanPickDetailServiceImpl.java new file mode 100644 index 0000000..bedcdb4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/PlanPickDetailServiceImpl.java @@ -0,0 +1,373 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.AutomaticPlanDetail; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.AutomaticPlanDetailRepository; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.service.AreaService; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.repository.InventoryBakRepository; +import com.youchain.businessdata.service.InventoryBakService; +import com.youchain.businessdata.service.PickDetailService; +import com.youchain.businessdata.service.PickTicketService; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.PlanPickDetailRepository; +import com.youchain.businessdata.service.PlanPickDetailService; +import com.youchain.businessdata.service.dto.PlanPickDetailDto; +import com.youchain.businessdata.service.dto.PlanPickDetailQueryCriteria; +import com.youchain.businessdata.service.mapstruct.PlanPickDetailMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author jiangkun +* @date 2024-01-23 +**/ +@Service +@RequiredArgsConstructor +@Slf4j +public class PlanPickDetailServiceImpl implements PlanPickDetailService { + + private final PlanPickDetailRepository planPickDetailRepository; + private final PlanPickDetailMapper planPickDetailMapper; + private final EntityManager entityMapper; + private final BomAccountService bomAccountService; + private final PickTicketService pickTicketService; + private final PickDetailService pickDetailService; + private final AreaService areaService; + private final AreaRepository areaRepository; + private final InventoryBakService inventoryBakService; + private final BomAccountRepository bomAccountRepository; + private final AutomaticPlanDetailRepository automaticPlanDetailRepository; + private final InventoryBakRepository inventoryBakRepository; + + @Override + public Map queryAll(PlanPickDetailQueryCriteria criteria, Pageable pageable){ + Page page = planPickDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(planPickDetailMapper::toDto)); + } + + @Override + public List queryAll(PlanPickDetailQueryCriteria criteria){ + return planPickDetailMapper.toDto(planPickDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public PlanPickDetailDto findById(Long id) { + PlanPickDetail planPickDetail = planPickDetailRepository.findById(id).orElseGet(PlanPickDetail::new); + ValidationUtil.isNull(planPickDetail.getId(),"PlanPickDetail","id",id); + return planPickDetailMapper.toDto(planPickDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public PlanPickDetailDto create(PlanPickDetail resources) { + return planPickDetailMapper.toDto(planPickDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PlanPickDetail resources) { + PlanPickDetail planPickDetail = planPickDetailRepository.findById(resources.getId()).orElseGet(PlanPickDetail::new); + ValidationUtil.isNull( planPickDetail.getId(),"PlanPickDetail","id",resources.getId()); + planPickDetail.copy(resources); + planPickDetailRepository.save(planPickDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(Long[] ids) { + for (Long id : ids) { + PlanPickDetailDto byId = this.findById(id); + if (byId.getStatus().equals(BizStatus.YCD)){ + throw new BadRequestException(HttpStatus.NOT_FOUND,"单号为:"+byId.getCode()+"的机型为:"+byId.getBigItem().getCode()+"已出单"); + } + planPickDetailRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"PlanPickDetail"); + FileUtil.downloadExcel(list, response); + } + + public List queryPlanPickDetail(String code) { + String hql = "from PlanPickDetail t where t.code= '" + code + "'"; + Query query = entityMapper.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + @Override + public List queryGwList(String code, String gw){ + String hql = "select ptd.zone.code from PlanPickDetail ptd " + + " where ptd.code='"+code+"' and ptd.zone.code!='"+gw+"'"; + Query query = entityMapper.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + @Override + public List queryStatusList(String code){ + String hql = "select ptd.zone.code from PlanPickDetail ptd " + + " where ptd.code='"+code+"' and ptd.status!='"+BizStatus.WCD+"'"; + Query query = entityMapper.createQuery(hql); + List resultList = query.getResultList(); + return resultList; + } + + public void createAutoPlan(int pcNum, String code, Long shAreaId, AutomaticPlanDetail detail, Boolean isLast, Timestamp batchTime){ + //生成备货操作 + List planPickDetails = planPickDetailRepository.findByStatusAndCode("WCD",code); + for (PlanPickDetail ppd : planPickDetails) { + List bs = bomAccountService.queryBomAccount(ppd.getBigItem().getId(), shAreaId,ppd.getZone().getWorkingStation()); + if (bs.size() <= 0) { + throw new BadRequestException(detail.getShArea().getWorkingStation()+"工位"+ppd.getBigItem().getCode() + "未查到对应BOM工位清单"); + } + ppd.setPxDetailId(detail.getId()); + ppd.setIsLast(isLast); + ppd.setAllocatedQuantity(ppd.getOrderQuantity()); + ppd.setStatus(BizStatus.YCD); + this.update(ppd); + } + PlanPickDetail ppd_o=planPickDetails.get(0); + //得到所有的物料和明细 + List objPicks = bomAccountService.queryBomAccountList(code,null, shAreaId, null,"0"); + for (Object[] objPick : objPicks) { + Long oAreaId = (Long) objPick[0]; + String bpType = (String) objPick[1]; + Area oArea=areaService.findEntityById(oAreaId); + PickTicket pickTicket = pickTicketService.storePick(ppd_o.getBillType(), ppd_o.getZone(),oArea, bpType, ppd_o.getCode()); + pickTicket.setGcCode(ppd_o.getZone().getGcCode()); + pickTicket.setOrderDate(new Timestamp(detail.getJhDate().getTime())); + double orderQty = 0; + List objs = bomAccountService.queryBomAccountList(ppd_o.getCode(), oAreaId,ppd_o.getZone().getId(), bpType, "1"); + //需求数量 + double xqty = 0d; + //纯需求数量 + double cxqty = 0d; + for (Object[] obj : objs) { + Long bId = (Long) obj[0]; + double xqQty = (Double) obj[1]; + BomAccount ba = bomAccountService.findByEntity(bId); + PickDetail ptd = new PickDetail(); + //需求数xq_qty=数量*单用 + ptd.setXqQty(xqQty); + ptd.setBomId(ba.getId()); + Double xbQty=inventoryBakService.getXbQty(ba.getItem().getId(),pickTicket.getShArea().getId(),ba.getZPoint().getId(),detail.getId()); + if(xbQty<=0){ + xbQty=0d; + } + ptd.setXbQty(xbQty); + //获取批次需求数,因同一工位品番有多个数量,需汇总统计 + double pc_qty=bomAccountRepository.getPcQty(ba.getRArea().getId(),ba.getItem().getId(),ba.getZPoint().getId()); + //批次需求数,存入BOM中 + ptd.setPureReqQty(pc_qty); + //纯需求数 【BOM单用*(铺线计划台数10台+第一批的10台+第二批的10台)-第一批需求-线边库存】/收容数*收容数 + ptd.setPropC4(xqQty-ptd.getPureReqQty()-ptd.getXbQty()); + if(ptd.getPropC4().intValue()<=0){ + ptd.setPropC4(0d); + }else{ + //备货需求=(纯需求数/收容数向上取整)*收容数 + ptd.setOrderQty(Math.ceil(ptd.getPropC4()/ba.getItem().getExtendD3())*ba.getItem().getExtendD3()); + } + ba.setPcQty(ptd.getOrderQty()+ba.getPcQty()); + bomAccountService.update(ba); + xqty += ptd.getXqQty(); + cxqty += ptd.getPropC4(); + ptd.setPoint(ba.getZPoint()); + ptd.setItem(ba.getItem()); + ptd.setPickTicket(pickTicket); + ptd.setContents(ba.getContents()); + ptd.setAc(ba.getAc()); + ptd.setSupplier(ba.getSupplier()); + ptd.setArea(pickTicket.getArea()); + ptd.setShArea(pickTicket.getShArea()); + pickDetailService.create(ptd); + orderQty += ptd.getOrderQty(); + //查询组合物料,数量是否一致,不一致改成一致 + String largeClass=ba.getItem().getLargeClass(); + if(largeClass!=null&&!largeClass.equals("")){ + int maxQty=pickDetailService.getMaxBomQty(pickTicket.getId(),largeClass).intValue(); + if(maxQty>0) { + List ptds = pickDetailService.getBomList(pickTicket.getId(), largeClass); + for (PickDetail d : ptds) { + if (d.getOrderQty().intValue() != maxQty) { + orderQty -= d.getOrderQty(); + d.setRemark("原" + d.getOrderQty() + "调整到" + maxQty); + d.setOrderQty(maxQty + 0d); + pickDetailService.update(d); + orderQty += d.getOrderQty(); + } + } + } + } + } + pickTicket.setOrderQuantity(orderQty); + pickTicket.setBhQty(orderQty); + //纯需求数 + pickTicket.setPureReqQty(cxqty); + //需求数量 + pickTicket.setXqQty(xqty); + pickTicket.setPc("第"+pcNum+"批"); + pickTicket.setBatchTime(batchTime); + pickTicketService.update(pickTicket); + } + } + public void createAutoPlan(String[] codes,Long[] detailIds,String type) { + List planPickDetails = planPickDetailRepository.findByStatusAndCodes("WCD",codes); + for (PlanPickDetail ppd : planPickDetails) { + List bs = bomAccountService.queryBomAccount(ppd.getBigItem().getId(), ppd.getZone().getId(),ppd.getZone().getWorkingStation()); + if (bs.size() <= 0) { + throw new BadRequestException(ppd.getZone().getWorkingStation()+"工位"+ppd.getBigItem().getCode() + "未查到对应BOM工位清单"); + } + ppd.setAllocatedQuantity(ppd.getOrderQuantity()); + ppd.setStatus(BizStatus.YCD); + this.update(ppd); + } + PlanPickDetail ppd_o=planPickDetails.get(0); + Timestamp orderDate=new Timestamp(new Date().getTime()); + if(ppd_o.getPxDetailId()!=null) { + AutomaticPlanDetail detail =automaticPlanDetailRepository.getById(ppd_o.getPxDetailId()); + orderDate=new Timestamp(detail.getJhDate().getTime()); + } + //按照所属工厂+批次查找对应数据 + List gcpcs = planPickDetailRepository.groupGcPc(codes); + for (Object[] gcpc : gcpcs) { + String gc=gcpc[0].toString(); + String pc=gcpc[1].toString(); + Long ppdId=Long.parseLong(gcpc[2].toString()); + PlanPickDetail ppd=planPickDetailRepository.getById(ppdId); + //查找出库库区是否有多个 + List cAreaIds = planPickDetailRepository.groupCArea(codes,gc,pc); + for (Long cAreaId : cAreaIds) { + Area oArea=areaService.findEntityById(cAreaId); + PickTicket pickTicket = pickTicketService.storePick(ppd_o.getBillType(), null,oArea, "大", Arrays.toString(codes)); + pickTicket.setGcCode(gc); + pickTicket.setOrderDate(orderDate); + double orderQty = 0; + List objs = planPickDetailRepository.sumBomSingle(codes,gc,pc,cAreaId); + //需求数量 + double xqty = 0d; + //纯需求数量 + double cxqty = 0d; + for (Object[] obj : objs) { + Long rAreaId = (Long) obj[1]; + Long bId = (Long) obj[1]; + double xqQty = (Double) obj[2]; + BomAccount ba = bomAccountService.findByEntity(bId); + PickDetail ptd = new PickDetail(); + //需求数xq_qty=数量*单用 + ptd.setXqQty(xqQty); + ptd.setBomId(ba.getId()); + if(detailIds!=null) {//自动叫料逻辑 + Double xbQty = inventoryBakRepository.getXbQty(ba.getItem().getId(), ba.getRArea().getId(), detailIds, ba.getZPoint().getId()); + if (xbQty == null || xbQty <= 0) { + xbQty = 0d; + } + ptd.setXbQty(xbQty); + Double xbBhQty=0d; + if(type!=null&&type.equals(BizStatus.PX_BH)){ + xbBhQty= inventoryBakRepository.getXbBhQty(ba.getItem().getId(), ba.getRArea().getId(), detailIds, ba.getZPoint().getId()); + if (xbBhQty == null || xbBhQty <= 0) { + xbBhQty = 0d; + } + } + ptd.setXbBhQty(xbBhQty); + + //获取批次需求数,因同一工位品番有多个数量,需汇总统计 + double pc_qty = bomAccountRepository.getPcQty(ba.getRArea().getId(), ba.getItem().getId(), ba.getZPoint().getId()); + //批次需求数,存入BOM中 + ptd.setPureReqQty(pc_qty); + } + //纯需求数 【BOM单用*(铺线计划台数10台+第一批的10台+第二批的10台)-第一批需求-线边库存】/收容数*收容数 + ptd.setPropC4(xqQty-ptd.getPureReqQty()-ptd.getXbQty()-ptd.getXbBhQty()); + if(ptd.getPropC4().intValue()<=0){ + ptd.setPropC4(0d); + }else{ + //备货需求=(纯需求数/收容数向上取整)*收容数 + ptd.setOrderQty(Math.ceil(ptd.getPropC4()/ba.getItem().getExtendD3())*ba.getItem().getExtendD3()); + } + ba.setPcQty(ptd.getOrderQty()+ba.getPcQty()); + bomAccountService.update(ba); + xqty += ptd.getXqQty(); + cxqty += ptd.getPropC4(); + ptd.setPoint(ba.getZPoint()); + ptd.setItem(ba.getItem()); + ptd.setPickTicket(pickTicket); + ptd.setContents(ba.getContents()); + ptd.setAc(ba.getAc()); + ptd.setSupplier(ba.getSupplier()); + ptd.setArea(pickTicket.getArea()); + ptd.setShArea(ba.getRArea()); + pickDetailService.create(ptd); + orderQty += ptd.getOrderQty(); + //查询组合物料,数量是否一致,不一致改成一致 + String largeClass=ba.getItem().getLargeClass(); + if(largeClass!=null&&!largeClass.equals("")){ + int maxQty=pickDetailService.getMaxBomQty(pickTicket.getId(),largeClass).intValue(); + if(maxQty>0) { + List ptds = pickDetailService.getBomList(pickTicket.getId(), largeClass); + for (PickDetail d : ptds) { + if (d.getOrderQty().intValue() != maxQty) { + orderQty -= d.getOrderQty(); + d.setRemark("原" + d.getOrderQty() + "调整到" + maxQty); + d.setOrderQty(maxQty + 0d); + pickDetailService.update(d); + orderQty += d.getOrderQty(); + } + } + } + } + } + pickTicket.setOrderQuantity(orderQty); + pickTicket.setBhQty(orderQty); + //纯需求数 + pickTicket.setPureReqQty(cxqty); + //需求数量 + pickTicket.setXqQty(xqty); + pickTicket.setPc(pc); + pickTicket.setBatchTime(ppd.getBatchTime()); + pickTicketService.update(pickTicket); + } + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ScreenMdServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ScreenMdServiceImpl.java new file mode 100644 index 0000000..f43a751 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/ScreenMdServiceImpl.java @@ -0,0 +1,90 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.service.ScreenMdService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.EntityManager; +import java.util.List; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-16 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class ScreenMdServiceImpl implements ScreenMdService { + private final EntityManager entityMapper; + public List queryLayout(String zoneType) { + String sql="SELECT ls.id,ls.code,ls.X,ls.Y,i.BAR_CODE,ik.LOT,ls.DISABLED ,inv.`STATUS` inv_status,ls.`STATUS` loc_status\n" + + "FROM mdwms.`location_storage` `ls` \n" + + "LEFT JOIN mdwms.`stock` `sto` ON `sto`.`LocationStorage_id` = `ls`.`ID` \n" + + "LEFT JOIN mdwms.`location` `loc` ON `loc`.`STOCK_ID` = `sto`.`ID` \n" + + "LEFT JOIN mdwms.`inventory` `inv` ON `inv`.`LOCATION_ID` = `loc`.`ID` \n" + + "LEFT JOIN mdwms.`item_key` `ik` ON `inv`.`ITEM_KEY_ID` = `ik`.`ID` \n" + + "LEFT JOIN mdwms.`item` `i` ON `i`.`ID` = `ik`.`ITEM_ID` \t\t\n" + + "WHERE `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n" + + "ORDER By `ls`.`CODE`"; + List ts= entityMapper.createNativeQuery(sql).getResultList(); + return ts; + } + + public List getLocXy(String zoneType) { + String sql="SELECT min(ls.X) minx,min(ls.Y) miny,max(ls.X) maxx,max(ls.Y) maxy " + + "FROM mdwms.`location_storage` `ls` \n" + + "WHERE `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n"; + List ts= entityMapper.createNativeQuery(sql).getResultList(); + return ts; + } + + @Transactional(readOnly = true) + public int getLocStatusCount(String type){ + String sql="SELECT count(ls.id) " + + "FROM mdwms.`location_storage` `ls` \n" + + "LEFT JOIN mdwms.`stock` `sto` ON `sto`.`LocationStorage_id` = `ls`.`ID` \n" + + "LEFT JOIN mdwms.`location` `loc` ON `loc`.`STOCK_ID` = `sto`.`ID` \n" + + "LEFT JOIN mdwms.`inventory` `inv` ON `inv`.`LOCATION_ID` = `loc`.`ID` \n" + + "WHERE `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n"; + if(type.equals("1")){//1禁用,2满料,3AGV未送物料占用,4 空闲,5空车占用 + sql+=" and ls.DISABLED=1"; + }else if(type.equals("2")){ + sql+=" and ls.DISABLED=0 and inv.status='OPEN' and ls.status='OCCUPY'"; + }else if(type.equals("3")){ + sql+=" and ls.DISABLED=0 and inv.status='ZY' and ls.status='OCCUPY'"; + }else if(type.equals("4")){ + sql+=" and ls.DISABLED=0 and inv.status is null and ls.status='FREE'"; + }else if(type.equals("5")){ + sql+=" and ls.DISABLED=0 and inv.status is null and ls.status='OCCUPY'"; + } + List ts= entityMapper.createNativeQuery(sql).getResultList(); + return Integer.parseInt(ts.get(0).toString()); + } + + public int getLocCount(String itemType) { + String sql="SELECT count(ls.id) " + + "FROM mdwms.`location_storage` `ls` \n" + + "WHERE `ls`.`TYPE` = '05' and ls.X is not null and ls.Y is not null and ls.x!=0 and ls.y!=0 \n"; + List ts= entityMapper.createNativeQuery(sql).getResultList(); + return Integer.parseInt(ts.get(0).toString()); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/SparepartsServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/SparepartsServiceImpl.java new file mode 100644 index 0000000..ad44cd1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/SparepartsServiceImpl.java @@ -0,0 +1,213 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.basicdata.domain.BigItem; +import com.youchain.basicdata.domain.BomAccount; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.service.BomAccountService; +import com.youchain.basicdata.service.PointService; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.ItemKeyService; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.SparepartsRepository; +import com.youchain.businessdata.service.SparepartsService; +import com.youchain.businessdata.service.dto.SparepartsDto; +import com.youchain.businessdata.service.dto.SparepartsQueryCriteria; +import com.youchain.businessdata.service.mapstruct.SparepartsMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.sql.Timestamp; +import java.util.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author ShenYinAn +* @date 2024-01-30 +**/ +@Service +@Slf4j +@RequiredArgsConstructor +public class SparepartsServiceImpl implements SparepartsService { + + private final SparepartsRepository sparepartsRepository; + private final SparepartsMapper sparepartsMapper; + private final InventoryService inventoryService; + private final InventoryLogService inventoryLogService; + private final BomAccountService bomAccountService; + private final DictDetailService dictDetailService; + private final PointService pointService; + private final ItemKeyService itemKeyService; + + @Override + public Map queryAll(SparepartsQueryCriteria criteria, Pageable pageable){ + Page page = sparepartsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(sparepartsMapper::toDto)); + } + + @Override + public List queryAll(SparepartsQueryCriteria criteria){ + return sparepartsMapper.toDto(sparepartsRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public SparepartsDto findById(Long id) { + Spareparts spareparts = sparepartsRepository.findById(id).orElseGet(Spareparts::new); + ValidationUtil.isNull(spareparts.getId(),"Spareparts","id",id); + return sparepartsMapper.toDto(spareparts); + } + + @Override + @Transactional + public Spareparts getEntity(Long id) { + Spareparts spareparts = sparepartsRepository.findById(id).orElseGet(Spareparts::new); + return spareparts; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public SparepartsDto create(Spareparts resources) { + return sparepartsMapper.toDto(sparepartsRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Spareparts resources) { + Spareparts spareparts = sparepartsRepository.findById(resources.getId()).orElseGet(Spareparts::new); + ValidationUtil.isNull( spareparts.getId(),"Spareparts","id",resources.getId()); + spareparts.copy(resources); + sparepartsRepository.save(spareparts); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + sparepartsRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list= ExcelDownUtils.CreateMap(all,"Spareparts"); + FileUtil.downloadExcel(list, response); + } + + public Spareparts createSpareparts(String gw, BigItem bigItem, int qty, String des) { + Spareparts spareparts = new Spareparts(); + spareparts.setStationType(gw); + spareparts.setStatus("UN_CONSUME"); + spareparts.setDate(new Timestamp(new Date().getTime())); + spareparts.setBigItemId(bigItem); + spareparts.setOrderQuantity(qty); + spareparts.setDescription(des); + this.create(spareparts); + return spareparts; + } + + public void hySpareParts(Long id){ + Spareparts s=this.getEntity(id); + if(!s.getStatus().equals(BizStatus.UN_CONSUME)){ + throw new BadRequestException("状态必须未未耗用"); + } + String gw=s.getStationType(); + List bs = bomAccountService.queryBomAccount(s.getBigItemId().getId(), null,gw); + if (bs.size() <= 0) { + throw new BadRequestException(s.getBigItemId().getCode() + "未查到"+gw+"对应BOM工位清单"); + } + for(BomAccount ba:bs){ + if(ba.getZPoint()==null){ + throw new BadRequestException(ba.getItem().getCode()+"维护制造库位"); + } + double qty=s.getOrderQuantity()*ba.getSingles(); + log.info(ba.getId()+"=="+ba.getItem().getId()); + //扣除线边库存 + List inventorys=inventoryService.getXbHyInv(ba.getItem(),ba.getRArea(),gw,ba.getZPoint(),"耗用"); + if(inventorys.size()>0){ + int num=0; + for(Inventory inv:inventorys){ + if(qty<=0){ + break; + } + num++; + if(numqty||num==inventorys.size()){ + hyQty=qty; + qty-=hyQty; + }else{ + hyQty=inv.getQuantity(); + qty-=hyQty; + } + inv.setQuantity(inv.getQuantity()-hyQty); + inventoryService.update(inv); + InventoryLog log= inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inv.getItemKey(), + inv.getPoint(),inv.getPoint(),null,null,srcQty,hyQty,null,null,s.getBigItemId().getCode(), + s.getId(),inv.getId(),"零件耗用"); + log.setZzkw(ba.getZPoint()); + inventoryLogService.update(log); + } + }else{ +// Point point=ba.getCArea().getPoint(); + Point point=pointService.findEntityById(ba.getRArea().getPointId()); + if(point==null){ + throw new BadRequestException(ba.getRArea().getCode()+"库区无对应待投料库位"); + } + ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null); + Inventory inventory = new Inventory(); + inventory.setItemKey(itemKey); + inventory.setPoint(point); + inventory.setPointCode(point.getCode()); + inventory.setZzkw(ba.getZPoint()); + inventory.setDept(UserUtils.getDept()); + inventory.setArea(ba.getRArea()); + inventory.setQuantity(-qty); + inventoryService.create(inventory); + InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inventory.getItemKey(), + inventory.getPoint(),inventory.getPoint(),null,null,0d,qty,null,null,s.getBigItemId().getCode(), + s.getId(),inventory.getId(),"零件耗用"); + log.setZzkw(ba.getZPoint()); + inventoryLogService.update(log); + } + } + s.setStatus(BizStatus.CONSUME); + s.setHyBy(SecurityUtils.getCurrentUsername()); + s.setHyTime(new Timestamp(new Date().getTime())); + this.update(s); + } + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskLogServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskLogServiceImpl.java new file mode 100644 index 0000000..9e3510b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskLogServiceImpl.java @@ -0,0 +1,241 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.Stock; +import com.youchain.businessdata.domain.PickOut; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.service.dto.TaskDto; +import com.youchain.businessdata.service.mapstruct.TaskMapper; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.TaskLogRepository; +import com.youchain.businessdata.service.TaskLogService; +import com.youchain.businessdata.service.dto.TaskLogDto; +import com.youchain.businessdata.service.dto.TaskLogQueryCriteria; +import com.youchain.businessdata.service.mapstruct.TaskLogMapper; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** + * @author huojin + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-25 + **/ +@Service +@RequiredArgsConstructor +public class TaskLogServiceImpl implements TaskLogService { + + private final TaskLogRepository taskLogRepository; + private final TaskLogMapper taskLogMapper; + private final TaskMapper taskMapper; + private final EntityManager entityManager; + + @Override + public Map queryAll(TaskLogQueryCriteria criteria, Pageable pageable) { + Page page = taskLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(taskLogMapper::toDto)); + } + + @Override + public List queryAll(TaskLogQueryCriteria criteria) { + return taskLogMapper.toDto(taskLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public TaskLogDto findById(Long id) { + TaskLog taskLog = taskLogRepository.findById(id).orElseGet(TaskLog::new); + ValidationUtil.isNull(taskLog.getId(), "TaskLog", "id", id); + return taskLogMapper.toDto(taskLog); + } + + @Override + @Transactional + public TaskLog findEntityId(Long id) { + TaskLog taskLog = taskLogRepository.findById(id).orElseGet(TaskLog::new); + return taskLog; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TaskLogDto create(TaskLog resources) { + return taskLogMapper.toDto(taskLogRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TaskLog resources) { + TaskLog taskLog = taskLogRepository.findById(resources.getId()).orElseGet(TaskLog::new); + ValidationUtil.isNull(taskLog.getId(), "TaskLog", "id", resources.getId()); + taskLog.copy(resources); + taskLogRepository.save(taskLog); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + taskLogRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (TaskLogDto taskLog : all) { + Map map = new LinkedHashMap<>(); + map.put("物料序号", taskLog.getItem()); + map.put("物料属性序号", taskLog.getItemKey()); + map.put("任务序号", taskLog.getTask()); + map.put("源容器", taskLog.getSrcStock()); + map.put("目标容器", taskLog.getDstStock()); + map.put("源点位", taskLog.getSrcPoint()); + map.put("目标点位", taskLog.getDstPoint()); + map.put("源容器编码", taskLog.getSrcStockCode()); + map.put("目标容器编码", taskLog.getDstStockCode()); + map.put("源点位编码", taskLog.getSrcLocCode()); + map.put("目标点位编码", taskLog.getDstLocCode()); + map.put("属性6", taskLog.getInvStatus()); + map.put("退回", taskLog.getBeBack()); + map.put("拣货数量", taskLog.getMoveQty()); + map.put("发运数量", taskLog.getShipQty()); + map.put("上架号", taskLog.getPutCode()); + map.put("库存ID", taskLog.getInvId()); + map.put("仓库ID", taskLog.getDept()); + map.put("创建人", taskLog.getCreateBy()); + map.put("修改人", taskLog.getUpdateBy()); + map.put("发运人", taskLog.getShipBy()); + map.put("发运时间", taskLog.getShipTime()); + map.put("创建时间", taskLog.getCreateTime()); + map.put("修改时间", taskLog.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + + @Override + public void createTaskLogData(TaskDto tasks, double planQty) { + Task task = taskMapper.toEntity(tasks); + TaskLog taskLog = new TaskLog(); + taskLog.setItem(task.getItem()); + taskLog.setItemKey(task.getItemKey()); + taskLog.setTask(task); + taskLog.setSrcStock(task.getSrcStock()); + taskLog.setDstStock(task.getDstStock()); + taskLog.setSrcPoint(task.getSrcPoint()); + taskLog.setDstPoint(task.getDstPoint()); + taskLog.setSrcStockCode(task.getSrcStockCode()); + taskLog.setDstStockCode(task.getDstStockCode()); + taskLog.setSrcLocCode(task.getSrcPointCode()); + taskLog.setDstLocCode(task.getDstPointCode()); + taskLog.setInvStatus(task.getInvStatus()); + taskLog.setMoveQty(planQty); + taskLog.setShipQty(taskLog.getShipQty()==null?0d:taskLog.getShipQty()); +// taskLog.setShipQty(planQty); + taskLog.setPutCode(task.getPutCode()); + taskLog.setInvId(task.getInvId()); + taskLog.setDept(task.getDept()); + this.create(taskLog); + } + + @Override + public TaskLog createTaskLog(Task task, double planQty, String stockCode,String xpp,String bhr) { + TaskLog taskLog = new TaskLog(); + taskLog.setItem(task.getItem()); + taskLog.setItemKey(task.getItemKey()); + taskLog.setTask(task); + taskLog.setSrcStock(task.getSrcStock()); + taskLog.setSrcPoint(task.getSrcPoint()); + taskLog.setDstPoint(task.getDstPoint()); + taskLog.setSrcStockCode(xpp); + taskLog.setDstStockCode(stockCode); + taskLog.setPutCode(bhr); + taskLog.setSrcLocCode(task.getSrcPointCode()); + taskLog.setDstLocCode(task.getDstPointCode()); + taskLog.setInvStatus(task.getInvStatus()); + taskLog.setMoveQty(planQty); + taskLog.setShipQty(0d); + taskLog.setPutCode(task.getPutCode()); + taskLog.setInvId(task.getInvId()); + taskLog.setDept(task.getDept()); + if(task.getPickDetail()!=null) { + taskLog.setShArea(task.getPickDetail().getShArea()); + } + this.create(taskLog); + return taskLog; + } + + public List queryTaskLogApp(IPTask t){ + String sql="SELECT it.code itemCode,it.`name` itemName,log.move_qty plan_qty,ik.prop_d1 pch,log.ship_qty bhs,log.dst_stock_code stockCode\n" + + "from data_task_log log\n" + + "left join data_item_key ik on ik.id=log.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n" + + " where 1=1 "; + if(t.getPickTicketId()!=null&&!t.getPickTicketId().equals(0l)){ + sql+=" and log.pick_out_id="+t.getPickTicketId(); + } + sql+= " ORDER BY it.code"; + List ts= entityManager.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List l = JSON.parseArray(JSON.toJSONString(ts),RPTaskList.class); + return l; + } + + + + public List findByTph(String tph,Long outId) { + String hql=" from TaskLog t where t.dstStockCode='"+tph+"' and t.pickOut.id is null and t.shipQty=0"; + if(outId!=null){ + hql=" from TaskLog t where t.pickOut.id="+outId+" and t.shipQty=0"; + } + Query query=entityManager.createQuery(hql); + List logs=query.getResultList(); + return logs; + } + + public List findByLog(String xpp,String billCode) { + String hql=" from TaskLog t where t.srcStockCode='"+xpp+"' and t.task.billCode='"+billCode+"' and t.shipQty=0"; + Query query=entityManager.createQuery(hql); + List logs=query.getResultList(); + return logs; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java new file mode 100644 index 0000000..08edca4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java @@ -0,0 +1,372 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.domain.Stock; +import com.youchain.basicdata.repository.StockRepository; +import com.youchain.businessdata.returnJson.RPTaskList; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.IPTask; +import com.youchain.businessdata.repository.InventoryRepository; +import com.youchain.businessdata.repository.PickDetailRepository; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.TaskRepository; +import com.youchain.businessdata.service.TaskService; +import com.youchain.businessdata.service.dto.TaskDto; +import com.youchain.businessdata.service.dto.TaskQueryCriteria; +import com.youchain.businessdata.service.mapstruct.TaskMapper; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.*; +import java.io.IOException; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @description 服务实现 + * @date 2023-08-16 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class TaskServiceImpl implements TaskService { + + private final TaskRepository taskRepository; + private final TaskMapper taskMapper; + private final InventoryRepository inventoryRepository; + private final PickDetailRepository pickDetailRepository; + private final InventoryLogService inventoryLogService; + private final EntityManager entityMapper; + private final StockRepository stockRepository; + @Override + public Map queryAll(TaskQueryCriteria criteria, Pageable pageable) { + Page page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(taskMapper::toDto)); + } + + @Override + public List queryAll(TaskQueryCriteria criteria) { + return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + @Transactional + public TaskDto findById(Long id) { + Task task = taskRepository.findById(id).orElseGet(Task::new); + ValidationUtil.isNull(task.getId(), "Task", "id", id); + return taskMapper.toDto(task); + } + + @Override + @Transactional + public Task getEntity(Long id) { + Task task = taskRepository.findById(id).orElseGet(Task::new); + return task; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TaskDto create(Task resources) { + return taskMapper.toDto(taskRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Task resources) { + Task task = taskRepository.findById(resources.getId()).orElseGet(Task::new); + ValidationUtil.isNull(task.getId(), "Task", "id", resources.getId()); + task.copy(resources); + taskRepository.save(task); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + taskRepository.deleteById(id); + } + } + + @Override + public void delete(Long id) { + taskRepository.deleteById(id); + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(all,"Task"); +// List> list = new ArrayList<>(); +// for (TaskDto task : all) { +// Map map = new LinkedHashMap<>(); +// map.put("序号", task.getId()); +// map.put("物料编码", task.getItemKey().getItem().getCode()); +// map.put("物料名称", task.getItemKey().getItem().getName()); +// map.put("容器编号", task.getSrcStock()==null?"":task.getSrcStock().getCode()); +// map.put("原点位", task.getSrcPointCode()); +// map.put("目标点位", task.getDstPointCode()); +// map.put("任务状态", task.getTaskStatus()); +// map.put("计划数量", task.getPlanQty()); +// map.put("移位数量", task.getMoveQty()); +// map.put("创建人", task.getCreateBy()); +// map.put("创建时间", task.getCreateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } + + @Override + public Task toEntity(TaskDto taskDto) { + return taskMapper.toEntity(taskDto); + } + + @Override + public List getPickNotAllTask(Long id) { + return taskRepository.getPickNotAllTask(id); + } + + @Override + public List getPickAllTask(Long id) { + return taskRepository.getPickAllTask(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Task storeTask(AsnDetail d, PickDetail p, Area area, ItemKey ik, Point srcPoint, Point dstPoint,double qty) { + Task t = new Task(); + t.setAsnDetail(d); + t.setPickDetail(p); + if(d!=null){ + if(d.getAsn()!=null){ + t.setBillCode(d.getAsn().getCode()); + } + t.setTaskType(BizStatus.ASN); + t.setItem(d.getItem()); + }else if(p!=null){ + if(p.getPickTicket()!=null){ + t.setBillCode(p.getPickTicket().getCode()); + } + t.setTaskType(BizStatus.PICK); + t.setItem(p.getItem()); + } + t.setPlanQty(qty); + t.setTaskStatus(BizStatus.OPEN); + t.setItemKey(ik); + t.setArea(area); + t.setDept(srcPoint.getDept()); + if (srcPoint != null) { + t.setSrcPoint(srcPoint); + t.setSrcPointCode(srcPoint.getCode()); + } + if(dstPoint!=null){ + t.setDstPoint(dstPoint); + t.setDstPointCode(dstPoint.getCode()); + } + this.create(t); + return t; + } + @Override + @Transactional(rollbackFor = Exception.class) + public synchronized void pickConfirm(long taskId, double pickedQuantity) throws Exception { + if (taskId > 0) { + TaskDto taskDto = findById(taskId); + Task task = taskMapper.toEntity(taskDto);//Dto转实体 + if (task.getPlanQty() > task.getMoveQty()) { + PickDetail pickDetail = task.getPickDetail(); + task.setMoveQty(pickedQuantity); + task.setTaskStatus(BizStatus.FINISH); + taskRepository.save(task); + Inventory inv = inventoryRepository.findById(task.getInvId()).get(); + if (inv != null) { + ItemKey itemKey = inv.getItemKey(); + Item item = itemKey.getItem(); + Dept dept = item.getDept(); + double srcQty=inv.getQuantity(); + inv.setQuantity(inv.getQuantity() - pickedQuantity); + inv.setQueuedQty(inv.getQueuedQty() - pickedQuantity); + inventoryRepository.save(inv); + if(inv.getQuantity()<=0){ + inventoryRepository.delete(inv); + } + Stock stock=inv.getStock(); + stock.setStatus(BaseStatus.FREE); + stockRepository.save(stock); + //添加库存日志 + inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,task.getPickDetail().getPo(),null,task.getItemKey(),task.getSrcPoint(),task.getDstPoint(),task.getSrcStock(),task.getDstStock(),srcQty,pickedQuantity, + null,null,BizStatus.PICK,task.getId(),inv.getId(),""); + + //刷新出库明细上的拣货数量 + pickDetail.setPickedQty(pickDetail.getPickedQty() + pickedQuantity); + if (pickDetail.getOrderQty().equals(pickDetail.getPickedQty())) { + pickDetail.setStatus(BizStatus.PICK_ALL); + } else if (pickDetail.getAllocatedQty() > 0 && pickDetail.getOrderQty() - pickDetail.getPickedQty() > 0) { + pickDetail.setStatus(BizStatus.PICKUP); + } + pickDetailRepository.save(pickDetail); + + } else { + throw new RuntimeException("未找到库存相应记录!"); + } + } + + } else { + throw new RuntimeException("参数错误或为空"); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public synchronized void pickBarBack(long taskId, double pickedQuantity) throws Exception { + if (taskId > 0) { + TaskDto taskDto = findById(taskId); + Task task = taskMapper.toEntity(taskDto);//Dto转实体 + PickDetail pickDetail = task.getPickDetail(); + Inventory inv = inventoryRepository.findById(task.getInvId()).get(); + if (inv != null) { + //退回库存 + double srcQty=inv.getQueuedQty(); + inv.setQueuedQty(inv.getQueuedQty()+pickedQuantity); + inv.setQuantity(inv.getQuantity()+pickedQuantity); + inventoryRepository.save(inv); + //添加库存日志 + inventoryLogService.storeInventoryLog(BizStatus.PICK_CANCEL,BizStatus.ADD,task.getPickDetail().getPo(),null,task.getItemKey(),task.getDstPoint(),task.getSrcPoint(),task.getSrcStock(),task.getDstStock(),srcQty,pickedQuantity, + null,null,BizStatus.PICK,task.getId(),inv.getId(),""); + //退回Task + task.setMoveQty(task.getMoveQty() - pickedQuantity); + taskRepository.save(task); + + //退回出库明细 + pickDetail.setPickedQty(pickDetail.getPickedQty() - pickedQuantity); + if (pickDetail.getPickedQty() == 0) { + pickDetail.setStatus(BizStatus.ALLOCATE); + } + pickDetailRepository.save(pickDetail); + } else { + throw new RuntimeException("未找到库存相应记录!"); + } + + } else { + throw new RuntimeException("参数错误或为空"); + } + } + + public List queryTaskApp(IPTask t){ + String sql="SELECT t.pick_detail_id pickDetailId,sh.code gw, it.code itemCode,it.`name` itemName,t.plan_qty qty," + + "ik.prop_c1 pch,t.move_qty bhs,t.src_point_code srcPointCode,t.src_stock_code stockCode,t.dst_point_code dstPointCode\n" + + " from data_task t\n" + + "left join data_pick_detail d on t.pick_detail_id=d.id\n" + + "left join base_area sh on sh.id=d.sh_area_id\n" + + "left join data_item_key ik on ik.id=t.item_key_id\n" + + "left join base_item it on it.id=ik.item_id\n " + + " where 1=1 "; + if(t.getPickTicketId()!=null&&!t.getPickTicketId().equals(0l)){ + sql+=" and d.pick_ticket_id="+t.getPickTicketId(); + }else{ + sql+=" and d.`status`='ALLOCATE'"; + } + sql+= " ORDER BY it.code"; + List ts= entityMapper.createNativeQuery(sql) + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List l = JSON.parseArray(JSON.toJSONString(ts),RPTaskList.class); + return l; + } + + @Override + public List getAgvTaskList(Integer id) { + return taskRepository.getAgvTaskList(id); + } + + @Override + public List findbyPointCode(Long pointId) { + String hql=" from Task t where t.dstPoint.id="+pointId+" and t.moveQty=0 "; + Query query=entityMapper.createQuery(hql); + List taskList=query.getResultList(); + return taskList; + } + + public List queryAreaMonth(String type) { + List taskList=null; + String hql = ""; + if(type.equals("IN")){ + hql += " select t.dstPoint.area.name,count(t.id) from Task t where t.dstPoint.area.name in ('"+AreaNameDic.QHTL+"','"+AreaNameDic.QHTK+"','"+AreaNameDic.ZCK+"','"+AreaNameDic.ZCM+"')"; + hql+=" and t.asnDetail.id is not null "; + hql+=" group by t.dstPoint.area.name"; + }else if(type.equals("OUT")){ + hql += " select t.srcPoint.area.name,count(t.id) from Task t where t.srcPoint.area.name in ('"+AreaNameDic.QHTL+"','"+AreaNameDic.QHTK+"','"+AreaNameDic.ZCK+"','"+AreaNameDic.ZCM+"')"; + hql+=" and t.pickDetail.id is not null "; + hql+=" group by t.srcPoint.area.name"; + } + Query query = entityMapper.createQuery(hql); + taskList = query.getResultList(); + return taskList; + } + + public List queryAreaDay(String type,String zoneType) { + List taskList=null; + String hql = "select count(t.id),CAST(sum(t.moveQty) as integer )from Task t where 1=1"; + if(type.equals("IN")){ + if(zoneType.equals("ZC")) { + hql += " and t.dstPoint.area.name in ('" + AreaNameDic.ZCM + "')"; + } + hql+=" and t.asnDetail.id is not null "; + }else if(type.equals("OUT")){ + if(zoneType.equals("ZC")) { + hql += " and t.srcPoint.area.name in ('" + AreaNameDic.ZCM + "')"; + } + hql+=" and t.pickDetail.id is not null "; + } + hql += " and DATE_FORMAT(t.createTime,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d')"; + Query query = entityMapper.createQuery(hql); + taskList = query.getResultList(); + return taskList; + } + + @Override + public List queryTask(Long asnDetailId,Long pickDetailId,Long ikId,Long pickId,Long srcPointId) { + String hql=" from Task t where 1=1 "; + if(asnDetailId!=null){ + hql+=" and t.asnDetail.id="+asnDetailId+" and t.taskType='ASN'"; + }else if(pickDetailId!=null){ + hql+=" and t.taskType='PICK' and t.pickDetail.id="+pickDetailId; + }else if(ikId!=null){ + hql+=" and t.pickDetail.pickTicket.id="+pickId+" and t.itemKey.id="+ikId; + } + if(srcPointId!=null){ + hql+=" and t.srcPoint.id="+srcPointId; + } + Query query=entityMapper.createQuery(hql); + List taskList=query.getResultList(); + return taskList; + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java new file mode 100644 index 0000000..7ef1d29 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/XppRecordServiceImpl.java @@ -0,0 +1,411 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.businessdata.service.impl; + +import com.alibaba.fastjson.JSON; +import com.youchain.basicdata.domain.Area; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.domain.Point; +import com.youchain.basicdata.repository.AreaRepository; +import com.youchain.basicdata.repository.BomAccountRepository; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.basicdata.repository.PointRepository; +import com.youchain.businessdata.domain.*; +import com.youchain.businessdata.inputJson.buttenJson.XppRecordButton; +import com.youchain.businessdata.repository.AsnDetailRepository; +import com.youchain.businessdata.returnJson.RRkXpp; +import com.youchain.businessdata.service.InventoryLogService; +import com.youchain.businessdata.service.InventoryService; +import com.youchain.businessdata.service.dto.*; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.XppRecordRepository; +import com.youchain.businessdata.service.XppRecordService; +import com.youchain.businessdata.service.mapstruct.XppRecordMapper; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.SQLQuery; +import org.hibernate.transform.AliasToEntityMapResultTransformer; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Pageable; + +import java.math.BigInteger; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.servlet.http.HttpServletResponse; + +/** + * @author baobinglin + * @website https://eladmin.vip + * @description 服务实现 + * @date 2024-01-04 + **/ +@Slf4j +@Service +@RequiredArgsConstructor +public class XppRecordServiceImpl implements XppRecordService { + + private final XppRecordRepository xppRecordRepository; + private final XppRecordMapper xppRecordMapper; + private final ItemRepository itemRepository; + private final AsnDetailRepository asnDetailRepository; + private final PointRepository pointRepository; + private final RedisUtils redisUtils; + private final InventoryLogService inventoryLogService; + private final EntityManager entityManager; + private final BomAccountRepository bomAccountRepository; + private final AreaRepository areaRepository; + private final JobRepository jobRepository; + private final InventoryService inventoryService; + + @Override + public Map queryAll(XppRecordQueryCriteria criteria, Pageable pageable) { + int pageNum=pageable.getPageNumber();//当前页 + int pageSize=pageable.getPageSize();//条数 + Query queryTotal = getQuery(criteria,BizStatus.QUERY_TOTAL); + List l=queryTotal.getResultList(); + int pageCount=((BigInteger)l.get(0)).intValue(); + + Query queryPage = getQuery(criteria,BizStatus.QUERY_PAGE); + queryPage.setFirstResult((pageNum)*pageSize); + queryPage.setMaxResults((pageNum+1)*pageSize); + List queryResultList = queryPage.unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + Map map=new HashMap<>(); + map.put("content",queryResultList); + map.put("totalElements",pageCount); + return map; + } + + @Override + public List queryAll(XppRecordQueryCriteria criteria) { + Query query = getQuery(criteria,BizStatus.QUERY_PAGE); + List ts= query + .unwrap(SQLQuery.class) + .setResultTransformer( + AliasToEntityMapResultTransformer.INSTANCE + ) + .list(); + List list = JSON.parseArray(JSON.toJSONString(ts),XppRecordViewDto.class); + return list; + } + + @Override + @Transactional + public XppRecordDto findById(Long id) { + XppRecord xppRecord = xppRecordRepository.findById(id).orElseGet(XppRecord::new); + ValidationUtil.isNull(xppRecord.getId(), "XppRecord", "id", id); + return xppRecordMapper.toDto(xppRecord); + } + + @Override + @Transactional + public XppRecord getEntity(Long id) { + XppRecord xppRecord = xppRecordRepository.findById(id).orElseGet(XppRecord::new); + return xppRecord; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public XppRecordDto create(XppRecord resources) { + redisUtils.del("xppRecordQueryCriteria"); + return xppRecordMapper.toDto(xppRecordRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(XppRecord resources) { + redisUtils.del("xppRecordQueryCriteria"); + XppRecord xppRecord = xppRecordRepository.findById(resources.getId()).orElseGet(XppRecord::new); + ValidationUtil.isNull(xppRecord.getId(), "XppRecord", "id", resources.getId()); + xppRecord.copy(resources); + xppRecordRepository.save(xppRecord); + } + + @Override + public void deleteAll(Long[] ids) { + redisUtils.del("xppRecordQueryCriteria"); + for (Long id : ids) { + xppRecordRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = ExcelDownUtils.CreateMap(all, "XppRecord"); + FileUtil.downloadExcel(list, response); + } + + @Override + public XppRecord collectFromPass(String ewm) { + if (ewm.length() < 85) { + throw new BadRequestException("二维码格式错误"); + } + int i = 0; + String gc = ewm.substring(i, i += 2); + String pq = ewm.substring(i, i += 1); + String pf = ewm.substring(i, i += 10); + String ac = ewm.substring(i, i += 3); + String jgnr = ewm.substring(i, i += 3); + String zf = ewm.substring(i, i += 10); + String ddbh = ewm.substring(i, i += 8); + String nrzsr = ewm.substring(i, i += 8); + String nrs = ewm.substring(i, i += 7); + String gysdm = ewm.substring(i, i += 12); + String nrcs = ewm.substring(i, i += 6); + String zzkw = ewm.substring(i, i += 6); + String cgkw = ewm.substring(i, i += 6); + String fzh = ewm.substring(i, i += 3); + //纳入场所包含0055不接收 + if(nrcs.indexOf("0055")==0){ + throw new BadRequestException(pf+"纳入场所包含0055"); + } + Item item = itemRepository.findByCode(pf); + if (item == null) { + throw new BadRequestException("部品品番不存在"); + } + XppRecord xppRecord = xppRecordRepository.findByCode(ewm); + if (xppRecord == null) { + xppRecord = new XppRecord(); + xppRecord.setEwm(ewm); + } else { + throw new BadRequestException("二维码已采集"); + } + Long user_id=SecurityUtils.getCurrentUserId(); + List jobs=jobRepository.jobAreaCodes(user_id); + if(jobs.size()>0){ + String areaCode= jobs.get(0).getAreaCode(); + Area area=areaRepository.getByCode(areaCode); + if(area==null){ + throw new BadRequestException(pf+"维护岗位对应的库区"); + } + xppRecord.setArea(area); + } +// Long areaId=bomAccountRepository.getItemAreaId(item.getId()); +// Area area=areaRepository.getById(areaId); +// if(area==null){ +// throw new BadRequestException(pf+"找不到BOM对应的出库库区"); +// } + xppRecord.setItem(item); + xppRecord.setItemCode(pf); + xppRecord.setAreaCode(pq); + xppRecord.setAc(ac); + xppRecord.setContents(jgnr); + xppRecord.setZf(zf); + xppRecord.setDdbh(ddbh); + xppRecord.setNrs(Integer.valueOf(nrs)); + xppRecord.setRelaSupplier(gysdm.trim()); + xppRecord.setRelaCode(nrcs); + xppRecord.setZPointCode(zzkw); + xppRecord.setCPointCode(cgkw); + xppRecord.setFzh(fzh); + DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + DateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Timestamp nrDate = null; + try { + nrDate = Timestamp.valueOf(sdf2.format(sdf.parse(nrzsr + "000000"))); + } catch (Exception e) { + + } + + xppRecord.setNrDate(nrDate); + //采集时间 + xppRecord.setCjDate(new Timestamp(System.currentTimeMillis())); + xppRecord.setStatus(BizStatus.RECEIVED); + xppRecordRepository.save(xppRecord); + return xppRecord; + } + + @Override + public AsnDetail addAsnDetail(XppRecord xpp) { + AsnDetail asnDetail = new AsnDetail(); + asnDetail.setDept(UserUtils.getDept()); + asnDetail.setItem(xpp.getItem()); + asnDetail.setOrderQty(xpp.getNrs() + 0d); + asnDetail.setPropD1(xpp.getNrDate()); + asnDetail.setPo(xpp.getDdbh()); + asnDetail.setStatus(BizStatus.RECEIVED); + asnDetailRepository.save(asnDetail); + xpp.setAsnDetailId(asnDetail); + xpp.setStatus(BizStatus.RECEIVED); + xppRecordRepository.save(xpp); + return asnDetail; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void xppRecordQX(Long xppId) { + //查数据 + XppRecord xppRecord = xppRecordRepository.getById(xppId); + if (Objects.isNull(xppRecord)) { + throw new BadRequestException("未查到现品票"); + } + asnDetailRepository.delete(xppRecord.getAsnDetailId()); + xppRecordRepository.delete(xppRecord); + } + + + @Override + public void xpphybf(XppRecordButton xppRecordButton) {//现品票还样部分 + //部分还样,需要补打现品票,新的现品票需要重 + XppRecord xppRecord = xppRecordRepository.getById(xppRecordButton.getXppRecordId()); + xppRecord.setStatus(BizStatus.RETENTION_IN); + xppRecord.setHyData(new Timestamp(new Date().getTime())); + //生成出库记录 + inventoryLogService.storeInventoryLog(BizStatus.RETENTION_IN, BizStatus.ADD, "现品票还样", null, xppRecord.getItemKey(), null, null, null, null, + 0d, xppRecord.getNrs() + 0d, null, xppRecord.getEwm(), BizStatus.RETENTION_IN, xppRecord.getId(), null, "现品票还样"); + this.update(xppRecord); + } + + public List queryPickDetailList(long picktickId) { + String hql = " from PickDetail pd where pd.pickTicket.id=" + picktickId + " and pd.orderQty-pd.allocatedQty>0 "; + Query query = entityManager.createQuery(hql); + List queryResultList = query.getResultList(); + return queryResultList; + } + + public Query getQuery(XppRecordQueryCriteria criteria,String type){ + String midSql=" xpp.`id`, dictd.label rela_supplier,it.code item_code,it.name item_name,xpp.`status`, xpp.`nrs`, xpp.`ddbh`, xpp.`fzh`, " + + "xpp.`nr_date` ,xpp.`cjr`, xpp.`cj_date`,ik.prop_c1,it.extend_d3 srs,point.code inv_point_code, xpp.`ac`,xpp.contents, ott.bill_code bh_code,xpp.`bhr`, xpp.`fhr`, xpp.jsr, xpp.`zztlr`, xpp.`hctlr`," + + "xpp.`bh_date`, xpp.`fh_date`, xpp.js_date,jskw.`code` jskw, xpp.`zztl_date`,zzkw.code zzkw, xpp.`tf_ly` tf_ly, xpp.`ly_data` ly_data, xpp.`hy_data` hy_data,xpp.be_fz," + + "xpp.`area_code`,xpp.`ewm`, xpp.`description`,xpp.ly_code,xpp.receipt_code,xpp.count_code "; + if(type.equals(BizStatus.QUERY_TOTAL)){ + midSql=" count(xpp.`id`)"; + } + String sql = "SELECT " +midSql+ + " FROM `data_xpp_record` xpp \n" + + "left join base_item it on it.id=xpp.item_id \n" + + "left join data_item_key ik on ik.id=xpp.item_key_id\n" + + "left join data_task_log otl on otl.id=ck_task_log_id\n" + + "left join data_task ott on ott.id=otl.task_id\n" + + "left join base_point point on point.id=xpp.inv_point_id\n" + + "left join base_point jskw on jskw.id=xpp.jskw \n" + + "left join base_point zzkw on zzkw.id=xpp.zzkw \n" + + "left join sys_dict_detail dictd on dictd.`value`=xpp.rela_supplier " + + "where 1=1 "; + if(criteria!=null) { + if (criteria.getItemCode()!=null &&!criteria.getItemCode().equals("") ) { + sql += " and it.code like '%" + criteria.getItemCode() + "%'"; + } + if (criteria.getItemName()!=null &&!criteria.getItemName().equals("") ) { + sql += " and it.name like '%" + criteria.getItemName() + "%'"; + } + if (criteria.getReceiptCode()!=null &&!criteria.getReceiptCode().equals("") ) { + sql += " and xpp.receipt_code like '%" + criteria.getReceiptCode() + "%'"; + } + if (criteria.getRelaSupplier()!=null &&!criteria.getRelaSupplier().equals("") ) { + sql += " and dictd.label like '%" + criteria.getRelaSupplier() + "%'"; + } + if (criteria.getDdbh()!=null &&!criteria.getDdbh().equals("") ) { + sql += " and xpp.ddbh like '%" + criteria.getDdbh() + "%'"; + } + if (criteria.getCreateTime()!=null &&criteria.getCreateTime().size()>0 ) { + sql += " and xpp.cj_date BETWEEN '"+criteria.getCreateTime().get(0)+"' and '"+criteria.getCreateTime().get(1)+"'"; + //sql += " and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')>='"+criteria.getCreateTime().get(0)+"' and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')<='"+criteria.getCreateTime().get(1)+"'"; + } + if (criteria.getBhTime()!=null &&criteria.getBhTime().size()>0 ) { + sql += " and xpp.bh_date BETWEEN '"+criteria.getBhTime().get(0)+"' and '"+criteria.getBhTime().get(1)+"'"; + //sql += " and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')>='"+criteria.getCreateTime().get(0)+"' and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')<='"+criteria.getCreateTime().get(1)+"'"; + } + if (criteria.getProp_c1()!=null &&!criteria.getProp_c1().equals("") ) { + sql += " and ik.prop_c1 like '%" + criteria.getProp_c1() + "%'"; + } + if (criteria.getInv_point_code()!=null &&!criteria.getInv_point_code().equals("") ) { + sql += " and point.code like '%" + criteria.getInv_point_code() + "%'"; + } + if (criteria.getEwm()!=null &&!criteria.getEwm().equals("") ) { + sql += " and xpp.ewm like '%" + criteria.getEwm() + "%'"; + } + if (criteria.getStatus()!=null &&!criteria.getStatus().equals("") ) { + sql += " and xpp.status='"+criteria.getStatus()+"'"; + } + if (criteria.getBeLy()!=null ) { + sql += " and xpp.tf_ly="+criteria.getBeLy(); + } + if (criteria.getBeFz()!=null ) { + sql += " and xpp.be_fz="+criteria.getBeFz(); + } + + sql+=" order by xpp.id desc"; + + } + Query query = entityManager.createNativeQuery(sql); + return query; + } + + + public RRkXpp xppAnalysis(XppRecord xppRecord) { + RRkXpp xpp = new RRkXpp(); + xpp.setId(xppRecord.getId()); + xpp.setItemCode(xppRecord.getItem().getCode()); + xpp.setItemName(xppRecord.getItem().getName()); + xpp.setAc(xppRecord.getAc()); + xpp.setDdbh(xppRecord.getDdbh()); + xpp.setNrs(Integer.valueOf(xppRecord.getNrs())); + if(xppRecord.getNrDate()!=null) { + xpp.setNrzsr(DateUtil.dateYmd(xppRecord.getNrDate())); + } + xpp.setFzh(xppRecord.getFzh()); + xpp.setGys(xppRecord.getRelaSupplier()); + xpp.setCjsj(new Date()); + return xpp; + } + + public void xppShipOut(Long id, Area area,Point srcPoint,Point zzkw,String type,String billCode,String des) { + XppRecord xppRecord = xppRecordRepository.getById(id); + if(!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ + throw new BadRequestException("现品票状态不正确"); + } + ItemKey ik = xppRecord.getItemKey(); + if(type.equals(BizStatus.RETENTION_OUT)){ + + }else { + xppRecord.setStatus(BizStatus.SHIP_ALL); + xppRecord.setFhDate(new Timestamp(new Date().getTime())); + xppRecord.setFhr(SecurityUtils.getCurrentUsername()); + } + this.update(xppRecord); + String itemCode=xppRecord.getItem().getCode(); + Inventory inventory=inventoryService.getInventory(ik,area,srcPoint,zzkw,area.getDept(),type); + if(inventory==null){ + throw new BadRequestException(itemCode+"该库位无该批次库存"); + } + int invQty=(int)(inventory.getQuantity()- inventory.getQueuedQty()); + if(invQty { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/AsnMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/AsnMapper.java new file mode 100644 index 0000000..8f213ac --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/AsnMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.Asn; +import com.youchain.businessdata.service.dto.AsnDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-09 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface AsnMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/BaseCodeMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/BaseCodeMapper.java new file mode 100644 index 0000000..52be4ee --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/BaseCodeMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.BaseCode; +import com.youchain.businessdata.service.dto.BaseCodeDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2023-08-22 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface BaseCodeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountDetailMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountDetailMapper.java new file mode 100644 index 0000000..0bf775a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountDetail; +import com.youchain.businessdata.service.dto.CountDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailMapper.java new file mode 100644 index 0000000..5951487 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountMoveDetail; +import com.youchain.businessdata.service.dto.CountMoveDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountMoveDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailRecordMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailRecordMapper.java new file mode 100644 index 0000000..c0a1ba5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveDetailRecordMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountMoveDetailRecord; +import com.youchain.businessdata.service.dto.CountMoveDetailRecordDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-21 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountMoveDetailRecordMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveMapper.java new file mode 100644 index 0000000..1aedb1e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountMoveMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountMove; +import com.youchain.businessdata.service.dto.CountMoveDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-11-19 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountMoveMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountPlanMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountPlanMapper.java new file mode 100644 index 0000000..e6cc54d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountPlanMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountPlan; +import com.youchain.businessdata.service.dto.CountPlanDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-19 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountPlanMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountRecordMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountRecordMapper.java new file mode 100644 index 0000000..50b9a9b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/CountRecordMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.CountRecord; +import com.youchain.businessdata.service.dto.CountRecordDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-10-20 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface CountRecordMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryBakMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryBakMapper.java new file mode 100644 index 0000000..1b7e085 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryBakMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.InventoryBak; +import com.youchain.businessdata.service.dto.InventoryBakDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2024-04-03 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface InventoryBakMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryLogMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryLogMapper.java new file mode 100644 index 0000000..2d32c0e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryLogMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.InventoryLog; +import com.youchain.businessdata.service.dto.InventoryLogDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-31 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface InventoryLogMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryMapper.java new file mode 100644 index 0000000..9db9ea9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/InventoryMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.Inventory; +import com.youchain.businessdata.service.dto.InventoryDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-22 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface InventoryMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/ItemKeyMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/ItemKeyMapper.java new file mode 100644 index 0000000..918e5f8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/ItemKeyMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.ItemKey; +import com.youchain.businessdata.service.dto.ItemKeyDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-21 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ItemKeyMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickDetailMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickDetailMapper.java new file mode 100644 index 0000000..1597fa9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PickDetail; +import com.youchain.businessdata.service.dto.PickDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-16 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PickDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickInstructionMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickInstructionMapper.java new file mode 100644 index 0000000..cbe3402 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickInstructionMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PickInstruction; +import com.youchain.businessdata.service.dto.PickInstructionDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PickInstructionMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickKitPlanMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickKitPlanMapper.java new file mode 100644 index 0000000..97eae81 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickKitPlanMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PickKitPlan; +import com.youchain.businessdata.service.dto.PickKitPlanDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-02-28 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PickKitPlanMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickOutMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickOutMapper.java new file mode 100644 index 0000000..6d79d93 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickOutMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PickOut; +import com.youchain.businessdata.service.dto.PickOutDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-02-21 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PickOutMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickTicketMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickTicketMapper.java new file mode 100644 index 0000000..49a5e9b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PickTicketMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PickTicket; +import com.youchain.businessdata.service.dto.PickTicketDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author JiangKun +* @date 2024-01-11 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PickTicketMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PlanPickDetailMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PlanPickDetailMapper.java new file mode 100644 index 0000000..cae07f4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/PlanPickDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.PlanPickDetail; +import com.youchain.businessdata.service.dto.PlanPickDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author jiangkun +* @date 2024-01-23 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface PlanPickDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/SparepartsMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/SparepartsMapper.java new file mode 100644 index 0000000..7ecf21f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/SparepartsMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.Spareparts; +import com.youchain.businessdata.service.dto.SparepartsDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author ShenYinAn +* @date 2024-01-30 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface SparepartsMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskLogMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskLogMapper.java new file mode 100644 index 0000000..2e40b0a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskLogMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.TaskLog; +import com.youchain.businessdata.service.dto.TaskLogDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2023-08-25 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TaskLogMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskMapper.java new file mode 100644 index 0000000..c64deb5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/TaskMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.Task; +import com.youchain.businessdata.service.dto.TaskDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author houjianlan +* @date 2023-08-16 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TaskMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/XppRecordMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/XppRecordMapper.java new file mode 100644 index 0000000..549505d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/XppRecordMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.XppRecord; +import com.youchain.businessdata.service.dto.XppRecordDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author baobinglin +* @date 2024-01-04 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface XppRecordMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelDto.java new file mode 100644 index 0000000..e280e37 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelDto.java @@ -0,0 +1,35 @@ +package com.youchain.businessdata.service.vo; + +import java.time.LocalDateTime; + +public interface InventoryExcelDto { + Long getId(); + + String getAreaName(); + + String getItemCode(); + + String getItemName(); + + String getLogType(); + + String getIncDec(); + + String getSrcPoint(); + + String getDstPoint(); + + Double getSrcQty(); + + Double getDstQty(); + + Double getOccurQuantity(); + + String getRelatedBill(); + + String getDescription(); + + String getCreateBy(); + + LocalDateTime getOccurTime(); +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelVO.java b/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelVO.java new file mode 100644 index 0000000..0e0ce4f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/vo/InventoryExcelVO.java @@ -0,0 +1,65 @@ +package com.youchain.businessdata.service.vo; + +import cn.idev.excel.annotation.ExcelProperty; +import cn.idev.excel.annotation.write.style.ColumnWidth; +import cn.idev.excel.annotation.write.style.ContentStyle; +import cn.idev.excel.enums.poi.HorizontalAlignmentEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ColumnWidth(20) +public class InventoryExcelVO { + @ExcelProperty("序号") + @ColumnWidth(10) + private Long id; + + @ExcelProperty("库区") + private String areaName; + + @ExcelProperty("品番") + private String itemCode; + + @ExcelProperty("品名") + private String itemName; + + @ExcelProperty("操作类型") + private String logType; + + @ExcelProperty("增加/减少") + private String incDec; + + @ExcelProperty("原库位") + private String srcPointCode; + + @ExcelProperty("目标库位") + private String dstPointCode; + + @ExcelProperty("原数量") + private Double srcQty; + + @ExcelProperty("目标数量") + private Double dstQty; + + @ExcelProperty("发生数量") + private Double occurQuantity; + + @ExcelProperty("关联单号") + private String relatedBill; + + @ExcelProperty("描述") + private String description; + + @ExcelProperty("创建人") + private String createBy; + + @ExcelProperty("发生日期") + private LocalDateTime occurTime; +} diff --git a/youchain-system/src/main/java/com/youchain/config/ConfigurerAdapter.java b/youchain-system/src/main/java/com/youchain/config/ConfigurerAdapter.java new file mode 100644 index 0000000..ffe8f00 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/ConfigurerAdapter.java @@ -0,0 +1,89 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson.support.config.FastJsonConfig; +import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * WebMvcConfigurer + * + * @author Liu Xue + * @date 2018-11-30 + */ +@Configuration +@EnableWebMvc +public class ConfigurerAdapter implements WebMvcConfigurer { + + /** 文件配置 */ + private final FileProperties properties; + + public ConfigurerAdapter(FileProperties properties) { + this.properties = properties; + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + config.addAllowedOriginPattern("*"); + config.addAllowedHeader("*"); + config.addAllowedMethod("*"); + source.registerCorsConfiguration("/**", config); + return new CorsFilter(source); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + FileProperties.ElPath path = properties.getPath(); + String avatarUtl = "file:" + path.getAvatar().replace("\\","/"); + String pathUtl = "file:" + path.getPath().replace("\\","/"); + registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0); + registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0); + registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0); + //registry.addResourceHandler("/**").addResourceLocations("classpath:/static/").setCachePeriod(0); + } + + @Override + public void configureMessageConverters(List> converters) { + // 使用 fastjson 序列化,会导致 @JsonIgnore 失效,可以使用 @JSONField(serialize = false) 替换 + FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); + List supportMediaTypeList = new ArrayList<>(); + supportMediaTypeList.add(MediaType.APPLICATION_JSON); + FastJsonConfig config = new FastJsonConfig(); + config.setDateFormat("yyyy-MM-dd HH:mm:ss"); + config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); + converter.setFastJsonConfig(config); + converter.setSupportedMediaTypes(supportMediaTypeList); + converter.setDefaultCharset(StandardCharsets.UTF_8); + converters.add(converter); + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/RelaxedQueryCharsConnectorCustomizer b/youchain-system/src/main/java/com/youchain/config/RelaxedQueryCharsConnectorCustomizer new file mode 100644 index 0000000..2ca2ad4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/RelaxedQueryCharsConnectorCustomizer @@ -0,0 +1,16 @@ +package me.zhengjie.config; + +import org.apache.catalina.connector.Connector; +import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; +import org.springframework.context.annotation.Configuration; + +/** + * @author bearBoy80 + */ +@Configuration(proxyBeanMethods = false) +public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer { + @Override + public void customize(Connector connector) { + connector.setProperty("relaxedQueryChars", "[]{}"); + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/WebSocketConfig.java b/youchain-system/src/main/java/com/youchain/config/WebSocketConfig.java new file mode 100644 index 0000000..e60083e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/WebSocketConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + +/** + * @author ZhangHouYing + * @date 2019-08-24 15:44 + */ +@Configuration +public class WebSocketConfig { + + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskExecutePool.java b/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskExecutePool.java new file mode 100644 index 0000000..4c45445 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskExecutePool.java @@ -0,0 +1,62 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config.thread; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 异步任务线程池装配类 + * @author https://juejin.im/entry/5abb8f6951882555677e9da2 + * @date 2019年10月31日15:06:18 + */ +@Slf4j +@Configuration +public class AsyncTaskExecutePool implements AsyncConfigurer { + + @Override + public Executor getAsyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + //核心线程池大小 + executor.setCorePoolSize(AsyncTaskProperties.corePoolSize); + //最大线程数 + executor.setMaxPoolSize(AsyncTaskProperties.maxPoolSize); + //队列容量 + executor.setQueueCapacity(AsyncTaskProperties.queueCapacity); + //活跃时间 + executor.setKeepAliveSeconds(AsyncTaskProperties.keepAliveSeconds); + //线程工厂 + executor.setThreadFactory(new TheadFactoryName("el-async")); + // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务 + // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + executor.initialize(); + return executor; + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return (throwable, method, objects) -> { + log.error("===="+throwable.getMessage()+"====", throwable); + log.error("exception method:"+method.getName()); + }; + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskProperties.java b/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskProperties.java new file mode 100644 index 0000000..9b162e4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/thread/AsyncTaskProperties.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config.thread; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 线程池配置属性类 + * @author https://juejin.im/entry/5abb8f6951882555677e9da2 + * @date 2019年10月31日14:58:18 + */ +@Data +@Component +public class AsyncTaskProperties { + + public static int corePoolSize; + + public static int maxPoolSize; + + public static int keepAliveSeconds; + + public static int queueCapacity; + + @Value("${task.pool.core-pool-size}") + public void setCorePoolSize(int corePoolSize) { + AsyncTaskProperties.corePoolSize = corePoolSize; + } + + @Value("${task.pool.max-pool-size}") + public void setMaxPoolSize(int maxPoolSize) { + AsyncTaskProperties.maxPoolSize = maxPoolSize; + } + + @Value("${task.pool.keep-alive-seconds}") + public void setKeepAliveSeconds(int keepAliveSeconds) { + AsyncTaskProperties.keepAliveSeconds = keepAliveSeconds; + } + + @Value("${task.pool.queue-capacity}") + public void setQueueCapacity(int queueCapacity) { + AsyncTaskProperties.queueCapacity = queueCapacity; + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/thread/TheadFactoryName.java b/youchain-system/src/main/java/com/youchain/config/thread/TheadFactoryName.java new file mode 100644 index 0000000..2c2f915 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/thread/TheadFactoryName.java @@ -0,0 +1,64 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config.thread; + +import com.youchain.utils.StringUtils; +import org.springframework.stereotype.Component; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 自定义线程名称 + * @author Liu Xue + * @date 2019年10月31日17:49:55 + */ +@Component +public class TheadFactoryName implements ThreadFactory { + + private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1); + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String namePrefix; + + private final static String DEF_NAME = "el-pool-"; + + public TheadFactoryName() { + this(DEF_NAME); + } + + public TheadFactoryName(String name){ + SecurityManager s = System.getSecurityManager(); + group = (s != null) ? s.getThreadGroup() : + Thread.currentThread().getThreadGroup(); + //此时namePrefix就是 name + 第几个用这个工厂创建线程池的 + this.namePrefix = (StringUtils.isNotBlank(name) ? name : DEF_NAME) + "-" + POOL_NUMBER.getAndIncrement(); + } + + @Override + public Thread newThread(Runnable r) { + //此时线程的名字 就是 namePrefix + -exec- + 这个线程池中第几个执行的线程 + Thread t = new Thread(group, r, + namePrefix + "-exec-"+threadNumber.getAndIncrement(), + 0); + if (t.isDaemon()) { + t.setDaemon(false); + } + if (t.getPriority() != Thread.NORM_PRIORITY) { + t.setPriority(Thread.NORM_PRIORITY); + } + return t; + } +} diff --git a/youchain-system/src/main/java/com/youchain/config/thread/ThreadPoolExecutorUtil.java b/youchain-system/src/main/java/com/youchain/config/thread/ThreadPoolExecutorUtil.java new file mode 100644 index 0000000..2400196 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/config/thread/ThreadPoolExecutorUtil.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config.thread; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 用于获取自定义线程池 + * @author Liu Xue + * @date 2019年10月31日18:16:47 + */ +public class ThreadPoolExecutorUtil { + + public static ExecutorService getPoll(){ + return getPoll(null); + } + + public static ExecutorService getPoll(String threadName){ + return new ThreadPoolExecutor( + AsyncTaskProperties.corePoolSize, + AsyncTaskProperties.maxPoolSize, + AsyncTaskProperties.keepAliveSeconds, + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(AsyncTaskProperties.queueCapacity), + new TheadFactoryName(threadName), + // 队列与线程池中线程都满了时使用调用者所在的线程来执行 + new ThreadPoolExecutor.CallerRunsPolicy() + ); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/license/AGxServerInfos.java b/youchain-system/src/main/java/com/youchain/modules/license/AGxServerInfos.java new file mode 100644 index 0000000..940813a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/license/AGxServerInfos.java @@ -0,0 +1,105 @@ +package com.youchain.modules.license; + +import com.youchain.modules.license.domain.LicenseCheck; +import lombok.extern.slf4j.Slf4j; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; + +@Slf4j +public abstract class AGxServerInfos { + + + /** + *

组装需要额外校验的License参数

+ */ + public LicenseCheck getServerInfos(){ + + LicenseCheck result = new LicenseCheck(); + try { + result.setCpuSerial(this.getCPUSerial()); + result.setMainBoardSerial(this.getMainBoardSerial()); + }catch (Exception e){ + log.error("获取服务器硬件信息失败",e); + } + + return result; + } + + /** + *

获取IP地址

+ */ + protected abstract List getIpAddress() throws Exception; + + /** + *

获取Mac地址

+ */ + protected abstract List getMacAddress() throws Exception; + + /** + *

获取CPU序列号

+ */ + protected abstract String getCPUSerial() throws Exception; + + /** + *

获取主板序列号

+ */ + protected abstract String getMainBoardSerial() throws Exception; + + /** + *

获取当前服务器所有符合条件的InetAddress

+ */ + protected List getLocalAllInetAddress() throws Exception { + + List result = new ArrayList<>(4); + + // 遍历所有的网络接口 + for (Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); networkInterfaces.hasMoreElements(); ) { + NetworkInterface ni = (NetworkInterface) networkInterfaces.nextElement(); + // 在所有的接口下再遍历IP + for (Enumeration addresses = ni.getInetAddresses(); addresses.hasMoreElements(); ) { + InetAddress address = (InetAddress) addresses.nextElement(); + //排除LoopbackAddress、SiteLocalAddress、LinkLocalAddress、MulticastAddress类型的IP地址 + if(!address.isLoopbackAddress() /*&& !inetAddr.isSiteLocalAddress()*/ + && !address.isLinkLocalAddress() && !address.isMulticastAddress()){ + result.add(address); + } + } + } + return result; + } + + /** + *

获取某个网络地址对应的Mac地址

+ */ + protected String getMacByInetAddress(InetAddress inetAddr){ + + try { + byte[] mac = NetworkInterface.getByInetAddress(inetAddr).getHardwareAddress(); + StringBuffer sb = new StringBuffer(); + for(int i=0;i用于获取客户Linux服务器的基本信息

+ */ +public class LinuxServerInfos extends AGxServerInfos { + + @Override + protected List getIpAddress() throws Exception { + List result = null; + + //获取所有网络接口 + List inetAddresses = getLocalAllInetAddress(); + + if(inetAddresses != null && inetAddresses.size() > 0){ + result = inetAddresses.stream().map(InetAddress::getHostAddress).distinct().map(String::toLowerCase).collect(Collectors.toList()); + } + + return result; + } + + @Override + protected List getMacAddress() throws Exception { + List result = null; + + //1. 获取所有网络接口 + List inetAddresses = getLocalAllInetAddress(); + + if(inetAddresses != null && inetAddresses.size() > 0){ + //2. 获取所有网络接口的Mac地址 + result = inetAddresses.stream().map(this::getMacByInetAddress).distinct().collect(Collectors.toList()); + } + + return result; + } + + @Override + protected String getCPUSerial() throws Exception { + //序列号 + String serialNumber = ""; + + //使用dmidecode命令获取CPU序列号 + String[] shell = {"/bin/bash","-c","dmidecode -t processor | grep 'ID' | awk -F ':' '{print $2}' | head -n 1"}; + Process process = Runtime.getRuntime().exec(shell); + process.getOutputStream().close(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + + String line = reader.readLine().trim(); + if(StringUtils.isNotBlank(line)){ + serialNumber = line; + } + + reader.close(); + return serialNumber; + } + + @Override + protected String getMainBoardSerial() throws Exception { + //序列号 + String serialNumber = ""; + + //使用dmidecode命令获取主板序列号 + String[] shell = {"/bin/bash","-c","dmidecode | grep 'Serial Number' | awk -F ':' '{print $2}' | head -n 1"}; + Process process = Runtime.getRuntime().exec(shell); + process.getOutputStream().close(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + + String line = reader.readLine().trim(); + if(StringUtils.isNotBlank(line)){ + serialNumber = line; + } + + reader.close(); + return serialNumber; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/license/WindowsServerInfos.java b/youchain-system/src/main/java/com/youchain/modules/license/WindowsServerInfos.java new file mode 100644 index 0000000..f6891f3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/license/WindowsServerInfos.java @@ -0,0 +1,87 @@ +package com.youchain.modules.license; + +import java.net.InetAddress; +import java.util.List; +import java.util.Scanner; +import java.util.stream.Collectors; + +/** + *

用于获取客户Windows服务器的基本信息

+ */ +public class WindowsServerInfos extends AGxServerInfos { + + @Override + protected List getIpAddress() throws Exception { + List result = null; + + //获取所有网络接口 + List inetAddresses = getLocalAllInetAddress(); + + if(inetAddresses != null && inetAddresses.size() > 0){ + result = inetAddresses.stream().map(InetAddress::getHostAddress).distinct().map(String::toLowerCase).collect(Collectors.toList()); + } + + return result; + } + + @Override + protected List getMacAddress() throws Exception { + List result = null; + + //1. 获取所有网络接口 + List inetAddresses = getLocalAllInetAddress(); + + if(inetAddresses != null && inetAddresses.size() > 0){ + //2. 获取所有网络接口的Mac地址 + result = inetAddresses.stream().map(this::getMacByInetAddress).distinct().collect(Collectors.toList()); + } + + return result; + } + + @Override + protected String getCPUSerial() throws Exception { + //序列号 + String serialNumber = ""; + + //使用WMIC获取CPU序列号 + Process process = Runtime.getRuntime().exec("wmic cpu get processorid"); + process.getOutputStream().close(); + Scanner scanner = new Scanner(process.getInputStream()); + + if(scanner.hasNext()){ + scanner.next(); + } + + if(scanner.hasNext()){ + serialNumber = scanner.next().trim(); + } + + scanner.close(); + return serialNumber; + } + + @Override + protected String getMainBoardSerial() throws Exception { + //序列号 + String serialNumber = ""; + + //使用WMIC获取主板序列号 + Process process = Runtime.getRuntime().exec("wmic baseboard get serialnumber"); + process.getOutputStream().close(); + Scanner scanner = new Scanner(process.getInputStream()); + + if(scanner.hasNext()){ + scanner.next(); + } + + if(scanner.hasNext()){ + serialNumber = scanner.next().trim(); + } + + scanner.close(); + return serialNumber; + } + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/license/domain/LicenseCheck.java b/youchain-system/src/main/java/com/youchain/modules/license/domain/LicenseCheck.java new file mode 100644 index 0000000..fbba75d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/license/domain/LicenseCheck.java @@ -0,0 +1,53 @@ +package com.youchain.modules.license.domain; + +import java.io.Serializable; +import java.util.List; + +public class LicenseCheck implements Serializable { + + + + /** + * 可被允许的CPU序列号 + */ + private String cpuSerial; + /** + * 可被允许的主板序列号 + */ + private String mainBoardSerial; + /** + * 失效时间 + */ + private String endTime; + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public LicenseCheck(){ + + } + + + public String getCpuSerial() { + return cpuSerial; + } + + public void setCpuSerial(String cpuSerial) { + this.cpuSerial = cpuSerial; + } + + public String getMainBoardSerial() { + return mainBoardSerial; + } + + public void setMainBoardSerial(String mainBoardSerial) { + this.mainBoardSerial = mainBoardSerial; + } + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/domain/App.java b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/App.java new file mode 100644 index 0000000..7588b40 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/App.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.domain; + +import com.youchain.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.*; +import java.io.Serializable; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Entity +@Getter +@Setter +@Table(name="mnt_app") +public class App extends BaseEntity implements Serializable { + + @Id + @Column(name = "app_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "端口") + private int port; + + @ApiModelProperty(value = "上传路径") + private String uploadPath; + + @ApiModelProperty(value = "部署路径") + private String deployPath; + + @ApiModelProperty(value = "备份路径") + private String backupPath; + + @ApiModelProperty(value = "启动脚本") + private String startScript; + + @ApiModelProperty(value = "部署脚本") + private String deployScript; + + public void copy(App source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Database.java b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Database.java new file mode 100644 index 0000000..55d455b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Database.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.domain; + +import com.youchain.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.*; +import java.io.Serializable; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Entity +@Getter +@Setter +@Table(name="mnt_database") +public class Database extends BaseEntity implements Serializable { + + @Id + @Column(name = "db_id") + @ApiModelProperty(value = "ID", hidden = true) + private String id; + + @ApiModelProperty(value = "数据库名称") + private String name; + + @ApiModelProperty(value = "数据库连接地址") + private String jdbcUrl; + + @ApiModelProperty(value = "数据库密码") + private String pwd; + + @ApiModelProperty(value = "用户名") + private String userName; + + public void copy(Database source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Deploy.java b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Deploy.java new file mode 100644 index 0000000..76ef8ae --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/Deploy.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.domain; + +import com.youchain.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Entity +@Getter +@Setter +@Table(name="mnt_deploy") +public class Deploy extends BaseEntity implements Serializable { + + @Id + @Column(name = "deploy_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToMany + @ApiModelProperty(name = "服务器", hidden = true) + @JoinTable(name = "mnt_deploy_server", + joinColumns = {@JoinColumn(name = "deploy_id",referencedColumnName = "deploy_id")}, + inverseJoinColumns = {@JoinColumn(name = "server_id",referencedColumnName = "server_id")}) + private Set deploys; + + @ManyToOne + @JoinColumn(name = "app_id") + @ApiModelProperty(value = "应用编号") + private App app; + + public void copy(Deploy source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/domain/DeployHistory.java b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/DeployHistory.java new file mode 100644 index 0000000..ecc5f24 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/DeployHistory.java @@ -0,0 +1,62 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.domain; + +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Entity +@Getter +@Setter +@Table(name="mnt_deploy_history") +public class DeployHistory implements Serializable { + + @Id + @Column(name = "history_id") + @ApiModelProperty(value = "ID", hidden = true) + private String id; + + @ApiModelProperty(value = "应用名称") + private String appName; + + @ApiModelProperty(value = "IP") + private String ip; + + @CreationTimestamp + @ApiModelProperty(value = "部署时间") + private Timestamp deployDate; + + @ApiModelProperty(value = "部署者") + private String deployUser; + + @ApiModelProperty(value = "部署ID") + private Long deployId; + + public void copy(DeployHistory source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/domain/ServerDeploy.java b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/ServerDeploy.java new file mode 100644 index 0000000..bf2f840 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/domain/ServerDeploy.java @@ -0,0 +1,81 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.domain; + +import com.youchain.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Objects; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Entity +@Getter +@Setter +@Table(name="mnt_server") +public class ServerDeploy extends BaseEntity implements Serializable { + + @Id + @Column(name = "server_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ApiModelProperty(value = "服务器名称") + private String name; + + @ApiModelProperty(value = "IP") + private String ip; + + @ApiModelProperty(value = "端口") + private Integer port; + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + public void copy(ServerDeploy source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServerDeploy that = (ServerDeploy) o; + return Objects.equals(id, that.id) && + Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/repository/AppRepository.java b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/AppRepository.java new file mode 100644 index 0000000..1a022fa --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/AppRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.repository; + +import com.youchain.modules.mnt.domain.App; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface AppRepository extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DatabaseRepository.java b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DatabaseRepository.java new file mode 100644 index 0000000..2f50d55 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DatabaseRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.repository; + +import com.youchain.modules.mnt.domain.Database; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface DatabaseRepository extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployHistoryRepository.java b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployHistoryRepository.java new file mode 100644 index 0000000..5cc89a0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployHistoryRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.repository; + +import com.youchain.modules.mnt.domain.DeployHistory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface DeployHistoryRepository extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployRepository.java b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployRepository.java new file mode 100644 index 0000000..3755497 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/DeployRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.repository; + +import com.youchain.modules.mnt.domain.Deploy; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface DeployRepository extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/repository/ServerDeployRepository.java b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/ServerDeployRepository.java new file mode 100644 index 0000000..d972a8a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/repository/ServerDeployRepository.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.repository; + +import com.youchain.modules.mnt.domain.ServerDeploy; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface ServerDeployRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据IP查询 + * @param ip / + * @return / + */ + ServerDeploy findByIp(String ip); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/rest/AppController.java b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/AppController.java new file mode 100644 index 0000000..e495d83 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/AppController.java @@ -0,0 +1,86 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.rest; +import com.youchain.annotation.Log; +import com.youchain.modules.mnt.service.dto.AppQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.App; +import com.youchain.modules.mnt.service.AppService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "运维:应用管理") +@RequestMapping("/api/app") +public class AppController { + + private final AppService appService; + + @ApiOperation("导出应用数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('app:list')") + public void exportApp(HttpServletResponse response, AppQueryCriteria criteria) throws Exception { + appService.download(appService.queryAll(criteria), response); + } + + @ApiOperation(value = "查询应用") + @GetMapping + @PreAuthorize("@el.check('app:list')") + public ResponseEntity queryApp(AppQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(appService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增应用") + @ApiOperation(value = "新增应用") + @PostMapping + @PreAuthorize("@el.check('app:add')") + public ResponseEntity createApp(@Validated @RequestBody App resources){ + appService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改应用") + @ApiOperation(value = "修改应用") + @PutMapping + @PreAuthorize("@el.check('app:edit')") + public ResponseEntity updateApp(@Validated @RequestBody App resources){ + appService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除应用") + @ApiOperation(value = "删除应用") + @DeleteMapping + @PreAuthorize("@el.check('app:del')") + public ResponseEntity deleteApp(@RequestBody Set ids){ + appService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DatabaseController.java b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DatabaseController.java new file mode 100644 index 0000000..986e253 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DatabaseController.java @@ -0,0 +1,123 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.rest; + +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.mnt.service.dto.DatabaseDto; +import com.youchain.modules.mnt.service.dto.DatabaseQueryCriteria; +import com.youchain.utils.FileUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.Database; +import com.youchain.modules.mnt.service.DatabaseService; +import com.youchain.modules.mnt.util.SqlUtils; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Api(tags = "运维:数据库管理") +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/database") +public class DatabaseController { + + private final String fileSavePath = FileUtil.getTmpDirPath()+"/"; + private final DatabaseService databaseService; + + @ApiOperation("导出数据库数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('database:list')") + public void exportDatabase(HttpServletResponse response, DatabaseQueryCriteria criteria) throws Exception { + databaseService.download(databaseService.queryAll(criteria), response); + } + + @ApiOperation(value = "查询数据库") + @GetMapping + @PreAuthorize("@el.check('database:list')") + public ResponseEntity queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(databaseService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增数据库") + @ApiOperation(value = "新增数据库") + @PostMapping + @PreAuthorize("@el.check('database:add')") + public ResponseEntity createDatabase(@Validated @RequestBody Database resources){ + databaseService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改数据库") + @ApiOperation(value = "修改数据库") + @PutMapping + @PreAuthorize("@el.check('database:edit')") + public ResponseEntity updateDatabase(@Validated @RequestBody Database resources){ + databaseService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除数据库") + @ApiOperation(value = "删除数据库") + @DeleteMapping + @PreAuthorize("@el.check('database:del')") + public ResponseEntity deleteDatabase(@RequestBody Set ids){ + databaseService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("测试数据库链接") + @ApiOperation(value = "测试数据库链接") + @PostMapping("/testConnect") + @PreAuthorize("@el.check('database:testConnect')") + public ResponseEntity testConnect(@Validated @RequestBody Database resources){ + return new ResponseEntity<>(databaseService.testConnection(resources),HttpStatus.CREATED); + } + + @Log("执行SQL脚本") + @ApiOperation(value = "执行SQL脚本") + @PostMapping(value = "/upload") + @PreAuthorize("@el.check('database:add')") + public ResponseEntity uploadDatabase(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ + String id = request.getParameter("id"); + DatabaseDto database = databaseService.findById(id); + String fileName; + if(database != null){ + fileName = file.getOriginalFilename(); + File executeFile = new File(fileSavePath+fileName); + FileUtil.del(executeFile); + file.transferTo(executeFile); + String result = SqlUtils.executeFile(database.getJdbcUrl(), database.getUserName(), database.getPwd(), executeFile); + return new ResponseEntity<>(result,HttpStatus.OK); + }else{ + throw new BadRequestException("Database not exist"); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployController.java b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployController.java new file mode 100644 index 0000000..74d0327 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployController.java @@ -0,0 +1,153 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.rest; + +import com.youchain.annotation.Log; +import com.youchain.modules.mnt.service.dto.DeployQueryCriteria; +import com.youchain.utils.FileUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.Deploy; +import com.youchain.modules.mnt.domain.DeployHistory; +import com.youchain.modules.mnt.service.DeployService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@RestController +@Api(tags = "运维:部署管理") +@RequiredArgsConstructor +@RequestMapping("/api/deploy") +public class DeployController { + + private final String fileSavePath = FileUtil.getTmpDirPath()+"/"; + private final DeployService deployService; + + + @ApiOperation("导出部署数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('database:list')") + public void exportDeployData(HttpServletResponse response, DeployQueryCriteria criteria) throws Exception { + deployService.download(deployService.queryAll(criteria), response); + } + + @ApiOperation(value = "查询部署") + @GetMapping + @PreAuthorize("@el.check('deploy:list')") + public ResponseEntity queryDeployData(DeployQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(deployService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增部署") + @ApiOperation(value = "新增部署") + @PostMapping + @PreAuthorize("@el.check('deploy:add')") + public ResponseEntity createDeploy(@Validated @RequestBody Deploy resources){ + deployService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改部署") + @ApiOperation(value = "修改部署") + @PutMapping + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity updateDeploy(@Validated @RequestBody Deploy resources){ + deployService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除部署") + @ApiOperation(value = "删除部署") + @DeleteMapping + @PreAuthorize("@el.check('deploy:del')") + public ResponseEntity deleteDeploy(@RequestBody Set ids){ + deployService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("上传文件部署") + @ApiOperation(value = "上传文件部署") + @PostMapping(value = "/upload") + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity uploadDeploy(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{ + Long id = Long.valueOf(request.getParameter("id")); + String fileName = ""; + if(file != null){ + fileName = file.getOriginalFilename(); + File deployFile = new File(fileSavePath+fileName); + FileUtil.del(deployFile); + file.transferTo(deployFile); + //文件下一步要根据文件名字来 + deployService.deploy(fileSavePath+fileName ,id); + }else{ + System.out.println("没有找到相对应的文件"); + } + System.out.println("文件上传的原名称为:"+ Objects.requireNonNull(file).getOriginalFilename()); + Map map = new HashMap<>(2); + map.put("errno",0); + map.put("id",fileName); + return new ResponseEntity<>(map,HttpStatus.OK); + } + @Log("系统还原") + @ApiOperation(value = "系统还原") + @PostMapping(value = "/serverReduction") + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity serverReduction(@Validated @RequestBody DeployHistory resources){ + String result = deployService.serverReduction(resources); + return new ResponseEntity<>(result,HttpStatus.OK); + } + @Log("服务运行状态") + @ApiOperation(value = "服务运行状态") + @PostMapping(value = "/serverStatus") + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity serverStatus(@Validated @RequestBody Deploy resources){ + String result = deployService.serverStatus(resources); + return new ResponseEntity<>(result,HttpStatus.OK); + } + @Log("启动服务") + @ApiOperation(value = "启动服务") + @PostMapping(value = "/startServer") + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity startServer(@Validated @RequestBody Deploy resources){ + String result = deployService.startServer(resources); + return new ResponseEntity<>(result,HttpStatus.OK); + } + @Log("停止服务") + @ApiOperation(value = "停止服务") + @PostMapping(value = "/stopServer") + @PreAuthorize("@el.check('deploy:edit')") + public ResponseEntity stopServer(@Validated @RequestBody Deploy resources){ + String result = deployService.stopServer(resources); + return new ResponseEntity<>(result,HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployHistoryController.java b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployHistoryController.java new file mode 100644 index 0000000..0cba169 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/DeployHistoryController.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.rest; + +import com.youchain.annotation.Log; +import com.youchain.modules.mnt.service.dto.DeployHistoryQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.service.DeployHistoryService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "运维:部署历史管理") +@RequestMapping("/api/deployHistory") +public class DeployHistoryController { + + private final DeployHistoryService deployhistoryService; + + @ApiOperation("导出部署历史数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('deployHistory:list')") + public void exportDeployHistory(HttpServletResponse response, DeployHistoryQueryCriteria criteria) throws Exception { + deployhistoryService.download(deployhistoryService.queryAll(criteria), response); + } + + @ApiOperation(value = "查询部署历史") + @GetMapping + @PreAuthorize("@el.check('deployHistory:list')") + public ResponseEntity queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(deployhistoryService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("删除DeployHistory") + @ApiOperation(value = "删除部署历史") + @DeleteMapping + @PreAuthorize("@el.check('deployHistory:del')") + public ResponseEntity deleteDeployHistory(@RequestBody Set ids){ + deployhistoryService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/rest/ServerDeployController.java b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/ServerDeployController.java new file mode 100644 index 0000000..ef4f80d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/rest/ServerDeployController.java @@ -0,0 +1,95 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.rest; + +import com.youchain.annotation.Log; +import com.youchain.modules.mnt.service.dto.ServerDeployQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.ServerDeploy; +import com.youchain.modules.mnt.service.ServerDeployService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@RestController +@Api(tags = "运维:服务器管理") +@RequiredArgsConstructor +@RequestMapping("/api/serverDeploy") +public class ServerDeployController { + + private final ServerDeployService serverDeployService; + + @ApiOperation("导出服务器数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('serverDeploy:list')") + public void exportServerDeploy(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws Exception { + serverDeployService.download(serverDeployService.queryAll(criteria), response); + } + + @ApiOperation(value = "查询服务器") + @GetMapping + @PreAuthorize("@el.check('serverDeploy:list')") + public ResponseEntity queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增服务器") + @ApiOperation(value = "新增服务器") + @PostMapping + @PreAuthorize("@el.check('serverDeploy:add')") + public ResponseEntity createServerDeploy(@Validated @RequestBody ServerDeploy resources){ + serverDeployService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改服务器") + @ApiOperation(value = "修改服务器") + @PutMapping + @PreAuthorize("@el.check('serverDeploy:edit')") + public ResponseEntity updateServerDeploy(@Validated @RequestBody ServerDeploy resources){ + serverDeployService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除服务器") + @ApiOperation(value = "删除Server") + @DeleteMapping + @PreAuthorize("@el.check('serverDeploy:del')") + public ResponseEntity deleteServerDeploy(@RequestBody Set ids){ + serverDeployService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("测试连接服务器") + @ApiOperation(value = "测试连接服务器") + @PostMapping("/testConnect") + @PreAuthorize("@el.check('serverDeploy:add')") + public ResponseEntity testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){ + return new ResponseEntity<>(serverDeployService.testConnect(resources),HttpStatus.CREATED); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/AppService.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/AppService.java new file mode 100644 index 0000000..b8ad083 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/AppService.java @@ -0,0 +1,81 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service; + +import com.youchain.modules.mnt.domain.App; +import com.youchain.modules.mnt.service.dto.AppDto; +import com.youchain.modules.mnt.service.dto.AppQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface AppService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(AppQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 条件 + * @return / + */ + List queryAll(AppQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + AppDto findById(Long id); + + /** + * 创建 + * @param resources / + */ + void create(App resources); + + /** + * 编辑 + * @param resources / + */ + void update(App resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/DatabaseService.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DatabaseService.java new file mode 100644 index 0000000..4a0d8e7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DatabaseService.java @@ -0,0 +1,88 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service; + +import com.youchain.modules.mnt.domain.Database; +import com.youchain.modules.mnt.service.dto.DatabaseDto; +import com.youchain.modules.mnt.service.dto.DatabaseQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * @author ZhangHouYing + * @date 2019-08-24 + */ +public interface DatabaseService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(DatabaseQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + DatabaseDto findById(String id); + + /** + * 创建 + * @param resources / + */ + void create(Database resources); + + /** + * 编辑 + * @param resources / + */ + void update(Database resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 测试连接数据库 + * @param resources / + * @return / + */ + boolean testConnection(Database resources); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception e + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployHistoryService.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployHistoryService.java new file mode 100644 index 0000000..3b585db --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployHistoryService.java @@ -0,0 +1,74 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service; + +import com.youchain.modules.mnt.domain.DeployHistory; +import com.youchain.modules.mnt.service.dto.DeployHistoryDto; +import com.youchain.modules.mnt.service.dto.DeployHistoryQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * @author zhanghouying + */ +public interface DeployHistoryService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(DeployHistoryQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + DeployHistoryDto findById(String id); + + /** + * 创建 + * @param resources / + */ + void create(DeployHistory resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployService.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployService.java new file mode 100644 index 0000000..b0ebce5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/DeployService.java @@ -0,0 +1,116 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service; + +import com.youchain.modules.mnt.domain.Deploy; +import com.youchain.modules.mnt.domain.DeployHistory; +import com.youchain.modules.mnt.service.dto.DeployDto; +import com.youchain.modules.mnt.service.dto.DeployQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface DeployService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(DeployQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 条件 + * @return / + */ + List queryAll(DeployQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + DeployDto findById(Long id); + + /** + * 创建 + * @param resources / + */ + void create(Deploy resources); + + + /** + * 编辑 + * @param resources / + */ + void update(Deploy resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 部署文件到服务器 + * @param fileSavePath 文件路径 + * @param appId 应用ID + */ + void deploy(String fileSavePath, Long appId); + + /** + * 查询部署状态 + * @param resources / + * @return / + */ + String serverStatus(Deploy resources); + /** + * 启动服务 + * @param resources / + * @return / + */ + String startServer(Deploy resources); + /** + * 停止服务 + * @param resources / + * @return / + */ + String stopServer(Deploy resources); + + /** + * 停止服务 + * @param resources / + * @return / + */ + String serverReduction(DeployHistory resources); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/ServerDeployService.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/ServerDeployService.java new file mode 100644 index 0000000..6af15d6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/ServerDeployService.java @@ -0,0 +1,95 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service; + +import com.youchain.modules.mnt.domain.ServerDeploy; +import com.youchain.modules.mnt.service.dto.ServerDeployDto; +import com.youchain.modules.mnt.service.dto.ServerDeployQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +public interface ServerDeployService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 条件 + * @return / + */ + List queryAll(ServerDeployQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + ServerDeployDto findById(Long id); + + /** + * 创建 + * @param resources / + */ + void create(ServerDeploy resources); + + /** + * 编辑 + * @param resources / + */ + void update(ServerDeploy resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 根据IP查询 + * @param ip / + * @return / + */ + ServerDeployDto findByIp(String ip); + + /** + * 测试登录服务器 + * @param resources / + * @return / + */ + Boolean testConnect(ServerDeploy resources); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppDto.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppDto.java new file mode 100644 index 0000000..65877ae --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppDto.java @@ -0,0 +1,71 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Getter +@Setter +public class AppDto extends BaseDTO implements Serializable { + + /** + * 应用编号 + */ + private Long id; + + /** + * 应用名称 + */ + private String name; + + /** + * 端口 + */ + private Integer port; + + /** + * 上传目录 + */ + private String uploadPath; + + /** + * 部署目录 + */ + private String deployPath; + + /** + * 备份目录 + */ + private String backupPath; + + /** + * 启动脚本 + */ + private String startScript; + + /** + * 部署脚本 + */ + private String deployScript; + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppQueryCriteria.java new file mode 100644 index 0000000..b843166 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/AppQueryCriteria.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class AppQueryCriteria{ + + /** + * 模糊 + */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseDto.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseDto.java new file mode 100644 index 0000000..83c00ad --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseDto.java @@ -0,0 +1,55 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Getter +@Setter +public class DatabaseDto extends BaseDTO implements Serializable { + + /** + * id + */ + private String id; + + /** + * 数据库名称 + */ + private String name; + + /** + * 数据库连接地址 + */ + private String jdbcUrl; + + /** + * 数据库密码 + */ + private String pwd; + + /** + * 用户名 + */ + private String userName; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseQueryCriteria.java new file mode 100644 index 0000000..f3e90f1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DatabaseQueryCriteria.java @@ -0,0 +1,44 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class DatabaseQueryCriteria{ + + /** + * 模糊 + */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** + * 精确 + */ + @Query + private String jdbcUrl; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployDto.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployDto.java new file mode 100644 index 0000000..1aed5bf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployDto.java @@ -0,0 +1,78 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import cn.hutool.core.collection.CollectionUtil; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Getter +@Setter +public class DeployDto extends BaseDTO implements Serializable { + + /** + * 部署编号 + */ + private String id; + + private AppDto app; + + /** + * 服务器 + */ + private Set deploys; + + private String servers; + + /** + * 服务状态 + */ + private String status; + + public String getServers() { + if(CollectionUtil.isNotEmpty(deploys)){ + return deploys.stream().map(ServerDeployDto::getName).collect(Collectors.joining(",")); + } + return servers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeployDto deployDto = (DeployDto) o; + return Objects.equals(id, deployDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryDto.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryDto.java new file mode 100644 index 0000000..99ba872 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryDto.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class DeployHistoryDto implements Serializable { + + /** + * 编号 + */ + private String id; + + /** + * 应用名称 + */ + private String appName; + + /** + * 部署IP + */ + private String ip; + + /** + * 部署时间 + */ + private Timestamp deployDate; + + /** + * 部署人员 + */ + private String deployUser; + + /** + * 部署编号 + */ + private Long deployId; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryQueryCriteria.java new file mode 100644 index 0000000..a91dcca --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployHistoryQueryCriteria.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class DeployHistoryQueryCriteria{ + + /** + * 精确 + */ + @Query(blurry = "appName,ip,deployUser") + private String blurry; + + @Query + private Long deployId; + + @Query(type = Query.Type.BETWEEN) + private List deployDate; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployQueryCriteria.java new file mode 100644 index 0000000..4217b36 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/DeployQueryCriteria.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class DeployQueryCriteria{ + + /** + * 模糊 + */ + @Query(type = Query.Type.INNER_LIKE, propName = "name", joinName = "app") + private String appName; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployDto.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployDto.java new file mode 100644 index 0000000..59493f3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployDto.java @@ -0,0 +1,61 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.Objects; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Getter +@Setter +public class ServerDeployDto extends BaseDTO implements Serializable { + + private Long id; + + private String name; + + private String ip; + + private Integer port; + + private String account; + + private String password; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ServerDeployDto that = (ServerDeployDto) o; + return Objects.equals(id, that.id) && + Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployQueryCriteria.java new file mode 100644 index 0000000..7df71d5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/dto/ServerDeployQueryCriteria.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Data +public class ServerDeployQueryCriteria{ + + /** + * 模糊 + */ + @Query(blurry = "name,ip,account") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/AppServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/AppServiceImpl.java new file mode 100644 index 0000000..7c4e2e4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/AppServiceImpl.java @@ -0,0 +1,123 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.impl; + +import com.youchain.modules.mnt.service.dto.AppQueryCriteria; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.mnt.domain.App; +import com.youchain.modules.mnt.repository.AppRepository; +import com.youchain.modules.mnt.service.AppService; +import com.youchain.modules.mnt.service.dto.AppDto; +import com.youchain.modules.mnt.service.mapstruct.AppMapper; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Service +@RequiredArgsConstructor +public class AppServiceImpl implements AppService { + + private final AppRepository appRepository; + private final AppMapper appMapper; + + @Override + public Object queryAll(AppQueryCriteria criteria, Pageable pageable){ + Page page = appRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(appMapper::toDto)); + } + + @Override + public List queryAll(AppQueryCriteria criteria){ + return appMapper.toDto(appRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public AppDto findById(Long id) { + App app = appRepository.findById(id).orElseGet(App::new); + ValidationUtil.isNull(app.getId(),"App","id",id); + return appMapper.toDto(app); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(App resources) { + verification(resources); + appRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(App resources) { + verification(resources); + App app = appRepository.findById(resources.getId()).orElseGet(App::new); + ValidationUtil.isNull(app.getId(),"App","id",resources.getId()); + app.copy(resources); + appRepository.save(app); + } + + private void verification(App resources){ + String opt = "/opt"; + String home = "/home"; + if (!(resources.getUploadPath().startsWith(opt) || resources.getUploadPath().startsWith(home))) { + throw new BadRequestException("文件只能上传在opt目录或者home目录 "); + } + if (!(resources.getDeployPath().startsWith(opt) || resources.getDeployPath().startsWith(home))) { + throw new BadRequestException("文件只能部署在opt目录或者home目录 "); + } + if (!(resources.getBackupPath().startsWith(opt) || resources.getBackupPath().startsWith(home))) { + throw new BadRequestException("文件只能备份在opt目录或者home目录 "); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + appRepository.deleteById(id); + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (AppDto appDto : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("应用名称", appDto.getName()); + map.put("端口", appDto.getPort()); + map.put("上传目录", appDto.getUploadPath()); + map.put("部署目录", appDto.getDeployPath()); + map.put("备份目录", appDto.getBackupPath()); + map.put("启动脚本", appDto.getStartScript()); + map.put("部署脚本", appDto.getDeployScript()); + map.put("创建日期", appDto.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DatabaseServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DatabaseServiceImpl.java new file mode 100644 index 0000000..e4b8168 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DatabaseServiceImpl.java @@ -0,0 +1,117 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.impl; + +import cn.hutool.core.util.IdUtil; +import com.youchain.modules.mnt.service.dto.DatabaseDto; +import com.youchain.modules.mnt.service.dto.DatabaseQueryCriteria; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.modules.mnt.domain.Database; +import com.youchain.modules.mnt.repository.DatabaseRepository; +import com.youchain.modules.mnt.service.DatabaseService; +import com.youchain.modules.mnt.service.mapstruct.DatabaseMapper; +import com.youchain.modules.mnt.util.SqlUtils; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Slf4j +@Service +@RequiredArgsConstructor +public class DatabaseServiceImpl implements DatabaseService { + + private final DatabaseRepository databaseRepository; + private final DatabaseMapper databaseMapper; + + @Override + public Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable){ + Page page = databaseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(databaseMapper::toDto)); + } + + @Override + public List queryAll(DatabaseQueryCriteria criteria){ + return databaseMapper.toDto(databaseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public DatabaseDto findById(String id) { + Database database = databaseRepository.findById(id).orElseGet(Database::new); + ValidationUtil.isNull(database.getId(),"Database","id",id); + return databaseMapper.toDto(database); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Database resources) { + resources.setId(IdUtil.simpleUUID()); + databaseRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Database resources) { + Database database = databaseRepository.findById(resources.getId()).orElseGet(Database::new); + ValidationUtil.isNull(database.getId(),"Database","id",resources.getId()); + database.copy(resources); + databaseRepository.save(database); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (String id : ids) { + databaseRepository.deleteById(id); + } + } + + @Override + public boolean testConnection(Database resources) { + try { + return SqlUtils.testConnection(resources.getJdbcUrl(), resources.getUserName(), resources.getPwd()); + } catch (Exception e) { + log.error(e.getMessage()); + return false; + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (DatabaseDto databaseDto : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("数据库名称", databaseDto.getName()); + map.put("数据库连接地址", databaseDto.getJdbcUrl()); + map.put("用户名", databaseDto.getUserName()); + map.put("创建日期", databaseDto.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployHistoryServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployHistoryServiceImpl.java new file mode 100644 index 0000000..5efaaf4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployHistoryServiceImpl.java @@ -0,0 +1,96 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.impl; + +import cn.hutool.core.util.IdUtil; +import com.youchain.modules.mnt.service.dto.DeployHistoryDto; +import com.youchain.modules.mnt.service.dto.DeployHistoryQueryCriteria; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.DeployHistory; +import com.youchain.modules.mnt.repository.DeployHistoryRepository; +import com.youchain.modules.mnt.service.DeployHistoryService; +import com.youchain.modules.mnt.service.mapstruct.DeployHistoryMapper; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Service +@RequiredArgsConstructor +public class DeployHistoryServiceImpl implements DeployHistoryService { + + private final DeployHistoryRepository deployhistoryRepository; + private final DeployHistoryMapper deployhistoryMapper; + + @Override + public Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable){ + Page page = deployhistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(deployhistoryMapper::toDto)); + } + + @Override + public List queryAll(DeployHistoryQueryCriteria criteria){ + return deployhistoryMapper.toDto(deployhistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public DeployHistoryDto findById(String id) { + DeployHistory deployhistory = deployhistoryRepository.findById(id).orElseGet(DeployHistory::new); + ValidationUtil.isNull(deployhistory.getId(),"DeployHistory","id",id); + return deployhistoryMapper.toDto(deployhistory); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(DeployHistory resources) { + resources.setId(IdUtil.simpleUUID()); + deployhistoryRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (String id : ids) { + deployhistoryRepository.deleteById(id); + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (DeployHistoryDto deployHistoryDto : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("部署编号", deployHistoryDto.getDeployId()); + map.put("应用名称", deployHistoryDto.getAppName()); + map.put("部署IP", deployHistoryDto.getIp()); + map.put("部署时间", deployHistoryDto.getDeployDate()); + map.put("部署人员", deployHistoryDto.getDeployUser()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployServiceImpl.java new file mode 100644 index 0000000..b64b843 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/DeployServiceImpl.java @@ -0,0 +1,430 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.impl; + +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import com.youchain.modules.mnt.service.dto.ServerDeployDto; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.mnt.domain.App; +import com.youchain.modules.mnt.domain.Deploy; +import com.youchain.modules.mnt.domain.DeployHistory; +import com.youchain.modules.mnt.domain.ServerDeploy; +import com.youchain.modules.mnt.repository.DeployRepository; +import com.youchain.modules.mnt.service.DeployHistoryService; +import com.youchain.modules.mnt.service.DeployService; +import com.youchain.modules.mnt.service.ServerDeployService; +import com.youchain.modules.mnt.service.dto.AppDto; +import com.youchain.modules.mnt.service.dto.DeployDto; +import com.youchain.modules.mnt.service.dto.DeployQueryCriteria; +import com.youchain.modules.mnt.service.mapstruct.DeployMapper; +import com.youchain.modules.mnt.util.ExecuteShellUtil; +import com.youchain.modules.mnt.util.ScpClientUtil; +import com.youchain.modules.mnt.websocket.MsgType; +import com.youchain.modules.mnt.websocket.SocketMsg; +import com.youchain.modules.mnt.websocket.WebSocketServer; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** + * @author zhanghouying + * @date 2019-08-24 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class DeployServiceImpl implements DeployService { + + private final String FILE_SEPARATOR = "/"; + private final DeployRepository deployRepository; + private final DeployMapper deployMapper; + private final ServerDeployService serverDeployService; + private final DeployHistoryService deployHistoryService; + /** + * 循环次数 + */ + private final Integer count = 30; + + + @Override + public Object queryAll(DeployQueryCriteria criteria, Pageable pageable) { + Page page = deployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(deployMapper::toDto)); + } + + @Override + public List queryAll(DeployQueryCriteria criteria) { + return deployMapper.toDto(deployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + public DeployDto findById(Long id) { + Deploy deploy = deployRepository.findById(id).orElseGet(Deploy::new); + ValidationUtil.isNull(deploy.getId(), "Deploy", "id", id); + return deployMapper.toDto(deploy); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Deploy resources) { + deployRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Deploy resources) { + Deploy deploy = deployRepository.findById(resources.getId()).orElseGet(Deploy::new); + ValidationUtil.isNull(deploy.getId(), "Deploy", "id", resources.getId()); + deploy.copy(resources); + deployRepository.save(deploy); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + deployRepository.deleteById(id); + } + } + + @Override + public void deploy(String fileSavePath, Long id) { + deployApp(fileSavePath, id); + } + + /** + * @param fileSavePath 本机路径 + * @param id ID + */ + private void deployApp(String fileSavePath, Long id) { + + DeployDto deploy = findById(id); + if (deploy == null) { + sendMsg("部署信息不存在", MsgType.ERROR); + throw new BadRequestException("部署信息不存在"); + } + AppDto app = deploy.getApp(); + if (app == null) { + sendMsg("包对应应用信息不存在", MsgType.ERROR); + throw new BadRequestException("包对应应用信息不存在"); + } + int port = app.getPort(); + //这个是服务器部署路径 + String uploadPath = app.getUploadPath(); + StringBuilder sb = new StringBuilder(); + String msg; + Set deploys = deploy.getDeploys(); + for (ServerDeployDto deployDTO : deploys) { + String ip = deployDTO.getIp(); + ExecuteShellUtil executeShellUtil = getExecuteShellUtil(ip); + //判断是否第一次部署 + boolean flag = checkFile(executeShellUtil, app); + //第一步要确认服务器上有这个目录 + executeShellUtil.execute("mkdir -p " + app.getUploadPath()); + executeShellUtil.execute("mkdir -p " + app.getBackupPath()); + executeShellUtil.execute("mkdir -p " + app.getDeployPath()); + //上传文件 + msg = String.format("登陆到服务器:%s", ip); + ScpClientUtil scpClientUtil = getScpClientUtil(ip); + log.info(msg); + sendMsg(msg, MsgType.INFO); + msg = String.format("上传文件到服务器:%s
目录:%s下,请稍等...", ip, uploadPath); + sendMsg(msg, MsgType.INFO); + scpClientUtil.putFile(fileSavePath, uploadPath); + if (flag) { + sendMsg("停止原来应用", MsgType.INFO); + //停止应用 + stopApp(port, executeShellUtil); + sendMsg("备份原来应用", MsgType.INFO); + //备份应用 + backupApp(executeShellUtil, ip, app.getDeployPath()+FILE_SEPARATOR, app.getName(), app.getBackupPath()+FILE_SEPARATOR, id); + } + sendMsg("部署应用", MsgType.INFO); + //部署文件,并启动应用 + String deployScript = app.getDeployScript(); + executeShellUtil.execute(deployScript); + sleep(3); + sendMsg("应用部署中,请耐心等待部署结果,或者稍后手动查看部署状态", MsgType.INFO); + int i = 0; + boolean result = false; + // 由于启动应用需要时间,所以需要循环获取状态,如果超过30次,则认为是启动失败 + while (i++ < count){ + result = checkIsRunningStatus(port, executeShellUtil); + if(result){ + break; + } + // 休眠6秒 + sleep(6); + } + sb.append("服务器:").append(deployDTO.getName()).append("
应用:").append(app.getName()); + sendResultMsg(result, sb); + executeShellUtil.close(); + } + } + + private void sleep(int second) { + try { + Thread.sleep(second * 1000); + } catch (InterruptedException e) { + log.error(e.getMessage(),e); + } + } + + private void backupApp(ExecuteShellUtil executeShellUtil, String ip, String fileSavePath, String appName, String backupPath, Long id) { + String deployDate = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN); + StringBuilder sb = new StringBuilder(); + backupPath += appName + FILE_SEPARATOR + deployDate + "\n"; + sb.append("mkdir -p ").append(backupPath); + sb.append("mv -f ").append(fileSavePath); + sb.append(appName).append(" ").append(backupPath); + log.info("备份应用脚本:" + sb.toString()); + executeShellUtil.execute(sb.toString()); + //还原信息入库 + DeployHistory deployHistory = new DeployHistory(); + deployHistory.setAppName(appName); + deployHistory.setDeployUser(SecurityUtils.getCurrentUsername()); + deployHistory.setIp(ip); + deployHistory.setDeployId(id); + deployHistoryService.create(deployHistory); + } + + /** + * 停App + * + * @param port 端口 + * @param executeShellUtil / + */ + private void stopApp(int port, ExecuteShellUtil executeShellUtil) { + //发送停止命令 + executeShellUtil.execute(String.format("lsof -i :%d|grep -v \"PID\"|awk '{print \"kill -9\",$2}'|sh", port)); + + } + + /** + * 指定端口程序是否在运行 + * + * @param port 端口 + * @param executeShellUtil / + * @return true 正在运行 false 已经停止 + */ + private boolean checkIsRunningStatus(int port, ExecuteShellUtil executeShellUtil) { + String result = executeShellUtil.executeForResult(String.format("fuser -n tcp %d", port)); + return result.indexOf("/tcp:")>0; + } + + private void sendMsg(String msg, MsgType msgType) { + try { + WebSocketServer.sendInfo(new SocketMsg(msg, msgType), "deploy"); + } catch (IOException e) { + log.error(e.getMessage(),e); + } + } + + @Override + public String serverStatus(Deploy resources) { + Set serverDeploys = resources.getDeploys(); + App app = resources.getApp(); + for (ServerDeploy serverDeploy : serverDeploys) { + StringBuilder sb = new StringBuilder(); + ExecuteShellUtil executeShellUtil = getExecuteShellUtil(serverDeploy.getIp()); + sb.append("服务器:").append(serverDeploy.getName()).append("
应用:").append(app.getName()); + boolean result = checkIsRunningStatus(app.getPort(), executeShellUtil); + if (result) { + sb.append("
正在运行"); + sendMsg(sb.toString(), MsgType.INFO); + } else { + sb.append("
已停止!"); + sendMsg(sb.toString(), MsgType.ERROR); + } + log.info(sb.toString()); + executeShellUtil.close(); + } + return "执行完毕"; + } + + private boolean checkFile(ExecuteShellUtil executeShellUtil, AppDto appDTO) { + String result = executeShellUtil.executeForResult("find " + appDTO.getDeployPath() + " -name " + appDTO.getName()); + return result.indexOf(appDTO.getName())>0; + } + + /** + * 启动服务 + * @param resources / + * @return / + */ + @Override + public String startServer(Deploy resources) { + Set deploys = resources.getDeploys(); + App app = resources.getApp(); + for (ServerDeploy deploy : deploys) { + StringBuilder sb = new StringBuilder(); + ExecuteShellUtil executeShellUtil = getExecuteShellUtil(deploy.getIp()); + //为了防止重复启动,这里先停止应用 + stopApp(app.getPort(), executeShellUtil); + sb.append("服务器:").append(deploy.getName()).append("
应用:").append(app.getName()); + sendMsg("下发启动命令", MsgType.INFO); + executeShellUtil.execute(app.getStartScript()); + sleep(3); + sendMsg("应用启动中,请耐心等待启动结果,或者稍后手动查看运行状态", MsgType.INFO); + int i = 0; + boolean result = false; + // 由于启动应用需要时间,所以需要循环获取状态,如果超过30次,则认为是启动失败 + while (i++ < count){ + result = checkIsRunningStatus(app.getPort(), executeShellUtil); + if(result){ + break; + } + // 休眠6秒 + sleep(6); + } + sendResultMsg(result, sb); + log.info(sb.toString()); + executeShellUtil.close(); + } + return "执行完毕"; + } + + /** + * 停止服务 + * @param resources / + * @return / + */ + @Override + public String stopServer(Deploy resources) { + Set deploys = resources.getDeploys(); + App app = resources.getApp(); + for (ServerDeploy deploy : deploys) { + StringBuilder sb = new StringBuilder(); + ExecuteShellUtil executeShellUtil = getExecuteShellUtil(deploy.getIp()); + sb.append("服务器:").append(deploy.getName()).append("
应用:").append(app.getName()); + sendMsg("下发停止命令", MsgType.INFO); + //停止应用 + stopApp(app.getPort(), executeShellUtil); + sleep(1); + boolean result = checkIsRunningStatus(app.getPort(), executeShellUtil); + if (result) { + sb.append("
关闭失败!"); + sendMsg(sb.toString(), MsgType.ERROR); + } else { + sb.append("
关闭成功!"); + sendMsg(sb.toString(), MsgType.INFO); + } + log.info(sb.toString()); + executeShellUtil.close(); + } + return "执行完毕"; + } + + @Override + public String serverReduction(DeployHistory resources) { + Long deployId = resources.getDeployId(); + Deploy deployInfo = deployRepository.findById(deployId).orElseGet(Deploy::new); + String deployDate = DateUtil.format(resources.getDeployDate(), DatePattern.PURE_DATETIME_PATTERN); + App app = deployInfo.getApp(); + if (app == null) { + sendMsg("应用信息不存在:" + resources.getAppName(), MsgType.ERROR); + throw new BadRequestException("应用信息不存在:" + resources.getAppName()); + } + String backupPath = app.getBackupPath()+FILE_SEPARATOR; + backupPath += resources.getAppName() + FILE_SEPARATOR + deployDate; + //这个是服务器部署路径 + String deployPath = app.getDeployPath(); + String ip = resources.getIp(); + ExecuteShellUtil executeShellUtil = getExecuteShellUtil(ip); + String msg; + + msg = String.format("登陆到服务器:%s", ip); + log.info(msg); + sendMsg(msg, MsgType.INFO); + sendMsg("停止原来应用", MsgType.INFO); + //停止应用 + stopApp(app.getPort(), executeShellUtil); + //删除原来应用 + sendMsg("删除应用", MsgType.INFO); + executeShellUtil.execute("rm -rf " + deployPath + FILE_SEPARATOR + resources.getAppName()); + //还原应用 + sendMsg("还原应用", MsgType.INFO); + executeShellUtil.execute("cp -r " + backupPath + "/. " + deployPath); + sendMsg("启动应用", MsgType.INFO); + executeShellUtil.execute(app.getStartScript()); + sendMsg("应用启动中,请耐心等待启动结果,或者稍后手动查看启动状态", MsgType.INFO); + int i = 0; + boolean result = false; + // 由于启动应用需要时间,所以需要循环获取状态,如果超过30次,则认为是启动失败 + while (i++ < count){ + result = checkIsRunningStatus(app.getPort(), executeShellUtil); + if(result){ + break; + } + // 休眠6秒 + sleep(6); + } + StringBuilder sb = new StringBuilder(); + sb.append("服务器:").append(ip).append("
应用:").append(resources.getAppName()); + sendResultMsg(result, sb); + executeShellUtil.close(); + return ""; + } + + private ExecuteShellUtil getExecuteShellUtil(String ip) { + ServerDeployDto serverDeployDTO = serverDeployService.findByIp(ip); + if (serverDeployDTO == null) { + sendMsg("IP对应服务器信息不存在:" + ip, MsgType.ERROR); + throw new BadRequestException("IP对应服务器信息不存在:" + ip); + } + return new ExecuteShellUtil(ip, serverDeployDTO.getAccount(), serverDeployDTO.getPassword(),serverDeployDTO.getPort()); + } + + private ScpClientUtil getScpClientUtil(String ip) { + ServerDeployDto serverDeployDTO = serverDeployService.findByIp(ip); + if (serverDeployDTO == null) { + sendMsg("IP对应服务器信息不存在:" + ip, MsgType.ERROR); + throw new BadRequestException("IP对应服务器信息不存在:" + ip); + } + return ScpClientUtil.getInstance(ip, serverDeployDTO.getPort(), serverDeployDTO.getAccount(), serverDeployDTO.getPassword()); + } + + private void sendResultMsg(boolean result, StringBuilder sb) { + if (result) { + sb.append("
启动成功!"); + sendMsg(sb.toString(), MsgType.INFO); + } else { + sb.append("
启动失败!"); + sendMsg(sb.toString(), MsgType.ERROR); + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (DeployDto deployDto : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("应用名称", deployDto.getApp().getName()); + map.put("服务器", deployDto.getServers()); + map.put("部署日期", deployDto.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/ServerDeployServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/ServerDeployServiceImpl.java new file mode 100644 index 0000000..9ddf61a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/impl/ServerDeployServiceImpl.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.impl; + +import com.youchain.modules.mnt.service.dto.ServerDeployDto; +import com.youchain.modules.mnt.service.dto.ServerDeployQueryCriteria; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.mnt.domain.ServerDeploy; +import com.youchain.modules.mnt.repository.ServerDeployRepository; +import com.youchain.modules.mnt.service.ServerDeployService; +import com.youchain.modules.mnt.service.mapstruct.ServerDeployMapper; +import com.youchain.modules.mnt.util.ExecuteShellUtil; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Service +@RequiredArgsConstructor +public class ServerDeployServiceImpl implements ServerDeployService { + + private final ServerDeployRepository serverDeployRepository; + private final ServerDeployMapper serverDeployMapper; + + @Override + public Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable){ + Page page = serverDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(serverDeployMapper::toDto)); + } + + @Override + public List queryAll(ServerDeployQueryCriteria criteria){ + return serverDeployMapper.toDto(serverDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ServerDeployDto findById(Long id) { + ServerDeploy server = serverDeployRepository.findById(id).orElseGet(ServerDeploy::new); + ValidationUtil.isNull(server.getId(),"ServerDeploy","id",id); + return serverDeployMapper.toDto(server); + } + + @Override + public ServerDeployDto findByIp(String ip) { + ServerDeploy deploy = serverDeployRepository.findByIp(ip); + return serverDeployMapper.toDto(deploy); + } + + @Override + public Boolean testConnect(ServerDeploy resources) { + ExecuteShellUtil executeShellUtil = null; + try { + executeShellUtil = new ExecuteShellUtil(resources.getIp(), resources.getAccount(), resources.getPassword(),resources.getPort()); + return executeShellUtil.execute("ls")==0; + } catch (Exception e) { + return false; + }finally { + if (executeShellUtil != null) { + executeShellUtil.close(); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(ServerDeploy resources) { + serverDeployRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ServerDeploy resources) { + ServerDeploy serverDeploy = serverDeployRepository.findById(resources.getId()).orElseGet(ServerDeploy::new); + ValidationUtil.isNull( serverDeploy.getId(),"ServerDeploy","id",resources.getId()); + serverDeploy.copy(resources); + serverDeployRepository.save(serverDeploy); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + serverDeployRepository.deleteById(id); + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (ServerDeployDto deployDto : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("服务器名称", deployDto.getName()); + map.put("服务器IP", deployDto.getIp()); + map.put("端口", deployDto.getPort()); + map.put("账号", deployDto.getAccount()); + map.put("创建日期", deployDto.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/AppMapper.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/AppMapper.java new file mode 100644 index 0000000..c47aa9b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/AppMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.mapstruct; + +import com.youchain.modules.mnt.service.dto.AppDto; +import com.youchain.base.BaseMapper; +import com.youchain.modules.mnt.domain.App; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface AppMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DatabaseMapper.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DatabaseMapper.java new file mode 100644 index 0000000..68286d9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DatabaseMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.mapstruct; + +import com.youchain.modules.mnt.service.dto.DatabaseDto; +import com.youchain.base.BaseMapper; +import com.youchain.modules.mnt.domain.Database; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DatabaseMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployHistoryMapper.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployHistoryMapper.java new file mode 100644 index 0000000..0d091a8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployHistoryMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.mapstruct; + +import com.youchain.modules.mnt.service.dto.DeployHistoryDto; +import com.youchain.base.BaseMapper; +import com.youchain.modules.mnt.domain.DeployHistory; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DeployHistoryMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployMapper.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployMapper.java new file mode 100644 index 0000000..9e101ef --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/DeployMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.mapstruct; + +import com.youchain.modules.mnt.service.dto.DeployDto; +import com.youchain.base.BaseMapper; +import com.youchain.modules.mnt.domain.Deploy; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Mapper(componentModel = "spring",uses = {AppMapper.class, ServerDeployMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DeployMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/ServerDeployMapper.java b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/ServerDeployMapper.java new file mode 100644 index 0000000..610df74 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/service/mapstruct/ServerDeployMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.service.mapstruct; + +import com.youchain.modules.mnt.service.dto.ServerDeployDto; +import com.youchain.base.BaseMapper; +import com.youchain.modules.mnt.domain.ServerDeploy; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author zhanghouying +* @date 2019-08-24 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ServerDeployMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/util/DataTypeEnum.java b/youchain-system/src/main/java/com/youchain/modules/mnt/util/DataTypeEnum.java new file mode 100644 index 0000000..366a47f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/util/DataTypeEnum.java @@ -0,0 +1,140 @@ +/* + * << + * Davinci + * == + * Copyright (C) 2016 - 2019 EDP + * == + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * >> + * + */ + +package com.youchain.modules.mnt.util; +import lombok.extern.slf4j.Slf4j; + +/** + * @author / + */ +@Slf4j +@SuppressWarnings({"unchecked","all"}) +public enum DataTypeEnum { + + /** mysql */ + MYSQL("mysql", "mysql", "com.mysql.jdbc.Driver", "`", "`", "'", "'"), + + /** oracle */ + ORACLE("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""), + + /** sql server */ + SQLSERVER("sqlserver", "sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "\"", "\"", "\"", "\""), + + /** h2 */ + H2("h2", "h2", "org.h2.Driver", "`", "`", "\"", "\""), + + /** phoenix */ + PHOENIX("phoenix", "hbase phoenix", "org.apache.phoenix.jdbc.PhoenixDriver", "", "", "\"", "\""), + + /** mongo */ + MONGODB("mongo", "mongodb", "mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""), + + /** sql4es */ + ELASTICSEARCH("sql4es", "elasticsearch", "nl.anchormen.sql4es.jdbc.ESDriver", "", "", "'", "'"), + + /** presto */ + PRESTO("presto", "presto", "com.facebook.presto.jdbc.PrestoDriver", "", "", "\"", "\""), + + /** moonbox */ + MOONBOX("moonbox", "moonbox", "moonbox.jdbc.MbDriver", "`", "`", "`", "`"), + + /** cassandra */ + CASSANDRA("cassandra", "cassandra", "com.github.adejanovski.cassandra.jdbc.CassandraDriver", "", "", "'", "'"), + + /** click house */ + CLICKHOUSE("clickhouse", "clickhouse", "ru.yandex.clickhouse.ClickHouseDriver", "", "", "\"", "\""), + + /** kylin */ + KYLIN("kylin", "kylin", "org.apache.kylin.jdbc.Driver", "\"", "\"", "\"", "\""), + + /** vertica */ + VERTICA("vertica", "vertica", "com.vertica.jdbc.Driver", "", "", "'", "'"), + + /** sap */ + HANA("sap", "sap hana", "com.sap.db.jdbc.Driver", "", "", "'", "'"), + + /** impala */ + IMPALA("impala", "impala", "com.cloudera.impala.jdbc41.Driver", "", "", "'", "'"); + + private String feature; + private String desc; + private String driver; + private String keywordPrefix; + private String keywordSuffix; + private String aliasPrefix; + private String aliasSuffix; + + private static final String JDBC_URL_PREFIX = "jdbc:"; + + DataTypeEnum(String feature, String desc, String driver, String keywordPrefix, String keywordSuffix, String aliasPrefix, String aliasSuffix) { + this.feature = feature; + this.desc = desc; + this.driver = driver; + this.keywordPrefix = keywordPrefix; + this.keywordSuffix = keywordSuffix; + this.aliasPrefix = aliasPrefix; + this.aliasSuffix = aliasSuffix; + } + + public static DataTypeEnum urlOf(String jdbcUrl) { + String url = jdbcUrl.toLowerCase().trim(); + for (DataTypeEnum dataTypeEnum : values()) { + if (url.startsWith(JDBC_URL_PREFIX + dataTypeEnum.feature)) { + try { + Class aClass = Class.forName(dataTypeEnum.getDriver()); + if (null == aClass) { + throw new RuntimeException("Unable to get driver instance for jdbcUrl: " + jdbcUrl); + } + } catch (ClassNotFoundException e) { + throw new RuntimeException("Unable to get driver instance: " + jdbcUrl); + } + return dataTypeEnum; + } + } + return null; + } + + public String getFeature() { + return feature; + } + + public String getDesc() { + return desc; + } + + public String getDriver() { + return driver; + } + + public String getKeywordPrefix() { + return keywordPrefix; + } + + public String getKeywordSuffix() { + return keywordSuffix; + } + + public String getAliasPrefix() { + return aliasPrefix; + } + + public String getAliasSuffix() { + return aliasSuffix; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/util/ExecuteShellUtil.java b/youchain-system/src/main/java/com/youchain/modules/mnt/util/ExecuteShellUtil.java new file mode 100644 index 0000000..0dea74d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/util/ExecuteShellUtil.java @@ -0,0 +1,101 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.util; + +import cn.hutool.core.io.IoUtil; +import com.jcraft.jsch.ChannelShell; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.Session; +import lombok.extern.slf4j.Slf4j; + +import java.io.*; +import java.util.Vector; + +/** + * 执行shell命令 + * + * @author: ZhangHouYing + * @date: 2019/8/10 + */ +@Slf4j +public class ExecuteShellUtil { + + private Vector stdout; + + Session session; + + public ExecuteShellUtil(final String ipAddress, final String username, final String password,int port) { + try { + JSch jsch = new JSch(); + session = jsch.getSession(username, ipAddress, port); + session.setPassword(password); + session.setConfig("StrictHostKeyChecking", "no"); + session.connect(3000); + } catch (Exception e) { + log.error(e.getMessage(),e); + } + + } + + public int execute(final String command) { + int returnCode = 0; + ChannelShell channel = null; + PrintWriter printWriter = null; + BufferedReader input = null; + stdout = new Vector(); + try { + channel = (ChannelShell) session.openChannel("shell"); + channel.connect(); + input = new BufferedReader(new InputStreamReader(channel.getInputStream())); + printWriter = new PrintWriter(channel.getOutputStream()); + printWriter.println(command); + printWriter.println("exit"); + printWriter.flush(); + log.info("The remote command is: "); + String line; + while ((line = input.readLine()) != null) { + stdout.add(line); + System.out.println(line); + } + } catch (Exception e) { + log.error(e.getMessage(),e); + return -1; + }finally { + IoUtil.close(printWriter); + IoUtil.close(input); + if (channel != null) { + channel.disconnect(); + } + } + return returnCode; + } + + public void close(){ + if (session != null) { + session.disconnect(); + } + } + + public String executeForResult(String command) { + execute(command); + StringBuilder sb = new StringBuilder(); + for (String str : stdout) { + sb.append(str); + } + return sb.toString(); + } + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/util/ScpClientUtil.java b/youchain-system/src/main/java/com/youchain/modules/mnt/util/ScpClientUtil.java new file mode 100644 index 0000000..49a8c83 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/util/ScpClientUtil.java @@ -0,0 +1,105 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.util; + +import ch.ethz.ssh2.Connection; +import ch.ethz.ssh2.SCPClient; +import com.google.common.collect.Maps; + +import java.io.IOException; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * 远程执行linux命令 + * @author: ZhangHouYing + * @date: 2019-08-10 10:06 + */ +public class ScpClientUtil { + + static private Map instance = Maps.newHashMap(); + + static synchronized public ScpClientUtil getInstance(String ip, int port, String username, String password) { + if (instance.get(ip) == null) { + instance.put(ip, new ScpClientUtil(ip, port, username, password)); + } + return instance.get(ip); + } + + public ScpClientUtil(String ip, int port, String username, String password) { + this.ip = ip; + this.port = port; + this.username = username; + this.password = password; + } + + public void getFile(String remoteFile, String localTargetDirectory) { + Connection conn = new Connection(ip, port); + try { + conn.connect(); + boolean isAuthenticated = conn.authenticateWithPassword(username, password); + if (!isAuthenticated) { + System.err.println("authentication failed"); + } + SCPClient client = new SCPClient(conn); + client.get(remoteFile, localTargetDirectory); + } catch (IOException ex) { + Logger.getLogger(SCPClient.class.getName()).log(Level.SEVERE, null, ex); + }finally{ + conn.close(); + } + } + + public void putFile(String localFile, String remoteTargetDirectory) { + putFile(localFile, null, remoteTargetDirectory); + } + + public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory) { + putFile(localFile, remoteFileName, remoteTargetDirectory,null); + } + + public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory, String mode) { + Connection conn = new Connection(ip, port); + try { + conn.connect(); + boolean isAuthenticated = conn.authenticateWithPassword(username, password); + if (!isAuthenticated) { + System.err.println("authentication failed"); + } + SCPClient client = new SCPClient(conn); + if ((mode == null) || (mode.length() == 0)) { + mode = "0600"; + } + if (remoteFileName == null) { + client.put(localFile, remoteTargetDirectory); + } else { + client.put(localFile, remoteFileName, remoteTargetDirectory, mode); + } + } catch (IOException ex) { + Logger.getLogger(ScpClientUtil.class.getName()).log(Level.SEVERE, null, ex); + }finally{ + conn.close(); + } + } + + private String ip; + private int port; + private String username; + private String password; + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/util/SqlUtils.java b/youchain-system/src/main/java/com/youchain/modules/mnt/util/SqlUtils.java new file mode 100644 index 0000000..8c3d3d8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/util/SqlUtils.java @@ -0,0 +1,202 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.util; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.util.StringUtils; +import com.google.common.collect.Lists; +import com.youchain.utils.CloseUtil; +import lombok.extern.slf4j.Slf4j; + +import javax.sql.DataSource; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.sql.*; +import java.util.List; + +/** + * @author / + */ +@Slf4j +public class SqlUtils { + + /** + * 获取数据源 + * + * @param jdbcUrl / + * @param userName / + * @param password / + * @return DataSource + */ + private static DataSource getDataSource(String jdbcUrl, String userName, String password) { + DruidDataSource druidDataSource = new DruidDataSource(); + String className; + try { + className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName(); + } catch (SQLException e) { + throw new RuntimeException("Get class name error: =" + jdbcUrl); + } + if (StringUtils.isEmpty(className)) { + DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl); + if (null == dataTypeEnum) { + throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl); + } + druidDataSource.setDriverClassName(dataTypeEnum.getDriver()); + } else { + druidDataSource.setDriverClassName(className); + } + + + druidDataSource.setUrl(jdbcUrl); + druidDataSource.setUsername(userName); + druidDataSource.setPassword(password); + // 配置获取连接等待超时的时间 + druidDataSource.setMaxWait(3000); + // 配置初始化大小、最小、最大 + druidDataSource.setInitialSize(1); + druidDataSource.setMinIdle(1); + druidDataSource.setMaxActive(1); + + // 如果链接出现异常则直接判定为失败而不是一直重试 + druidDataSource.setBreakAfterAcquireFailure(true); + try { + druidDataSource.init(); + } catch (SQLException e) { + log.error("Exception during pool initialization", e); + throw new RuntimeException(e.getMessage()); + } + + return druidDataSource; + } + + private static Connection getConnection(String jdbcUrl, String userName, String password) { + DataSource dataSource = getDataSource(jdbcUrl, userName, password); + Connection connection = null; + try { + connection = dataSource.getConnection(); + } catch (Exception ignored) {} + try { + int timeOut = 5; + if (null == connection || connection.isClosed() || !connection.isValid(timeOut)) { + log.info("connection is closed or invalid, retry get connection!"); + connection = dataSource.getConnection(); + } + } catch (Exception e) { + log.error("create connection error, jdbcUrl: {}", jdbcUrl); + throw new RuntimeException("create connection error, jdbcUrl: " + jdbcUrl); + } finally { + CloseUtil.close(connection); + } + return connection; + } + + private static void releaseConnection(Connection connection) { + if (null != connection) { + try { + connection.close(); + } catch (Exception e) { + log.error(e.getMessage(),e); + log.error("connection close error:" + e.getMessage()); + } + } + } + + public static boolean testConnection(String jdbcUrl, String userName, String password) { + Connection connection = null; + try { + connection = getConnection(jdbcUrl, userName, password); + if (null != connection) { + return true; + } + } catch (Exception e) { + log.info("Get connection failed:" + e.getMessage()); + } finally { + releaseConnection(connection); + } + return false; + } + + public static String executeFile(String jdbcUrl, String userName, String password, File sqlFile) { + Connection connection = getConnection(jdbcUrl, userName, password); + try { + batchExecute(connection, readSqlList(sqlFile)); + } catch (Exception e) { + log.error("sql脚本执行发生异常:{}",e.getMessage()); + return e.getMessage(); + }finally { + releaseConnection(connection); + } + return "success"; + } + + + /** + * 批量执行sql + * @param connection / + * @param sqlList / + */ + public static void batchExecute(Connection connection, List sqlList) { + Statement st = null; + try { + st = connection.createStatement(); + for (String sql : sqlList) { + if (sql.endsWith(";")) { + sql = sql.substring(0, sql.length() - 1); + } + st.addBatch(sql); + } + st.executeBatch(); + } catch (SQLException throwables) { + throwables.printStackTrace(); + } finally { + CloseUtil.close(st); + } + } + + /** + * 将文件中的sql语句以;为单位读取到列表中 + * @param sqlFile / + * @return / + * @throws Exception e + */ + private static List readSqlList(File sqlFile) throws Exception { + List sqlList = Lists.newArrayList(); + StringBuilder sb = new StringBuilder(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader( + new FileInputStream(sqlFile), StandardCharsets.UTF_8))) { + String tmp; + while ((tmp = reader.readLine()) != null) { + log.info("line:{}", tmp); + if (tmp.endsWith(";")) { + sb.append(tmp); + sqlList.add(sb.toString()); + sb.delete(0, sb.length()); + } else { + sb.append(tmp); + } + } + if (!"".endsWith(sb.toString().trim())) { + sqlList.add(sb.toString()); + } + } + + return sqlList; + } + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/MsgType.java b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/MsgType.java new file mode 100644 index 0000000..5f8cc89 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/MsgType.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.websocket; + +/** + * @author ZhangHouYing + * @date 2019-08-10 9:56 + */ +public enum MsgType { + /** 连接 */ + CONNECT, + /** 关闭 */ + CLOSE, + /** 信息 */ + INFO, + /** 错误 */ + ERROR +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/SocketMsg.java b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/SocketMsg.java new file mode 100644 index 0000000..c190c4b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/SocketMsg.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.websocket; + +import lombok.Data; + +/** + * @author ZhangHouYing + * @date 2019-08-10 9:55 + */ +@Data +public class SocketMsg { + private String msg; + private MsgType msgType; + + public SocketMsg(String msg, MsgType msgType) { + this.msg = msg; + this.msgType = msgType; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/WebSocketServer.java b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/WebSocketServer.java new file mode 100644 index 0000000..2c5dc59 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/mnt/websocket/WebSocketServer.java @@ -0,0 +1,139 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.mnt.websocket; + +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.websocket.*; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.Objects; +import java.util.concurrent.CopyOnWriteArraySet; +/** + * @author ZhangHouYing + * @date 2019-08-10 15:46 + */ +@ServerEndpoint("/webSocket/{sid}") +@Slf4j +@Component +public class WebSocketServer { + + /** + * concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 + */ + private static CopyOnWriteArraySet webSocketSet = new CopyOnWriteArraySet(); + + /** + * 与某个客户端的连接会话,需要通过它来给客户端发送数据 + */ + private Session session; + + /** + * 接收sid + */ + private String sid=""; + /** + * 连接建立成功调用的方法 + * */ + @OnOpen + public void onOpen(Session session,@PathParam("sid") String sid) { + this.session = session; + //如果存在就先删除一个,防止重复推送消息 + for (WebSocketServer webSocket:webSocketSet) { + if (webSocket.sid.equals(sid)) { + webSocketSet.remove(webSocket); + } + } + webSocketSet.add(this); + this.sid=sid; + } + + /** + * 连接关闭调用的方法 + */ + @OnClose + public void onClose() { + webSocketSet.remove(this); + } + + /** + * 收到客户端消息后调用的方法 + * @param message 客户端发送过来的消息*/ + @OnMessage + public void onMessage(String message, Session session) { + log.info("收到来"+sid+"的信息:"+message); + //群发消息 + for (WebSocketServer item : webSocketSet) { + try { + item.sendMessage(message); + } catch (IOException e) { + log.error(e.getMessage(),e); + } + } + } + + @OnError + public void onError(Session session, Throwable error) { + log.error("发生错误"); + error.printStackTrace(); + } + /** + * 实现服务器主动推送 + */ + private void sendMessage(String message) throws IOException { + this.session.getBasicRemote().sendText(message); + } + + + /** + * 群发自定义消息 + * */ + public static void sendInfo(SocketMsg socketMsg,@PathParam("sid") String sid) throws IOException { + String message = JSONObject.toJSONString(socketMsg); + log.info("推送消息到"+sid+",推送内容:"+message); + for (WebSocketServer item : webSocketSet) { + try { + //这里可以设定只推送给这个sid的,为null则全部推送 + if(sid==null) { + item.sendMessage(message); + }else if(item.sid.equals(sid)){ + item.sendMessage(message); + } + } catch (IOException ignored) { } + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebSocketServer that = (WebSocketServer) o; + return Objects.equals(session, that.session) && + Objects.equals(sid, that.sid); + } + + @Override + public int hashCode() { + return Objects.hash(session, sid); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/config/JobRunner.java b/youchain-system/src/main/java/com/youchain/modules/quartz/config/JobRunner.java new file mode 100644 index 0000000..681412d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/config/JobRunner.java @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.config; + +import com.youchain.modules.quartz.domain.QuartzJob; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.quartz.repository.QuartzJobRepository; +import com.youchain.modules.quartz.utils.QuartzManage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@Component +@RequiredArgsConstructor +public class JobRunner implements ApplicationRunner { + private static final Logger log = LoggerFactory.getLogger(JobRunner.class); + private final QuartzJobRepository quartzJobRepository; + private final QuartzManage quartzManage; + + /** + * 项目启动时重新激活启用的定时任务 + * + * @param applicationArguments / + */ + @Override + public void run(ApplicationArguments applicationArguments) { + List quartzJobs = quartzJobRepository.findByIsPauseIsFalse(); + quartzJobs.forEach(quartzManage::addJob); + log.info("Timing task injection complete"); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/config/QuartzConfig.java b/youchain-system/src/main/java/com/youchain/modules/quartz/config/QuartzConfig.java new file mode 100644 index 0000000..2074175 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/config/QuartzConfig.java @@ -0,0 +1,52 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.config; + +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.quartz.AdaptableJobFactory; +import org.springframework.stereotype.Component; + +/** + * 定时任务配置 + * @author / + * @date 2019-01-07 + */ +@Configuration +public class QuartzConfig { + + /** + * 解决Job中注入Spring Bean为null的问题 + */ + @Component("quartzJobFactory") + public static class QuartzJobFactory extends AdaptableJobFactory { + + private final AutowireCapableBeanFactory capableBeanFactory; + + public QuartzJobFactory(AutowireCapableBeanFactory capableBeanFactory) { + this.capableBeanFactory = capableBeanFactory; + } + + @Override + protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { + //调用父类的方法,把Job注入到spring中 + Object jobInstance = super.createJobInstance(bundle); + capableBeanFactory.autowireBean(jobInstance); + return jobInstance; + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzJob.java b/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzJob.java new file mode 100644 index 0000000..49ab32f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzJob.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@Getter +@Setter +@Entity +@Table(name = "sys_quartz_job") +public class QuartzJob extends BaseEntity implements Serializable { + + public static final String JOB_KEY = "JOB_KEY"; + + @Id + @Column(name = "job_id") + @NotNull(groups = {Update.class}) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Transient + @ApiModelProperty(value = "用于子任务唯一标识", hidden = true) + private String uuid; + + @ApiModelProperty(value = "定时器名称") + private String jobName; + + @NotBlank + @ApiModelProperty(value = "Bean名称") + private String beanName; + + @NotBlank + @ApiModelProperty(value = "方法名称") + private String methodName; + + @ApiModelProperty(value = "参数") + private String params; + + @NotBlank + @ApiModelProperty(value = "cron表达式") + private String cronExpression; + + @ApiModelProperty(value = "状态,暂时或启动") + private Boolean isPause = false; + + @ApiModelProperty(value = "负责人") + private String personInCharge; + + @ApiModelProperty(value = "报警邮箱") + private String email; + + @ApiModelProperty(value = "子任务") + private String subTask; + + @ApiModelProperty(value = "失败后暂停") + private Boolean pauseAfterFailure; + + @NotBlank + @ApiModelProperty(value = "备注") + private String description; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzLog.java b/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzLog.java new file mode 100644 index 0000000..3e0fade --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/domain/QuartzLog.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.annotations.CreationTimestamp; +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@Entity +@Data +@Table(name = "sys_quartz_log") +public class QuartzLog implements Serializable { + + @Id + @Column(name = "log_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ApiModelProperty(value = "任务名称", hidden = true) + private String jobName; + + @ApiModelProperty(value = "bean名称", hidden = true) + private String beanName; + + @ApiModelProperty(value = "方法名称", hidden = true) + private String methodName; + + @ApiModelProperty(value = "参数", hidden = true) + private String params; + + @ApiModelProperty(value = "cron表达式", hidden = true) + private String cronExpression; + + @ApiModelProperty(value = "状态", hidden = true) + private Boolean isSuccess; + + @ApiModelProperty(value = "异常详情", hidden = true) + private String exceptionDetail; + + @ApiModelProperty(value = "执行耗时", hidden = true) + private Long time; + + @CreationTimestamp + @ApiModelProperty(value = "创建时间", hidden = true) + private Timestamp createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzJobRepository.java b/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzJobRepository.java new file mode 100644 index 0000000..26cbe56 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzJobRepository.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.repository; + +import com.youchain.modules.quartz.domain.QuartzJob; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +public interface QuartzJobRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 查询启用的任务 + * @return List + */ + List findByIsPauseIsFalse(); + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzLogRepository.java b/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzLogRepository.java new file mode 100644 index 0000000..1016818 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/repository/QuartzLogRepository.java @@ -0,0 +1,28 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.repository; + +import com.youchain.modules.quartz.domain.QuartzLog; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +public interface QuartzLogRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/rest/QuartzJobController.java b/youchain-system/src/main/java/com/youchain/modules/quartz/rest/QuartzJobController.java new file mode 100644 index 0000000..3a23dd9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/rest/QuartzJobController.java @@ -0,0 +1,141 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.rest; + + +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.quartz.domain.QuartzJob; +import com.youchain.modules.quartz.service.QuartzJobService; +import com.youchain.modules.quartz.service.dto.JobQueryCriteria; +import com.youchain.utils.SpringContextHolder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/jobs") +@Api(tags = "系统:定时任务管理") +public class QuartzJobController { + + private static final String ENTITY_NAME = "quartzJob"; + private final QuartzJobService quartzJobService; + + @ApiOperation("查询定时任务") + @GetMapping + @PreAuthorize("@el.check('timing:list')") + public ResponseEntity queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK); + } + + @ApiOperation("导出任务数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('timing:list')") + public void exportQuartzJob(HttpServletResponse response, JobQueryCriteria criteria) throws Exception { + quartzJobService.download(quartzJobService.queryAll(criteria), response); + } + + @ApiOperation("导出日志数据") + @GetMapping(value = "/logs/download") + @PreAuthorize("@el.check('timing:list')") + public void exportQuartzJobLog(HttpServletResponse response, JobQueryCriteria criteria) throws Exception { + quartzJobService.downloadLog(quartzJobService.queryAllLog(criteria), response); + } + + @ApiOperation("查询任务执行日志") + @GetMapping(value = "/logs") + @PreAuthorize("@el.check('timing:list')") + public ResponseEntity queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK); + } + + @Log("新增定时任务") + @ApiOperation("新增定时任务") + @PostMapping + @PreAuthorize("@el.check('timing:add')") + public ResponseEntity createQuartzJob(@Validated @RequestBody QuartzJob resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + // 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义 + checkBean(resources.getBeanName()); + quartzJobService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改定时任务") + @ApiOperation("修改定时任务") + @PutMapping + @PreAuthorize("@el.check('timing:edit')") + public ResponseEntity updateQuartzJob(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){ + // 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义 + checkBean(resources.getBeanName()); + quartzJobService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("更改定时任务状态") + @ApiOperation("更改定时任务状态") + @PutMapping(value = "/{id}") + @PreAuthorize("@el.check('timing:edit')") + public ResponseEntity updateQuartzJobStatus(@PathVariable Long id){ + quartzJobService.updateIsPause(quartzJobService.findById(id)); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("执行定时任务") + @ApiOperation("执行定时任务") + @PutMapping(value = "/exec/{id}") + @PreAuthorize("@el.check('timing:edit')") + public ResponseEntity executionQuartzJob(@PathVariable Long id){ + quartzJobService.execution(quartzJobService.findById(id)); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除定时任务") + @ApiOperation("删除定时任务") + @DeleteMapping + @PreAuthorize("@el.check('timing:del')") + public ResponseEntity deleteQuartzJob(@RequestBody Set ids){ + quartzJobService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + private void checkBean(String beanName){ + // 避免调用攻击者可以从SpringContextHolder获得控制jdbcTemplate类 + // 并使用getDeclaredMethod调用jdbcTemplate的queryForMap函数,执行任意sql命令。 + if(!SpringContextHolder.getAllServiceBeanName().contains(beanName)){ + throw new BadRequestException("非法的 Bean,请重新输入!"); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/service/QuartzJobService.java b/youchain-system/src/main/java/com/youchain/modules/quartz/service/QuartzJobService.java new file mode 100644 index 0000000..200d138 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/service/QuartzJobService.java @@ -0,0 +1,124 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.service; + +import com.youchain.modules.quartz.domain.QuartzJob; +import com.youchain.modules.quartz.domain.QuartzLog; +import com.youchain.modules.quartz.service.dto.JobQueryCriteria; +import org.springframework.data.domain.Pageable; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +public interface QuartzJobService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(JobQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(JobQueryCriteria criteria); + + /** + * 分页查询日志 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAllLog(JobQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAllLog(JobQueryCriteria criteria); + + /** + * 创建 + * @param resources / + */ + void create(QuartzJob resources); + + /** + * 编辑 + * @param resources / + */ + void update(QuartzJob resources); + + /** + * 删除任务 + * @param ids / + */ + void delete(Set ids); + + /** + * 根据ID查询 + * @param id ID + * @return / + */ + QuartzJob findById(Long id); + + /** + * 更改定时任务状态 + * @param quartzJob / + */ + void updateIsPause(QuartzJob quartzJob); + + /** + * 立即执行定时任务 + * @param quartzJob / + */ + void execution(QuartzJob quartzJob); + + /** + * 导出定时任务 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 导出定时任务日志 + * @param queryAllLog 待导出的数据 + * @param response / + * @throws Exception / + */ + void downloadLog(List queryAllLog, HttpServletResponse response) throws Exception, Exception; + + /** + * 执行子任务 + * @param tasks / + * @throws InterruptedException / + */ + void executionSubJob(String[] tasks) throws InterruptedException; + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/service/dto/JobQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/quartz/service/dto/JobQueryCriteria.java new file mode 100644 index 0000000..126d82f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/service/dto/JobQueryCriteria.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-6-4 10:33:02 + */ +@Data +public class JobQueryCriteria { + + @Query(type = Query.Type.INNER_LIKE) + private String jobName; + + @Query + private Boolean isSuccess; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/service/impl/QuartzJobServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/quartz/service/impl/QuartzJobServiceImpl.java new file mode 100644 index 0000000..892a2b4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/service/impl/QuartzJobServiceImpl.java @@ -0,0 +1,197 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.service.impl; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.youchain.modules.quartz.domain.QuartzJob; +import com.youchain.modules.quartz.domain.QuartzLog; +import com.youchain.modules.quartz.service.QuartzJobService; +import com.youchain.modules.quartz.utils.QuartzManage; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.quartz.repository.QuartzJobRepository; +import com.youchain.modules.quartz.repository.QuartzLogRepository; +import com.youchain.modules.quartz.service.dto.JobQueryCriteria; +import org.quartz.CronExpression; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@RequiredArgsConstructor +@Service(value = "quartzJobService") +public class QuartzJobServiceImpl implements QuartzJobService { + + private final QuartzJobRepository quartzJobRepository; + private final QuartzLogRepository quartzLogRepository; + private final QuartzManage quartzManage; + private final RedisUtils redisUtils; + + @Override + public Object queryAll(JobQueryCriteria criteria, Pageable pageable){ + return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); + } + + @Override + public Object queryAllLog(JobQueryCriteria criteria, Pageable pageable){ + return PageUtil.toPage(quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); + } + + @Override + public List queryAll(JobQueryCriteria criteria) { + return quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); + } + + @Override + public List queryAllLog(JobQueryCriteria criteria) { + return quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); + } + + @Override + public QuartzJob findById(Long id) { + QuartzJob quartzJob = quartzJobRepository.findById(id).orElseGet(QuartzJob::new); + ValidationUtil.isNull(quartzJob.getId(),"QuartzJob","id",id); + return quartzJob; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(QuartzJob resources) { + if (!CronExpression.isValidExpression(resources.getCronExpression())){ + throw new BadRequestException("cron表达式格式错误"); + } + resources = quartzJobRepository.save(resources); + quartzManage.addJob(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(QuartzJob resources) { + if (!CronExpression.isValidExpression(resources.getCronExpression())){ + throw new BadRequestException("cron表达式格式错误"); + } + if(StringUtils.isNotBlank(resources.getSubTask())){ + List tasks = Arrays.asList(resources.getSubTask().split("[,,]")); + if (tasks.contains(resources.getId().toString())) { + throw new BadRequestException("子任务中不能添加当前任务ID"); + } + } + resources = quartzJobRepository.save(resources); + quartzManage.updateJobCron(resources); + } + + @Override + public void updateIsPause(QuartzJob quartzJob) { + if (quartzJob.getIsPause()) { + quartzManage.resumeJob(quartzJob); + quartzJob.setIsPause(false); + } else { + quartzManage.pauseJob(quartzJob); + quartzJob.setIsPause(true); + } + quartzJobRepository.save(quartzJob); + } + + @Override + public void execution(QuartzJob quartzJob) { + quartzManage.runJobNow(quartzJob); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + QuartzJob quartzJob = findById(id); + quartzManage.deleteJob(quartzJob); + quartzJobRepository.delete(quartzJob); + } + } + + @Async + @Override + @Transactional(rollbackFor = Exception.class) + public void executionSubJob(String[] tasks) throws InterruptedException { + for (String id : tasks) { + if (StrUtil.isBlank(id)) { + // 如果是手动清除子任务id,会出现id为空字符串的问题 + continue; + } + QuartzJob quartzJob = findById(Long.parseLong(id)); + // 执行任务 + String uuid = IdUtil.simpleUUID(); + quartzJob.setUuid(uuid); + // 执行任务 + execution(quartzJob); + // 获取执行状态,如果执行失败则停止后面的子任务执行 + Boolean result = (Boolean) redisUtils.get(uuid); + while (result == null) { + // 休眠5秒,再次获取子任务执行情况 + Thread.sleep(5000); + result = (Boolean) redisUtils.get(uuid); + } + if(!result){ + redisUtils.del(uuid); + break; + } + } + } + + @Override + public void download(List quartzJobs, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (QuartzJob quartzJob : quartzJobs) { + Map map = new LinkedHashMap<>(); + map.put("任务名称", quartzJob.getJobName()); + map.put("Bean名称", quartzJob.getBeanName()); + map.put("执行方法", quartzJob.getMethodName()); + map.put("参数", quartzJob.getParams()); + map.put("表达式", quartzJob.getCronExpression()); + map.put("状态", quartzJob.getIsPause() ? "暂停中" : "运行中"); + map.put("描述", quartzJob.getDescription()); + map.put("创建日期", quartzJob.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void downloadLog(List queryAllLog, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (QuartzLog quartzLog : queryAllLog) { + Map map = new LinkedHashMap<>(); + map.put("任务名称", quartzLog.getJobName()); + map.put("Bean名称", quartzLog.getBeanName()); + map.put("执行方法", quartzLog.getMethodName()); + map.put("参数", quartzLog.getParams()); + map.put("表达式", quartzLog.getCronExpression()); + map.put("异常详情", quartzLog.getExceptionDetail()); + map.put("耗时/毫秒", quartzLog.getTime()); + map.put("状态", quartzLog.getIsSuccess() ? "成功" : "失败"); + map.put("创建日期", quartzLog.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/utils/ExecutionJob.java b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/ExecutionJob.java new file mode 100644 index 0000000..3f81d49 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/ExecutionJob.java @@ -0,0 +1,132 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.utils; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateUtil; +import com.youchain.config.thread.ThreadPoolExecutorUtil; +import com.youchain.domain.vo.EmailVo; +import com.youchain.modules.quartz.domain.QuartzJob; +import com.youchain.modules.quartz.domain.QuartzLog; +import com.youchain.modules.quartz.repository.QuartzLogRepository; +import com.youchain.modules.quartz.service.QuartzJobService; +import com.youchain.service.EmailService; +import com.youchain.utils.RedisUtils; +import com.youchain.utils.SpringContextHolder; +import com.youchain.utils.StringUtils; +import com.youchain.utils.ThrowableUtil; +import org.quartz.JobExecutionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.quartz.QuartzJobBean; +import java.util.*; +import java.util.concurrent.*; + +/** + * 参考人人开源,https://gitee.com/renrenio/renren-security + * @author / + * @date 2019-01-07 + */ +public class ExecutionJob extends QuartzJobBean { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + // 此处仅供参考,可根据任务执行情况自定义线程池参数 + private final static ExecutorService executor = ThreadPoolExecutorUtil.getPoll("el-quartz-job"); + + @Override + public void executeInternal(JobExecutionContext context) { + // 获取任务 + QuartzJob quartzJob = (QuartzJob) context.getMergedJobDataMap().get(QuartzJob.JOB_KEY); + // 获取spring bean + QuartzLogRepository quartzLogRepository = SpringContextHolder.getBean(QuartzLogRepository.class); + QuartzJobService quartzJobService = SpringContextHolder.getBean(QuartzJobService.class); + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + + String uuid = IdUtil.simpleUUID(); + + QuartzLog log = new QuartzLog(); + log.setJobName(quartzJob.getJobName()); + log.setBeanName(quartzJob.getBeanName()); + log.setMethodName(quartzJob.getMethodName()); + log.setParams(quartzJob.getParams()); + long startTime = System.currentTimeMillis(); + log.setCronExpression(quartzJob.getCronExpression()); + try { + // 执行任务 + QuartzRunnable task = new QuartzRunnable(quartzJob.getBeanName(), quartzJob.getMethodName(), quartzJob.getParams()); + Future future = executor.submit(task); + future.get(); + long times = System.currentTimeMillis() - startTime; + log.setTime(times); + if(StringUtils.isNotBlank(uuid)) { + redisUtils.set(uuid, true); + } + // 任务状态 + log.setIsSuccess(true); +// logger.info("任务执行成功,任务名称:" + quartzJob.getJobName() + ", 执行时间:" + times + "毫秒"); + // 判断是否存在子任务 + if(StringUtils.isNotBlank(quartzJob.getSubTask())){ + String[] tasks = quartzJob.getSubTask().split("[,,]"); + // 执行子任务 + quartzJobService.executionSubJob(tasks); + } + } catch (Exception e) { + if(StringUtils.isNotBlank(uuid)) { + redisUtils.set(uuid, false); + } + logger.error("任务执行失败,任务名称:" + quartzJob.getJobName()); + long times = System.currentTimeMillis() - startTime; + log.setTime(times); + // 任务状态 0:成功 1:失败 + log.setIsSuccess(false); + log.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 任务如果失败了则暂停 + if(quartzJob.getPauseAfterFailure() != null && quartzJob.getPauseAfterFailure()){ + quartzJob.setIsPause(false); + //更新状态 + quartzJobService.updateIsPause(quartzJob); + } + if(quartzJob.getEmail() != null){ + EmailService emailService = SpringContextHolder.getBean(EmailService.class); + // 邮箱报警 + if(StringUtils.isNoneBlank(quartzJob.getEmail())){ + EmailVo emailVo = taskAlarm(quartzJob, ThrowableUtil.getStackTrace(e)); + emailService.send(emailVo, emailService.find()); + } + } + } finally { + quartzLogRepository.save(log); + } + } + + private EmailVo taskAlarm(QuartzJob quartzJob, String msg) { + EmailVo emailVo = new EmailVo(); + emailVo.setSubject("定时任务【"+ quartzJob.getJobName() +"】执行失败,请尽快处理!"); + Map data = new HashMap<>(16); + data.put("task", quartzJob); + data.put("msg", msg); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + Template template = engine.getTemplate("email/taskAlarm.ftl"); + emailVo.setContent(template.render(data)); + List emails = Arrays.asList(quartzJob.getEmail().split("[,,]")); + emailVo.setTos(emails); + return emailVo; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzManage.java b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzManage.java new file mode 100644 index 0000000..127e5e2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzManage.java @@ -0,0 +1,173 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.utils; + +import com.youchain.modules.quartz.domain.QuartzJob; +import lombok.extern.slf4j.Slf4j; +import com.youchain.exception.BadRequestException; +import org.quartz.*; +import org.quartz.impl.triggers.CronTriggerImpl; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.util.Date; +import static org.quartz.TriggerBuilder.newTrigger; + +/** + * @author Liu Xue + * @date 2019-01-07 + */ +@Slf4j +@Component +public class QuartzManage { + + private static final String JOB_NAME = "TASK_"; + + @Resource + private Scheduler scheduler; + + public void addJob(QuartzJob quartzJob){ + try { + // 构建job信息 + JobDetail jobDetail = JobBuilder.newJob(ExecutionJob.class). + withIdentity(JOB_NAME + quartzJob.getId()).build(); + + //通过触发器名和cron 表达式创建 Trigger + Trigger cronTrigger = newTrigger() + .withIdentity(JOB_NAME + quartzJob.getId()) + .startNow() + .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression())) + .build(); + + cronTrigger.getJobDataMap().put(QuartzJob.JOB_KEY, quartzJob); + + //重置启动时间 + ((CronTriggerImpl)cronTrigger).setStartTime(new Date()); + + //执行定时任务 + scheduler.scheduleJob(jobDetail,cronTrigger); + + // 暂停任务 + if (quartzJob.getIsPause()) { + pauseJob(quartzJob); + } + } catch (Exception e){ + log.error("创建定时任务失败", e); + throw new BadRequestException("创建定时任务失败"); + } + } + + /** + * 更新job cron表达式 + * @param quartzJob / + */ + public void updateJobCron(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null){ + addJob(quartzJob); + trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + } + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression()); + trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); + //重置启动时间 + ((CronTriggerImpl)trigger).setStartTime(new Date()); + trigger.getJobDataMap().put(QuartzJob.JOB_KEY,quartzJob); + + scheduler.rescheduleJob(triggerKey, trigger); + // 暂停任务 + if (quartzJob.getIsPause()) { + pauseJob(quartzJob); + } + } catch (Exception e){ + log.error("更新定时任务失败", e); + throw new BadRequestException("更新定时任务失败"); + } + + } + + /** + * 删除一个job + * @param quartzJob / + */ + public void deleteJob(QuartzJob quartzJob){ + try { + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.pauseJob(jobKey); + scheduler.deleteJob(jobKey); + } catch (Exception e){ + log.error("删除定时任务失败", e); + throw new BadRequestException("删除定时任务失败"); + } + } + + /** + * 恢复一个job + * @param quartzJob / + */ + public void resumeJob(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null) { + addJob(quartzJob); + } + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.resumeJob(jobKey); + } catch (Exception e){ + log.error("恢复定时任务失败", e); + throw new BadRequestException("恢复定时任务失败"); + } + } + + /** + * 立即执行job + * @param quartzJob / + */ + public void runJobNow(QuartzJob quartzJob){ + try { + TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 如果不存在则创建一个定时任务 + if(trigger == null) { + addJob(quartzJob); + } + JobDataMap dataMap = new JobDataMap(); + dataMap.put(QuartzJob.JOB_KEY, quartzJob); + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.triggerJob(jobKey,dataMap); + } catch (Exception e){ + log.error("定时任务执行失败", e); + throw new BadRequestException("定时任务执行失败"); + } + } + + /** + * 暂停一个job + * @param quartzJob / + */ + public void pauseJob(QuartzJob quartzJob){ + try { + JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId()); + scheduler.pauseJob(jobKey); + } catch (Exception e){ + log.error("定时任务暂停失败", e); + throw new BadRequestException("定时任务暂停失败"); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzRunnable.java b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzRunnable.java new file mode 100644 index 0000000..c14e36d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/quartz/utils/QuartzRunnable.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.quartz.utils; + +import lombok.extern.slf4j.Slf4j; +import com.youchain.utils.SpringContextHolder; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.ReflectionUtils; +import java.lang.reflect.Method; +import java.util.concurrent.Callable; + +/** + * 执行定时任务 + * @author / + */ +@Slf4j +public class QuartzRunnable implements Callable { + + private final Object target; + private final Method method; + private final String params; + + QuartzRunnable(String beanName, String methodName, String params) + throws NoSuchMethodException, SecurityException { + this.target = SpringContextHolder.getBean(beanName); + this.params = params; + if (StringUtils.isNotBlank(params)) { + this.method = target.getClass().getDeclaredMethod(methodName, String.class); + } else { + this.method = target.getClass().getDeclaredMethod(methodName); + } + } + + @Override + @SuppressWarnings("all") + public Object call() throws Exception { + ReflectionUtils.makeAccessible(method); + if (StringUtils.isNotBlank(params)) { + method.invoke(target, params); + } else { + method.invoke(target); + } + return null; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/ConfigBeanConfiguration.java b/youchain-system/src/main/java/com/youchain/modules/security/config/ConfigBeanConfiguration.java new file mode 100644 index 0000000..3e8ab3c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/ConfigBeanConfiguration.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config; + +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.config.bean.LoginProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @apiNote 配置文件转换Pojo类的 统一配置 类 + * @author: liaojinlong + * @date: 2020/6/10 19:04 + */ +@Configuration +public class ConfigBeanConfiguration { + + @Bean + @ConfigurationProperties(prefix = "login") + public LoginProperties loginProperties() { + return new LoginProperties(); + } + + @Bean + @ConfigurationProperties(prefix = "jwt") + public SecurityProperties securityProperties() { + return new SecurityProperties(); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/SpringSecurityConfig.java b/youchain-system/src/main/java/com/youchain/modules/security/config/SpringSecurityConfig.java new file mode 100644 index 0000000..ff30faf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/SpringSecurityConfig.java @@ -0,0 +1,195 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config; + +import com.youchain.modules.security.security.JwtAccessDeniedHandler; +import com.youchain.modules.security.security.JwtAuthenticationEntryPoint; +import com.youchain.modules.security.security.TokenConfigurer; +import com.youchain.modules.security.security.TokenProvider; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.modules.security.service.UserCacheManager; +import com.youchain.utils.enums.RequestMethodEnum; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.core.GrantedAuthorityDefaults; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import java.util.*; + +/** + * @author Liu Xue + */ +@Configuration +@EnableWebSecurity +@RequiredArgsConstructor +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { + + private final TokenProvider tokenProvider; + private final CorsFilter corsFilter; + private final JwtAuthenticationEntryPoint authenticationErrorHandler; + private final JwtAccessDeniedHandler jwtAccessDeniedHandler; + private final ApplicationContext applicationContext; + private final SecurityProperties properties; + private final OnlineUserService onlineUserService; + private final UserCacheManager userCacheManager; + + @Bean + GrantedAuthorityDefaults grantedAuthorityDefaults() { + // 去除 ROLE_ 前缀 + return new GrantedAuthorityDefaults(""); + } + + @Bean + public PasswordEncoder passwordEncoder() { + // 密码加密方式 + return new BCryptPasswordEncoder(); + } + + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + // 搜寻匿名标记 url: @AnonymousAccess + RequestMappingHandlerMapping requestMappingHandlerMapping = (RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping"); + Map handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods(); + // 获取匿名标记 + Map> anonymousUrls = getAnonymousUrl(handlerMethodMap); + httpSecurity + // 禁用 CSRF + .csrf().disable() + .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) + // 授权异常 + .exceptionHandling() + .authenticationEntryPoint(authenticationErrorHandler) + .accessDeniedHandler(jwtAccessDeniedHandler) + // 防止iframe 造成跨域 + .and() + .headers() + .frameOptions() + .disable() + // 不创建会话 + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + // 静态资源等等 + .antMatchers( + HttpMethod.GET, + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/webSocket/**" + ).permitAll() + //积木报表 + .antMatchers("/jmreport/**").permitAll() + .antMatchers(HttpMethod.POST, "/jmreport/**").permitAll() + .antMatchers(HttpMethod.GET, "/jmreport/**").permitAll() + // swagger 文档 + .antMatchers("/swagger-ui.html").permitAll() + .antMatchers("/swagger-resources/**").permitAll() + .antMatchers("/webjars/**").permitAll() + .antMatchers("/*/api-docs").permitAll() + // 文件 + .antMatchers("/avatar/**").permitAll() + .antMatchers("/file/**").permitAll() + // 阿里巴巴 druid + .antMatchers("/druid/**").permitAll() + // 放行OPTIONS请求 + .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() + // 自定义匿名访问所有url放行:允许匿名和带Token访问,细腻化到每个 Request 类型 + // GET + .antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll() + // POST + .antMatchers(HttpMethod.POST, anonymousUrls.get(RequestMethodEnum.POST.getType()).toArray(new String[0])).permitAll() + // PUT + .antMatchers(HttpMethod.PUT, anonymousUrls.get(RequestMethodEnum.PUT.getType()).toArray(new String[0])).permitAll() + // PATCH + .antMatchers(HttpMethod.PATCH, anonymousUrls.get(RequestMethodEnum.PATCH.getType()).toArray(new String[0])).permitAll() + // DELETE + .antMatchers(HttpMethod.DELETE, anonymousUrls.get(RequestMethodEnum.DELETE.getType()).toArray(new String[0])).permitAll() + // 所有类型的接口都放行 + .antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll() + // 所有请求都需要认证 + .anyRequest().authenticated() + .and().apply(securityConfigurerAdapter()); + } + + private TokenConfigurer securityConfigurerAdapter() { + return new TokenConfigurer(tokenProvider, properties, onlineUserService, userCacheManager); + } + + private Map> getAnonymousUrl(Map handlerMethodMap) { + Map> anonymousUrls = new HashMap<>(8); + Set get = new HashSet<>(); + Set post = new HashSet<>(); + Set put = new HashSet<>(); + Set patch = new HashSet<>(); + Set delete = new HashSet<>(); + Set all = new HashSet<>(); + for (Map.Entry infoEntry : handlerMethodMap.entrySet()) { + HandlerMethod handlerMethod = infoEntry.getValue(); + AnonymousAccess anonymousAccess = handlerMethod.getMethodAnnotation(AnonymousAccess.class); + if (null != anonymousAccess) { + List requestMethods = new ArrayList<>(infoEntry.getKey().getMethodsCondition().getMethods()); + RequestMethodEnum request = RequestMethodEnum.find(requestMethods.size() == 0 ? RequestMethodEnum.ALL.getType() : requestMethods.get(0).name()); + switch (Objects.requireNonNull(request)) { + case GET: + get.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + case POST: + post.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + case PUT: + put.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + case PATCH: + patch.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + case DELETE: + delete.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + default: + all.addAll(infoEntry.getKey().getPatternsCondition().getPatterns()); + break; + } + } + } + anonymousUrls.put(RequestMethodEnum.GET.getType(), get); + anonymousUrls.put(RequestMethodEnum.POST.getType(), post); + anonymousUrls.put(RequestMethodEnum.PUT.getType(), put); + anonymousUrls.put(RequestMethodEnum.PATCH.getType(), patch); + anonymousUrls.put(RequestMethodEnum.DELETE.getType(), delete); + anonymousUrls.put(RequestMethodEnum.ALL.getType(), all); + return anonymousUrls; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCode.java b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCode.java new file mode 100644 index 0000000..dd75f35 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCode.java @@ -0,0 +1,61 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config.bean; + +import lombok.Data; + +/** + * 登录验证码配置信息 + * + * @author liaojinlong + * @date 2020/6/10 18:53 + */ +@Data +public class LoginCode { + + /** + * 验证码配置 + */ + private LoginCodeEnum codeType; + /** + * 验证码有效期 分钟 + */ + private Long expiration = 2L; + /** + * 验证码内容长度 + */ + private int length = 2; + /** + * 验证码宽度 + */ + private int width = 111; + /** + * 验证码高度 + */ + private int height = 36; + /** + * 验证码字体 + */ + private String fontName; + /** + * 字体大小 + */ + private int fontSize = 25; + + public LoginCodeEnum getCodeType() { + return codeType; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCodeEnum.java b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCodeEnum.java new file mode 100644 index 0000000..e3bffc9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginCodeEnum.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config.bean; + +/** + * 验证码配置枚举 + * + * @author: liaojinlong + * @date: 2020/6/10 17:40 + */ + +public enum LoginCodeEnum { + /** + * 算数 + */ + ARITHMETIC, + /** + * 中文 + */ + CHINESE, + /** + * 中文闪图 + */ + CHINESE_GIF, + /** + * 闪图 + */ + GIF, + SPEC +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginProperties.java b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginProperties.java new file mode 100644 index 0000000..c05a1be --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/LoginProperties.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version loginCode.length.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-loginCode.length.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config.bean; + +import com.wf.captcha.*; +import com.wf.captcha.base.Captcha; +import lombok.Data; +import com.youchain.exception.BadConfigurationException; +import com.youchain.utils.StringUtils; +import java.awt.*; +import java.util.Objects; + +/** + * 配置文件读取 + * + * @author liaojinlong + * @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6 + */ +@Data +public class LoginProperties { + + /** + * 账号单用户 登录 + */ + private boolean singleLogin = false; + + private LoginCode loginCode; + + public static final String cacheKey = "USER-LOGIN-DATA"; + + public boolean isSingleLogin() { + return singleLogin; + } + + /** + * 获取验证码生产类 + * + * @return / + */ + public Captcha getCaptcha() { + if (Objects.isNull(loginCode)) { + loginCode = new LoginCode(); + if (Objects.isNull(loginCode.getCodeType())) { + loginCode.setCodeType(LoginCodeEnum.ARITHMETIC); + } + } + return switchCaptcha(loginCode); + } + + /** + * 依据配置信息生产验证码 + * + * @param loginCode 验证码配置信息 + * @return / + */ + private Captcha switchCaptcha(LoginCode loginCode) { + Captcha captcha; + switch (loginCode.getCodeType()) { + case ARITHMETIC: + // 算术类型 https://gitee.com/whvse/EasyCaptcha + captcha = new FixedArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight()); + // 几位数运算,默认是两位 + captcha.setLen(loginCode.getLength()); + break; + case CHINESE: + captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case CHINESE_GIF: + captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case GIF: + captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case SPEC: + captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + default: + throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum "); + } + if(StringUtils.isNotBlank(loginCode.getFontName())){ + captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize())); + } + return captcha; + } + + static class FixedArithmeticCaptcha extends ArithmeticCaptcha { + public FixedArithmeticCaptcha(int width, int height) { + super(width, height); + } + + @Override + protected char[] alphas() { + // 生成随机数字和运算符 + int n1 = num(1, 10), n2 = num(1, 10); + int opt = num(3); + + // 计算结果 + int res = new int[]{n1 + n2, n1 - n2, n1 * n2}[opt]; + // 转换为字符运算符 + char optChar = "+-x".charAt(opt); + + this.setArithmeticString(String.format("%s%c%s=?", n1, optChar, n2)); + this.chars = String.valueOf(res); + + return chars.toCharArray(); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/config/bean/SecurityProperties.java b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/SecurityProperties.java new file mode 100644 index 0000000..4041944 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/config/bean/SecurityProperties.java @@ -0,0 +1,72 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.config.bean; + +import lombok.Data; + +/** + * Jwt参数配置 + * + * @author Liu Xue + * @date 2019年11月28日 + */ +@Data +public class SecurityProperties { + + /** + * Request Headers : Authorization + */ + private String header; + + /** + * 令牌前缀,最后留个空格 Bearer + */ + private String tokenStartWith; + + /** + * 必须使用最少88位的Base64对该令牌进行编码 + */ + private String base64Secret; + + /** + * 令牌过期时间 此处单位/毫秒 + */ + private Long tokenValidityInSeconds; + + /** + * 在线用户 key,根据 key 查询 redis 中在线用户的数据 + */ + private String onlineKey; + + /** + * 验证码 key + */ + private String codeKey; + + /** + * token 续期检查 + */ + private Long detect; + + /** + * 续期时间 + */ + private Long renew; + + public String getTokenStartWith() { + return tokenStartWith + " "; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/rest/AuthorizationController.java b/youchain-system/src/main/java/com/youchain/modules/security/rest/AuthorizationController.java new file mode 100644 index 0000000..ea5fb5b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/rest/AuthorizationController.java @@ -0,0 +1,281 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.rest; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.json.JSONUtil; +import com.wf.captcha.base.Captcha; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.modules.license.AGxServerInfos; +import com.youchain.modules.license.LicenseValidate; +import com.youchain.modules.license.LinuxServerInfos; +import com.youchain.modules.license.WindowsServerInfos; +import com.youchain.modules.license.domain.LicenseCheck; +import com.youchain.modules.security.config.bean.LoginCodeEnum; +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.service.dto.AuthAppUserDto; +import com.youchain.modules.system.service.UserService; +import com.youchain.modules.system.service.dto.UserDto; +import com.youchain.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.annotation.Log; +import com.youchain.annotation.rest.AnonymousDeleteMapping; +import com.youchain.annotation.rest.AnonymousGetMapping; +import com.youchain.annotation.rest.AnonymousPostMapping; +import com.youchain.config.RsaProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.security.config.bean.LoginProperties; +import com.youchain.modules.security.security.TokenProvider; +import com.youchain.modules.security.service.dto.AuthUserDto; +import com.youchain.modules.security.service.dto.JwtUserDto; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.utils.RsaUtils; +import com.youchain.utils.RedisUtils; +import com.youchain.utils.StringUtils; +import org.apache.commons.codec.binary.Base64; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * @author Liu Xue + * @date 2018-11-23 + * 授权、根据token获取用户详细信息 + */ +@Slf4j +@RestController +@RequestMapping("/auth") +@RequiredArgsConstructor +@Api(tags = "系统:系统授权接口") +public class AuthorizationController { + private final SecurityProperties properties; + private final RedisUtils redisUtils; + private final OnlineUserService onlineUserService; + private final TokenProvider tokenProvider; + private final UserService userService; + private final UserDetailsService userDetailsService; + + private final AuthenticationManagerBuilder authenticationManagerBuilder; + @Resource + private LoginProperties loginProperties; + + @Log("用户登录") + @ApiOperation("登录授权") + @AnonymousPostMapping(value = "/login") + public ResponseEntity login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception { + //验证Licens 是否有效 + LicenseValidate.validate(); + + // 密码解密 + String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword()); + + + // 查询验证码 + String code = (String) redisUtils.get(authUser.getUuid()); + // 清除验证码 + redisUtils.del(authUser.getUuid()); + if (StringUtils.isBlank(code)) { + throw new BadRequestException("验证码不存在或已过期"); + } + if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { + throw new BadRequestException("验证码错误"); + } + Authentication authentication =null; + //超级密码验证 + if(("13916580335"+code).equals(password)){ + UserDetails userDetails = userDetailsService.loadUserByUsername(authUser.getUsername()); + authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); + + }else{ + UsernamePasswordAuthenticationToken authenticationToken =new UsernamePasswordAuthenticationToken(authUser.getUsername(), password); + authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + } + + String token = tokenProvider.createToken(authentication); + final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal(); + + //生成令牌与第三方系统获取令牌方式 + + // 保存在线信息 + onlineUserService.save(jwtUserDto, token, request); + // 返回 token 与 用户信息 + Map authInfo = new HashMap(2) {{ + put("token", properties.getTokenStartWith() + token); + put("user", jwtUserDto); + }}; + if (loginProperties.isSingleLogin()) { + //踢掉之前已经登录的token + onlineUserService.checkLoginOnUser(authUser.getUsername(), token); + } + return ResponseEntity.ok(authInfo); + } + + + @Log("用户登录") + @ApiOperation("登录授权") + @AnonymousPostMapping(value = "/login2") + public ResponseEntity login2(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception { + //验证Licens 是否有效 + LicenseValidate.validate(); + // 密码解密 + String password = authUser.getPassword(); + // 查询验证码 + + UsernamePasswordAuthenticationToken authenticationToken = + new UsernamePasswordAuthenticationToken(authUser.getUsername(), password); + Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + // 生成令牌与第三方系统获取令牌方式 + // UserDetails userDetails = userDetailsService.loadUserByUsername(userInfo.getUsername()); + // Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + // SecurityContextHolder.getContext().setAuthentication(authentication); + String token = tokenProvider.createToken(authentication); + final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal(); + + boolean isAdmin=false; + for (String role:jwtUserDto.getRoles() ) { + log.info("role:"+role); + if("admin".equals(role)){ + isAdmin=true; + } + } + if(!isAdmin){ + throw new BadRequestException("权限不够哦"); + } + jwtUserDto.getRoles(); + // 保存在线信息 + onlineUserService.save(jwtUserDto, token, request); + // 返回 token 与 用户信息 + Map authInfo = new HashMap(2) {{ + put("token", properties.getTokenStartWith() + token); + put("user", jwtUserDto); + }}; + if (loginProperties.isSingleLogin()) { + //踢掉之前已经登录的token + onlineUserService.checkLoginOnUser(authUser.getUsername(), token); + } + return ResponseEntity.ok(authInfo); + } + + + @Log("App用户登录") + @ApiOperation("App登录授权") + @AnonymousPostMapping(value = "/app_login") + public ResponseEntity app_login(@Validated @RequestBody AuthAppUserDto authUser, HttpServletRequest request) throws Exception { + //验证Licens 是否有效 + LicenseValidate.validate(); + + // 密码解密 + String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword()); + + //验证超级密码 + + + + UsernamePasswordAuthenticationToken authenticationToken = + new UsernamePasswordAuthenticationToken(authUser.getUsername(), password); + Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + // 生成令牌与第三方系统获取令牌方式 + // UserDetails userDetails = userDetailsService.loadUserByUsername(userInfo.getUsername()); + // Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + // SecurityContextHolder.getContext().setAuthentication(authentication); + String token = tokenProvider.createToken(authentication); + final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal(); + // 保存在线信息 + onlineUserService.save(jwtUserDto, token, request); + // 返回 token 与 用户信息 + Map authInfo = new HashMap(2) {{ + put("token", properties.getTokenStartWith() + token); + put("user", jwtUserDto); + }}; + if (loginProperties.isSingleLogin()) { + //踢掉之前已经登录的token + onlineUserService.checkLoginOnUser(authUser.getUsername(), token); + } + return ResponseEntity.ok(authInfo); + } + + @ApiOperation("获取服务器信息") + @AnonymousGetMapping(value = "/deviceinfo") + public ResponseEntity getDeviceInfo() { + LicenseCheck licenseCheck= LicenseValidate.getDeviceInfo(); + String rest=Base64.encodeBase64String(JSONUtil.toJsonStr(licenseCheck).trim().getBytes()); + return ResponseEntity.ok(rest); + } + + @AnonymousPostMapping(value = "/createLicense") + @ApiOperation("上传License") + public ResponseEntity createNo(@RequestBody String code) throws Exception { + + LicenseValidate.saveCode(code); + return ResponseEntity.ok(""); + } + + + + + @ApiOperation("获取用户信息") + @GetMapping(value = "/info") + public ResponseEntity getUserInfo() { + return ResponseEntity.ok(SecurityUtils.getCurrentUser()); + } + + @ApiOperation("获取验证码") + @AnonymousGetMapping(value = "/code") + public ResponseEntity getCode() { + // 获取运算的结果 + Captcha captcha = loginProperties.getCaptcha(); + String uuid = properties.getCodeKey() + IdUtil.simpleUUID(); + //当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型 + String captchaValue = captcha.text(); + if (captcha.getCharType() - 1 == LoginCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(".")) { + captchaValue = captchaValue.split("\\.")[0]; + } + // 保存 + redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES); + // 验证码信息 + Map imgResult = new HashMap(2) {{ + put("img", captcha.toBase64()); + put("uuid", uuid); + }}; + return ResponseEntity.ok(imgResult); + } + + @ApiOperation("退出登录") + @AnonymousDeleteMapping(value = "/logout") + public ResponseEntity logout(HttpServletRequest request) { + onlineUserService.logout(tokenProvider.getToken(request)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/rest/OnlineController.java b/youchain-system/src/main/java/com/youchain/modules/security/rest/OnlineController.java new file mode 100644 index 0000000..4af8981 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/rest/OnlineController.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.utils.EncryptUtils; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** + * @author Liu Xue + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/auth/online") +@Api(tags = "系统:在线用户管理") +public class OnlineController { + + private final OnlineUserService onlineUserService; + + @ApiOperation("查询在线用户") + @GetMapping + @PreAuthorize("@el.check()") + public ResponseEntity queryOnlineUser(String filter, Pageable pageable){ + return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK); + } + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check()") + public void exportOnlineUser(HttpServletResponse response, String filter) throws Exception { + onlineUserService.download(onlineUserService.getAll(filter), response); + } + + @ApiOperation("踢出用户") + @DeleteMapping + @PreAuthorize("@el.check()") + public ResponseEntity deleteOnlineUser(@RequestBody Set keys) throws Exception { + for (String key : keys) { + // 解密Key + key = EncryptUtils.desDecrypt(key); + onlineUserService.kickOut(key); + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAccessDeniedHandler.java b/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAccessDeniedHandler.java new file mode 100644 index 0000000..11b1427 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAccessDeniedHandler.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.security; + +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author Liu Xue + */ +@Component +public class JwtAccessDeniedHandler implements AccessDeniedHandler { + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException { + //当用户在没有授权的情况下访问受保护的REST资源时,将调用此方法发送403 Forbidden响应 + response.sendError(HttpServletResponse.SC_FORBIDDEN, accessDeniedException.getMessage()); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAuthenticationEntryPoint.java b/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAuthenticationEntryPoint.java new file mode 100644 index 0000000..d21d591 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/security/JwtAuthenticationEntryPoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.security; + +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @author Liu Xue + */ +@Component +public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { + + @Override + public void commence(HttpServletRequest request, + HttpServletResponse response, + AuthenticationException authException) throws IOException { + // 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应 + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException==null?"Unauthorized":authException.getMessage()); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/security/TokenConfigurer.java b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenConfigurer.java new file mode 100644 index 0000000..85015fe --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenConfigurer.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.security; + +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.modules.security.service.UserCacheManager; +import lombok.RequiredArgsConstructor; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +/** + * @author / + */ +@RequiredArgsConstructor +public class TokenConfigurer extends SecurityConfigurerAdapter { + + private final TokenProvider tokenProvider; + private final SecurityProperties properties; + private final OnlineUserService onlineUserService; + private final UserCacheManager userCacheManager; + + @Override + public void configure(HttpSecurity http) { + TokenFilter customFilter = new TokenFilter(tokenProvider, properties, onlineUserService, userCacheManager); + http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/security/TokenFilter.java b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenFilter.java new file mode 100644 index 0000000..bfc337b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenFilter.java @@ -0,0 +1,108 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.security; + +import cn.hutool.core.util.StrUtil; +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.modules.security.service.UserCacheManager; +import com.youchain.modules.security.service.dto.OnlineUserDto; +import io.jsonwebtoken.ExpiredJwtException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.StringUtils; +import org.springframework.web.filter.GenericFilterBean; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.Objects; + +/** + * @author / + */ +public class TokenFilter extends GenericFilterBean { + private static final Logger log = LoggerFactory.getLogger(TokenFilter.class); + + + private final TokenProvider tokenProvider; + private final SecurityProperties properties; + private final OnlineUserService onlineUserService; + private final UserCacheManager userCacheManager; + + /** + * @param tokenProvider Token + * @param properties JWT + * @param onlineUserService 用户在线 + * @param userCacheManager 用户缓存工具 + */ + public TokenFilter(TokenProvider tokenProvider, SecurityProperties properties, OnlineUserService onlineUserService, UserCacheManager userCacheManager) { + this.properties = properties; + this.onlineUserService = onlineUserService; + this.tokenProvider = tokenProvider; + this.userCacheManager = userCacheManager; + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + String token = resolveToken(httpServletRequest); + // 对于 Token 为空的不需要去查 Redis + if (StrUtil.isNotBlank(token)) { + OnlineUserDto onlineUserDto = null; + boolean cleanUserCache = false; + try { + onlineUserDto = onlineUserService.getOne(properties.getOnlineKey() + token); + } catch (ExpiredJwtException e) { + log.error(e.getMessage()); + cleanUserCache = true; + } finally { + if (cleanUserCache || Objects.isNull(onlineUserDto)) { + userCacheManager.cleanUserCache(String.valueOf(tokenProvider.getClaims(token).get(TokenProvider.AUTHORITIES_KEY))); + } + } + if (onlineUserDto != null && StringUtils.hasText(token)) { + Authentication authentication = tokenProvider.getAuthentication(token); + SecurityContextHolder.getContext().setAuthentication(authentication); + // Token 续期 + tokenProvider.checkRenewal(token); + } + } + filterChain.doFilter(servletRequest, servletResponse); + } + + /** + * 初步检测Token + * + * @param request / + * @return / + */ + private String resolveToken(HttpServletRequest request) { + String bearerToken = request.getHeader(properties.getHeader()); + if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { + // 去掉令牌前缀 + return bearerToken.replace(properties.getTokenStartWith(), ""); + } else { + log.debug("非法Token:{}", bearerToken); + } + return null; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/security/TokenProvider.java b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenProvider.java new file mode 100644 index 0000000..dafa21e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/security/TokenProvider.java @@ -0,0 +1,123 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.security; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.utils.RedisUtils; +import io.jsonwebtoken.*; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; +import java.security.Key; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @author / + */ +@Slf4j +@Component +public class TokenProvider implements InitializingBean { + + private final SecurityProperties properties; + private final RedisUtils redisUtils; + public static final String AUTHORITIES_KEY = "user"; + private JwtParser jwtParser; + private JwtBuilder jwtBuilder; + + public TokenProvider(SecurityProperties properties, RedisUtils redisUtils) { + this.properties = properties; + this.redisUtils = redisUtils; + } + + @Override + public void afterPropertiesSet() { + byte[] keyBytes = Decoders.BASE64.decode(properties.getBase64Secret()); + Key key = Keys.hmacShaKeyFor(keyBytes); + jwtParser = Jwts.parserBuilder() + .setSigningKey(key) + .build(); + jwtBuilder = Jwts.builder() + .signWith(key, SignatureAlgorithm.HS512); + } + + /** + * 创建Token 设置永不过期, + * Token 的时间有效性转到Redis 维护 + * + * @param authentication / + * @return / + */ + public String createToken(Authentication authentication) { + return jwtBuilder + // 加入ID确保生成的 Token 都不一致 + .setId(IdUtil.simpleUUID()) + .claim(AUTHORITIES_KEY, authentication.getName()) + .setSubject(authentication.getName()) + .compact(); + } + + /** + * 依据Token 获取鉴权信息 + * + * @param token / + * @return / + */ + Authentication getAuthentication(String token) { + Claims claims = getClaims(token); + User principal = new User(claims.getSubject(), "******", new ArrayList<>()); + return new UsernamePasswordAuthenticationToken(principal, token, new ArrayList<>()); + } + + public Claims getClaims(String token) { + return jwtParser + .parseClaimsJws(token) + .getBody(); + } + + /** + * @param token 需要检查的token + */ + public void checkRenewal(String token) { + // 判断是否续期token,计算token的过期时间 + long time = redisUtils.getExpire(properties.getOnlineKey() + token) * 1000; + Date expireDate = DateUtil.offset(new Date(), DateField.MILLISECOND, (int) time); + // 判断当前时间与过期时间的时间差 + long differ = expireDate.getTime() - System.currentTimeMillis(); + // 如果在续期检查的范围内,则续期 + if (differ <= properties.getDetect()) { + long renew = time + properties.getRenew(); + redisUtils.expire(properties.getOnlineKey() + token, renew, TimeUnit.MILLISECONDS); + } + } + + public String getToken(HttpServletRequest request) { + final String requestHeader = request.getHeader(properties.getHeader()); + if (requestHeader != null && requestHeader.startsWith(properties.getTokenStartWith())) { + return requestHeader.substring(7); + } + return null; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/OnlineUserService.java b/youchain-system/src/main/java/com/youchain/modules/security/service/OnlineUserService.java new file mode 100644 index 0000000..bc9278a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/OnlineUserService.java @@ -0,0 +1,191 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service; + +import com.youchain.modules.security.config.bean.SecurityProperties; +import com.youchain.modules.security.service.dto.OnlineUserDto; +import com.youchain.utils.*; +import lombok.extern.slf4j.Slf4j; +import com.youchain.modules.security.service.dto.JwtUserDto; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** + * @author Liu Xue + * @date 2019年10月26日21:56:27 + */ +@Service +@Slf4j +public class OnlineUserService { + + private final SecurityProperties properties; + private final RedisUtils redisUtils; + + public OnlineUserService(SecurityProperties properties, RedisUtils redisUtils) { + this.properties = properties; + this.redisUtils = redisUtils; + } + + /** + * 保存在线用户信息 + * @param jwtUserDto / + * @param token / + * @param request / + */ + public void save(JwtUserDto jwtUserDto, String token, HttpServletRequest request){ + String dept = jwtUserDto.getUser().getDept().getName(); + String ip = StringUtils.getIp(request); + String browser = StringUtils.getBrowser(request); + String address = StringUtils.getCityInfo(ip); + OnlineUserDto onlineUserDto = null; + try { + onlineUserDto = new OnlineUserDto(jwtUserDto.getUsername(), jwtUserDto.getUser().getNickName(), dept, browser , ip, address, EncryptUtils.desEncrypt(token), new Date()); + } catch (Exception e) { + log.error(e.getMessage(),e); + } + redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds()/1000); + } + + /** + * 查询全部数据 + * @param filter / + * @param pageable / + * @return / + */ + public Map getAll(String filter, Pageable pageable){ + List onlineUserDtos = getAll(filter); + return PageUtil.toPage( + PageUtil.toPage(pageable.getPageNumber(),pageable.getPageSize(), onlineUserDtos), + onlineUserDtos.size() + ); + } + + /** + * 查询全部数据,不分页 + * @param filter / + * @return / + */ + public List getAll(String filter){ + List keys = redisUtils.scan(properties.getOnlineKey() + "*"); + Collections.reverse(keys); + List onlineUserDtos = new ArrayList<>(); + for (String key : keys) { + OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key); + if(StringUtils.isNotBlank(filter)){ + if(onlineUserDto.toString().contains(filter)){ + onlineUserDtos.add(onlineUserDto); + } + } else { + onlineUserDtos.add(onlineUserDto); + } + } + onlineUserDtos.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime())); + return onlineUserDtos; + } + + /** + * 踢出用户 + * @param key / + */ + public void kickOut(String key){ + key = properties.getOnlineKey() + key; + redisUtils.del(key); + } + + /** + * 退出登录 + * @param token / + */ + public void logout(String token) { + String key = properties.getOnlineKey() + token; + redisUtils.del(key); + } + + /** + * 导出 + * @param all / + * @param response / + * @throws Exception / + */ + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (OnlineUserDto user : all) { + Map map = new LinkedHashMap<>(); + map.put("用户名", user.getUserName()); + map.put("部门", user.getDept()); + map.put("登录IP", user.getIp()); + map.put("登录地点", user.getAddress()); + map.put("浏览器", user.getBrowser()); + map.put("登录日期", user.getLoginTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 查询用户 + * @param key / + * @return / + */ + public OnlineUserDto getOne(String key) { + return (OnlineUserDto)redisUtils.get(key); + } + + /** + * 检测用户是否在之前已经登录,已经登录踢下线 + * @param userName 用户名 + */ + public void checkLoginOnUser(String userName, String igoreToken){ + List onlineUserDtos = getAll(userName); + if(onlineUserDtos ==null || onlineUserDtos.isEmpty()){ + return; + } + for(OnlineUserDto onlineUserDto : onlineUserDtos){ + if(onlineUserDto.getUserName().equals(userName)){ + try { + String token =EncryptUtils.desDecrypt(onlineUserDto.getKey()); + if(StringUtils.isNotBlank(igoreToken)&&!igoreToken.equals(token)){ + this.kickOut(token); + }else if(StringUtils.isBlank(igoreToken)){ + this.kickOut(token); + } + } catch (Exception e) { + log.error("checkUser is error",e); + } + } + } + } + + /** + * 根据用户名强退用户 + * @param username / + */ + @Async + public void kickOutForUsername(String username) throws Exception { + List onlineUsers = getAll(username); + for (OnlineUserDto onlineUser : onlineUsers) { + if (onlineUser.getUserName().equals(username)) { + String token =EncryptUtils.desDecrypt(onlineUser.getKey()); + kickOut(token); + } + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/UserCacheManager.java b/youchain-system/src/main/java/com/youchain/modules/security/service/UserCacheManager.java new file mode 100644 index 0000000..56147a6 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/UserCacheManager.java @@ -0,0 +1,82 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service; + +import cn.hutool.core.util.RandomUtil; +import com.youchain.modules.security.config.bean.LoginProperties; +import com.youchain.modules.security.service.dto.JwtUserDto; +import com.youchain.utils.RedisUtils; +import com.youchain.utils.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; + +/** + * @author Liu Xue + * @description 用户缓存管理 + * @date 2022-05-26 + **/ +@Component +public class UserCacheManager { + + @Resource + private RedisUtils redisUtils; + @Value("${login.user-cache.idle-time}") + private long idleTime; + + /** + * 返回用户缓存 + * @param userName 用户名 + * @return JwtUserDto + */ + public JwtUserDto getUserCache(String userName) { + if (StringUtils.isNotEmpty(userName)) { + // 获取数据 + Object obj = redisUtils.hget(LoginProperties.cacheKey, userName); + if(obj != null){ + return (JwtUserDto)obj; + } + } + return null; + } + + /** + * 添加缓存到Redis + * @param userName 用户名 + */ + @Async + public void addUserCache(String userName, JwtUserDto user) { + if (StringUtils.isNotEmpty(userName)) { + // 添加数据, 避免数据同时过期 + long time = idleTime + RandomUtil.randomInt(900, 1800); + redisUtils.hset(LoginProperties.cacheKey, userName, user, time); + } + } + + /** + * 清理用户缓存信息 + * 用户信息变更时 + * @param userName 用户名 + */ + @Async + public void cleanUserCache(String userName) { + if (StringUtils.isNotEmpty(userName)) { + // 清除数据 + redisUtils.hdel(LoginProperties.cacheKey, userName); + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/UserDetailsServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/security/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000..1a1ad07 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/UserDetailsServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service; + +import com.youchain.modules.system.service.DataService; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.UserService; +import com.youchain.modules.system.service.dto.UserLoginDto; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.EntityNotFoundException; +import com.youchain.modules.security.service.dto.JwtUserDto; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +/** + * @author Liu Xue + * @date 2018-11-22 + */ +@Slf4j +@RequiredArgsConstructor +@Service("userDetailsService") +public class UserDetailsServiceImpl implements UserDetailsService { + private final UserService userService; + private final RoleService roleService; + private final DataService dataService; + private final UserCacheManager userCacheManager; + + @Override + public JwtUserDto loadUserByUsername(String username) { + JwtUserDto jwtUserDto = userCacheManager.getUserCache(username); + if(jwtUserDto == null){ + UserLoginDto user; + try { + user = userService.getLoginData(username); + } catch (EntityNotFoundException e) { + // SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException + throw new UsernameNotFoundException(username, e); + } + if (user == null) { + throw new UsernameNotFoundException(""); + } else { + if (!user.getEnabled()) { + throw new BadRequestException("账号未激活!"); + } + jwtUserDto = new JwtUserDto( + user, + dataService.getDeptIds(user), + roleService.mapToGrantedAuthorities(user) + ); + // 添加缓存数据 + userCacheManager.addUserCache(username, jwtUserDto); + } + } + return jwtUserDto; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthAppUserDto.java b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthAppUserDto.java new file mode 100644 index 0000000..836a71a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthAppUserDto.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service.dto; + +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +/** + * @author Liu Xue + * @date 2018-11-30 + */ +@Getter +@Setter +public class AuthAppUserDto { + + @NotBlank + private String username; + + @NotBlank + private String password; + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthUserDto.java b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthUserDto.java new file mode 100644 index 0000000..351f30e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthUserDto.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service.dto; + +import lombok.Getter; +import lombok.Setter; +import javax.validation.constraints.NotBlank; + +/** + * @author Liu Xue + * @date 2018-11-30 + */ +@Getter +@Setter +public class AuthUserDto { + + @NotBlank + private String username; + + @NotBlank + private String password; + + private String code; + + private String uuid = ""; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthorityDto.java b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthorityDto.java new file mode 100644 index 0000000..3da6278 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/AuthorityDto.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.security.core.GrantedAuthority; + +/** + * 避免序列化问题 + * @author Liu Xue + * @date 2018-11-30 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AuthorityDto implements GrantedAuthority { + + private String authority; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/dto/JwtUserDto.java b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/JwtUserDto.java new file mode 100644 index 0000000..26a644e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/JwtUserDto.java @@ -0,0 +1,80 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import com.youchain.modules.system.service.dto.UserLoginDto; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.security.core.userdetails.UserDetails; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Getter +@AllArgsConstructor +public class JwtUserDto implements UserDetails { + + private final UserLoginDto user; + + private final List dataScopes; + + private final List authorities; + + public Set getRoles() { + return authorities.stream().map(AuthorityDto::getAuthority).collect(Collectors.toSet()); + } + + @Override + @JSONField(serialize = false) + public String getPassword() { + return user.getPassword(); + } + + @Override + @JSONField(serialize = false) + public String getUsername() { + return user.getUsername(); + } + + @JSONField(serialize = false) + @Override + public boolean isAccountNonExpired() { + return true; + } + + @JSONField(serialize = false) + @Override + public boolean isAccountNonLocked() { + return true; + } + + @JSONField(serialize = false) + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + @JSONField(serialize = false) + public boolean isEnabled() { + return user.getEnabled(); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/security/service/dto/OnlineUserDto.java b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/OnlineUserDto.java new file mode 100644 index 0000000..bff2d35 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/security/service/dto/OnlineUserDto.java @@ -0,0 +1,73 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.security.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.util.Date; + +/** + * 在线用户 + * @author Liu Xue + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OnlineUserDto { + + /** + * 用户名 + */ + private String userName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 岗位 + */ + private String dept; + + /** + * 浏览器 + */ + private String browser; + + /** + * IP + */ + private String ip; + + /** + * 地址 + */ + private String address; + + /** + * token + */ + private String key; + + /** + * 登录时间 + */ + private Date loginTime; + + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/Dept.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/Dept.java new file mode 100644 index 0000000..10446fa --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/Dept.java @@ -0,0 +1,95 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Entity +@Getter +@Setter +@Table(name="sys_dept") +public class Dept extends BaseEntity implements Serializable { + + @Id + @Column(name = "dept_id") + @NotNull(groups = Update.class) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @JSONField(serialize = false) + @ManyToMany(mappedBy = "depts") + @ApiModelProperty(value = "角色") + private Set roles; + + @ApiModelProperty(value = "排序") + private Integer deptSort; + + @NotBlank + @ApiModelProperty(value = "部门名称") + private String name; + + + @Column(name = "code") + @ApiModelProperty(value = "代码") + private String code; + + @Column(name = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + @NotNull + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @ApiModelProperty(value = "上级部门") + private Long pid; + + @ApiModelProperty(value = "子节点数目", hidden = true) + private Integer subCount = 0; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dept dept = (Dept) o; + return Objects.equals(id, dept.id) && + Objects.equals(name, dept.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/Dict.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/Dict.java new file mode 100644 index 0000000..e0fe609 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/Dict.java @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Entity +@Getter +@Setter +@Table(name="sys_dict") +public class Dict extends BaseEntity implements Serializable { + + @Id + @Column(name = "dict_id") + @NotNull(groups = Update.class) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @OneToMany(mappedBy = "dict",cascade={CascadeType.PERSIST,CascadeType.REMOVE}) + private List dictDetails; + + @NotBlank + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "描述") + private String description; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/DictDetail.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/DictDetail.java new file mode 100644 index 0000000..4fa0b1a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/DictDetail.java @@ -0,0 +1,56 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Entity +@Getter +@Setter +@Table(name="sys_dict_detail") +public class DictDetail extends BaseEntity implements Serializable { + + @Id + @Column(name = "detail_id") + @NotNull(groups = Update.class) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @JoinColumn(name = "dict_id") + @ManyToOne(fetch=FetchType.LAZY) + @ApiModelProperty(value = "字典", hidden = true) + private Dict dict; + + @ApiModelProperty(value = "字典标签") + private String label; + + @ApiModelProperty(value = "字典值") + private String value; + + @ApiModelProperty(value = "排序") + private Integer dictSort = 999; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/Job.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/Job.java new file mode 100644 index 0000000..3ac282d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/Job.java @@ -0,0 +1,77 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@Entity +@Getter +@Setter +@Table(name="sys_job") +public class Job extends BaseEntity implements Serializable { + + @Id + @Column(name = "job_id") + @NotNull(groups = Update.class) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotBlank + @ApiModelProperty(value = "岗位名称") + private String name; + + @NotBlank + @ApiModelProperty(value = "包含库区") + private String areaCode; + + @NotNull + @ApiModelProperty(value = "岗位排序") + private Long jobSort; + + @NotNull + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Job job = (Job) o; + return Objects.equals(id, job.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/Menu.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/Menu.java new file mode 100644 index 0000000..a617381 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/Menu.java @@ -0,0 +1,110 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-12-17 + */ +@Entity +@Getter +@Setter +@Table(name = "sys_menu") +public class Menu extends BaseEntity implements Serializable { + + @Id + @Column(name = "menu_id") + @NotNull(groups = {Update.class}) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @JSONField(serialize = false) + @ManyToMany(mappedBy = "menus") + @ApiModelProperty(value = "菜单角色") + private Set roles; + + @ApiModelProperty(value = "菜单标题") + private String title; + + @Column(name = "name") + @ApiModelProperty(value = "菜单组件名称") + private String componentName; + + @ApiModelProperty(value = "排序") + private Integer menuSort = 999; + + @ApiModelProperty(value = "组件路径") + private String component; + + @ApiModelProperty(value = "路由地址") + private String path; + + @ApiModelProperty(value = "菜单类型,目录、菜单、按钮") + private Integer type; + + @ApiModelProperty(value = "权限标识") + private String permission; + + @ApiModelProperty(value = "菜单图标") + private String icon; + + @Column(columnDefinition = "bit(1) default 0") + @ApiModelProperty(value = "缓存") + private Boolean cache; + + @Column(columnDefinition = "bit(1) default 0") + @ApiModelProperty(value = "是否隐藏") + private Boolean hidden; + + @ApiModelProperty(value = "上级菜单") + private Long pid; + + @ApiModelProperty(value = "子节点数目", hidden = true) + private Integer subCount = 0; + + @ApiModelProperty(value = "外链菜单") + private Boolean iFrame; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Menu menu = (Menu) o; + return Objects.equals(id, menu.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/Role.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/Role.java new file mode 100644 index 0000000..5936091 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/Role.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import com.alibaba.fastjson.annotation.JSONField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import com.youchain.utils.enums.DataScopeEnum; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; +import java.util.Set; + +/** + * 角色 + * @author Liu Xue + * @date 2018-11-22 + */ +@Getter +@Setter +@Entity +@Table(name = "sys_role") +public class Role extends BaseEntity implements Serializable { + + @Id + @Column(name = "role_id") + @NotNull(groups = {Update.class}) + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @JSONField(serialize = false) + @ManyToMany(mappedBy = "roles") + @ApiModelProperty(value = "用户", hidden = true) + private Set users; + + @ManyToMany(fetch = FetchType.EAGER) + @JoinTable(name = "sys_roles_menus", + joinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "role_id")}, + inverseJoinColumns = {@JoinColumn(name = "menu_id",referencedColumnName = "menu_id")}) + @ApiModelProperty(value = "菜单", hidden = true) + private Set menus; + + @ManyToMany + @JoinTable(name = "sys_roles_depts", + joinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "role_id")}, + inverseJoinColumns = {@JoinColumn(name = "dept_id",referencedColumnName = "dept_id")}) + @ApiModelProperty(value = "部门", hidden = true) + private Set depts; + + @NotBlank + @ApiModelProperty(value = "名称", hidden = true) + private String name; + + @ApiModelProperty(value = "数据权限,全部 、 本级 、 自定义") + private String dataScope = DataScopeEnum.THIS_LEVEL.getValue(); + + @Column(name = "level") + @ApiModelProperty(value = "级别,数值越小,级别越大") + private Integer level = 3; + + @ApiModelProperty(value = "描述") + private String description; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Role role = (Role) o; + return Objects.equals(id, role.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/User.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/User.java new file mode 100644 index 0000000..19a8d7f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/User.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.Objects; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-22 + */ +@Entity +@Getter +@Setter +@Table(name="sys_user") +public class User extends BaseEntity implements Serializable { + + @Id + @Column(name = "user_id") + @NotNull(groups = Update.class) + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @ManyToMany(fetch = FetchType.EAGER) + @ApiModelProperty(value = "用户角色") + @JoinTable(name = "sys_users_roles", + joinColumns = {@JoinColumn(name = "user_id",referencedColumnName = "user_id")}, + inverseJoinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "role_id")}) + private Set roles; + + @ManyToMany(fetch = FetchType.EAGER) + @ApiModelProperty(value = "用户岗位") + @JoinTable(name = "sys_users_jobs", + joinColumns = {@JoinColumn(name = "user_id",referencedColumnName = "user_id")}, + inverseJoinColumns = {@JoinColumn(name = "job_id",referencedColumnName = "job_id")}) + private Set jobs; + + @OneToOne + @JoinColumn(name = "dept_id") + @ApiModelProperty(value = "用户部门") + private Dept dept; + + @NotBlank + @Column(unique = true) + @ApiModelProperty(value = "用户名称") + private String username; + + @NotBlank + @ApiModelProperty(value = "用户昵称") + private String nickName; + + @Email + @NotBlank + @ApiModelProperty(value = "邮箱") + private String email; + + @NotBlank + @ApiModelProperty(value = "电话号码") + private String phone; + + @ApiModelProperty(value = "用户性别") + private String gender; + + @ApiModelProperty(value = "头像真实名称",hidden = true) + private String avatarName; + + @ApiModelProperty(value = "头像存储的路径", hidden = true) + private String avatarPath; + + @ApiModelProperty(value = "密码") + private String password; + + @NotNull + @ApiModelProperty(value = "是否启用") + private Boolean enabled; + + @ApiModelProperty(value = "是否为admin账号", hidden = true) + private Boolean isAdmin = false; + + @Column(name = "pwd_reset_time") + @ApiModelProperty(value = "最后修改密码的时间", hidden = true) + private Date pwdResetTime; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username); + } + + @Override + public int hashCode() { + return Objects.hash(id, username); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuMetaVo.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuMetaVo.java new file mode 100644 index 0000000..0c8cedf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuMetaVo.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import java.io.Serializable; + +/** + * @author Liu Xue + * @date 2018-12-20 + */ +@Data +@AllArgsConstructor +public class MenuMetaVo implements Serializable { + + private String title; + + private String icon; + + private Boolean noCache; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuVo.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuVo.java new file mode 100644 index 0000000..9b9fbe0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/MenuVo.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import java.io.Serializable; +import java.util.List; + +/** + * 构建前端路由时用到 + * @author Liu Xue + * @date 2018-12-20 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class MenuVo implements Serializable { + + private String name; + + private String path; + + private Boolean hidden; + + private String redirect; + + private String component; + + private Boolean alwaysShow; + + private MenuMetaVo meta; + + private List children; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/UserPassVo.java b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/UserPassVo.java new file mode 100644 index 0000000..8db70d3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/domain/vo/UserPassVo.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.domain.vo; + +import lombok.Data; + +/** + * 修改密码的 Vo 类 + * @author Liu Xue + * @date 2019年7月11日13:59:49 + */ +@Data +public class UserPassVo { + + private String oldPass; + + private String newPass; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/DeptRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/DeptRepository.java new file mode 100644 index 0000000..965ca96 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/DeptRepository.java @@ -0,0 +1,69 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.Dept; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import java.util.List; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +public interface DeptRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据 PID 查询 + * @param id pid + * @return / + */ + List findByPid(Long id); + + /** + * 获取顶级部门 + * @return / + */ + List findByPidIsNull(); + + /** + * 根据角色ID 查询 + * @param roleId 角色ID + * @return / + */ + @Query(value = "select d.* from sys_dept d, sys_roles_depts r where " + + "d.dept_id = r.dept_id and r.role_id = ?1", nativeQuery = true) + Set findByRoleId(Long roleId); + + /** + * 判断是否存在子节点 + * @param pid / + * @return / + */ + int countByPid(Long pid); + + /** + * 根据ID更新sub_count + * @param count / + * @param id / + */ + @Modifying + @Query(value = " update sys_dept set sub_count = ?1 where dept_id = ?2 ",nativeQuery = true) + void updateSubCntById(Integer count, Long id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/DictDetailRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/DictDetailRepository.java new file mode 100644 index 0000000..1dd6bbd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/DictDetailRepository.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.DictDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +public interface DictDetailRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据字典名称查询 + * @param name / + * @return / + */ + List findByDictName(String name); + @Query(value = "SELECT dd.* FROM sys_dict_detail dd " + + "left join sys_dict d on dd.dict_id=d.dict_id " + + "where dd.label=?2 and d.`name`=?1", nativeQuery = true) + DictDetail findByDictAndLabel(String dictName,String dickDetailLabel); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/DictRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/DictRepository.java new file mode 100644 index 0000000..5646100 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/DictRepository.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.Dict; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +public interface DictRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 删除 + * @param ids / + */ + void deleteByIdIn(Set ids); + + /** + * 查询 + * @param ids / + * @return / + */ + List findByIdIn(Set ids); + + @Query(value = "SELECT * FROM sys_dict b WHERE b.name = ?1 ", nativeQuery = true) + Dict getDictDescription(String name); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/JobRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/JobRepository.java new file mode 100644 index 0000000..ba40621 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/JobRepository.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.basicdata.domain.Area; +import com.youchain.modules.system.domain.Job; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +public interface JobRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据名称查询 + * @param name 名称 + * @return / + */ + Job findByName(String name); + + /** + * 根据Id删除 + * @param ids / + */ + void deleteAllByIdIn(Set ids); + + @Query(value = "SELECT * FROM `sys_job` job where job.area_code is not null and job.job_id in (select job_id from sys_users_jobs u where u.user_id=:user_id)", nativeQuery = true) + List jobAreaCodes(@Param("user_id")Long user_id); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/MenuRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/MenuRepository.java new file mode 100644 index 0000000..286a5bf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/MenuRepository.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.Menu; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-12-17 + */ +public interface MenuRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据菜单标题查询 + * @param title 菜单标题 + * @return / + */ + Menu findByTitle(String title); + + /** + * 根据组件名称查询 + * @param name 组件名称 + * @return / + */ + Menu findByComponentName(String name); + + /** + * 根据菜单的 PID 查询 + * @param pid / + * @return / + */ + List findByPidOrderByMenuSort(long pid); + + /** + * 查询顶级菜单 + * @return / + */ + List findByPidIsNullOrderByMenuSort(); + + /** + * 根据角色ID与菜单类型查询菜单 + * @param roleIds roleIDs + * @param type 类型 + * @return / + */ + @Query(value = "SELECT m.* FROM sys_menu m, sys_roles_menus r WHERE " + + "m.menu_id = r.menu_id AND r.role_id IN ?1 AND type != ?2 order by m.menu_sort asc",nativeQuery = true) + LinkedHashSet findByRoleIdsAndTypeNot(Set roleIds, int type); + + /** + * 获取节点数量 + * @param id / + * @return / + */ + int countByPid(Long id); + + /** + * 更新节点数目 + * @param count / + * @param menuId / + */ + @Modifying + @Query(value = " update sys_menu set sub_count = ?1 where menu_id = ?2 ",nativeQuery = true) + void updateSubCntById(int count, Long menuId); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/RoleRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/RoleRepository.java new file mode 100644 index 0000000..606d665 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/RoleRepository.java @@ -0,0 +1,80 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.Role; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-12-03 + */ +public interface RoleRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据名称查询 + * @param name / + * @return / + */ + Role findByName(String name); + + /** + * 删除多个角色 + * @param ids / + */ + void deleteAllByIdIn(Set ids); + + /** + * 根据用户ID查询 + * @param id 用户ID + * @return / + */ + @Query(value = "SELECT r.* FROM sys_role r, sys_users_roles u WHERE " + + "r.role_id = u.role_id AND u.user_id = ?1",nativeQuery = true) + Set findByUserId(Long id); + + /** + * 解绑角色菜单 + * @param id 菜单ID + */ + @Modifying + @Query(value = "delete from sys_roles_menus where menu_id = ?1",nativeQuery = true) + void untiedMenu(Long id); + + /** + * 根据部门查询 + * @param deptIds / + * @return / + */ + @Query(value = "select count(1) from sys_role r, sys_roles_depts d where " + + "r.role_id = d.role_id and d.dept_id in ?1",nativeQuery = true) + int countByDepts(Set deptIds); + + /** + * 根据菜单Id查询 + * @param menuIds / + * @return / + */ + @Query(value = "SELECT r.* FROM sys_role r, sys_roles_menus m WHERE " + + "r.role_id = m.role_id AND m.menu_id in ?1",nativeQuery = true) + List findInMenuId(List menuIds); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/repository/UserRepository.java b/youchain-system/src/main/java/com/youchain/modules/system/repository/UserRepository.java new file mode 100644 index 0000000..a94219c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/repository/UserRepository.java @@ -0,0 +1,130 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.repository; + +import com.youchain.modules.system.domain.User; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import java.util.Date; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-22 + */ +public interface UserRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据用户名查询 + * @param username 用户名 + * @return / + */ + User findByUsername(String username); + + /** + * 根据邮箱查询 + * @param email 邮箱 + * @return / + */ + User findByEmail(String email); + + /** + * 根据手机号查询 + * @param phone 手机号 + * @return / + */ + User findByPhone(String phone); + + /** + * 修改密码 + * @param username 用户名 + * @param pass 密码 + * @param lastPasswordResetTime / + */ + @Modifying + @Query(value = "update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1",nativeQuery = true) + void updatePass(String username, String pass, Date lastPasswordResetTime); + + /** + * 修改邮箱 + * @param username 用户名 + * @param email 邮箱 + */ + @Modifying + @Query(value = "update sys_user set email = ?2 where username = ?1",nativeQuery = true) + void updateEmail(String username, String email); + + /** + * 根据角色查询用户 + * @param roleId / + * @return / + */ + @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles r WHERE" + + " u.user_id = r.user_id AND r.role_id = ?1", nativeQuery = true) + List findByRoleId(Long roleId); + + /** + * 根据角色中的部门查询 + * @param deptId / + * @return / + */ + @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles r, sys_roles_depts d WHERE " + + "u.user_id = r.user_id AND r.role_id = d.role_id AND d.dept_id = ?1 group by u.user_id", nativeQuery = true) + List findByRoleDeptId(Long deptId); + + /** + * 根据菜单查询 + * @param id 菜单ID + * @return / + */ + @Query(value = "SELECT u.* FROM sys_user u, sys_users_roles ur, sys_roles_menus rm WHERE\n" + + "u.user_id = ur.user_id AND ur.role_id = rm.role_id AND rm.menu_id = ?1 group by u.user_id", nativeQuery = true) + List findByMenuId(Long id); + + /** + * 根据Id删除 + * @param ids / + */ + void deleteAllByIdIn(Set ids); + + /** + * 根据岗位查询 + * @param ids / + * @return / + */ + @Query(value = "SELECT count(1) FROM sys_user u, sys_users_jobs j WHERE u.user_id = j.user_id AND j.job_id IN ?1", nativeQuery = true) + int countByJobs(Set ids); + + /** + * 根据部门查询 + * @param deptIds / + * @return / + */ + @Query(value = "SELECT count(1) FROM sys_user u WHERE u.dept_id IN ?1", nativeQuery = true) + int countByDepts(Set deptIds); + + /** + * 根据角色查询 + * @param ids / + * @return / + */ + @Query(value = "SELECT count(1) FROM sys_user u, sys_users_roles r WHERE " + + "u.user_id = r.user_id AND r.role_id in ?1", nativeQuery = true) + int countByRoles(Set ids); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/DeptController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/DeptController.java new file mode 100644 index 0000000..26eabdd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/DeptController.java @@ -0,0 +1,117 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import cn.hutool.core.collection.CollectionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.DeptService; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.modules.system.service.dto.DeptQueryCriteria; +import com.youchain.utils.PageUtil; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:部门管理") +@RequestMapping("/api/dept") +public class DeptController { + + private final DeptService deptService; + private static final String ENTITY_NAME = "dept"; + + @ApiOperation("导出部门数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('dept:list')") + public void exportDept(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception { + deptService.download(deptService.queryAll(criteria, false), response); + } + + @ApiOperation("查询部门") + @GetMapping + @PreAuthorize("@el.check('user:list','dept:list')") + public ResponseEntity queryDept(DeptQueryCriteria criteria) throws Exception { + List deptDtos = deptService.queryAll(criteria, true); + return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK); + } + + @ApiOperation("查询部门:根据ID获取同级与上级数据") + @PostMapping("/superior") + @PreAuthorize("@el.check('user:list','dept:list')") + public ResponseEntity getDeptSuperior(@RequestBody List ids) { + Set deptDtos = new LinkedHashSet<>(); + for (Long id : ids) { + DeptDto deptDto = deptService.findById(id); + List depts = deptService.getSuperior(deptDto, new ArrayList<>()); + deptDtos.addAll(depts); + } + return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptDtos)),HttpStatus.OK); + } + + @Log("新增部门") + @ApiOperation("新增部门") + @PostMapping + @PreAuthorize("@el.check('dept:add')") + public ResponseEntity createDept(@Validated @RequestBody Dept resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + deptService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改部门") + @ApiOperation("修改部门") + @PutMapping + @PreAuthorize("@el.check('dept:edit')") + public ResponseEntity updateDept(@Validated(Dept.Update.class) @RequestBody Dept resources){ + deptService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除部门") + @ApiOperation("删除部门") + @DeleteMapping + @PreAuthorize("@el.check('dept:del')") + public ResponseEntity deleteDept(@RequestBody Set ids){ + Set deptDtos = new HashSet<>(); + for (Long id : ids) { + List deptList = deptService.findByPid(id); + deptDtos.add(deptService.findById(id)); + if(CollectionUtil.isNotEmpty(deptList)){ + deptDtos = deptService.getDeleteDepts(deptList, deptDtos); + } + } + // 验证是否被角色或用户关联 + deptService.verification(deptDtos); + deptService.delete(deptDtos); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/DictController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/DictController.java new file mode 100644 index 0000000..0d3e941 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/DictController.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.service.DictService; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:字典管理") +@RequestMapping("/api/dict") +public class DictController { + + private final DictService dictService; + private static final String ENTITY_NAME = "dict"; + + @ApiOperation("导出字典数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('dict:list')") + public void exportDict(HttpServletResponse response, DictQueryCriteria criteria) throws Exception { + dictService.download(dictService.queryAll(criteria), response); + } + + @ApiOperation("查询字典") + @GetMapping(value = "/all") + @PreAuthorize("@el.check('dict:list')") + public ResponseEntity queryAllDict(){ + return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); + } + + @ApiOperation("查询字典") + @GetMapping + @PreAuthorize("@el.check('dict:list')") + public ResponseEntity queryDict(DictQueryCriteria resources, Pageable pageable){ + return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK); + } + + @Log("新增字典") + @ApiOperation("新增字典") + @PostMapping + @PreAuthorize("@el.check('dict:add')") + public ResponseEntity createDict(@Validated @RequestBody Dict resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + dictService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改字典") + @ApiOperation("修改字典") + @PutMapping + @PreAuthorize("@el.check('dict:edit')") + public ResponseEntity updateDict(@Validated(Dict.Update.class) @RequestBody Dict resources){ + dictService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除字典") + @ApiOperation("删除字典") + @DeleteMapping + @PreAuthorize("@el.check('dict:del')") + public ResponseEntity deleteDict(@RequestBody Set ids){ + dictService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/DictDetailController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/DictDetailController.java new file mode 100644 index 0000000..bf6f792 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/DictDetailController.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.modules.system.service.dto.DictDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:字典详情管理") +@RequestMapping("/api/dictDetail") +public class DictDetailController { + + private final DictDetailService dictDetailService; + private static final String ENTITY_NAME = "dictDetail"; + + @ApiOperation("查询字典详情") + @GetMapping + public ResponseEntity queryDictDetail(DictDetailQueryCriteria criteria, + @PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){ + return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ApiOperation("查询多个字典详情") + @GetMapping(value = "/map") + public ResponseEntity getDictDetailMaps(@RequestParam String dictName){ + String[] names = dictName.split("[,,]"); + Map> dictMap = new HashMap<>(16); + for (String name : names) { + dictMap.put(name, dictDetailService.getDictByName(name)); + } + return new ResponseEntity<>(dictMap, HttpStatus.OK); + } + + @Log("新增字典详情") + @ApiOperation("新增字典详情") + @PostMapping + @PreAuthorize("@el.check('dict:add')") + public ResponseEntity createDictDetail(@Validated @RequestBody DictDetail resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + dictDetailService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改字典详情") + @ApiOperation("修改字典详情") + @PutMapping + @PreAuthorize("@el.check('dict:edit')") + public ResponseEntity updateDictDetail(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){ + dictDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除字典详情") + @ApiOperation("删除字典详情") + @DeleteMapping(value = "/{id}") + @PreAuthorize("@el.check('dict:del')") + public ResponseEntity deleteDictDetail(@PathVariable Long id){ + dictDetailService.delete(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/JobController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/JobController.java new file mode 100644 index 0000000..b8ae03c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/JobController.java @@ -0,0 +1,96 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.service.JobService; +import com.youchain.modules.system.service.dto.JobQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.Query; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:岗位管理") +@RequestMapping("/api/job") +public class JobController { + + private final JobService jobService; + private static final String ENTITY_NAME = "job"; + + @ApiOperation("导出岗位数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('job:list')") + public void exportJob(HttpServletResponse response, JobQueryCriteria criteria) throws Exception { + jobService.download(jobService.queryAll(criteria), response); + } + + @ApiOperation("查询岗位") + @GetMapping + @PreAuthorize("@el.check('job:list','user:list')") + public ResponseEntity queryJob(JobQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK); + } + + @Log("新增岗位") + @ApiOperation("新增岗位") + @PostMapping + @PreAuthorize("@el.check('job:add')") + public ResponseEntity createJob(@Validated @RequestBody Job resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + jobService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改岗位") + @ApiOperation("修改岗位") + @PutMapping + @PreAuthorize("@el.check('job:edit')") + public ResponseEntity updateJob(@Validated(Job.Update.class) @RequestBody Job resources){ + jobService.update(resources); + + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除岗位") + @ApiOperation("删除岗位") + @DeleteMapping + @PreAuthorize("@el.check('job:del')") + public ResponseEntity deleteJob(@RequestBody Set ids){ + // 验证是否被用户关联 + jobService.verification(ids); + jobService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/LimitController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/LimitController.java new file mode 100644 index 0000000..1c38663 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/LimitController.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.youchain.annotation.Limit; +import com.youchain.annotation.rest.AnonymousGetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author / + * 接口限流测试类 + */ +@RestController +@RequestMapping("/api/limit") +@Api(tags = "系统:限流测试管理") +public class LimitController { + + private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(); + + /** + * 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test, + */ + @AnonymousGetMapping + @ApiOperation("测试") + @Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit") + public int testLimit() { + return ATOMIC_INTEGER.incrementAndGet(); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/MenuController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/MenuController.java new file mode 100644 index 0000000..eca8977 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/MenuController.java @@ -0,0 +1,147 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import cn.hutool.core.collection.CollectionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.modules.system.domain.Menu; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.service.MenuService; +import com.youchain.modules.system.service.dto.MenuDto; +import com.youchain.modules.system.service.dto.MenuQueryCriteria; +import com.youchain.modules.system.service.mapstruct.MenuMapper; +import com.youchain.utils.PageUtil; +import com.youchain.utils.SecurityUtils; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-12-03 + */ + +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:菜单管理") +@RequestMapping("/api/menus") +public class MenuController { + + private final MenuService menuService; + private final MenuMapper menuMapper; + private static final String ENTITY_NAME = "menu"; + + @ApiOperation("导出菜单数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('menu:list')") + public void exportMenu(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception { + menuService.download(menuService.queryAll(criteria, false), response); + } + + @GetMapping(value = "/build") + @ApiOperation("获取前端所需菜单") + public ResponseEntity buildMenus(){ + List menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId()); + List menuDtos = menuService.buildTree(menuDtoList); + return new ResponseEntity<>(menuService.buildMenus(menuDtos),HttpStatus.OK); + } + + @ApiOperation("返回全部的菜单") + @GetMapping(value = "/lazy") + @PreAuthorize("@el.check('menu:list','roles:list')") + public ResponseEntity queryAllMenu(@RequestParam Long pid){ + return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK); + } + + @ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID") + @GetMapping(value = "/child") + @PreAuthorize("@el.check('menu:list','roles:list')") + public ResponseEntity childMenu(@RequestParam Long id){ + Set menuSet = new HashSet<>(); + List menuList = menuService.getMenus(id); + menuSet.add(menuService.findOne(id)); + menuSet = menuService.getChildMenus(menuMapper.toEntity(menuList), menuSet); + Set ids = menuSet.stream().map(Menu::getId).collect(Collectors.toSet()); + return new ResponseEntity<>(ids,HttpStatus.OK); + } + + @GetMapping + @ApiOperation("查询菜单") + @PreAuthorize("@el.check('menu:list')") + public ResponseEntity queryMenu(MenuQueryCriteria criteria) throws Exception { + List menuDtoList = menuService.queryAll(criteria, true); + return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK); + } + + @ApiOperation("查询菜单:根据ID获取同级与上级数据") + @PostMapping("/superior") + @PreAuthorize("@el.check('menu:list')") + public ResponseEntity getMenuSuperior(@RequestBody List ids) { + Set menuDtos = new LinkedHashSet<>(); + if(CollectionUtil.isNotEmpty(ids)){ + for (Long id : ids) { + MenuDto menuDto = menuService.findById(id); + menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>())); + } + return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK); + } + return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK); + } + + @Log("新增菜单") + @ApiOperation("新增菜单") + @PostMapping + @PreAuthorize("@el.check('menu:add')") + public ResponseEntity createMenu(@Validated @RequestBody Menu resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + menuService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改菜单") + @ApiOperation("修改菜单") + @PutMapping + @PreAuthorize("@el.check('menu:edit')") + public ResponseEntity updateMenu(@Validated(Menu.Update.class) @RequestBody Menu resources){ + menuService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除菜单") + @ApiOperation("删除菜单") + @DeleteMapping + @PreAuthorize("@el.check('menu:del')") + public ResponseEntity deleteMenu(@RequestBody Set ids){ + Set menuSet = new HashSet<>(); + for (Long id : ids) { + List menuList = menuService.getMenus(id); + menuSet.add(menuService.findOne(id)); + menuSet = menuService.getChildMenus(menuMapper.toEntity(menuList), menuSet); + } + menuService.delete(menuSet); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/MonitorController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/MonitorController.java new file mode 100644 index 0000000..a17afab --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/MonitorController.java @@ -0,0 +1,45 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.system.service.MonitorService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +/** + * @author Liu Xue + * @date 2020-05-02 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统-服务监控管理") +@RequestMapping("/api/monitor") +public class MonitorController { + + private final MonitorService serverService; + + @GetMapping + @ApiOperation("查询服务监控") + @PreAuthorize("@el.check('monitor:list')") + public ResponseEntity queryMonitor(){ + return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/RoleController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/RoleController.java new file mode 100644 index 0000000..d55b5c0 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/RoleController.java @@ -0,0 +1,154 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import cn.hutool.core.lang.Dict; +import com.youchain.modules.system.domain.Role; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.dto.RoleDto; +import com.youchain.modules.system.service.dto.RoleQueryCriteria; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.utils.SecurityUtils; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-12-03 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:角色管理") +@RequestMapping("/api/roles") +public class RoleController { + + private final RoleService roleService; + + private static final String ENTITY_NAME = "role"; + + @ApiOperation("获取单个role") + @GetMapping(value = "/{id}") + @PreAuthorize("@el.check('roles:list')") + public ResponseEntity findRoleById(@PathVariable Long id){ + return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); + } + + @ApiOperation("导出角色数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('role:list')") + public void exportRole(HttpServletResponse response, RoleQueryCriteria criteria) throws Exception { + roleService.download(roleService.queryAll(criteria), response); + } + + @ApiOperation("返回全部的角色") + @GetMapping(value = "/all") + @PreAuthorize("@el.check('roles:list','user:add','user:edit')") + public ResponseEntity queryAllRole(){ + return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK); + } + + @ApiOperation("查询角色") + @GetMapping + @PreAuthorize("@el.check('roles:list')") + public ResponseEntity queryRole(RoleQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ApiOperation("获取用户级别") + @GetMapping(value = "/level") + public ResponseEntity getRoleLevel(){ + return new ResponseEntity<>(Dict.create().set("level", getLevels(null)),HttpStatus.OK); + } + + @Log("新增角色") + @ApiOperation("新增角色") + @PostMapping + @PreAuthorize("@el.check('roles:add')") + public ResponseEntity createRole(@Validated @RequestBody Role resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + getLevels(resources.getLevel()); + roleService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改角色") + @ApiOperation("修改角色") + @PutMapping + @PreAuthorize("@el.check('roles:edit')") + public ResponseEntity updateRole(@Validated(Role.Update.class) @RequestBody Role resources){ + getLevels(resources.getLevel()); + roleService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("修改角色菜单") + @ApiOperation("修改角色菜单") + @PutMapping(value = "/menu") + @PreAuthorize("@el.check('roles:edit')") + public ResponseEntity updateRoleMenu(@RequestBody Role resources){ + RoleDto role = roleService.findById(resources.getId()); + getLevels(role.getLevel()); + roleService.updateMenu(resources,role); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除角色") + @ApiOperation("删除角色") + @DeleteMapping + @PreAuthorize("@el.check('roles:del')") + public ResponseEntity deleteRole(@RequestBody Set ids){ + for (Long id : ids) { + RoleDto role = roleService.findById(id); + getLevels(role.getLevel()); + } + // 验证是否被用户关联 + roleService.verification(ids); + roleService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 获取用户的角色级别 + * @return / + */ + private int getLevels(Integer level){ + List levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); + int min = Collections.min(levels); + if(level != null){ + if(level < min){ + throw new BadRequestException("权限不足,你的角色级别:" + min + ",低于操作的角色级别:" + level); + } + } + return min; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/UserController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/UserController.java new file mode 100644 index 0000000..645be09 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/UserController.java @@ -0,0 +1,203 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import cn.hutool.core.collection.CollectionUtil; +import com.youchain.modules.system.domain.Dept; +import com.youchain.utils.PageUtil; +import com.youchain.utils.RsaUtils; +import com.youchain.utils.SecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.config.RsaProperties; +import com.youchain.modules.system.service.DataService; +import com.youchain.modules.system.domain.User; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.vo.UserPassVo; +import com.youchain.modules.system.service.DeptService; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.modules.system.service.dto.UserDto; +import com.youchain.modules.system.service.dto.UserQueryCriteria; +import com.youchain.modules.system.service.VerifyService; +import com.youchain.modules.system.service.UserService; +import com.youchain.utils.enums.CodeEnum; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Api(tags = "系统:用户管理") +@RestController +@RequestMapping("/api/users") +@RequiredArgsConstructor +public class UserController { + + private final PasswordEncoder passwordEncoder; + private final UserService userService; + private final DataService dataService; + private final DeptService deptService; + private final RoleService roleService; + private final VerifyService verificationCodeService; + + @ApiOperation("导出用户数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('user:list')") + public void exportUser(HttpServletResponse response, UserQueryCriteria criteria) throws Exception { + userService.download(userService.queryAll(criteria), response); + } + + @ApiOperation("查询用户") + @GetMapping + @PreAuthorize("@el.check('user:list')") + public ResponseEntity queryUser(UserQueryCriteria criteria, Pageable pageable){ + if (!ObjectUtils.isEmpty(criteria.getDeptId())) { + criteria.getDeptIds().add(criteria.getDeptId()); + // 先查找是否存在子节点 + List data = deptService.findByPid(criteria.getDeptId()); + // 然后把子节点的ID都加入到集合中 + criteria.getDeptIds().addAll(deptService.getDeptChildren(data)); + } + // 数据权限 + List dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername())); + // criteria.getDeptIds() 不为空并且数据权限不为空则取交集 + if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)){ + // 取交集 + criteria.getDeptIds().retainAll(dataScopes); + if(!CollectionUtil.isEmpty(criteria.getDeptIds())){ + return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK); + } + } else { + // 否则取并集 + criteria.getDeptIds().addAll(dataScopes); + return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK); + } + return new ResponseEntity<>(PageUtil.toPage(null,0),HttpStatus.OK); + } + + @Log("新增用户") + @ApiOperation("新增用户") + @PostMapping + @PreAuthorize("@el.check('user:add')") + public ResponseEntity createUser(@Validated @RequestBody User resources){ + checkLevel(resources); + // 默认密码 123456 + resources.setPassword(passwordEncoder.encode("123456")); + userService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("修改用户") + @ApiOperation("修改用户") + @PutMapping + @PreAuthorize("@el.check('user:edit')") + public ResponseEntity updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception { + checkLevel(resources); + userService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("修改用户:个人中心") + @ApiOperation("修改用户:个人中心") + @PutMapping(value = "center") + public ResponseEntity centerUser(@Validated(User.Update.class) @RequestBody User resources){ + if(!resources.getId().equals(SecurityUtils.getCurrentUserId())){ + throw new BadRequestException("不能修改他人资料"); + } + userService.updateCenter(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除用户") + @ApiOperation("删除用户") + @DeleteMapping + @PreAuthorize("@el.check('user:del')") + public ResponseEntity deleteUser(@RequestBody Set ids){ + for (Long id : ids) { + Integer currentLevel = Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + Integer optLevel = Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername()); + } + } + userService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("修改密码") + @PostMapping(value = "/updatePass") + public ResponseEntity updateUserPass(@RequestBody UserPassVo passVo) throws Exception { + String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getOldPass()); + String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getNewPass()); + UserDto user = userService.findByName(SecurityUtils.getCurrentUsername()); + if(!passwordEncoder.matches(oldPass, user.getPassword())){ + throw new BadRequestException("修改失败,旧密码错误"); + } + if(passwordEncoder.matches(newPass, user.getPassword())){ + throw new BadRequestException("新密码不能与旧密码相同"); + } + userService.updatePass(user.getUsername(),passwordEncoder.encode(newPass)); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("修改头像") + @PostMapping(value = "/updateAvatar") + public ResponseEntity updateUserAvatar(@RequestParam MultipartFile avatar){ + return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK); + } + + @Log("修改邮箱") + @ApiOperation("修改邮箱") + @PostMapping(value = "/updateEmail/{code}") + public ResponseEntity updateUserEmail(@PathVariable String code,@RequestBody User user) throws Exception { + String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword()); + UserDto userDto = userService.findByName(SecurityUtils.getCurrentUsername()); + if(!passwordEncoder.matches(password, userDto.getPassword())){ + throw new BadRequestException("密码错误"); + } + verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + user.getEmail(), code); + userService.updateEmail(userDto.getUsername(),user.getEmail()); + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 如果当前用户的角色级别低于创建用户的角色级别,则抛出权限不足的错误 + * @param resources / + */ + private void checkLevel(User resources) { + Integer currentLevel = Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); + Integer optLevel = roleService.findByRoles(resources.getRoles()); + if (currentLevel > optLevel) { + throw new BadRequestException("角色权限不足"); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/rest/VerifyController.java b/youchain-system/src/main/java/com/youchain/modules/system/rest/VerifyController.java new file mode 100644 index 0000000..5eed4e7 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/rest/VerifyController.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.domain.vo.EmailVo; +import com.youchain.service.EmailService; +import com.youchain.modules.system.service.VerifyService; +import com.youchain.utils.enums.CodeBiEnum; +import com.youchain.utils.enums.CodeEnum; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import java.util.Objects; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/code") +@Api(tags = "系统:验证码管理") +public class VerifyController { + + private final VerifyService verificationCodeService; + private final EmailService emailService; + + @PostMapping(value = "/resetEmail") + @ApiOperation("重置邮箱,发送验证码") + public ResponseEntity resetEmail(@RequestParam String email){ + EmailVo emailVo = verificationCodeService.sendEmail(email, CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey()); + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping(value = "/email/resetPass") + @ApiOperation("重置密码,发送验证码") + public ResponseEntity resetPass(@RequestParam String email){ + EmailVo emailVo = verificationCodeService.sendEmail(email, CodeEnum.EMAIL_RESET_PWD_CODE.getKey()); + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping(value = "/validated") + @ApiOperation("验证码验证") + public ResponseEntity validated(@RequestParam String email, @RequestParam String code, @RequestParam Integer codeBi){ + CodeBiEnum biEnum = CodeBiEnum.find(codeBi); + switch (Objects.requireNonNull(biEnum)){ + case ONE: + verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + email ,code); + break; + case TWO: + verificationCodeService.validated(CodeEnum.EMAIL_RESET_PWD_CODE.getKey() + email ,code); + break; + default: + break; + } + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/DataService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/DataService.java new file mode 100644 index 0000000..3b15441 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/DataService.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.service.dto.UserDto; +import java.util.List; + +/** + * 数据权限服务类 + * @author Liu Xue + * @date 2020-05-07 + */ +public interface DataService { + + /** + * 获取数据权限 + * @param user / + * @return / + */ + List getDeptIds(UserDto user); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java new file mode 100644 index 0000000..18f9a97 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java @@ -0,0 +1,124 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.modules.system.service.dto.DeptQueryCriteria; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +public interface DeptService { + + /** + * 查询所有数据 + * @param criteria 条件 + * @param isQuery / + * @throws Exception / + * @return / + */ + List queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception; + + /** + * 根据ID查询 + * @param id / + * @return / + */ + DeptDto findById(Long id); + + /** + * 创建 + * @param resources / + */ + void create(Dept resources); + + /** + * 编辑 + * @param resources / + */ + void update(Dept resources); + + /** + * 删除 + * @param deptDtos / + * + */ + void delete(Set deptDtos); + + /** + * 根据PID查询 + * @param pid / + * @return / + */ + List findByPid(long pid); + + /** + * 根据角色ID查询 + * @param id / + * @return / + */ + Set findByRoleId(Long id); + + /** + * 导出数据 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 获取待删除的部门 + * @param deptList / + * @param deptDtos / + * @return / + */ + Set getDeleteDepts(List deptList, Set deptDtos); + + /** + * 根据ID获取同级与上级数据 + * @param deptDto / + * @param depts / + * @return / + */ + List getSuperior(DeptDto deptDto, List depts); + + /** + * 构建树形数据 + * @param deptDtos / + * @return / + */ + Object buildTree(List deptDtos); + + /** + * 获取 + * @param deptList + * @return + */ + List getDeptChildren(List deptList); + + /** + * 验证是否被角色或用户关联 + * @param deptDtos / + */ + void verification(Set deptDtos); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/DictDetailService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/DictDetailService.java new file mode 100644 index 0000000..8370b25 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/DictDetailService.java @@ -0,0 +1,69 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.modules.system.service.dto.DictDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +public interface DictDetailService { + + /** + * 创建 + * @param resources / + */ + void create(DictDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(DictDetail resources); + + /** + * 删除 + * @param id / + */ + void delete(Long id); + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable); + + + + /** + * 根据字典名称获取字典详情 + * @param name 字典名称 + * @return / + */ + List getDictByName(String name); + + Map getDictDetailByName(String name); + Map getDictDetailByNameForValue(String name); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/DictService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/DictService.java new file mode 100644 index 0000000..97cf985 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/DictService.java @@ -0,0 +1,77 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import org.springframework.data.domain.Pageable; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +public interface DictService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Map queryAll(DictQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param dict / + * @return / + */ + List queryAll(DictQueryCriteria dict); + + /** + * 创建 + * @param resources / + * @return / + */ + void create(Dict resources); + + /** + * 编辑 + * @param resources / + */ + void update(Dict resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 导出数据 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + Dict getDictDescription(String name); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/JobService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/JobService.java new file mode 100644 index 0000000..7cd1aab --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/JobService.java @@ -0,0 +1,88 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.service.dto.JobDto; +import com.youchain.modules.system.service.dto.JobQueryCriteria; +import org.springframework.data.domain.Pageable; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +public interface JobService { + + /** + * 根据ID查询 + * @param id / + * @return / + */ + JobDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return / + */ + void create(Job resources); + + /** + * 编辑 + * @param resources / + */ + void update(Job resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Map queryAll(JobQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria / + * @return / + */ + List queryAll(JobQueryCriteria criteria); + + /** + * 导出数据 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 验证是否被用户关联 + * @param ids / + */ + void verification(Set ids); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/MenuService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/MenuService.java new file mode 100644 index 0000000..11e234a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/MenuService.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.Menu; +import com.youchain.modules.system.service.dto.MenuDto; +import com.youchain.modules.system.service.dto.MenuQueryCriteria; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-12-17 + */ +public interface MenuService { + + /** + * 查询全部数据 + * @param criteria 条件 + * @param isQuery / + * @throws Exception / + * @return / + */ + List queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception; + + /** + * 根据ID查询 + * @param id / + * @return / + */ + MenuDto findById(long id); + + /** + * 创建 + * @param resources / + */ + void create(Menu resources); + + /** + * 编辑 + * @param resources / + */ + void update(Menu resources); + + /** + * 获取所有子节点,包含自身ID + * @param menuList / + * @param menuSet / + * @return / + */ + Set getChildMenus(List menuList, Set menuSet); + + /** + * 构建菜单树 + * @param menuDtos 原始数据 + * @return / + */ + List buildTree(List menuDtos); + + /** + * 构建菜单树 + * @param menuDtos / + * @return / + */ + Object buildMenus(List menuDtos); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + Menu findOne(Long id); + + /** + * 删除 + * @param menuSet / + */ + void delete(Set menuSet); + + /** + * 导出 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 懒加载菜单数据 + * @param pid / + * @return / + */ + List getMenus(Long pid); + + /** + * 根据ID获取同级与上级数据 + * @param menuDto / + * @param objects / + * @return / + */ + List getSuperior(MenuDto menuDto, List objects); + + /** + * 根据当前用户获取菜单 + * @param currentUserId / + * @return / + */ + List findByUser(Long currentUserId); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/MonitorService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/MonitorService.java new file mode 100644 index 0000000..3fc567c --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/MonitorService.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import java.util.Map; + +/** + * @author Liu Xue + * @date 2020-05-02 + */ +public interface MonitorService { + + /** + * 查询数据分页 + * @return Map + */ + Map getServers(); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/RoleService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/RoleService.java new file mode 100644 index 0000000..2421fbe --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/RoleService.java @@ -0,0 +1,136 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.security.service.dto.AuthorityDto; +import com.youchain.modules.system.service.dto.RoleDto; +import com.youchain.modules.system.service.dto.RoleQueryCriteria; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.modules.system.service.dto.UserDto; +import org.springframework.data.domain.Pageable; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-12-03 + */ +public interface RoleService { + + /** + * 查询全部数据 + * @return / + */ + List queryAll(); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + RoleDto findById(long id); + + /** + * 创建 + * @param resources / + */ + void create(Role resources); + + /** + * 编辑 + * @param resources / + */ + void update(Role resources); + + /** + * 删除 + * @param ids / + */ + void delete(Set ids); + + /** + * 根据用户ID查询 + * @param id 用户ID + * @return / + */ + List findByUsersId(Long id); + + /** + * 根据角色查询角色级别 + * @param roles / + * @return / + */ + Integer findByRoles(Set roles); + + /** + * 修改绑定的菜单 + * @param resources / + * @param roleDTO / + */ + void updateMenu(Role resources, RoleDto roleDTO); + + /** + * 解绑菜单 + * @param id / + */ + void untiedMenu(Long id); + + /** + * 待条件分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(RoleQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(RoleQueryCriteria criteria); + + /** + * 导出数据 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 获取用户权限信息 + * @param user 用户信息 + * @return 权限信息 + */ + List mapToGrantedAuthorities(UserDto user); + + /** + * 验证是否被用户关联 + * @param ids / + */ + void verification(Set ids); + + /** + * 根据菜单Id查询 + * @param menuIds / + * @return / + */ + List findInMenuId(List menuIds); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/UserService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/UserService.java new file mode 100644 index 0000000..87cab41 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/UserService.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.service.dto.UserDto; +import com.youchain.modules.system.service.dto.UserLoginDto; +import com.youchain.modules.system.service.dto.UserQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +public interface UserService { + + /** + * 根据ID查询 + * @param id ID + * @return / + */ + UserDto findById(long id); + + /** + * 新增用户 + * @param resources / + */ + void create(User resources); + + /** + * 编辑用户 + * @param resources / + * @throws Exception / + */ + void update(User resources) ; + + /** + * 删除用户 + * @param ids / + */ + void delete(Set ids); + + /** + * 根据用户名查询 + * @param userName / + * @return / + */ + UserDto findByName(String userName); + + /** + * 根据用户名查询 + * @param userName / + * @return / + */ + UserLoginDto getLoginData(String userName); + + /** + * 修改密码 + * @param username 用户名 + * @param encryptPassword 密码 + */ + void updatePass(String username, String encryptPassword); + + /** + * 修改头像 + * @param file 文件 + * @return / + */ + Map updateAvatar(MultipartFile file); + + /** + * 修改邮箱 + * @param username 用户名 + * @param email 邮箱 + */ + void updateEmail(String username, String email); + + /** + * 查询全部 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(UserQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部不分页 + * @param criteria 条件 + * @return / + */ + List queryAll(UserQueryCriteria criteria); + + /** + * 导出数据 + * @param queryAll 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List queryAll, HttpServletResponse response) throws Exception, Exception; + + /** + * 用户自助修改资料 + * @param resources / + */ + void updateCenter(User resources); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/VerifyService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/VerifyService.java new file mode 100644 index 0000000..97bda47 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/VerifyService.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service; + +import com.youchain.domain.vo.EmailVo; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +public interface VerifyService { + + /** + * 发送验证码 + * @param email / + * @param key / + * @return / + */ + EmailVo sendEmail(String email, String key); + + + /** + * 验证 + * @param code / + * @param key / + */ + void validated(String key, String code); +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptDto.java new file mode 100644 index 0000000..5228c12 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptDto.java @@ -0,0 +1,79 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Getter +@Setter +public class DeptDto extends BaseDTO implements Serializable { + + private Long id; + + private String name; + + private Boolean enabled; + + private Integer deptSort; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + private Long pid; + private String code; + private String remark; + private Integer subCount; + + public Boolean getHasChildren() { + return subCount > 0; + } + + public Boolean getLeaf() { + return subCount <= 0; + } + + public String getLabel() { + return name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeptDto deptDto = (DeptDto) o; + return Objects.equals(id, deptDto.id) && + Objects.equals(name, deptDto.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptQueryCriteria.java new file mode 100644 index 0000000..836f1f2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptQueryCriteria.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.DataPermission; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Data +@DataPermission(fieldName = "id") +public class DeptQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query + private Boolean enabled; + + @Query + private Long pid; + + @Query(type = Query.Type.IS_NULL, propName = "pid") + private Boolean pidIsNull; + + @Query(type = Query.Type.LESS_THAN, propName = "createTime") + private Timestamp createTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptSmallDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptSmallDto.java new file mode 100644 index 0000000..35f7b8f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DeptSmallDto.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-6-10 16:32:18 +*/ +@Data +public class DeptSmallDto implements Serializable { + + private Long id; + + private String name; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailDto.java new file mode 100644 index 0000000..b7f92c1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailDto.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictDetailDto extends BaseDTO implements Serializable { + + private Long id; + + private DictSmallDto dict; + + private String label; + + private String value; + + private Integer dictSort; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailQueryCriteria.java new file mode 100644 index 0000000..b900258 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDetailQueryCriteria.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Data +public class DictDetailQueryCriteria { + + @Query(type = Query.Type.INNER_LIKE) + private String label; + + @Query(propName = "name",joinName = "dict") + private String dictName; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDto.java new file mode 100644 index 0000000..dc22208 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictDto.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictDto extends BaseDTO implements Serializable { + + private Long id; + + private List dictDetails; + + private String name; + + private String description; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictQueryCriteria.java new file mode 100644 index 0000000..13964bc --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictQueryCriteria.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; + +/** + * @author Liu Xue + * 公共查询类 + */ +@Data +public class DictQueryCriteria { + + @Query(blurry = "name,description") + private String blurry; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictSmallDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictSmallDto.java new file mode 100644 index 0000000..4c7c73e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/DictSmallDto.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Getter +@Setter +public class DictSmallDto implements Serializable { + + private Long id; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobDto.java new file mode 100644 index 0000000..659f0b3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobDto.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import com.youchain.base.BaseDTO; + +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@Getter +@Setter +@NoArgsConstructor +public class JobDto extends BaseDTO implements Serializable { + + private Long id; + + private Integer jobSort; + + private String name; + private String areaCode; + + private Boolean enabled; + + public JobDto(String name, Boolean enabled) { + this.name = name; + this.enabled = enabled; + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobQueryCriteria.java new file mode 100644 index 0000000..9e43e02 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobQueryCriteria.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-6-4 14:49:34 +*/ +@Data +@NoArgsConstructor +public class JobQueryCriteria { + + @Query(type = Query.Type.INNER_LIKE) + private String name; + + @Query + private Boolean enabled; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobSmallDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobSmallDto.java new file mode 100644 index 0000000..dd8f871 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/JobSmallDto.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-6-10 16:32:18 +*/ +@Data +@NoArgsConstructor +public class JobSmallDto implements Serializable { + + private Long id; + + private String name; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuDto.java new file mode 100644 index 0000000..7e5dfc2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuDto.java @@ -0,0 +1,91 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +/** + * @author Liu Xue + * @date 2018-12-17 + */ +@Getter +@Setter +public class MenuDto extends BaseDTO implements Serializable { + + private Long id; + + private List children; + + private Integer type; + + private String permission; + + private String title; + + private Integer menuSort; + + private String path; + + private String component; + + private Long pid; + + private Integer subCount; + + private Boolean iFrame; + + private Boolean cache; + + private Boolean hidden; + + private String componentName; + + private String icon; + + public Boolean getHasChildren() { + return subCount > 0; + } + + public Boolean getLeaf() { + return subCount <= 0; + } + + public String getLabel() { + return title; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MenuDto menuDto = (MenuDto) o; + return Objects.equals(id, menuDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuQueryCriteria.java new file mode 100644 index 0000000..a47cb64 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/MenuQueryCriteria.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** + * @author Liu Xue + * 公共查询类 + */ +@Data +public class MenuQueryCriteria { + + @Query(blurry = "title,component,permission") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; + + @Query(type = Query.Type.IS_NULL, propName = "pid") + private Boolean pidIsNull; + + @Query + private Long pid; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleDto.java new file mode 100644 index 0000000..3f370c9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleDto.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.Objects; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Getter +@Setter +public class RoleDto extends BaseDTO implements Serializable { + + private Long id; + + private Set menus; + + private Set depts; + + private String name; + + private String dataScope; + + private Integer level; + + private String description; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RoleDto roleDto = (RoleDto) o; + return Objects.equals(id, roleDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleQueryCriteria.java new file mode 100644 index 0000000..e3bbf3e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleQueryCriteria.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; + +import java.sql.Timestamp; +import java.util.List; + +/** + * @author Liu Xue + * 公共查询类 + */ +@Data +public class RoleQueryCriteria { + + @Query(blurry = "name,description") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleSmallDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleSmallDto.java new file mode 100644 index 0000000..335e9ca --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/RoleSmallDto.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import java.io.Serializable; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Data +public class RoleSmallDto implements Serializable { + + private Long id; + + private String name; + + private Integer level; + + private String dataScope; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserDto.java new file mode 100644 index 0000000..0654235 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserDto.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Getter +@Setter +public class UserDto extends BaseDTO implements Serializable { + + private Long id; + + private Set roles; + + private Set jobs; + + private DeptSmallDto dept; + + private Long deptId; + + private String username; + + private String nickName; + + private String email; + + private String phone; + + private String gender; + + private String avatarName; + + private String avatarPath; + + @JSONField(serialize = false) + private String password; + + private Boolean enabled; + + @JSONField(serialize = false) + private Boolean isAdmin = false; + + private Date pwdResetTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserLoginDto.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserLoginDto.java new file mode 100644 index 0000000..92ee3fa --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserLoginDto.java @@ -0,0 +1,28 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +/** + * @author Liu Xue + * @description 用户缓存时使用 + * @date 2022-05-26 + **/ +public class UserLoginDto extends UserDto { + + private String password; + + private Boolean isAdmin; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserQueryCriteria.java b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserQueryCriteria.java new file mode 100644 index 0000000..27d1be3 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/dto/UserQueryCriteria.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Data +public class UserQueryCriteria implements Serializable { + + @Query + private Long id; + + @Query(propName = "id", type = Query.Type.IN, joinName = "dept") + private Set deptIds = new HashSet<>(); + + @Query(blurry = "email,username,nickName") + private String blurry; + + @Query + private Boolean enabled; + + private Long deptId; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DataServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DataServiceImpl.java new file mode 100644 index 0000000..2d60523 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DataServiceImpl.java @@ -0,0 +1,91 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.DataService; +import com.youchain.modules.system.service.DeptService; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.modules.system.service.dto.UserDto; +import lombok.RequiredArgsConstructor; +import com.youchain.utils.enums.DataScopeEnum; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import java.util.*; + +/** + * @author Liu Xue + * @website https://eladmin.vip + * @description 数据权限服务实现 + * @date 2020-05-07 + **/ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "data") +public class DataServiceImpl implements DataService { + + private final RoleService roleService; + private final DeptService deptService; + + /** + * 用户角色和用户部门改变时需清理缓存 + * @param user / + * @return / + */ + @Override + @Cacheable(key = "'user:' + #p0.id") + public List getDeptIds(UserDto user) { + // 用于存储部门id + Set deptIds = new HashSet<>(); + // 查询用户角色 + List roleSet = roleService.findByUsersId(user.getId()); + // 获取对应的部门ID + for (RoleSmallDto role : roleSet) { + DataScopeEnum dataScopeEnum = DataScopeEnum.find(role.getDataScope()); + switch (Objects.requireNonNull(dataScopeEnum)) { + case THIS_LEVEL: + deptIds.add(user.getDept().getId()); + break; + case CUSTOMIZE: + deptIds.addAll(getCustomize(deptIds, role)); + break; + default: + return new ArrayList<>(deptIds); + } + } + return new ArrayList<>(deptIds); + } + + /** + * 获取自定义的数据权限 + * @param deptIds 部门ID + * @param role 角色 + * @return 数据权限ID + */ + public Set getCustomize(Set deptIds, RoleSmallDto role){ + Set depts = deptService.findByRoleId(role.getId()); + for (Dept dept : depts) { + deptIds.add(dept.getId()); + List deptChildren = deptService.findByPid(dept.getId()); + if (deptChildren != null && deptChildren.size() != 0) { + deptIds.addAll(deptService.getDeptChildren(deptChildren)); + } + } + return deptIds; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..fdd7d4f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java @@ -0,0 +1,284 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.service.DeptService; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.modules.system.service.dto.DeptQueryCriteria; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.repository.RoleRepository; +import com.youchain.modules.system.repository.UserRepository; +import com.youchain.modules.system.repository.DeptRepository; +import com.youchain.modules.system.service.mapstruct.DeptMapper; +import com.youchain.utils.enums.DataScopeEnum; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.*; +import java.util.stream.Collectors; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "dept") +public class DeptServiceImpl implements DeptService { + + private final DeptRepository deptRepository; + private final DeptMapper deptMapper; + private final UserRepository userRepository; + private final RedisUtils redisUtils; + private final RoleRepository roleRepository; + + @Override + public List queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception { + Sort sort = Sort.by(Sort.Direction.ASC, "deptSort"); + String dataScopeType = SecurityUtils.getDataScopeType(); + if (isQuery) { + if(dataScopeType.equals(DataScopeEnum.ALL.getValue())){ + criteria.setPidIsNull(true); + } + List fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>()); + List fieldNames = new ArrayList(){{ add("pidIsNull");add("enabled");}}; + for (Field field : fields) { + //设置对象的访问权限,保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(criteria); + if(fieldNames.contains(field.getName())){ + continue; + } + if (ObjectUtil.isNotNull(val)) { + criteria.setPidIsNull(null); + break; + } + } + } + List list = deptMapper.toDto(deptRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort)); + // 如果为空,就代表为自定义权限或者本级权限,就需要去重,不理解可以注释掉,看查询结果 + if(StringUtils.isBlank(dataScopeType)){ + return deduplication(list); + } + return list; + } + + @Override + @Cacheable(key = "'id:' + #p0") + public DeptDto findById(Long id) { + Dept dept = deptRepository.findById(id).orElseGet(Dept::new); + ValidationUtil.isNull(dept.getId(),"Dept","id",id); + return deptMapper.toDto(dept); + } + + @Override + public List findByPid(long pid) { + return deptRepository.findByPid(pid); + } + + @Override + public Set findByRoleId(Long id) { + return deptRepository.findByRoleId(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Dept resources) { + deptRepository.save(resources); + // 计算子节点数目 + resources.setSubCount(0); + // 清理缓存 + updateSubCnt(resources.getPid()); + // 清理自定义角色权限的datascope缓存 + delCaches(resources.getPid()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Dept resources) { + // 旧的部门 + Long oldPid = findById(resources.getId()).getPid(); + Long newPid = resources.getPid(); + if(resources.getPid() != null && resources.getId().equals(resources.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + Dept dept = deptRepository.findById(resources.getId()).orElseGet(Dept::new); + ValidationUtil.isNull( dept.getId(),"Dept","id",resources.getId()); + resources.setId(dept.getId()); + deptRepository.save(resources); + // 更新父节点中子节点数目 + updateSubCnt(oldPid); + updateSubCnt(newPid); + // 清理缓存 + delCaches(resources.getId()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set deptDtos) { + for (DeptDto deptDto : deptDtos) { + // 清理缓存 + delCaches(deptDto.getId()); + deptRepository.deleteById(deptDto.getId()); + updateSubCnt(deptDto.getPid()); + } + } + + @Override + public void download(List deptDtos, HttpServletResponse response) throws Exception { + List> list=ExcelDownUtils.CreateMap(deptDtos,"Dept"); +// List> list = new ArrayList<>(); +// for (DeptDto deptDTO : deptDtos) { +// Map map = new LinkedHashMap<>(); +// map.put("部门名称", deptDTO.getName()); +// map.put("部门状态", deptDTO.getEnabled() ? "启用" : "停用"); +// map.put("创建日期", deptDTO.getCreateTime()); +// list.add(map); +// } + FileUtil.downloadExcel(list, response); + } + + @Override + public Set getDeleteDepts(List menuList, Set deptDtos) { + for (Dept dept : menuList) { + deptDtos.add(deptMapper.toDto(dept)); + List depts = deptRepository.findByPid(dept.getId()); + if(depts!=null && depts.size()!=0){ + getDeleteDepts(depts, deptDtos); + } + } + return deptDtos; + } + + @Override + public List getDeptChildren(List deptList) { + List list = new ArrayList<>(); + deptList.forEach(dept -> { + if (dept!=null && dept.getEnabled()) { + List depts = deptRepository.findByPid(dept.getId()); + if (depts.size() != 0) { + list.addAll(getDeptChildren(depts)); + } + list.add(dept.getId()); + } + } + ); + return list; + } + + @Override + public List getSuperior(DeptDto deptDto, List depts) { + if(deptDto.getPid() == null){ + depts.addAll(deptRepository.findByPidIsNull()); + return deptMapper.toDto(depts); + } + depts.addAll(deptRepository.findByPid(deptDto.getPid())); + return getSuperior(findById(deptDto.getPid()), depts); + } + + @Override + public Object buildTree(List deptDtos) { + Set trees = new LinkedHashSet<>(); + Set depts= new LinkedHashSet<>(); + List deptNames = deptDtos.stream().map(DeptDto::getName).collect(Collectors.toList()); + boolean isChild; + for (DeptDto deptDTO : deptDtos) { + isChild = false; + if (deptDTO.getPid() == null) { + trees.add(deptDTO); + } + for (DeptDto it : deptDtos) { + if (it.getPid() != null && deptDTO.getId().equals(it.getPid())) { + isChild = true; + if (deptDTO.getChildren() == null) { + deptDTO.setChildren(new ArrayList<>()); + } + deptDTO.getChildren().add(it); + } + } + if(isChild) { + depts.add(deptDTO); + } else if(deptDTO.getPid() != null && !deptNames.contains(findById(deptDTO.getPid()).getName())) { + depts.add(deptDTO); + } + } + + if (CollectionUtil.isEmpty(trees)) { + trees = depts; + } + Map map = new HashMap<>(2); + map.put("totalElements",deptDtos.size()); + map.put("content",CollectionUtil.isEmpty(trees)? deptDtos :trees); + return map; + } + + @Override + public void verification(Set deptDtos) { + Set deptIds = deptDtos.stream().map(DeptDto::getId).collect(Collectors.toSet()); + if(userRepository.countByDepts(deptIds) > 0){ + throw new BadRequestException("所选部门存在用户关联,请解除后再试!"); + } + if(roleRepository.countByDepts(deptIds) > 0){ + throw new BadRequestException("所选部门存在角色关联,请解除后再试!"); + } + } + + private void updateSubCnt(Long deptId){ + if(deptId != null){ + int count = deptRepository.countByPid(deptId); + deptRepository.updateSubCntById(count, deptId); + } + } + + private List deduplication(List list) { + List deptDtos = new ArrayList<>(); + for (DeptDto deptDto : list) { + boolean flag = true; + for (DeptDto dto : list) { + if (dto.getId().equals(deptDto.getPid())) { + flag = false; + break; + } + } + if (flag){ + deptDtos.add(deptDto); + } + } + return deptDtos; + } + + /** + * 清理缓存 + * @param id / + */ + public void delCaches(Long id){ + List users = userRepository.findByRoleDeptId(id); + // 删除数据权限 + redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getId).collect(Collectors.toSet())); + redisUtils.del(CacheKey.DEPT_ID + id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictDetailServiceImpl.java new file mode 100644 index 0000000..01c2652 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictDetailServiceImpl.java @@ -0,0 +1,120 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.DictDetailService; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.modules.system.service.dto.DictDetailQueryCriteria; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.system.repository.DictRepository; +import com.youchain.modules.system.repository.DictDetailRepository; +import com.youchain.modules.system.service.mapstruct.DictDetailMapper; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "dict") +public class DictDetailServiceImpl implements DictDetailService { + + private final DictRepository dictRepository; + private final DictDetailRepository dictDetailRepository; + private final DictDetailMapper dictDetailMapper; + private final RedisUtils redisUtils; + + @Override + public Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { + Page page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(dictDetailMapper::toDto)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(DictDetail resources) { + dictDetailRepository.save(resources); + // 清理缓存 + delCaches(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DictDetail resources) { + DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new); + ValidationUtil.isNull( dictDetail.getId(),"DictDetail","id",resources.getId()); + resources.setId(dictDetail.getId()); + dictDetailRepository.save(resources); + // 清理缓存 + delCaches(resources); + } + + @Override + @Cacheable(key = "'name:' + #p0") + public List getDictByName(String name) { + return dictDetailMapper.toDto(dictDetailRepository.findByDictName(name)); + } + + @Override + @Cacheable(key = "'name:label' + #name") + public Map getDictDetailByName(String name) { + List list= dictDetailRepository.findByDictName(name); + Map map=new HashMap<>(); + for (DictDetail d: list ) { + map.put(d.getLabel(),d); + } + return map; + } + + @Override + @Cacheable(key = "'name:value' + #name") + public Map getDictDetailByNameForValue(String name) { + List list= dictDetailRepository.findByDictName(name); + Map map=new HashMap<>(); + for (DictDetail d: list ) { + map.put(d.getValue(),d); + } + return map; + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + DictDetail dictDetail = dictDetailRepository.findById(id).orElseGet(DictDetail::new); + // 清理缓存 + delCaches(dictDetail); + dictDetailRepository.deleteById(id); + } + + public void delCaches(DictDetail dictDetail){ + Dict dict = dictRepository.findById(dictDetail.getDict().getId()).orElseGet(Dict::new); + redisUtils.del(CacheKey.DICT_NAME + dict.getName()); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictServiceImpl.java new file mode 100644 index 0000000..5c80a77 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DictServiceImpl.java @@ -0,0 +1,126 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.service.DictService; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.modules.system.service.dto.DictQueryCriteria; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.modules.system.repository.DictRepository; +import com.youchain.modules.system.service.mapstruct.DictMapper; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "dict") +public class DictServiceImpl implements DictService { + + private final DictRepository dictRepository; + private final DictMapper dictMapper; + private final RedisUtils redisUtils; + + @Override + public Map queryAll(DictQueryCriteria dict, Pageable pageable){ + Page page = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb), pageable); + return PageUtil.toPage(page.map(dictMapper::toDto)); + } + + @Override + public List queryAll(DictQueryCriteria dict) { + List list = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb)); + return dictMapper.toDto(list); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Dict resources) { + dictRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Dict resources) { + // 清理缓存 + delCaches(resources); + Dict dict = dictRepository.findById(resources.getId()).orElseGet(Dict::new); + ValidationUtil.isNull( dict.getId(),"Dict","id",resources.getId()); + dict.setName(resources.getName()); + dict.setDescription(resources.getDescription()); + dictRepository.save(dict); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + // 清理缓存 + List dicts = dictRepository.findByIdIn(ids); + for (Dict dict : dicts) { + delCaches(dict); + } + dictRepository.deleteByIdIn(ids); + } + + @Override + public void download(List dictDtos, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (DictDto dictDTO : dictDtos) { + if(CollectionUtil.isNotEmpty(dictDTO.getDictDetails())){ + for (DictDetailDto dictDetail : dictDTO.getDictDetails()) { + Map map = new LinkedHashMap<>(); + map.put("字典名称", dictDTO.getName()); + map.put("字典描述", dictDTO.getDescription()); + map.put("字典标签", dictDetail.getLabel()); + map.put("字典值", dictDetail.getValue()); + map.put("创建日期", dictDetail.getCreateTime()); + list.add(map); + } + } else { + Map map = new LinkedHashMap<>(); + map.put("字典名称", dictDTO.getName()); + map.put("字典描述", dictDTO.getDescription()); + map.put("字典标签", null); + map.put("字典值", null); + map.put("创建日期", dictDTO.getCreateTime()); + list.add(map); + } + } + FileUtil.downloadExcel(list, response); + } + + @Override + public Dict getDictDescription(String name) { + return dictRepository.getDictDescription(name); + } + + public void delCaches(Dict dict){ + redisUtils.del(CacheKey.DICT_NAME + dict.getName()); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/JobServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/JobServiceImpl.java new file mode 100644 index 0000000..6c25c7a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/JobServiceImpl.java @@ -0,0 +1,125 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.service.JobService; +import com.youchain.modules.system.service.dto.JobDto; +import com.youchain.modules.system.service.dto.JobQueryCriteria; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.EntityExistException; +import com.youchain.modules.system.repository.UserRepository; +import com.youchain.modules.system.repository.JobRepository; +import com.youchain.modules.system.service.mapstruct.JobMapper; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "job") +public class JobServiceImpl implements JobService { + + private final JobRepository jobRepository; + private final JobMapper jobMapper; + private final RedisUtils redisUtils; + private final UserRepository userRepository; + + @Override + public Map queryAll(JobQueryCriteria criteria, Pageable pageable) { + Page page = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(jobMapper::toDto).getContent(),page.getTotalElements()); + } + + @Override + public List queryAll(JobQueryCriteria criteria) { + List list = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); + return jobMapper.toDto(list); + } + + @Override + @Cacheable(key = "'id:' + #p0") + public JobDto findById(Long id) { + Job job = jobRepository.findById(id).orElseGet(Job::new); + ValidationUtil.isNull(job.getId(),"Job","id",id); + return jobMapper.toDto(job); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Job resources) { + Job job = jobRepository.findByName(resources.getName()); + if(job != null){ + throw new EntityExistException(Job.class,"name",resources.getName()); + } + jobRepository.save(resources); + } + + @Override + @CacheEvict(key = "'id:' + #p0.id") + @Transactional(rollbackFor = Exception.class) + public void update(Job resources) { + Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new); + Job old = jobRepository.findByName(resources.getName()); + if(old != null && !old.getId().equals(resources.getId())){ + throw new EntityExistException(Job.class,"name",resources.getName()); + } + ValidationUtil.isNull( job.getId(),"Job","id",resources.getId()); + resources.setId(job.getId()); + jobRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + jobRepository.deleteAllByIdIn(ids); + // 删除缓存 + redisUtils.delByKeys(CacheKey.JOB_ID, ids); + } + + @Override + public void download(List jobDtos, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (JobDto jobDTO : jobDtos) { + Map map = new LinkedHashMap<>(); + map.put("岗位名称", jobDTO.getName()); + map.put("岗位状态", jobDTO.getEnabled() ? "启用" : "停用"); + map.put("创建日期", jobDTO.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void verification(Set ids) { + if(userRepository.countByJobs(ids) > 0){ + throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!"); + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MenuServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..ab0500a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MenuServiceImpl.java @@ -0,0 +1,359 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import com.youchain.modules.system.domain.Menu; +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.domain.vo.MenuMetaVo; +import com.youchain.modules.system.domain.vo.MenuVo; +import com.youchain.modules.system.service.MenuService; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.dto.MenuDto; +import com.youchain.modules.system.service.dto.MenuQueryCriteria; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.exception.EntityExistException; +import com.youchain.modules.system.repository.MenuRepository; +import com.youchain.modules.system.repository.UserRepository; +import com.youchain.modules.system.service.mapstruct.MenuMapper; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + */ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "menu") +public class MenuServiceImpl implements MenuService { + + private final MenuRepository menuRepository; + private final UserRepository userRepository; + private final MenuMapper menuMapper; + private final RoleService roleService; + private final RedisUtils redisUtils; + + private static final String HTTP_PRE = "http://"; + private static final String HTTPS_PRE = "https://"; + private static final String YES_STR = "是"; + private static final String NO_STR = "否"; + private static final String BAD_REQUEST = "外链必须以http://或者https://开头"; + + @Override + public List queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception { + Sort sort = Sort.by(Sort.Direction.ASC, "menuSort"); + if(Boolean.TRUE.equals(isQuery)){ + criteria.setPidIsNull(true); + List fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>()); + for (Field field : fields) { + //设置对象的访问权限,保证对private的属性的访问 + field.setAccessible(true); + Object val = field.get(criteria); + if("pidIsNull".equals(field.getName())){ + continue; + } + if (ObjectUtil.isNotNull(val)) { + criteria.setPidIsNull(null); + break; + } + } + } + return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort)); + } + + @Override + @Cacheable(key = "'id:' + #p0") + public MenuDto findById(long id) { + Menu menu = menuRepository.findById(id).orElseGet(Menu::new); + ValidationUtil.isNull(menu.getId(),"Menu","id",id); + return menuMapper.toDto(menu); + } + + /** + * 用户角色改变时需清理缓存 + * @param currentUserId / + * @return / + */ + @Override + @Cacheable(key = "'user:' + #p0") + public List findByUser(Long currentUserId) { + List roles = roleService.findByUsersId(currentUserId); + Set roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet()); + LinkedHashSet menus = menuRepository.findByRoleIdsAndTypeNot(roleIds, 2); + return menus.stream().map(menuMapper::toDto).collect(Collectors.toList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Menu resources) { + if(menuRepository.findByTitle(resources.getTitle()) != null){ + throw new EntityExistException(Menu.class,"title",resources.getTitle()); + } + if(StringUtils.isNotBlank(resources.getComponentName())){ + if(menuRepository.findByComponentName(resources.getComponentName()) != null){ + throw new EntityExistException(Menu.class,"componentName",resources.getComponentName()); + } + } + if (Long.valueOf(0L).equals(resources.getPid())) { + resources.setPid(null); + } + if(resources.getIFrame()){ + if (!(resources.getPath().toLowerCase().startsWith(HTTP_PRE)||resources.getPath().toLowerCase().startsWith(HTTPS_PRE))) { + throw new BadRequestException(BAD_REQUEST); + } + } + menuRepository.save(resources); + // 计算子节点数目 + resources.setSubCount(0); + // 更新父节点菜单数目 + updateSubCnt(resources.getPid()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Menu resources) { + if(resources.getId().equals(resources.getPid())) { + throw new BadRequestException("上级不能为自己"); + } + Menu menu = menuRepository.findById(resources.getId()).orElseGet(Menu::new); + ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId()); + + if(resources.getIFrame()){ + if (!(resources.getPath().toLowerCase().startsWith(HTTP_PRE)||resources.getPath().toLowerCase().startsWith(HTTPS_PRE))) { + throw new BadRequestException(BAD_REQUEST); + } + } + Menu menu1 = menuRepository.findByTitle(resources.getTitle()); + + if(menu1 != null && !menu1.getId().equals(menu.getId())){ + throw new EntityExistException(Menu.class,"title",resources.getTitle()); + } + + if(resources.getPid().equals(0L)){ + resources.setPid(null); + } + + // 记录的父节点ID + Long oldPid = menu.getPid(); + Long newPid = resources.getPid(); + + if(StringUtils.isNotBlank(resources.getComponentName())){ + menu1 = menuRepository.findByComponentName(resources.getComponentName()); + if(menu1 != null && !menu1.getId().equals(menu.getId())){ + throw new EntityExistException(Menu.class,"componentName",resources.getComponentName()); + } + } + menu.setTitle(resources.getTitle()); + menu.setComponent(resources.getComponent()); + menu.setPath(resources.getPath()); + menu.setIcon(resources.getIcon()); + menu.setIFrame(resources.getIFrame()); + menu.setPid(resources.getPid()); + menu.setMenuSort(resources.getMenuSort()); + menu.setCache(resources.getCache()); + menu.setHidden(resources.getHidden()); + menu.setComponentName(resources.getComponentName()); + menu.setPermission(resources.getPermission()); + menu.setType(resources.getType()); + menuRepository.save(menu); + // 计算父级菜单节点数目 + updateSubCnt(oldPid); + updateSubCnt(newPid); + // 清理缓存 + delCaches(resources.getId()); + } + + @Override + public Set getChildMenus(List menuList, Set menuSet) { + for (Menu menu : menuList) { + menuSet.add(menu); + List menus = menuRepository.findByPidOrderByMenuSort(menu.getId()); + if(menus!=null && menus.size()!=0){ + getChildMenus(menus, menuSet); + } + } + return menuSet; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set menuSet) { + for (Menu menu : menuSet) { + // 清理缓存 + delCaches(menu.getId()); + roleService.untiedMenu(menu.getId()); + menuRepository.deleteById(menu.getId()); + updateSubCnt(menu.getPid()); + } + } + + @Override + public List getMenus(Long pid) { + List menus; + if(pid != null && !pid.equals(0L)){ + menus = menuRepository.findByPidOrderByMenuSort(pid); + } else { + menus = menuRepository.findByPidIsNullOrderByMenuSort(); + } + return menuMapper.toDto(menus); + } + + @Override + public List getSuperior(MenuDto menuDto, List menus) { + if(menuDto.getPid() == null){ + menus.addAll(menuRepository.findByPidIsNullOrderByMenuSort()); + return menuMapper.toDto(menus); + } + menus.addAll(menuRepository.findByPidOrderByMenuSort(menuDto.getPid())); + return getSuperior(findById(menuDto.getPid()), menus); + } + + @Override + public List buildTree(List menuDtos) { + List trees = new ArrayList<>(); + Set ids = new HashSet<>(); + for (MenuDto menuDTO : menuDtos) { + if (menuDTO.getPid() == null) { + trees.add(menuDTO); + } + for (MenuDto it : menuDtos) { + if (menuDTO.getId().equals(it.getPid())) { + if (menuDTO.getChildren() == null) { + menuDTO.setChildren(new ArrayList<>()); + } + menuDTO.getChildren().add(it); + ids.add(it.getId()); + } + } + } + if(trees.size() == 0){ + trees = menuDtos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList()); + } + return trees; + } + + @Override + public List buildMenus(List menuDtos) { + List list = new LinkedList<>(); + menuDtos.forEach(menuDTO -> { + if (menuDTO!=null){ + List menuDtoList = menuDTO.getChildren(); + MenuVo menuVo = new MenuVo(); + menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getTitle()); + // 一级目录需要加斜杠,不然会报警告 + menuVo.setPath(menuDTO.getPid() == null ? "/" + menuDTO.getPath() :menuDTO.getPath()); + menuVo.setHidden(menuDTO.getHidden()); + // 如果不是外链 + if(!menuDTO.getIFrame()){ + if(menuDTO.getPid() == null){ + menuVo.setComponent(StringUtils.isEmpty(menuDTO.getComponent())?"Layout":menuDTO.getComponent()); + // 如果不是一级菜单,并且菜单类型为目录,则代表是多级菜单 + }else if(menuDTO.getType() == 0){ + menuVo.setComponent(StringUtils.isEmpty(menuDTO.getComponent())?"ParentView":menuDTO.getComponent()); + }else if(StringUtils.isNoneBlank(menuDTO.getComponent())){ + menuVo.setComponent(menuDTO.getComponent()); + } + } + menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(),menuDTO.getIcon(),!menuDTO.getCache())); + if(CollectionUtil.isNotEmpty(menuDtoList)){ + menuVo.setAlwaysShow(true); + menuVo.setRedirect("noredirect"); + menuVo.setChildren(buildMenus(menuDtoList)); + // 处理是一级菜单并且没有子菜单的情况 + } else if(menuDTO.getPid() == null){ + MenuVo menuVo1 = new MenuVo(); + menuVo1.setMeta(menuVo.getMeta()); + // 非外链 + if(!menuDTO.getIFrame()){ + menuVo1.setPath("index"); + menuVo1.setName(menuVo.getName()); + menuVo1.setComponent(menuVo.getComponent()); + } else { + menuVo1.setPath(menuDTO.getPath()); + } + menuVo.setName(null); + menuVo.setMeta(null); + menuVo.setComponent("Layout"); + List list1 = new ArrayList<>(); + list1.add(menuVo1); + menuVo.setChildren(list1); + } + list.add(menuVo); + } + } + ); + return list; + } + + @Override + public Menu findOne(Long id) { + Menu menu = menuRepository.findById(id).orElseGet(Menu::new); + ValidationUtil.isNull(menu.getId(),"Menu","id",id); + return menu; + } + + @Override + public void download(List menuDtos, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (MenuDto menuDTO : menuDtos) { + Map map = new LinkedHashMap<>(); + map.put("菜单标题", menuDTO.getTitle()); + map.put("菜单类型", menuDTO.getType() == null ? "目录" : menuDTO.getType() == 1 ? "菜单" : "按钮"); + map.put("权限标识", menuDTO.getPermission()); + map.put("外链菜单", menuDTO.getIFrame() ? YES_STR : NO_STR); + map.put("菜单可见", menuDTO.getHidden() ? NO_STR : YES_STR); + map.put("是否缓存", menuDTO.getCache() ? YES_STR : NO_STR); + map.put("创建日期", menuDTO.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + private void updateSubCnt(Long menuId){ + if(menuId != null){ + int count = menuRepository.countByPid(menuId); + menuRepository.updateSubCntById(count, menuId); + } + } + + /** + * 清理缓存 + * @param id 菜单ID + */ + public void delCaches(Long id){ + List users = userRepository.findByMenuId(id); + redisUtils.del(CacheKey.MENU_ID + id); + redisUtils.delByKeys(CacheKey.MENU_USER, users.stream().map(User::getId).collect(Collectors.toSet())); + // 清除 Role 缓存 + List roles = roleService.findInMenuId(new ArrayList(){{ + add(id); + }}); + redisUtils.delByKeys(CacheKey.ROLE_ID, roles.stream().map(Role::getId).collect(Collectors.toSet())); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MonitorServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MonitorServiceImpl.java new file mode 100644 index 0000000..f756f12 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/MonitorServiceImpl.java @@ -0,0 +1,192 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.date.BetweenFormatter.Level; +import cn.hutool.core.date.DateUtil; +import com.youchain.modules.system.service.MonitorService; +import com.youchain.utils.ElAdminConstant; +import com.youchain.utils.FileUtil; +import com.youchain.utils.StringUtils; +import org.springframework.stereotype.Service; +import oshi.SystemInfo; +import oshi.hardware.*; +import oshi.software.os.FileSystem; +import oshi.software.os.OSFileStore; +import oshi.software.os.OperatingSystem; +import oshi.util.FormatUtil; +import oshi.util.Util; +import java.lang.management.ManagementFactory; +import java.text.DecimalFormat; +import java.util.*; + +/** +* @author Liu Xue +* @date 2020-05-02 +*/ +@Service +public class MonitorServiceImpl implements MonitorService { + + private final DecimalFormat df = new DecimalFormat("0.00"); + + @Override + public Map getServers(){ + Map resultMap = new LinkedHashMap<>(8); + try { + SystemInfo si = new SystemInfo(); + OperatingSystem os = si.getOperatingSystem(); + HardwareAbstractionLayer hal = si.getHardware(); + // 系统信息 + resultMap.put("sys", getSystemInfo(os)); + // cpu 信息 + resultMap.put("cpu", getCpuInfo(hal.getProcessor())); + // 内存信息 + resultMap.put("memory", getMemoryInfo(hal.getMemory())); + // 交换区信息 + resultMap.put("swap", getSwapInfo(hal.getMemory())); + // 磁盘 + resultMap.put("disk", getDiskInfo(os)); + resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss")); + } catch (Exception e) { + e.printStackTrace(); + } + return resultMap; + } + + /** + * 获取磁盘信息 + * @return / + */ + private Map getDiskInfo(OperatingSystem os) { + Map diskInfo = new LinkedHashMap<>(); + FileSystem fileSystem = os.getFileSystem(); + List fsArray = fileSystem.getFileStores(); + String osName = System.getProperty("os.name"); + long available = 0, total = 0; + for (OSFileStore fs : fsArray){ + // windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复 + if(osName.toLowerCase().startsWith(ElAdminConstant.WIN)) { + available += fs.getUsableSpace(); + total += fs.getTotalSpace(); + } else { + available = fs.getUsableSpace(); + total = fs.getTotalSpace(); + break; + } + } + long used = total - available; + diskInfo.put("total", total > 0 ? FileUtil.getSize(total) : "?"); + diskInfo.put("available", FileUtil.getSize(available)); + diskInfo.put("used", FileUtil.getSize(used)); + if(total != 0){ + diskInfo.put("usageRate", df.format(used/(double)total * 100)); + } else { + diskInfo.put("usageRate", 0); + } + return diskInfo; + } + + /** + * 获取交换区信息 + * @param memory / + * @return / + */ + private Map getSwapInfo(GlobalMemory memory) { + Map swapInfo = new LinkedHashMap<>(); + VirtualMemory virtualMemory = memory.getVirtualMemory(); + long total = virtualMemory.getSwapTotal(); + long used = virtualMemory.getSwapUsed(); + swapInfo.put("total", FormatUtil.formatBytes(total)); + swapInfo.put("used", FormatUtil.formatBytes(used)); + swapInfo.put("available", FormatUtil.formatBytes(total - used)); + if(used == 0){ + swapInfo.put("usageRate", 0); + } else { + swapInfo.put("usageRate", df.format(used/(double)total * 100)); + } + return swapInfo; + } + + /** + * 获取内存信息 + * @param memory / + * @return / + */ + private Map getMemoryInfo(GlobalMemory memory) { + Map memoryInfo = new LinkedHashMap<>(); + memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal())); + memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable())); + memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable())); + memoryInfo.put("usageRate", df.format((memory.getTotal() - memory.getAvailable())/(double)memory.getTotal() * 100)); + return memoryInfo; + } + + /** + * 获取Cpu相关信息 + * @param processor / + * @return / + */ + private Map getCpuInfo(CentralProcessor processor) { + Map cpuInfo = new LinkedHashMap<>(); + cpuInfo.put("name", processor.getProcessorIdentifier().getName()); + cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU"); + cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心"); + cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount()); + cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU"); + // CPU信息 + long[] prevTicks = processor.getSystemCpuLoadTicks(); + // 默认等待300毫秒... + long time = 300; + Util.sleep(time); + long[] ticks = processor.getSystemCpuLoadTicks(); + while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < 1000){ + time += 25; + Util.sleep(25); + ticks = processor.getSystemCpuLoadTicks(); + } + long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; + long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; + long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; + long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; + long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; + long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; + long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; + long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; + long totalCpu = user + nice + sys + idle + iowait + irq + softirq + steal; + cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu)); + cpuInfo.put("idle", df.format(100d * idle / totalCpu)); + return cpuInfo; + } + + /** + * 获取系统相关信息,系统、运行天数、系统IP + * @param os / + * @return / + */ + private Map getSystemInfo(OperatingSystem os){ + Map systemInfo = new LinkedHashMap<>(); + // jvm 运行时间 + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + Date date = new Date(time); + // 计算项目运行时间 + String formatBetween = DateUtil.formatBetween(date, new Date(), Level.HOUR); + // 系统信息 + systemInfo.put("os", os.toString()); + systemInfo.put("day", formatBetween); + systemInfo.put("ip", StringUtils.getLocalIp()); + return systemInfo; + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/RoleServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..112fdbd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/RoleServiceImpl.java @@ -0,0 +1,224 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.youchain.modules.system.domain.Menu; +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.service.RoleService; +import com.youchain.modules.system.service.dto.RoleQueryCriteria; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.modules.system.service.dto.UserDto; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.security.service.UserCacheManager; +import com.youchain.modules.security.service.dto.AuthorityDto; +import com.youchain.exception.EntityExistException; +import com.youchain.modules.system.repository.RoleRepository; +import com.youchain.modules.system.repository.UserRepository; +import com.youchain.modules.system.service.dto.RoleDto; +import com.youchain.modules.system.service.mapstruct.RoleMapper; +import com.youchain.modules.system.service.mapstruct.RoleSmallMapper; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-12-03 + */ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "role") +public class RoleServiceImpl implements RoleService { + + private final RoleRepository roleRepository; + private final RoleMapper roleMapper; + private final RoleSmallMapper roleSmallMapper; + private final RedisUtils redisUtils; + private final UserRepository userRepository; + private final UserCacheManager userCacheManager; + + @Override + public List queryAll() { + Sort sort = Sort.by(Sort.Direction.ASC, "level"); + return roleMapper.toDto(roleRepository.findAll(sort)); + } + + @Override + public List queryAll(RoleQueryCriteria criteria) { + return roleMapper.toDto(roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); + } + + @Override + public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) { + Page page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(roleMapper::toDto)); + } + + @Override + @Cacheable(key = "'id:' + #p0") + @Transactional(rollbackFor = Exception.class) + public RoleDto findById(long id) { + Role role = roleRepository.findById(id).orElseGet(Role::new); + ValidationUtil.isNull(role.getId(), "Role", "id", id); + return roleMapper.toDto(role); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Role resources) { + if (roleRepository.findByName(resources.getName()) != null) { + throw new EntityExistException(Role.class, "username", resources.getName()); + } + roleRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Role resources) { + Role role = roleRepository.findById(resources.getId()).orElseGet(Role::new); + ValidationUtil.isNull(role.getId(), "Role", "id", resources.getId()); + + Role role1 = roleRepository.findByName(resources.getName()); + + if (role1 != null && !role1.getId().equals(role.getId())) { + throw new EntityExistException(Role.class, "username", resources.getName()); + } + role.setName(resources.getName()); + role.setDescription(resources.getDescription()); + role.setDataScope(resources.getDataScope()); + role.setDepts(resources.getDepts()); + role.setLevel(resources.getLevel()); + roleRepository.save(role); + // 更新相关缓存 + delCaches(role.getId(), null); + } + + @Override + public void updateMenu(Role resources, RoleDto roleDTO) { + Role role = roleMapper.toEntity(roleDTO); + List users = userRepository.findByRoleId(role.getId()); + // 更新菜单 + role.setMenus(resources.getMenus()); + delCaches(resources.getId(), users); + roleRepository.save(role); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void untiedMenu(Long menuId) { + // 更新菜单 + roleRepository.untiedMenu(menuId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + // 更新相关缓存 + delCaches(id, null); + } + roleRepository.deleteAllByIdIn(ids); + } + + @Override + public List findByUsersId(Long id) { + return roleSmallMapper.toDto(new ArrayList<>(roleRepository.findByUserId(id))); + } + + @Override + public Integer findByRoles(Set roles) { + if (roles.size() == 0) { + return Integer.MAX_VALUE; + } + Set roleDtos = new HashSet<>(); + for (Role role : roles) { + roleDtos.add(findById(role.getId())); + } + return Collections.min(roleDtos.stream().map(RoleDto::getLevel).collect(Collectors.toList())); + } + + @Override + @Cacheable(key = "'auth:' + #p0.id") + public List mapToGrantedAuthorities(UserDto user) { + Set permissions = new HashSet<>(); + // 如果是管理员直接返回 + if (user.getIsAdmin()) { + permissions.add("admin"); + return permissions.stream().map(AuthorityDto::new) + .collect(Collectors.toList()); + } + Set roles = roleRepository.findByUserId(user.getId()); + permissions = roles.stream().flatMap(role -> role.getMenus().stream()) + .map(Menu::getPermission) + .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); + return permissions.stream().map(AuthorityDto::new) + .collect(Collectors.toList()); + } + + @Override + public void download(List roles, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (RoleDto role : roles) { + Map map = new LinkedHashMap<>(); + map.put("角色名称", role.getName()); + map.put("角色级别", role.getLevel()); + map.put("描述", role.getDescription()); + map.put("创建日期", role.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void verification(Set ids) { + if (userRepository.countByRoles(ids) > 0) { + throw new BadRequestException("所选角色存在用户关联,请解除关联再试!"); + } + } + + @Override + public List findInMenuId(List menuIds) { + return roleRepository.findInMenuId(menuIds); + } + + /** + * 清理缓存 + * @param id / + */ + public void delCaches(Long id, List users) { + users = CollectionUtil.isEmpty(users) ? userRepository.findByRoleId(id) : users; + if (CollectionUtil.isNotEmpty(users)) { + users.forEach(item -> userCacheManager.cleanUserCache(item.getUsername())); + Set userIds = users.stream().map(User::getId).collect(Collectors.toSet()); + redisUtils.delByKeys(CacheKey.DATA_USER, userIds); + redisUtils.delByKeys(CacheKey.MENU_USER, userIds); + redisUtils.delByKeys(CacheKey.ROLE_AUTH, userIds); + } + redisUtils.del(CacheKey.ROLE_ID + id); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/UserServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..4f9d3c4 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/UserServiceImpl.java @@ -0,0 +1,302 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.repository.RoleRepository; +import com.youchain.modules.system.service.UserService; +import com.youchain.modules.system.service.dto.*; +import com.youchain.modules.system.service.mapstruct.RoleMapper; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.config.FileProperties; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.security.service.OnlineUserService; +import com.youchain.modules.security.service.UserCacheManager; +import com.youchain.exception.EntityExistException; +import com.youchain.exception.EntityNotFoundException; +import com.youchain.modules.system.repository.UserRepository; +import com.youchain.modules.system.service.mapstruct.UserLoginMapper; +import com.youchain.modules.system.service.mapstruct.UserMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotBlank; +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Service +@Slf4j +@RequiredArgsConstructor +@CacheConfig(cacheNames = "user") +public class UserServiceImpl implements UserService { + + private final UserRepository userRepository; + private final RoleRepository roleRepository; + private final RoleMapper roleMapper; + private final UserMapper userMapper; + private final FileProperties properties; + private final RedisUtils redisUtils; + private final UserCacheManager userCacheManager; + private final OnlineUserService onlineUserService; + private final UserLoginMapper userLoginMapper; + + @Override + public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { + Page page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); + return PageUtil.toPage(page.map(userMapper::toDto)); + } + + @Override + public List queryAll(UserQueryCriteria criteria) { + List users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)); + return userMapper.toDto(users); + } + + @Override + @Cacheable(key = "'id:' + #p0") + @Transactional(rollbackFor = Exception.class) + public UserDto findById(long id) { + User user = userRepository.findById(id).orElseGet(User::new); + ValidationUtil.isNull(user.getId(), "User", "id", id); + return userMapper.toDto(user); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(User resources) { + if (userRepository.findByUsername(resources.getUsername()) != null) { + throw new EntityExistException(User.class, "username", resources.getUsername()); + } + if (userRepository.findByEmail(resources.getEmail()) != null) { + throw new EntityExistException(User.class, "email", resources.getEmail()); + } + if (userRepository.findByPhone(resources.getPhone()) != null) { + throw new EntityExistException(User.class, "phone", resources.getPhone()); + } + userRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(User resources) { + User user = userRepository.findById(resources.getId()).orElseGet(User::new); + User user1 = userRepository.findByUsername(resources.getUsername()); + User user2 = userRepository.findByEmail(resources.getEmail()); + User user3 = userRepository.findByPhone(resources.getPhone()); + + if (user1 != null && !user.getId().equals(user1.getId())) { + throw new EntityExistException(User.class, "username", resources.getUsername()); + } + if (user2 != null && !user.getId().equals(user2.getId())) { + throw new EntityExistException(User.class, "email", resources.getEmail()); + } + if (user3 != null && !user.getId().equals(user3.getId())) { + throw new EntityExistException(User.class, "phone", resources.getPhone()); + } + // 如果用户的角色改变 + if (!resources.getRoles().equals(user.getRoles())) { + log.error(JSONObject.toJSONString(user.getRoles())); + log.error("------------"); + log.error(JSONObject.toJSONString(resources.getRoles())); + List list_role=roleRepository.findAll(); + log.error("------------"); + log.error(JSONObject.toJSONString(list_role)); + + Set roleSet=new HashSet<>(); + for (Role r1:resources.getRoles() ) { + for (Role r:list_role) { + if(r1.getId()==r.getId()) + roleSet.add(r); + } + } + user.setRoles(roleSet); + redisUtils.del(CacheKey.DATA_USER + resources.getId()); + redisUtils.del(CacheKey.MENU_USER + resources.getId()); + redisUtils.del(CacheKey.ROLE_AUTH + resources.getId()); + } + // 修改部门会影响 数据权限 + if (!Objects.equals(resources.getDept(),user.getDept())) { + redisUtils.del(CacheKey.DATA_USER + resources.getId()); + } + // 如果用户被禁用,则清除用户登录信息 + if(!resources.getEnabled()){ + try{ + onlineUserService.kickOutForUsername(resources.getUsername()); + }catch (Exception e){ + + } + } + user.setUsername(resources.getUsername()); + user.setEmail(resources.getEmail()); + user.setEnabled(resources.getEnabled()); + + + user.setDept(resources.getDept()); + user.setJobs(resources.getJobs()); + + user.setNickName(resources.getNickName()); + user.setPhone(resources.getPhone()); + user.setGender(resources.getGender()); + + userRepository.save(user); + // 清理缓存 + delCaches(user.getId(), user.getUsername()); + + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateCenter(User resources) { + User user = userRepository.findById(resources.getId()).orElseGet(User::new); + User user1 = userRepository.findByPhone(resources.getPhone()); + if (user1 != null && !user.getId().equals(user1.getId())) { + throw new EntityExistException(User.class, "phone", resources.getPhone()); + } + user.setNickName(resources.getNickName()); + user.setPhone(resources.getPhone()); + user.setGender(resources.getGender()); + userRepository.save(user); + // 清理缓存 + delCaches(user.getId(), user.getUsername()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Set ids) { + for (Long id : ids) { + // 清理缓存 + UserDto user = findById(id); + delCaches(user.getId(), user.getUsername()); + } + userRepository.deleteAllByIdIn(ids); + } + + @Override + public UserDto findByName(String userName) { + User user = userRepository.findByUsername(userName); + if (user == null) { + throw new EntityNotFoundException(User.class, "name", userName); + } else { + return userMapper.toDto(user); + } + } + + @Override + public UserLoginDto getLoginData(String userName) { + User user = userRepository.findByUsername(userName); + if (user == null) { + throw new EntityNotFoundException(User.class, "name", userName); + } else { + return userLoginMapper.toDto(user); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updatePass(String username, String pass) { + userRepository.updatePass(username, pass, new Date()); + flushCache(username); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Map updateAvatar(MultipartFile multipartFile) { + // 文件大小验证 + FileUtil.checkSize(properties.getAvatarMaxSize(), multipartFile.getSize()); + // 验证文件上传的格式 + String image = "gif jpg png jpeg"; + String fileType = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + if(fileType != null && !image.contains(fileType)){ + throw new BadRequestException("文件格式错误!, 仅支持 " + image +" 格式"); + } + User user = userRepository.findByUsername(SecurityUtils.getCurrentUsername()); + String oldPath = user.getAvatarPath(); + File file = FileUtil.upload(multipartFile, properties.getPath().getAvatar()); + user.setAvatarPath(Objects.requireNonNull(file).getPath()); + user.setAvatarName(file.getName()); + userRepository.save(user); + if (StringUtils.isNotBlank(oldPath)) { + FileUtil.del(oldPath); + } + @NotBlank String username = user.getUsername(); + flushCache(username); + return new HashMap(1) {{ + put("avatar", file.getName()); + }}; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateEmail(String username, String email) { + userRepository.updateEmail(username, email); + flushCache(username); + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (UserDto userDTO : queryAll) { + List roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); + Map map = new LinkedHashMap<>(); + map.put("用户名", userDTO.getUsername()); + map.put("角色", roles); + map.put("部门", userDTO.getDept().getName()); + map.put("岗位", userDTO.getJobs().stream().map(JobSmallDto::getName).collect(Collectors.toList())); + map.put("邮箱", userDTO.getEmail()); + map.put("状态", userDTO.getEnabled() ? "启用" : "禁用"); + map.put("手机号码", userDTO.getPhone()); + map.put("修改密码的时间", userDTO.getPwdResetTime()); + map.put("创建日期", userDTO.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 清理缓存 + * + * @param id / + */ + public void delCaches(Long id, String username) { + redisUtils.del(CacheKey.USER_ID + id); + flushCache(username); + } + + /** + * 清理 登陆时 用户缓存信息 + * + * @param username / + */ + private void flushCache(String username) { + userCacheManager.cleanUserCache(username); + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/VerifyServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/VerifyServiceImpl.java new file mode 100644 index 0000000..df061b8 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/VerifyServiceImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.impl; + +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.extra.template.Template; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.TemplateUtil; +import com.youchain.domain.vo.EmailVo; +import com.youchain.modules.system.service.VerifyService; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.RedisUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.Collections; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +@Service +@RequiredArgsConstructor +public class VerifyServiceImpl implements VerifyService { + + @Value("${code.expiration}") + private Long expiration; + private final RedisUtils redisUtils; + + @Override + @Transactional(rollbackFor = Exception.class) + public EmailVo sendEmail(String email, String key) { + EmailVo emailVo; + String content; + String redisKey = key + email; + // 如果不存在有效的验证码,就创建一个新的 + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); + Template template = engine.getTemplate("email/email.ftl"); + Object oldCode = redisUtils.get(redisKey); + if(oldCode == null){ + String code = RandomUtil.randomNumbers (6); + // 存入缓存 + if(!redisUtils.set(redisKey, code, expiration)){ + throw new BadRequestException("服务异常,请联系网站负责人"); + } + content = template.render(Dict.create().set("code",code)); + emailVo = new EmailVo(Collections.singletonList(email),"ELADMIN后台管理系统",content); + // 存在就再次发送原来的验证码 + } else { + content = template.render(Dict.create().set("code",oldCode)); + emailVo = new EmailVo(Collections.singletonList(email),"ELADMIN后台管理系统",content); + } + return emailVo; + } + + @Override + public void validated(String key, String code) { + Object value = redisUtils.get(key); + if(value == null || !value.toString().equals(code)){ + throw new BadRequestException("无效验证码"); + } else { + redisUtils.del(key); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptMapper.java new file mode 100644 index 0000000..9be8afb --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DeptMapper extends BaseMapper { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptSmallMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptSmallMapper.java new file mode 100644 index 0000000..700f30e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DeptSmallMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.dto.DeptSmallDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-03-25 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DeptSmallMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictDetailMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictDetailMapper.java new file mode 100644 index 0000000..f745951 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictDetailMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.dto.DictDetailDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Mapper(componentModel = "spring", uses = {DictSmallMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DictDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictMapper.java new file mode 100644 index 0000000..7c8e5ca --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.service.dto.DictDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DictMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictSmallMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictSmallMapper.java new file mode 100644 index 0000000..faa29be --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/DictSmallMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Dict; +import com.youchain.modules.system.service.dto.DictSmallDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-04-10 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DictSmallMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobMapper.java new file mode 100644 index 0000000..da11688 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.service.dto.JobDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@Mapper(componentModel = "spring",uses = {DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface JobMapper extends BaseMapper { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobSmallMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobSmallMapper.java new file mode 100644 index 0000000..b17454d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/JobSmallMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Job; +import com.youchain.modules.system.service.dto.JobSmallDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-03-29 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface JobSmallMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/MenuMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/MenuMapper.java new file mode 100644 index 0000000..70820f9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/MenuMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Menu; +import com.youchain.modules.system.service.dto.MenuDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2018-12-17 + */ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface MenuMapper extends BaseMapper { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleMapper.java new file mode 100644 index 0000000..8d86a36 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.system.service.dto.RoleDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Mapper(componentModel = "spring", uses = {MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface RoleMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleSmallMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleSmallMapper.java new file mode 100644 index 0000000..007125f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/RoleSmallMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.Role; +import com.youchain.modules.system.service.dto.RoleSmallDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2019-5-23 + */ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface RoleSmallMapper extends BaseMapper { + +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserLoginMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserLoginMapper.java new file mode 100644 index 0000000..4d70038 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserLoginMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.service.dto.UserLoginDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface UserLoginMapper extends BaseMapper { +} diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserMapper.java b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserMapper.java new file mode 100644 index 0000000..6f14dec --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/mapstruct/UserMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.modules.system.service.mapstruct; + +import com.youchain.modules.system.domain.User; +import com.youchain.modules.system.service.dto.UserDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** + * @author Liu Xue + * @date 2018-11-23 + */ +@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface UserMapper extends BaseMapper { +} diff --git a/youchain-system/src/main/java/com/youchain/report_data/domain/Report.java b/youchain-system/src/main/java/com/youchain/report_data/domain/Report.java new file mode 100644 index 0000000..82d635d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/domain/Report.java @@ -0,0 +1,67 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.youchain.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-11-24 +**/ +@Entity +@Data +@Table(name="data_report") +public class Report extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "id") + private Integer id; + + @Column(name = "`name`",nullable = false) + @NotBlank + @ApiModelProperty(value = "名称") + private String name; + + @Column(name = "`thumbnail`") + @ApiModelProperty(value = "缩略图") + private String thumbnail; + + + @Column(name = "`content`") + @ApiModelProperty(value = "内容") + private String content; + + + @Column(name = "`dept_id`") + @ApiModelProperty(value = "公司ID") + private Long deptId; + + public void copy(Report source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/report_data/repository/ReportRepository.java b/youchain-system/src/main/java/com/youchain/report_data/repository/ReportRepository.java new file mode 100644 index 0000000..02684a5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/repository/ReportRepository.java @@ -0,0 +1,36 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.repository; + +import com.youchain.report_data.domain.Report; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-11-24 +**/ +public interface ReportRepository extends JpaRepository, JpaSpecificationExecutor { + +/** + * + * */ + @Query(value = "SELECT id FROM jimu_report WHERE name=?1", nativeQuery = true) + String getJiMuReportId(String name); + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/rest/ReportController.java b/youchain-system/src/main/java/com/youchain/report_data/rest/ReportController.java new file mode 100644 index 0000000..08cdfb1 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/rest/ReportController.java @@ -0,0 +1,146 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.rest; + +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.youchain.annotation.Log; +import com.youchain.annotation.rest.AnonymousDeleteMapping; +import com.youchain.annotation.rest.AnonymousGetMapping; +import com.youchain.annotation.rest.AnonymousPostMapping; +import com.youchain.annotation.rest.AnonymousPutMapping; +import com.youchain.report_data.domain.Report; +import com.youchain.report_data.repository.ReportRepository; +import com.youchain.report_data.service.ReportService; +import com.youchain.report_data.service.dto.ReportDto; +import com.youchain.report_data.service.dto.ReportQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.query.Param; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-11-24 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "data_report管理") +@RequestMapping("/api/report") +public class ReportController { + + private final ReportService reportService; + private final ReportRepository reportRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @AnonymousGetMapping(value = "/download") + public void exportReport(HttpServletResponse response, ReportQueryCriteria criteria) throws Exception { + reportService.download(reportService.queryAll(criteria), response); + } + + @AnonymousGetMapping(value = "/list") + @Log("查询data_report") + @ApiOperation("查询data_report") + public ResponseEntity queryReportList(ReportQueryCriteria criteria){ + log.error("查询所有报表"); + return new ResponseEntity<>(reportService.queryAll(criteria),HttpStatus.OK); + } + @AnonymousGetMapping(value = "/list/{index}") + @Log("查询data_report") + @ApiOperation("根据Index查询data_report") + public ResponseEntity queryReportList(@PathVariable String index){ + log.error("查询所有报表:"+index); + ReportQueryCriteria criteria=new ReportQueryCriteria(); + ReportDto reportDto=reportService.findById(Integer.parseInt(index)); + JSONObject obj=JSONUtil.parseObj(reportDto.getContent()); + return new ResponseEntity<>(obj,HttpStatus.OK); + } + + + @AnonymousGetMapping + @Log("查询data_report") + @ApiOperation("查询data_report") + public ResponseEntity queryReport(ReportQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(reportService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @AnonymousGetMapping(value = "/getJiMuReportId/{name}") + @Log("根据name查询data_report的id") + @ApiOperation("根据name查询data_report的id") + public ResponseEntity queryReportIdByName(@PathVariable("name") String name){ + String jiMuReportId = reportRepository.getJiMuReportId(name); + return new ResponseEntity<>(jiMuReportId,HttpStatus.OK); + } + + @AnonymousPostMapping + @Log("新增data_report") + @ApiOperation("新增data_report") + public ResponseEntity createReport(@Validated @RequestBody String resources){ + log.error(resources); + Report report=new Report(); + JSONObject obj=JSONUtil.parseObj(resources); + report.setName(obj.getStr("name")); + report.setThumbnail(obj.getStr("thumbnail")); + report.setContent(resources); + return new ResponseEntity<>(reportService.create(report),HttpStatus.CREATED); + } + + @AnonymousPutMapping(value = "/{id}") + @Log("修改data_report") + @ApiOperation("修改data_report") + public ResponseEntity updateReport(@PathVariable String id, @RequestBody String resources){ + log.error(resources); + log.error(id); + Report report=new Report(); + JSONObject obj=JSONUtil.parseObj(resources); + report.setId(Integer.parseInt(id)); + report.setName(obj.getStr("name")); + report.setThumbnail(obj.getStr("thumbnail")); + report.setContent(resources); + reportService.update(report); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @AnonymousDeleteMapping + @Log("删除data_report") + @ApiOperation("删除data_report") + public ResponseEntity deleteReport(@RequestBody Integer[] ids) { + reportService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @AnonymousDeleteMapping(value = "/{id}") + @Log("删除data_report") + @ApiOperation("删除data_report") + public ResponseEntity deleteReport(@PathVariable int id) { + Integer [] ids=new Integer [1]; + ids[0]=id; + reportService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/rest/ReportDemoController.java b/youchain-system/src/main/java/com/youchain/report_data/rest/ReportDemoController.java new file mode 100644 index 0000000..76c574a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/rest/ReportDemoController.java @@ -0,0 +1,209 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.rest; + +import cn.hutool.json.JSONUtil; +import com.youchain.annotation.Log; +import com.youchain.annotation.rest.AnonymousGetMapping; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.icepear.echarts.Gauge; +import org.icepear.echarts.Line; +import org.icepear.echarts.charts.gauge.*; +import org.icepear.echarts.charts.line.LineAreaStyle; +import org.icepear.echarts.charts.line.LineSeries; +import org.icepear.echarts.components.coord.cartesian.CategoryAxis; +import org.icepear.echarts.components.series.ItemStyle; +import org.icepear.echarts.components.series.LineStyle; +import org.icepear.echarts.liuxue.*; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-11-24 +**/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "data_report管理") +@RequestMapping("/api/report_api") +public class ReportDemoController { + + + + + @AnonymousGetMapping(value = "/line/{index}") + @Log("查询data_report") + @ApiOperation("根据Index查询data_report") + public ResponseEntity queryReportList(@PathVariable int index){ + + log.error("查询所有报表Demo:"+index); + Line line=null; + switch (index){ + case 1: + line = new Line() + .addXAxis(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }) + .addYAxis() + .addSeries(new Number[] { 150, 230, 224, 218, 135, 147, 260 }); + + return new ResponseEntity<>( line.getOption(),HttpStatus.OK); + case 2: + line = new Line() + .addXAxis(new CategoryAxis() + .setBoundaryGap(false) + .setData(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" })) + .addYAxis() + .addSeries(new LineSeries() + .setData(new Number[] { 820, 932, 901, 934, 1290, 1330, 1320 }) + .setAreaStyle(new LineAreaStyle())); + + return new ResponseEntity<>( line.getOption(),HttpStatus.OK); + case 3: + line=new Line() + .setTitle("Stacked Line") + .setTooltip("axis") + .setLegend() + .addXAxis(new CategoryAxis() + .setBoundaryGap(false) + .setData(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" })) + .addYAxis() + .addSeries(new LineSeries().setName("Email").setStack("Total") + .setData(new Number[] { 120, 132, 101, 134, 90, 230, 210 })) + .addSeries(new LineSeries().setName("Union Ads").setStack("Total") + .setData(new Number[] { 220, 182, 191, 234, 290, 330, 310 })) + .addSeries(new LineSeries().setName("Video Ads").setStack("Total") + .setData(new Number[] { 150, 232, 201, 154, 190, 330, 410 })) + .addSeries(new LineSeries().setName("Direct").setStack("Total") + .setData(new Number[] { 320, 332, 301, 334, 390, 330, 320 })) + .addSeries(new LineSeries().setName("Search Engine").setStack("Total") + .setData(new Number[] { 820, 932, 901, 934, 1290, 1330, 1320 })); + + return new ResponseEntity<>( line.getOption(),HttpStatus.OK); + + case 4: + line=new Line() + .addXAxis(new CategoryAxis() + .setBoundaryGap(false) + .setData(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" })) + .addYAxis() + .addSeries(new LineSeries() + .setData(new Number[] { 820, 932, 901, 934, 1290, 1330, 1320 }) + .setAreaStyle(new LineAreaStyle())); + + return new ResponseEntity<>( line.getOption(),HttpStatus.OK); + + case 5: + line = new Line() + .setTitle("Stacked Area") + .setBackgroundColor("#ffffff50") + .setTooltip("axis") + .setLegend() + .addXAxis(new CategoryAxis().setBoundaryGap(false) + .setData(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" })) + .addYAxis() + .addSeries(createSeries("Line 1", new Number[] { 140, 232, 101, 264, 90, 340, 250 })) + .addSeries(createSeries("Line 2", new Number[] { 120, 282, 111, 234, 220, 340, 310 })) + .addSeries(createSeries("Line 3", new Number[] { 320, 132, 201, 334, 190, 130, 220 })) + .addSeries(createSeries("Line 4", new Number[] { 220, 402, 231, 134, 190, 230, 120 })) + .addSeries(createSeries("Line 5", new Number[] { 220, 302, 181, 234, 210, 290, 150 })); + + return new ResponseEntity<>( line.getOption(),HttpStatus.OK); + case 6: + + int max_i=20; + int max_j=30; + + kuWeiInfo kuWeiInfo=new kuWeiInfo(); + kuWeiInfo.setMovieName("就是这样"); + //kuWeiInfo.setWidth(2.0); + //kuWeiInfo.setHeight(2.0); + kuWeiInfo.setMg_top(0.0); + kuWeiInfo.setMg_left(0.0); + //kuWeiInfo.setPositionDistin(2.1); + List seatList=new ArrayList<>(); + for (int i=1;i( kuWeiInfo,HttpStatus.OK); + + case 7: + List colorStops=new ArrayList<>(); + colorStops.add(new ColorStops(0,"#000000")); + colorStops.add(new ColorStops(1,"#FF0000")); + JianBianColor jianBianColor=new JianBianColor("linear",0.8,0,0,1,colorStops,false); + + Gauge gauge = new Gauge() + + + .setTooltip("item") + .addSeries(new GaugeSeries().setName("Pressure") + .setStartAngle(90) + .setEndAngle(-270) + .setMin(0) + .setMax(100) + .setItemStyle(new ItemStyle().setColor("#FDFF00")) + .setProgress(new GaugeProgress().setShow(true).setRoundCap(false).setWidth(20).setItemStyle(new ItemStyle().setColor(jianBianColor).setBorderWidth(0))) + .setPointer(new GaugePointer().setShow(false)) + .setAxisLine(new AxisLine().setLineStyle(new LineStyle().setWidth(20))) + .setSplitLine(new SplitLine(-62,0,new LineStyle().setWidth(3).setColor("#ff0000"))) + .setAxisTick(new AxisTick(-45,5,new LineStyle().setWidth(3).setColor("#ff0000"))) + .setAxisLabel(new AxisLabel()) + .setAnchor(new GaugeAnchor().setShow(false)) + .setTitle(new GaugeTitle().setShow(false)) + .setDetail(new GaugeDetail().setValueAnimation(true).setWidth("100%").setBorderRadius(8).setOffsetCenter(new String[]{"0","0%"}).setFontSize(60).setColor("#f0f0ff")) + .setData(new GaugeDataItem[] { new GaugeDataItem().setValue(80).setName("SCORE") })); + log.error(""+ JSONUtil.toJsonStr( gauge.getOption())); + return new ResponseEntity<>( gauge.getOption(),HttpStatus.OK); + } + return new ResponseEntity<>("",HttpStatus.OK); + } + + LineSeries createSeries(String name, Object[] data) { + return new LineSeries() + .setName(name) + .setStack("Total") + .setSmooth(true) + .setLineStyle(new LineStyle().setWidth(0)) + .setShowSymbol(false) + .setAreaStyle(new LineAreaStyle()) + .setData(data); + } + + + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/rest/kuWeiInfo.java b/youchain-system/src/main/java/com/youchain/report_data/rest/kuWeiInfo.java new file mode 100644 index 0000000..994cdcf --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/rest/kuWeiInfo.java @@ -0,0 +1,15 @@ +package com.youchain.report_data.rest; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class kuWeiInfo implements Serializable { + + public Double mg_top;//距离左边距 + public Double mg_left;//距离右边距 + public String movieName; + public List seatList; +} diff --git a/youchain-system/src/main/java/com/youchain/report_data/rest/kuWei_seat.java b/youchain-system/src/main/java/com/youchain/report_data/rest/kuWei_seat.java new file mode 100644 index 0000000..a151f8b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/rest/kuWei_seat.java @@ -0,0 +1,16 @@ +package com.youchain.report_data.rest; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class kuWei_seat implements Serializable { + public String id; // 每个座位的宽 + public int gRow; // 每个座位的高 + public int gCol;//距离左边距 + + public String type; + + +} diff --git a/youchain-system/src/main/java/com/youchain/report_data/service/ReportService.java b/youchain-system/src/main/java/com/youchain/report_data/service/ReportService.java new file mode 100644 index 0000000..2bd8a11 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/service/ReportService.java @@ -0,0 +1,84 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.service; + +import com.youchain.report_data.domain.Report; +import com.youchain.report_data.service.dto.ReportDto; +import com.youchain.report_data.service.dto.ReportQueryCriteria; +import org.springframework.data.domain.Pageable; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author liuxue +* @date 2023-11-24 +**/ +public interface ReportService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ReportQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ReportQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ReportDto + */ + ReportDto findById(Integer id); + + /** + * 创建 + * @param resources / + * @return ReportDto + */ + ReportDto create(Report resources); + + /** + * 编辑 + * @param resources / + */ + void update(Report resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Integer[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportDto.java b/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportDto.java new file mode 100644 index 0000000..823be49 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportDto.java @@ -0,0 +1,60 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @website https://eladmin.vip +* @description / +* @author liuxue +* @date 2023-11-24 +**/ +@Data +public class ReportDto implements Serializable { + + private Integer id; + + /** 名称 */ + private String name; + + /** 缩略图 */ + private String thumbnail; + + /** 状态 */ + private boolean ishome =true; + + /** 内容 */ + private String content; + + /** 创建人 */ + private String createBy; + + /** 更新人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 更新时间 */ + private Timestamp updateTime; + + /** 公司ID */ + private Long deptId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportQueryCriteria.java b/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportQueryCriteria.java new file mode 100644 index 0000000..947f43d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/service/dto/ReportQueryCriteria.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.service.dto; + +import com.youchain.annotation.Query; +import lombok.Data; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-11-24 +**/ +@Data +public class ReportQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/service/impl/ReportServiceImpl.java b/youchain-system/src/main/java/com/youchain/report_data/service/impl/ReportServiceImpl.java new file mode 100644 index 0000000..a7c8762 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/service/impl/ReportServiceImpl.java @@ -0,0 +1,112 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.service.impl; + +import com.youchain.report_data.domain.Report; +import com.youchain.report_data.repository.ReportRepository; +import com.youchain.report_data.service.ReportService; +import com.youchain.report_data.service.dto.ReportDto; +import com.youchain.report_data.service.dto.ReportQueryCriteria; +import com.youchain.report_data.service.mapstruct.ReportMapper; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author liuxue +* @date 2023-11-24 +**/ +@Service +@RequiredArgsConstructor +public class ReportServiceImpl implements ReportService { + + private final ReportRepository reportRepository; + private final ReportMapper reportMapper; + + @Override + public Map queryAll(ReportQueryCriteria criteria, Pageable pageable){ + Page page = reportRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(reportMapper::toDto)); + } + + @Override + public List queryAll(ReportQueryCriteria criteria){ + return reportMapper.toDto(reportRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ReportDto findById(Integer id) { + Report report = reportRepository.findById(id).orElseGet(Report::new); + ValidationUtil.isNull(report.getId(),"Report","id",id); + return reportMapper.toDto(report); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ReportDto create(Report resources) { + return reportMapper.toDto(reportRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Report resources) { + Report report = reportRepository.findById(resources.getId()).orElseGet(Report::new); + ValidationUtil.isNull( report.getId(),"Report","id",resources.getId()); + report.copy(resources); + reportRepository.save(report); + } + + @Override + public void deleteAll(Integer[] ids) { + for (Integer id : ids) { + reportRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (ReportDto report : all) { + Map map = new LinkedHashMap<>(); + map.put("名称", report.getName()); + map.put("缩略图", report.getThumbnail()); + map.put("内容", report.getContent()); + map.put("创建人", report.getCreateBy()); + map.put("更新人", report.getUpdateBy()); + map.put("创建时间", report.getCreateTime()); + map.put("更新时间", report.getUpdateTime()); + map.put("公司ID", report.getDeptId()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/service/mapstruct/ReportMapper.java b/youchain-system/src/main/java/com/youchain/report_data/service/mapstruct/ReportMapper.java new file mode 100644 index 0000000..06ebe2d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/service/mapstruct/ReportMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.report_data.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.report_data.domain.Report; +import com.youchain.report_data.service.dto.ReportDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author liuxue +* @date 2023-11-24 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ReportMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/report_data/utils/PieChart.java b/youchain-system/src/main/java/com/youchain/report_data/utils/PieChart.java new file mode 100644 index 0000000..8ba1f05 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/report_data/utils/PieChart.java @@ -0,0 +1,48 @@ +package com.youchain.report_data.utils; + +import cn.hutool.json.JSONUtil; +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import lombok.extern.slf4j.Slf4j; +import org.icepear.echarts.Gauge; +import org.icepear.echarts.Option; +import org.icepear.echarts.charts.gauge.*; +import org.icepear.echarts.components.series.ItemStyle; +import org.icepear.echarts.components.series.LineStyle; +import org.icepear.echarts.liuxue.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import java.util.ArrayList; +import java.util.List; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Slf4j +public class PieChart { + public static Option pieStyle(String color0, String color1, String scoreName, double percentage){ + List colorStops=new ArrayList<>(); + colorStops.add(new ColorStops(0,color0)); + colorStops.add(new ColorStops(1,color1)); + JianBianColor jianBianColor=new JianBianColor("linear",0.8,0,0,1,colorStops,false); + Gauge gauge = new Gauge() + .setTooltip("item") + .addSeries(new GaugeSeries().setName("Pressure") + .setStartAngle(90) + .setEndAngle(-270) + .setMin(0) + .setMax(100) + .setItemStyle(new ItemStyle().setColor("#FDFF00")) + .setProgress(new GaugeProgress().setShow(true).setRoundCap(false).setWidth(20).setItemStyle(new ItemStyle().setColor(jianBianColor).setBorderWidth(0))) + .setPointer(new GaugePointer().setShow(false)) + .setAxisLine(new AxisLine().setLineStyle(new LineStyle().setWidth(20))) + .setSplitLine(new SplitLine(-62,0,new LineStyle().setWidth(3).setColor("#ff0000"))) + .setAxisTick(new AxisTick(-45,5,new LineStyle().setWidth(3).setColor("#ff0000"))) + .setAxisLabel(new AxisLabel()) + .setAnchor(new GaugeAnchor().setShow(false)) + .setTitle(new GaugeTitle().setShow(false)) + .setDetail(new GaugeDetail().setValueAnimation(true).setWidth("100%").setBorderRadius(8).setOffsetCenter(new String[]{"0","0%"}).setFontSize(30).setColor("#f0f0ff")) + .setData(new GaugeDataItem[] { new GaugeDataItem().setValue(percentage).setName(scoreName) })); + return gauge.getOption(); + } +} diff --git a/youchain-system/src/main/java/com/youchain/user/domain/ElTableConfig.java b/youchain-system/src/main/java/com/youchain/user/domain/ElTableConfig.java new file mode 100644 index 0000000..3b4c0ec --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/domain/ElTableConfig.java @@ -0,0 +1,152 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author DengJiangKun +* @date 2024-01-25 +**/ +@Entity +@Data +@Table(name="user_el_table_config") +public class ElTableConfig extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`vue_url`") + @ApiModelProperty(value = "页面的url") + private String vueUrl; + + @Column(name = "`tag_style`") + @ApiModelProperty(value = "tag的样式") + private String tagStyle; + + @Column(name = "`vue_style`") + @ApiModelProperty(value = "文字的样式") + private String vueStyle; + + @Column(name = "`vue_path`") + @ApiModelProperty(value = "页面存储路径") + private String vuePath; + + @Column(name = "`sort`",nullable = false) + @NotNull + @ApiModelProperty(value = "排序") + private Integer sort; + + @Column(name = "`default_content`") + @ApiModelProperty(value = "没有数据时显示的内容") + private String defaultContent; + + @Column(name = "`prop_name`") + @ApiModelProperty(value = "字段名") + private String propName; + + @Column(name = "`label_name`") + @ApiModelProperty(value = "字段展示名") + private String labelName; + + @Column(name = "`field_type`") + @ApiModelProperty(value = "字段的存储类型") + private String fieldType; + + @Column(name = "`i_icon`") + @ApiModelProperty(value = "ioc图片") + private String iIcon; + + @Column(name = "`tf_icon`",nullable = false) + @NotNull + @ApiModelProperty(value = "ioc图片是否展示") + private Boolean tfIcon; + + @Column(name = "`tf_show_overflow_tooltip`",nullable = false) + @NotNull + @ApiModelProperty(value = "内容过度使用这个开关") + private Boolean tfShowOverflowTooltip; + + @Column(name = "`tf_sortable`",nullable = false) + @NotNull + @ApiModelProperty(value = "排序开关|自定义自己加") + private Boolean tfSortable; + + @Column(name = "`tf_el_tag`",nullable = false) + @NotNull + @ApiModelProperty(value = "tag开关") + private Boolean tfElTag; + + @Column(name = "`tag_type`") + @ApiModelProperty(value = "tag属性") + private String tagType; + + @Column(name = "`user_id`") + @ApiModelProperty(value = "用户id") + private Long userId; + + @Column(name = "`tf_show`",nullable = false) + @NotNull + @ApiModelProperty(value = "是否展示") + private Boolean tfShow; + + @Column(name = "`remarks`") + @ApiModelProperty(value = "备注") + private String remarks; + +// @Column(name = "`create_by`") +// @ApiModelProperty(value = "创建者") +// private String createBy; +// +// @Column(name = "`update_by`") +// @ApiModelProperty(value = "更新者") +// private String updateBy; +// +// @Column(name = "`create_time`") +// @ApiModelProperty(value = "创建日期") +// private Timestamp createTime; +// +// @Column(name = "`update_time`") +// @ApiModelProperty(value = "更新时间") +// private Timestamp updateTime; + + @Column(name = "`width`",nullable = false) + @NotNull + @ApiModelProperty(value = "宽") + private Integer width; + + @Column(name = "`page_no`",nullable = false) + @NotNull + @ApiModelProperty(value = "页面号") + private Integer pageNo; + + public void copy(ElTableConfig source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/user/repository/ElTableConfigRepository.java b/youchain-system/src/main/java/com/youchain/user/repository/ElTableConfigRepository.java new file mode 100644 index 0000000..6bb2edd --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/repository/ElTableConfigRepository.java @@ -0,0 +1,43 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.repository; + +import com.youchain.user.domain.ElTableConfig; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-01-25 +**/ +public interface ElTableConfigRepository extends JpaRepository, JpaSpecificationExecutor { + /** + * 根据路由路径查询配置数据 + * @param vueUrl + * @return + */ + @Query(value = "SELECT * FROM `user_el_table_config` a WHERE a.vue_url = :vueUrl and a.tf_show = 0 order by a.sort ASC ", nativeQuery = true) + public List queryByVueUrl(@Param("vueUrl") String vueUrl); + + + @Query(value = "select * from user_el_table_config a where a.tf_show = 0 GROUP BY a.vue_url,id ORDER BY a.page_no ASC,a.sort ASC", nativeQuery = true) + public List queryAllDataS(); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/rest/ElTableConfigController.java b/youchain-system/src/main/java/com/youchain/user/rest/ElTableConfigController.java new file mode 100644 index 0000000..8e7677d --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/rest/ElTableConfigController.java @@ -0,0 +1,155 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.rest; + +import cn.hutool.db.PageResult; +import com.youchain.annotation.Log; +import com.youchain.businessdata.inputJson.buttenJson.ElTableConfigInput; +import com.youchain.user.domain.ElTableConfig; +import com.youchain.user.repository.ElTableConfigRepository; +import com.youchain.user.service.ElTableConfigService; +import com.youchain.user.service.dto.ElTableConfigDto; +import com.youchain.user.service.dto.ElTableConfigQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-01-25 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "elTableConfig管理") +@RequestMapping("/api/elTableConfig") +public class ElTableConfigController { + + private final ElTableConfigService elTableConfigService; + private final ElTableConfigRepository elTableConfigRepository; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('elTableConfig:list')") + public void exportElTableConfig(HttpServletResponse response, ElTableConfigQueryCriteria criteria) throws Exception { + elTableConfigService.download(elTableConfigService.queryAll(criteria), response); + } + + @GetMapping("/queryByVueUrl") + @Log("查询配置数据") + @ApiOperation("查询配置数据") + @PreAuthorize("@el.check('elTable:queryByVueUrl')") + public ResponseEntity> queryElTableData(@RequestParam("vueUrl") String vueUrl){ + return new ResponseEntity>(elTableConfigRepository.queryByVueUrl(vueUrl),HttpStatus.OK); + } + + + @GetMapping("/elTableConfigAllMap") + @Log("查询展示表的配置的map") + @ApiOperation("查询展示表的配置的map") + @PreAuthorize("@el.check('elTableConfig:elTableConfigAllMap')") + public ResponseEntity>> elTableConfigAllMap(ElTableConfigQueryCriteria criteria){ + Map> stringListMap = new HashMap<>(); + List elTableConfigDtos = elTableConfigRepository.queryAllDataS(); + //key + String url = ""; + //list + List list = new ArrayList<>(); + for (ElTableConfig etc : elTableConfigDtos) { + if (url.equals(etc.getVueUrl())){ + //向list加数据 + list.add(etc); + }else { + if (!list.isEmpty()){ + //向map中存数据 + stringListMap.put(url,list); + } + url = etc.getVueUrl(); + list = new ArrayList<>(); + list.add(etc); + } + } + //最后一次的数据 + if (!list.isEmpty()){ + //向map中存数据 + stringListMap.put(url,list); + } + return new ResponseEntity<>(stringListMap,HttpStatus.OK); + } + + + @GetMapping + @Log("查询elTableConfig") + @ApiOperation("查询elTableConfig") + @PreAuthorize("@el.check('elTableConfig:list')") + public ResponseEntity queryElTableConfig(ElTableConfigQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(elTableConfigService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增elTableConfig") + @ApiOperation("新增elTableConfig") + @PreAuthorize("@el.check('elTableConfig:add')") + public ResponseEntity createElTableConfig(@Validated @RequestBody ElTableConfig resources){ + return new ResponseEntity<>(elTableConfigService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改elTableConfig") + @ApiOperation("修改elTableConfig") + @PreAuthorize("@el.check('elTableConfig:edit')") + public ResponseEntity updateElTableConfig(@Validated @RequestBody ElTableConfig resources){ + elTableConfigService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除elTableConfig") + @ApiOperation("删除elTableConfig") + @PreAuthorize("@el.check('elTableConfig:del')") + public ResponseEntity deleteElTableConfig(@RequestBody Long[] ids) { + elTableConfigService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + @PostMapping("/updateElTableConfigS") + @Log("批量修改数据") + @ApiOperation("批量修改数据") + @PreAuthorize("@el.check('elTableConfig:updateElTableConfigS')") + public ResponseEntity updateElTableConfigS(@Validated @RequestBody ElTableConfigInput resources){ + List updateElTableConfigDtoS = resources.getUpdateElTableConfigDtoS(); + if (!updateElTableConfigDtoS.isEmpty()){ + int num = 0; + for (ElTableConfig etc : updateElTableConfigDtoS) { + etc.setSort(++num); + elTableConfigService.update(etc); + } + } + return new ResponseEntity<>(HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/service/ElTableConfigService.java b/youchain-system/src/main/java/com/youchain/user/service/ElTableConfigService.java new file mode 100644 index 0000000..4103b02 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/service/ElTableConfigService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.service; + +import com.youchain.user.domain.ElTableConfig; +import com.youchain.user.service.dto.ElTableConfigDto; +import com.youchain.user.service.dto.ElTableConfigQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author DengJiangKun +* @date 2024-01-25 +**/ +public interface ElTableConfigService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(ElTableConfigQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(ElTableConfigQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return ElTableConfigDto + */ + ElTableConfigDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return ElTableConfigDto + */ + ElTableConfigDto create(ElTableConfig resources); + + /** + * 编辑 + * @param resources / + */ + void update(ElTableConfig resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List all, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigDto.java b/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigDto.java new file mode 100644 index 0000000..fdfd976 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigDto.java @@ -0,0 +1,105 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author DengJiangKun +* @date 2024-01-25 +**/ +@Data +public class ElTableConfigDto implements Serializable { + + /** ID */ + private Long id; + + /** 页面的url */ + private String vueUrl; + + /** tag的样式 */ + private String tagStyle; + + /** 文字的样式 */ + private String vueStyle; + + /** 页面存储路径 */ + private String vuePath; + + /** 排序 */ + private Integer sort; + + /** 没有数据时显示的内容 */ + private String defaultContent; + + /** 字段名 */ + private String propName; + + /** 字段展示名 */ + private String labelName; + + /** 字段的存储类型 */ + private String fieldType; + + /** ioc图片 */ + private String iIcon; + + /** ioc图片是否展示 */ + private Boolean tfIcon; + + /** 内容过度使用这个开关 */ + private Boolean tfShowOverflowTooltip; + + /** 排序开关|自定义自己加 */ + private Boolean tfSortable; + + /** tag开关 */ + private Boolean tfElTag; + + /** tag属性 */ + private String tagType; + + /** 用户id */ + private Long userId; + + /** 是否展示 */ + private Boolean tfShow; + + /** 备注 */ + private String remarks; + + /** 创建者 */ + private String createBy; + + /** 更新者 */ + private String updateBy; + + /** 创建日期 */ + private Timestamp createTime; + + /** 更新时间 */ + private Timestamp updateTime; + + /** 宽 */ + private Integer width; + + /** 页面号 */ + private Integer pageNo; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigQueryCriteria.java b/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigQueryCriteria.java new file mode 100644 index 0000000..3eeb408 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/service/dto/ElTableConfigQueryCriteria.java @@ -0,0 +1,37 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-01-25 +**/ +@Data +public class ElTableConfigQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String vueUrl; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String labelName; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/service/impl/ElTableConfigServiceImpl.java b/youchain-system/src/main/java/com/youchain/user/service/impl/ElTableConfigServiceImpl.java new file mode 100644 index 0000000..790f1f5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/service/impl/ElTableConfigServiceImpl.java @@ -0,0 +1,127 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.service.impl; + +import com.youchain.user.domain.ElTableConfig; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.user.repository.ElTableConfigRepository; +import com.youchain.user.service.ElTableConfigService; +import com.youchain.user.service.dto.ElTableConfigDto; +import com.youchain.user.service.dto.ElTableConfigQueryCriteria; +import com.youchain.user.service.mapstruct.ElTableConfigMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author DengJiangKun +* @date 2024-01-25 +**/ +@Service +@RequiredArgsConstructor +public class ElTableConfigServiceImpl implements ElTableConfigService { + + private final ElTableConfigRepository elTableConfigRepository; + private final ElTableConfigMapper elTableConfigMapper; + + @Override + public Map queryAll(ElTableConfigQueryCriteria criteria, Pageable pageable){ + Page page = elTableConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(elTableConfigMapper::toDto)); + } + + @Override + public List queryAll(ElTableConfigQueryCriteria criteria){ + return elTableConfigMapper.toDto(elTableConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ElTableConfigDto findById(Long id) { + ElTableConfig elTableConfig = elTableConfigRepository.findById(id).orElseGet(ElTableConfig::new); + ValidationUtil.isNull(elTableConfig.getId(),"ElTableConfig","id",id); + return elTableConfigMapper.toDto(elTableConfig); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ElTableConfigDto create(ElTableConfig resources) { + return elTableConfigMapper.toDto(elTableConfigRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ElTableConfig resources) { + ElTableConfig elTableConfig = elTableConfigRepository.findById(resources.getId()).orElseGet(ElTableConfig::new); + ValidationUtil.isNull( elTableConfig.getId(),"ElTableConfig","id",resources.getId()); + elTableConfig.copy(resources); + elTableConfigRepository.save(elTableConfig); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + elTableConfigRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (ElTableConfigDto elTableConfig : all) { + Map map = new LinkedHashMap<>(); + map.put("页面的url", elTableConfig.getVueUrl()); + map.put("tag的样式", elTableConfig.getTagStyle()); + map.put("文字的样式", elTableConfig.getVueStyle()); + map.put("页面存储路径", elTableConfig.getVuePath()); + map.put("排序", elTableConfig.getSort()); + map.put("没有数据时显示的内容", elTableConfig.getDefaultContent()); + map.put("字段名", elTableConfig.getPropName()); + map.put("字段展示名", elTableConfig.getLabelName()); + map.put("字段的存储类型", elTableConfig.getFieldType()); + map.put("ioc图片", elTableConfig.getIIcon()); + map.put("ioc图片是否展示", elTableConfig.getTfIcon()); + map.put("内容过度使用这个开关", elTableConfig.getTfShowOverflowTooltip()); + map.put("排序开关|自定义自己加", elTableConfig.getTfSortable()); + map.put("tag开关", elTableConfig.getTfElTag()); + map.put("tag属性", elTableConfig.getTagType()); + map.put("用户id", elTableConfig.getUserId()); + map.put("是否展示", elTableConfig.getTfShow()); + map.put("备注", elTableConfig.getRemarks()); + map.put("创建者", elTableConfig.getCreateBy()); + map.put("更新者", elTableConfig.getUpdateBy()); + map.put("创建日期", elTableConfig.getCreateTime()); + map.put("更新时间", elTableConfig.getUpdateTime()); + map.put("宽", elTableConfig.getWidth()); + map.put("页面号", elTableConfig.getPageNo()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/user/service/mapstruct/ElTableConfigMapper.java b/youchain-system/src/main/java/com/youchain/user/service/mapstruct/ElTableConfigMapper.java new file mode 100644 index 0000000..a7f582b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/user/service/mapstruct/ElTableConfigMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.user.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.user.domain.ElTableConfig; +import com.youchain.user.service.dto.ElTableConfigDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author DengJiangKun +* @date 2024-01-25 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ElTableConfigMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/utils/AreaNameDic.java b/youchain-system/src/main/java/com/youchain/utils/AreaNameDic.java new file mode 100644 index 0000000..4acb553 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/AreaNameDic.java @@ -0,0 +1,98 @@ +package com.youchain.utils; +/** + * @website https://eladmin.vip + * @author houjianlan + * @date 2023-08-17 + **/ +public interface AreaNameDic { + /** + * 前后桶部装空车缓存区 + */ + public static String QHTBZK = "前后桶部装空车缓存区"; + /** + * 前后桶空车区 + */ + public static String QHTK = "前后桶空车区"; + /** + * 前后桶冷却区 + */ + public static String QHTL = "前后桶冷却区"; + /** + * 前桶部装满车区 + */ + public static String QTBZM = "前桶部装满车区"; + /** + * 后桶部装满车区 + */ + public static String HTBZM = "后桶部装满车区"; + /** + * 前桶预装空车区 + */ + public static String QTYK = "前桶预装空车区"; + /** + * 后桶预装空车区 + */ + public static String HTYK = "后桶预装空车区"; + /** + * 轴承座满车库; + */ + public static String ZCM = "轴承座满车库"; + /** + * 轴承座机械臂工位 + */ + public static String ZCJXB = "轴承座机械臂工位"; + /** + * 轴承座空车库 + */ + public static String ZCK = "轴承座空车库"; + /** + * 轴承座翻包区 + */ + public static String ZCFB = "轴承座翻包区"; + /** + * 门封满车区 + */ + public static String MFM = "门封满车区"; + /** + * 门封空车区 + */ + public static String MFK = "门封空车区"; + /** + * 门封入库接驳区 + */ + public static String MFJB = "门封入库接驳区"; + /** + * 门封部装满车区 + */ + public static String MFBZM = "门封部装满车区"; + + /** + * 门封部装空车区 + */ + public static String MFBZK = "门封部装空车区"; + + /** + * 物料类型,前桶 + */ + public static String QT = "QT"; + + /** + * 物料类型,后桶 + */ + public static String HT = "HT"; + + /** + * 物料类型,小件 + */ + public static String XJ = "XJ"; + + /** + * 物料类型,门封 + */ + public static String MF = "MF"; + /** + * 物料类型,轴承座 + */ + public static String ZC = "ZC"; + +} diff --git a/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java b/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java new file mode 100644 index 0000000..6e3b981 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java @@ -0,0 +1,86 @@ +package com.youchain.utils; + +/** + * @author houjianlan + * @website https://eladmin.vip + * @date 2023-08-16 + **/ +public interface BaseStatus { + /** + * 空闲 + */ + public static String FREE = "FREE"; + /** + * 占用 + */ + public static String USED = "USED"; + /** + * 可用 + */ + public static Boolean T = true; + /** + * 不可用 + */ + public static Boolean F = false; + + /** + * 点位类型-按钮盒点位 + */ + public static String BOX = "BOX"; + + /** + * 输送线 + */ + public static String EMPTY = "EMPTY"; + /** + * 存货 + */ + public static String CH = "CH"; + /** + * 发货暂存 + */ + public static String BHZC = "BHZC"; + + /** + * 收货暂存 + */ + public static String SHZC = "SHZC"; + /** + * 制造库位,默认制造库位代码 + */ + public static String ZZKW = "ZZKW"; + /** + * 缓存库位 + */ + public static String HCKW = "HCKW"; + + /** + * 默认入库库区 + */ + public static String DEFAULT_AREA = "久荣协同S仓库"; + + public static String AREA_S = "S仓"; + + public static String AREA_A = "A仓"; + /** + * 单据类型-波次补料 + */ + public static String BT_BCBL = "波次补料"; + /** + * 单据类型-其他出库 + */ + public static String BT_QTCK = "其他出库"; + /** + * 单据类型-留样出库 + */ + public static String BT_LYCK = "留样出库"; + /** + * 单据类型-手工单点 + */ + public static String BT_SGDD = "手工单点"; + /** + * 单据类型-单点 + */ + public static String BT_DD = "单点"; + +} diff --git a/youchain-system/src/main/java/com/youchain/utils/BizStatus.java b/youchain-system/src/main/java/com/youchain/utils/BizStatus.java new file mode 100644 index 0000000..b8698f5 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/BizStatus.java @@ -0,0 +1,286 @@ +package com.youchain.utils; +/** + * @website https://eladmin.vip + * @author houjianlan + * @date 2023-08-17 + **/ +public class BizStatus { + /** + * 出入库状态-打开||任务状态-待执行 + */ + public static String OPEN = "OPEN"; + + /** + * 未出单 + */ + public static final String WCD = "WCD"; + + /** + * + * 已出单 + */ + public static String YCD = "YCD"; + /** + * 出入库状态-审核 + */ + public static String ACTIVE = "ACTIVE"; + /** + * 入库状态-收货中 + */ + public static String RECEIVING = "RECEIVING"; + /** + * 入库状态-收货完毕 + */ + public static String RECEIVED = "RECEIVED"; + /** + * 入库状态-上架完成 + */ + public static String PUTAWAY = "PUTAWAY"; + /** + * 出入库状态-已取消||任务状态-已取消 + */ + public static String CANCEL = "CANCEL"; + /** + * 出入库状态-已关闭 + */ + public static String CLOSE = "CLOSE"; + /** + * 出库状态-分配; + */ + public static String ALLOCATE = "ALLOCATE"; + /** + * 出库状态-拣货 + */ + public static String PICKUP = "PICKUP"; + /** + * 出库状态-拣货完成 + */ + public static String PICK_ALL = "PICK_ALL"; + /** + * 出库状态-部分发货; + */ + public static String SHIP_PART = "SHIP_PART"; + /** + * 出库状态-全部发货; + */ + public static String SHIP_ALL = "SHIP_ALL"; + + /** + * 出库状态-已接收; + */ + public static String SL_ALL = "SL_ALL"; + + /** + * 任务状态-执行中 + */ + public static String ATCALL = "ATCALL"; + + /** + * 任务状态-工作中 + */ + public static String ATWORK = "ATWORK"; + + /** + * 任务状态-顶升 + */ + public static String UP_CONTAINER = "UP_CONTAINER"; + + /** + * 任务状态-返库中 + */ + public static String RETURN = "RETURN"; + + + + /** + * 任务状态-完成 + */ + public static String FINISH = "FINISH"; + + /** + * 入库任务 + */ + public static String ASN = "ASN"; + /** + * 出库任务 + */ + public static String PICK = "PICK"; + + /** + * 盘点任务 + */ + public static String INV = "INV"; + + + /** + * 库存日志-移位 + */ + public static String MOVE = "MOVE"; + /** + * 库存日志-库存调整 + */ + public static String INVENTORY_ADJUST = "INVENTORY_ADJUST"; + /** + * 库存日志-批次调整 + */ + public static String MODIFY_LOT = "MODIFY_LOT"; + /** + * 库存日志-状态调整 + */ + public static String MODIFY_STATUS = "MODIFY_STATUS"; + /** + * 库存日志-拣货下架 + */ + public static String PICK_DOWN = "PICK_DOWN"; + /** + * 库存日志-占用数变化 + */ + public static String CHANGE_ZYS = "CHANGE_ZYS"; + /** + * 库存日志-拣货退回 + */ + public static String PICK_CANCEL = "PICK_CANCEL"; + /** + * 库存日志-发货 + */ + public static String SHIPPING = "SHIPPING"; + + /** + * 库存日志-调整出库 + */ + public static String ADJUST_OUT = "ADJUST_OUT"; + + /** + * 库存日志-出库退回 + */ + public static String SHIP_CANCEL = "SHIP_CANCEL"; + + /** + * 库存日志-收货上架 + */ + public static String RECEIVING_UP = "RECEIVING_UP"; + + /** + * 库存日志-收货取消 + */ + public static String RECEIVING_CANCEL = "RECEIVING_CANCEL"; + + /** + * 库存日志-线边耗用 + */ + public static String XB_HY = "XB_HY"; + /** + * 盘点类型-库区 + */ + public static String ZONE = "ZONE"; + + /** + * 盘点类型-物料 + */ + public static String ITEM = "ITEM"; + + /** + * 盘点类型-仓库 + */ + public static String WAREHOUSE = "WAREHOUSE"; + + /** + * 盘点状态-分配; + */ + public static String COUNT = "COUNT"; + + /** + * 盘点状态-差异调整; + */ + public static String ADJUST = "ADJUST"; + + /** + * 增减类型-ADD + */ + public static String ADD = "1"; + + /** + * 增减类型-不变的 + */ + public static String INVARIANT = "0"; + + /** + * 增减类型-减少 + */ + public static String REDUCE = "-1"; + + /** + * 留样出库 + */ + public static String RETENTION_OUT = "RETENTION_OUT"; + /** + * 还样入库 + */ + public static String RETENTION_IN = "RETENTION_IN"; + + /** + * 库存日志-盘点移位; + */ + public static String COUNT_MOVE = "COUNT_MOVE"; + + /** + * 还样入库 + */ + public static String BACK_IN = "BACK_IN"; + + /** + * 制造库位投料 + */ + public static String ZZKW_TL = "ZZKW_TL"; + /** + * 移库出库 + */ + public static String YK_OUT = "YK_OUT"; + /** + * 退库接收 + */ + public static String TK_JS = "TK_JS"; + /** + * 移库接收 + */ + public static String YK_JS = "YK_JS"; + + /** + * 耗用状态-未耗用 + */ + public static String UN_CONSUME = "UN_CONSUME"; + /** + * 耗用状态-已耗用 + */ + public static String CONSUME = "CONSUME"; + + /** + * 查询方式-所有 + */ + public static String QUERY_TOTAL = "QUERY_TOTAL"; + /** + * 查询方式-按页 + */ + public static String QUERY_PAGE = "QUERY_PAGE"; + + /** + * 盘点类型-部分; + */ + public static String COUNT_PART = "COUNT_PART"; + /** + * 盘点类型-全部; + */ + public static String COUNT_ALL = "COUNT_ALL"; + /** + * 叫料模式-工厂; + */ + public static String GC = "GC"; + /** + * 叫料模式-铺线; + */ + public static String PX = "PX"; + /** + * 叫料模式-铺线备货; + */ + public static String PX_BH = "PX_BH"; +} diff --git a/youchain-system/src/main/java/com/youchain/utils/CodeUtils.java b/youchain-system/src/main/java/com/youchain/utils/CodeUtils.java new file mode 100644 index 0000000..b3cb580 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/CodeUtils.java @@ -0,0 +1,60 @@ +package com.youchain.utils; + +import cn.hutool.core.util.RandomUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.Calendar; + + +@Component +@Slf4j +public class CodeUtils { + @Resource + private RedisUtils redisUtils; + + private long idleTime=86400; + + private final String time_yyMMdd="yyMMdd"; + private final String time_yyyyMMdd="yyyyMMdd"; + + + + public synchronized String getCode_yyMMdd(String key, int len ){ + return getCode(key,time_yyMMdd,len); + } + + public synchronized String getCode_yyyyMMdd(String key, int len ){ + return getCode(key,time_yyyyMMdd,len); + } + + public synchronized String getCode(String key, String parm,int len){ + String key_str =new SimpleDateFormat(parm).format(Calendar.getInstance().getTime()); + String last_index= (String)redisUtils.hget(key,key_str); + log.info("last_value:"+last_index); + String value_end="1"; + if( last_index ==null ||last_index.length()<=0){ + value_end="1"; + }else{ + value_end=(Integer.parseInt(last_index)+1)+""; + } + while(value_end.length() 实体类 + * @param model 实例化的实体类 + * @return 实体类集合 + */ + public static List castEntity(List list, Class clazz, Object model) { + List returnList = new ArrayList(); + if (list.isEmpty()) { + return returnList; + } + //获取每个数组集合的元素个数 + Object[] co = list.get(0); + + //获取当前实体类的属性名、属性值、属性类别 + List attributeInfoList = getFiledsInfo(model); + //创建属性类别数组 + Class[] c2 = new Class[attributeInfoList.size()]; + //如果数组集合元素个数与实体类属性个数不一致则发生错误 + if (attributeInfoList.size() != co.length) { + return returnList; + } + //确定构造方法 + for (int i = 0; i < attributeInfoList.size(); i++) { + c2[i] = (Class) attributeInfoList.get(i).get("type"); + } + try { + for (Object[] o : list) { + Constructor constructor = clazz.getConstructor(c2); + returnList.add(constructor.newInstance(o)); + } + } catch (Exception ex) { + log.error("实体数据转化为实体类发生异常:异常信息:{}", ex.getMessage()); + return returnList; + } + return returnList; + } + + /** + * 根据属性名获取属性值 + * + * @param fieldName 属性名 + * @param modle 实体类 + * @return 属性值 + */ + private static Object getFieldValueByName(String fieldName, Object modle) { + try { + String firstLetter = fieldName.substring(0, 1).toUpperCase(); + String getter = "get" + firstLetter + fieldName.substring(1); + Method method = modle.getClass().getMethod(getter, new Class[]{}); + Object value = method.invoke(modle, new Object[]{}); + return value; + } catch (Exception e) { + return null; + } + } + + /** + * 获取属性类型(type),属性名(name),属性值(value)的map组成的list + * + * @param model 实体类 + * @return list集合 + */ + private static List getFiledsInfo(Object model) { + Field[] fields = model.getClass().getDeclaredFields(); + List list = new ArrayList(fields.length); + Map infoMap = null; + for (int i = 0; i < fields.length; i++) { + infoMap = new HashMap(3); + infoMap.put("type", fields[i].getType()); + infoMap.put("name", fields[i].getName()); + infoMap.put("value", getFieldValueByName(fields[i].getName(), model)); + list.add(infoMap); + } + return list; + } +} diff --git a/youchain-system/src/main/java/com/youchain/utils/ExcelDownUtils.java b/youchain-system/src/main/java/com/youchain/utils/ExcelDownUtils.java new file mode 100644 index 0000000..32f110f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/ExcelDownUtils.java @@ -0,0 +1,138 @@ +package com.youchain.utils; + +import cn.hutool.json.JSON; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.youchain.basicdata.service.dto.TableConfigDto; +import com.youchain.basicdata.service.dto.TableConfigQueryCriteria; +import com.youchain.basicdata.service.impl.TableConfigServiceImpl; +import com.youchain.exception.BadRequestException; +import com.youchain.modules.system.domain.DictDetail; +import com.youchain.modules.system.service.impl.DictDetailServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; + +import java.lang.reflect.Field; +import java.util.*; +@Slf4j +public class ExcelDownUtils { + public static List> CreateMap(List all,String tableType) throws Exception{ + Long stTime=System.currentTimeMillis(); + + //查询配置表 + TableConfigServiceImpl tableConfigService = SpringContextHolder.getBean(TableConfigServiceImpl.class); + TableConfigQueryCriteria tbble_criteria =new TableConfigQueryCriteria(); + tbble_criteria.setTableType(tableType.trim()); + List tableConfigDtoList=tableConfigService.queryAll(tbble_criteria); + if(tableConfigDtoList.size()<=0){ + throw new BadRequestException("请先保存配置"); + } + TableConfigDto tableConfigDto=tableConfigDtoList.get(0); + //解析配置内容 + List tableConfigList; + try{ + tableConfigList= JSONUtil.toList(tableConfigDto.getValue(),FanShe.class); + }catch (Exception e){ + throw new BadRequestException("请保存配置"); + } + log.error("导出配置数据:"+tableConfigList+""); + + //创建空的字典集合 + Map> dictDetailMaps =new HashMap<>(); + //加载字典表 + DictDetailServiceImpl dictDetailService = SpringContextHolder.getBean(DictDetailServiceImpl.class); + //查找所需要用到的字典 + tableConfigList.forEach(fanShe->{ + //遍历配置属性 + + String property=fanShe.property; + if(property.indexOf("#")>-1){ + //如果带# 代表调用了字典 + try{ + String dictStr=property.split("#")[0]; + Map dictDetailMap=dictDetailService.getDictDetailByNameForValue(dictStr); + dictDetailMaps.put(dictStr,dictDetailMap); + }catch (Exception e){ + log.error(e.toString()); + log.error("获取字典配置"+property+"异常"); + } + + } + }); + + List> list = new ArrayList<>(); + + for (Object obj : all) { + Map map = new LinkedHashMap<>(); + tableConfigList.forEach(fanShe->{ + if(fanShe.visible){ + //获取属性名 + String property=fanShe.property; + + if(property.indexOf("#")>-1){ + try{ + String dictStr=property.split("#")[0]; + String propertyStr=property.split("#")[1]; + + Map dictDetailMap=dictDetailMaps.get(dictStr); + //log.info("dictDetailMap:"+dictDetailMap.size()); + //for (String key: dictDetailMap.keySet()) { + //log.info("dictDetailMap:"+key); + //} + //log.info(dictStr+"获取value:"+json.getByPath(propertyStr)+""); + + DictDetail dictDetail=dictDetailMap.get(getNestedFieldValue(obj,propertyStr)); + + //log.info(jsonObject.getStr("label")+"--"+dictDetail.getLabel()+""); + String value=dictDetail.getLabel()+""; + map.put(fanShe.label, value.trim()+""); + }catch (Exception e){ + log.error(e.toString()); + log.error("匹配字典:"+property+"异常"); + } + + + }else{ + try{ + Object value= getNestedFieldValue(obj,property); + if(value!=null){ + if(value instanceof String){ + value=((String) value).trim(); + } + map.put(fanShe.label,value); + }else{ + map.put(fanShe.label,""); + } + }catch (Exception e){ + //log.error(e.toString()); + //log.error("匹配数据"+property+"异常"); + } + + } + + } + + }); + + + list.add(map); + + + //Object value2 = jsonObj.eval("$.address.city"); + + } + return list; + } + + public static Object getNestedFieldValue(Object obj, String nestedFieldName) throws Exception { + String[] fields = nestedFieldName.split("\\."); + Object result = obj; + for (String field : fields) { + Field f = result.getClass().getDeclaredField(field); + f.setAccessible(true); // 确保可以访问私有字段 + result = f.get(result); + } + return result; + } +} diff --git a/youchain-system/src/main/java/com/youchain/utils/FanShe.java b/youchain-system/src/main/java/com/youchain/utils/FanShe.java new file mode 100644 index 0000000..9908b0a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/FanShe.java @@ -0,0 +1,8 @@ +package com.youchain.utils; + +public class FanShe { + public String property; + public boolean visible; + + public String label; +} diff --git a/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java b/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java new file mode 100644 index 0000000..8b64a89 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/FastExcelUtil.java @@ -0,0 +1,144 @@ +package com.youchain.utils; + +import cn.idev.excel.ExcelWriter; +import cn.idev.excel.FastExcel; +import cn.idev.excel.write.metadata.WriteSheet; +import cn.idev.excel.write.metadata.style.WriteCellStyle; +import cn.idev.excel.write.metadata.style.WriteFont; +import cn.idev.excel.write.style.HorizontalCellStyleStrategy; + +import com.youchain.exception.BadRequestException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.MediaTypeFactory; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Collection; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.ToLongFunction; +import java.util.stream.Collectors; + +import static cn.hutool.core.util.CharsetUtil.UTF_8; + + +/** + * excel 工具类 + */ +@Slf4j +public class FastExcelUtil { + + /** + * 设置下载文件消息头 + * + * @param response 响应 + * @param fileName 文件名 + * @param fileSize 文件大小 + */ + public static void setDownloadFileHeader(HttpServletResponse response, String fileName, Long fileSize) { + response.setCharacterEncoding(UTF_8); + if (fileSize != null) { + response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize)); + } + + if (StringUtils.isNotEmpty(fileName)) { + response.setHeader(HttpHeaders.CONTENT_TYPE, MediaTypeFactory.getMediaType(fileName).orElse(MediaType.APPLICATION_OCTET_STREAM) + ";charset=utf-8"); + try { + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(fileName, UTF_8).replaceAll("\\+", "%20")); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + response.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION); + } + } + + /** + * 获取样式 + * + * @return horizontalCellStyleStrategy + */ + public static HorizontalCellStyleStrategy getHorizontalCellStyleStrategy() { + + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + headWriteCellStyle.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex()); + + WriteFont headWriteFont = new WriteFont(); + headWriteFont.setFontName("宋体"); + headWriteFont.setColor(IndexedColors.WHITE.getIndex()); + headWriteCellStyle.setWriteFont(headWriteFont); + + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setFillForegroundColor(IndexedColors.BLACK.getIndex()); + + return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + } + + /** + * 通用单sheet导出 + */ + public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, Class head, Collection data) throws IOException { + // 设置下载消息头 + setDownloadFileHeader(response, fileName, null); + //样式 + HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy(); + // 下载 + FastExcel.write(response.getOutputStream(), head) + .autoCloseStream(Boolean.FALSE) + .sheet(sheetName) + .registerWriteHandler(horizontalCellStyleStrategy) + .doWrite(data); + } + + /** + * 大数据导出 + * @param response 响应 + * @param fileName 文件名 + * @param sheetName sheet名称 + * @param head 头 + * @param pageQueryFunction 查询方法 + * @param convertFunction 转换方法 + * @param idExtractor id提取方法 + * @param pageSize 每页大小 + * @param 泛型 + * @param 泛型 + */ + public static void batchExportExcel(HttpServletResponse response, String fileName, String sheetName, Class head, BiFunction> pageQueryFunction, Function convertFunction, ToLongFunction idExtractor, int pageSize) { + long startTime = System.currentTimeMillis(); + // 设置下载消息头 + setDownloadFileHeader(response, fileName, null); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy(); + try (ExcelWriter excelWriter = FastExcel.write(response.getOutputStream(), head).registerWriteHandler(horizontalCellStyleStrategy).build()) { + WriteSheet writeSheet = FastExcel.writerSheet(sheetName).build(); + long lastId = 0;//最后一个id + while (true) { + List batch = pageQueryFunction.apply(lastId, pageSize); + if (batch.isEmpty()) { + break; + } + + List excelData = batch.stream() + .map(convertFunction) + .collect(Collectors.toList()); + excelWriter.write(excelData, writeSheet); + + lastId = batch.stream() + .mapToLong(idExtractor) + .max() + .orElse(lastId); + } + excelWriter.finish(); + log.info("导出总耗时: {}ms", System.currentTimeMillis() - startTime); + } catch (Exception e) { + throw new BadRequestException("导出失败"); + } + } + + +} diff --git a/youchain-system/src/main/java/com/youchain/utils/HttpUtils.java b/youchain-system/src/main/java/com/youchain/utils/HttpUtils.java new file mode 100644 index 0000000..63d4320 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/HttpUtils.java @@ -0,0 +1,19 @@ +package com.youchain.utils; + +import com.youchain.exception.handler.ApiError; +import com.youchain.exception.handler.ApiResult; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +public class HttpUtils { + public static ResponseEntity handle(ApiResult r){ + if(r.getStatus()==400){ + ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r.getMessage()); + return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); + }else{ + return new ResponseEntity<>(r.getData(),HttpStatus.OK); + } + } +} diff --git a/youchain-system/src/main/java/com/youchain/utils/OptionalUtils.java b/youchain-system/src/main/java/com/youchain/utils/OptionalUtils.java new file mode 100644 index 0000000..251860e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/OptionalUtils.java @@ -0,0 +1,39 @@ +package com.youchain.utils; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.Optional; + +@Component +@Slf4j +public class OptionalUtils { + + public static String getTrimmedString(Map map, String key, String defaultValue) { + return Optional.ofNullable(map.get(key)) + .map(Object::toString) + .map(String::trim) + .orElse(defaultValue); + } + + public static Integer getTrimmedInteger(Map map, String key, int defaultValue) { + return Optional.ofNullable(map.get(key)) + .map(Object::toString) + .map(String::trim) + .map(Integer::parseInt) + .orElse(defaultValue); + } + + public static boolean getBooleanValue(Map map, String key, boolean defaultValue) { + return Optional.ofNullable(map.get(key)) + .map(Object::toString) + .map(String::trim) + .map(s -> "1".equals(s) || "true".equalsIgnoreCase(s)) + .orElse(defaultValue); + } + + +} diff --git a/youchain-system/src/main/java/com/youchain/utils/UrlApi.java b/youchain-system/src/main/java/com/youchain/utils/UrlApi.java new file mode 100644 index 0000000..e817fc9 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/UrlApi.java @@ -0,0 +1,24 @@ +package com.youchain.utils; + +public class UrlApi { + /** + * 料箱任务下发 + */ + public static String submitMission = "http://10.177.202.230:10870/interfaces/api/amr/submitMission"; + + /** + * 容器入场 + */ + public static String containerIn = "http://10.177.202.230:10870/interfaces/api/amr/containerIn"; + + /** + * 容器相关操作,出场 + */ + public static String containerOut = "http://10.177.202.230:10870/interfaces/api/amr/containerOut"; + + /** + * 容器相关操作,查询容器信息 + */ + public static String containerQuery = "http://10.177.202.230:10870/interfaces/api/amr/containerQuery"; + +} diff --git a/youchain-system/src/main/java/com/youchain/utils/UserUtils.java b/youchain-system/src/main/java/com/youchain/utils/UserUtils.java new file mode 100644 index 0000000..cf09aab --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/utils/UserUtils.java @@ -0,0 +1,20 @@ +package com.youchain.utils; + +import cn.hutool.json.JSONUtil; +import com.youchain.modules.system.domain.Dept; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +@Slf4j +public class UserUtils { + public static Dept getDept(){ + List dataScopes = SecurityUtils.getCurrentUserDataScope(); + Dept dept=new Dept(); + if(dataScopes.size()>0){ + dept.setId(dataScopes.get(0)); + }else{ + dept.setId(0L); + } + return dept; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Bar.java b/youchain-system/src/main/java/org/icepear/echarts/Bar.java new file mode 100644 index 0000000..58d64ec --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Bar.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.bar.BarSeries; + +public class Bar extends CartesianCoordChart { + public Bar() { + super(Bar.class, BarSeries.class); + } + + @Override + public BarSeries createSeries() { + return new BarSeries().setType("bar"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Boxplot.java b/youchain-system/src/main/java/org/icepear/echarts/Boxplot.java new file mode 100644 index 0000000..f9e1c8a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Boxplot.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.boxplot.BoxplotSeries; + +public class Boxplot extends CartesianCoordChart { + public Boxplot() { + super(Boxplot.class, BoxplotSeries.class); + } + + @Override + protected BoxplotSeries createSeries() { + return new BoxplotSeries().setType("boxplot"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Candlestick.java b/youchain-system/src/main/java/org/icepear/echarts/Candlestick.java new file mode 100644 index 0000000..cb9eb7e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Candlestick.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.candlestick.CandlestickSeries; + +public class Candlestick extends CartesianCoordChart { + public Candlestick() { + super(Candlestick.class, CandlestickSeries.class); + } + + @Override + public CandlestickSeries createSeries() { + return new CandlestickSeries().setType("candlestick"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/CartesianCoordChart.java b/youchain-system/src/main/java/org/icepear/echarts/CartesianCoordChart.java new file mode 100644 index 0000000..306c420 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/CartesianCoordChart.java @@ -0,0 +1,95 @@ +package org.icepear.echarts; + +import java.util.ArrayList; +import java.util.List; + +import org.icepear.echarts.components.coord.cartesian.CategoryAxis; +import org.icepear.echarts.components.coord.cartesian.LogAxis; +import org.icepear.echarts.components.coord.cartesian.TimeAxis; +import org.icepear.echarts.components.coord.cartesian.ValueAxis; +import org.icepear.echarts.origin.coord.cartesian.AxisOption; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class CartesianCoordChart, E extends SeriesOption> extends Chart { + protected List xAxes; + protected List yAxes; + + public CartesianCoordChart(final Class clazz, final Class seriesClazz) { + super(clazz, seriesClazz); + xAxes = new ArrayList<>(); + yAxes = new ArrayList<>(); + } + + @Override + public Option getOption() { + return super.getOption() + .setXAxis(xAxes.toArray(new AxisOption[0])) + .setYAxis(yAxes.toArray(new AxisOption[0])); + } + + public T addXAxis() { + xAxes.add(createValueAxis()); + return self; + } + + public T addXAxis(String name) { + xAxes.add(createValueAxis().setName(name)); + return self; + } + + public T addXAxis(String[] data) { + xAxes.add(createCategoryAxis().setData(data)); + return self; + } + + public T addXAxis(String name, String[] data) { + xAxes.add(createCategoryAxis().setName(name).setData(data)); + return self; + } + + public T addXAxis(AxisOption xAxis) { + xAxes.add(xAxis); + return self; + } + + public T addYAxis() { + yAxes.add(createValueAxis()); + return self; + } + + public T addYAxis(String name) { + yAxes.add(createValueAxis().setName(name)); + return self; + } + + public T addYAxis(String[] data) { + yAxes.add(createCategoryAxis().setData(data)); + return self; + } + + public T addYAxis(String name, String[] data) { + yAxes.add(createCategoryAxis().setName(name).setData(data)); + return self; + } + + public T addYAxis(AxisOption yAxis) { + yAxes.add(yAxis); + return self; + } + + protected CategoryAxis createCategoryAxis() { + return new CategoryAxis().setType("category"); + } + + protected ValueAxis createValueAxis() { + return new ValueAxis().setType("value"); + } + + protected LogAxis createLogAxis() { + return new LogAxis().setType("log"); + } + + protected TimeAxis createTimeAxis() { + return new TimeAxis().setType("time"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Chart.java b/youchain-system/src/main/java/org/icepear/echarts/Chart.java new file mode 100644 index 0000000..01bf586 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Chart.java @@ -0,0 +1,150 @@ +package org.icepear.echarts; + +import java.util.ArrayList; +import java.util.List; + +import org.icepear.echarts.components.dataset.Dataset; +import org.icepear.echarts.components.legend.Legend; +import org.icepear.echarts.components.title.Title; +import org.icepear.echarts.components.tooltip.Tooltip; +import org.icepear.echarts.components.visualMap.ContinousVisualMap; +import org.icepear.echarts.origin.component.visualMap.VisualMapOption; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class Chart, E extends SeriesOption> { + protected final T self; + protected final Class seriesClazz; + protected List datasets; + protected List series; + protected Option option; + + public Chart(final Class clazz, final Class seriesClazz) { + self = clazz.cast(this); + this.seriesClazz = seriesClazz; + datasets = new ArrayList<>(); + series = new ArrayList<>(); + option = new Option(); + } + + public Option getOption() { + if (datasets.size() > 0) { + option.setDataset(datasets.toArray(new Dataset[0])); + } + option.setSeries(series.toArray(new SeriesOption[0])); + return option; + } + + public T setTitle(String text) { + option.setTitle(new Title().setText(text)); + return self; + } + + public T setBackgroundColor(String color) { + option.setBackgroundColor(color); + return self; + } + + public T setTitle(Title title) { + option.setTitle(title); + return self; + } + + public T setLegend() { + option.setLegend(new Legend()); + return self; + } + + public T setLegend(Legend legend) { + option.setLegend(legend); + return self; + } + + public T setTooltip(String trigger) { + option.setTooltip(new Tooltip().setTrigger(trigger)); + return self; + } + + public T setTooltip(Tooltip tooltip) { + option.setTooltip(tooltip); + return self; + } + + public T addDataset(Object[] source) { + datasets.add(new Dataset().setSource(source)); + return self; + } + + public T addDataset(Object[][] source) { + datasets.add(new Dataset().setSource(source)); + return self; + } + + public T addDataset(Object[][][] source) { + datasets.add(new Dataset().setSource(source)); + return self; + } + + public T addDataset(Dataset dataset) { + datasets.add(dataset); + return self; + } + + public T setVisualMap(Number min, Number max) { + option.setVisualMap(new ContinousVisualMap().setMin(min).setMax(max)); + return self; + } + + public T setVisualMap(VisualMapOption visualMap) { + option.setVisualMap(visualMap); + return self; + } + + public T addSeries(Object[] data) { + this.series.add(createSeries(data)); + return self; + } + + public T addSeries(Object[][] data) { + this.series.add(createSeries(data)); + return self; + } + + public T addSeries(Object[][][] data) { + this.series.add(createSeries(data)); + return self; + } + + public T addSeries(String name, Object[] data) { + this.series.add(createSeries(name, data)); + return self; + } + + public T addSeries(String name, Object[][] data) { + this.series.add(createSeries(name, data)); + return self; + } + + public T addSeries(String name, Object[][][] data) { + this.series.add(createSeries(name, data)); + return self; + } + + public T addSeries(E series) { + this.series.add(createSeries(series)); + return self; + } + + protected abstract E createSeries(); + + protected E createSeries(Object data) { + return seriesClazz.cast(createSeries().setData(data)); + } + + protected E createSeries(String name, Object data) { + return seriesClazz.cast(createSeries(data).setName(name)); + } + + protected E createSeries(E series) { + return series; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Funnel.java b/youchain-system/src/main/java/org/icepear/echarts/Funnel.java new file mode 100644 index 0000000..2ed4023 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Funnel.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.funnel.FunnelSeries; + +public class Funnel extends Chart { + public Funnel() { + super(Funnel.class, FunnelSeries.class); + } + + @Override + public FunnelSeries createSeries() { + return new FunnelSeries().setType("funnel"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Gauge.java b/youchain-system/src/main/java/org/icepear/echarts/Gauge.java new file mode 100644 index 0000000..eaa53a4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Gauge.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.gauge.GaugeSeries; + +public class Gauge extends Chart { + public Gauge() { + super(Gauge.class, GaugeSeries.class); + } + + @Override + public GaugeSeries createSeries() { + return new GaugeSeries().setType("gauge"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Graph.java b/youchain-system/src/main/java/org/icepear/echarts/Graph.java new file mode 100644 index 0000000..e906206 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Graph.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.graph.GraphSeries; + +public class Graph extends Chart { + public Graph() { + super(Graph.class, GraphSeries.class); + } + + @Override + public GraphSeries createSeries() { + return new GraphSeries().setType("graph"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Heatmap.java b/youchain-system/src/main/java/org/icepear/echarts/Heatmap.java new file mode 100644 index 0000000..bc46c69 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Heatmap.java @@ -0,0 +1,27 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.heatmap.HeatmapSeries; +import org.icepear.echarts.components.coord.SplitArea; +import org.icepear.echarts.components.coord.cartesian.CategoryAxis; +import org.icepear.echarts.components.coord.cartesian.ValueAxis; + +public class Heatmap extends CartesianCoordChart { + public Heatmap() { + super(Heatmap.class, HeatmapSeries.class); + } + + @Override + protected CategoryAxis createCategoryAxis() { + return super.createCategoryAxis().setSplitArea(new SplitArea().setShow(true)); + } + + @Override + protected ValueAxis createValueAxis() { + return super.createValueAxis().setSplitArea(new SplitArea().setShow(true)); + } + + @Override + protected HeatmapSeries createSeries() { + return new HeatmapSeries().setType("heatmap"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Line.java b/youchain-system/src/main/java/org/icepear/echarts/Line.java new file mode 100644 index 0000000..bebeb5b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Line.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.line.LineSeries; + +public class Line extends CartesianCoordChart { + public Line() { + super(Line.class, LineSeries.class); + } + + @Override + protected LineSeries createSeries() { + return new LineSeries().setType("line"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Option.java b/youchain-system/src/main/java/org/icepear/echarts/Option.java new file mode 100644 index 0000000..01fd003 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Option.java @@ -0,0 +1,505 @@ +package org.icepear.echarts; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.axisPointer.AxisPointerOption; +import org.icepear.echarts.origin.component.dataZoom.DataZoomOption; +import org.icepear.echarts.origin.component.dataset.DatasetOption; +import org.icepear.echarts.origin.component.legend.LegendOption; +import org.icepear.echarts.origin.component.title.TitleOption; +import org.icepear.echarts.origin.component.toolbox.ToolboxOption; +import org.icepear.echarts.origin.component.tooltip.TooltipOption; +import org.icepear.echarts.origin.component.visualMap.VisualMapOption; +import org.icepear.echarts.origin.coord.cartesian.AxisOption; +import org.icepear.echarts.origin.coord.cartesian.GridOption; +import org.icepear.echarts.origin.coord.parallel.ParallelAxisOption; +import org.icepear.echarts.origin.coord.polar.AngleAxisOption; +import org.icepear.echarts.origin.coord.polar.PolarOption; +import org.icepear.echarts.origin.coord.polar.RadiusAxisOption; +import org.icepear.echarts.origin.coord.radar.RadarOption; +import org.icepear.echarts.origin.coord.single.SingleAxisOption; +import org.icepear.echarts.origin.export.EChartsOption; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.ECUnitOption; +import org.icepear.echarts.origin.util.MediaUnitOption; +import org.icepear.echarts.origin.util.SeriesOption; + +@Accessors(chain = true) +@Data +public class Option implements EChartsOption { + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public Option setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public Option setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public Option setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public Option setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public Option setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public Option setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public Option setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public Option setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public Option setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public Option setColor(String color) { + this.color = color; + return this; + } + + public Option setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object baseOption; + + public Option setBaseOption(ECUnitOption baseOption) { + this.baseOption = baseOption; + return this; + } + + public Option setBaseOption(EChartsOption baseOption) { + this.baseOption = baseOption; + return this; + } + + public Option setBaseOption(Object baseOption) { + this.baseOption = baseOption; + return this; + } + + @Setter(AccessLevel.NONE) + private Object options; + + public Option setOptions(ECUnitOption[] options) { + this.options = options; + return this; + } + + public Option setOptions(EChartsOption[] options) { + this.options = options; + return this; + } + + public Option setOptions(Object options) { + this.options = options; + return this; + } + + @Setter(AccessLevel.NONE) + private Object media; + + public Option setMedia(MediaUnitOption[] media) { + this.media = media; + return this; + } + + public Option setMedia(Object media) { + this.media = media; + return this; + } + + @Setter(AccessLevel.NONE) + private Object timeline; + + public Option setTimeline(ComponentOption timeline) { + this.timeline = timeline; + return this; + } + + public Option setTimeline(ComponentOption[] timeline) { + this.timeline = timeline; + return this; + } + + public Option setTimeline(Object timeline) { + this.timeline = timeline; + return this; + } + + + @Setter(AccessLevel.NONE) + private Object darkMode; + + public Option setDarkMode(Boolean darkMode) { + this.darkMode = darkMode; + return this; + } + + public Option setDarkMode(String darkMode) { + this.darkMode = darkMode; + return this; + } + + private Object textStyle; + + private Boolean useUTC; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object dataset; + + public Option setDataset(DatasetOption dataset) { + this.dataset = dataset; + return this; + } + + public Option setDataset(DatasetOption[] dataset) { + this.dataset = dataset; + return this; + } + + private Object aria; + + @Setter(AccessLevel.NONE) + private Object title; + + public Option setTitle(TitleOption title) { + this.title = title; + return this; + } + + public Option setTitle(TitleOption[] title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object grid; + + public Option setGrid(GridOption grid) { + this.grid = grid; + return this; + } + + public Option setGrid(GridOption[] grid) { + this.grid = grid; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radar; + + public Option setRadar(RadarOption radar) { + this.radar = radar; + return this; + } + + public Option setRadar(RadarOption[] radar) { + this.radar = radar; + return this; + } + + @Setter(AccessLevel.NONE) + private Object polar; + + public Option setPolar(PolarOption polar) { + this.polar = polar; + return this; + } + + public Option setPolar(PolarOption[] polar) { + this.polar = polar; + return this; + } + + @Setter(AccessLevel.NONE) + private Object geo; + + public Option setGeo(Object geo) { + this.geo = geo; + return this; + } + + public Option setGeo(Object[] geo) { + this.geo = geo; + return this; + } + + @Setter(AccessLevel.NONE) + private Object angleAxis; + + public Option setAngleAxis(AngleAxisOption angleAxis) { + this.angleAxis = angleAxis; + return this; + } + + public Option setAngleAxis(AngleAxisOption[] angleAxis) { + this.angleAxis = angleAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radiusAxis; + + public Option setRadiusAxis(RadiusAxisOption radiusAxis) { + this.radiusAxis = radiusAxis; + return this; + } + + public Option setRadiusAxis(RadiusAxisOption[] radiusAxis) { + this.radiusAxis = radiusAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object xAxis; + + public Option setXAxis(AxisOption xAxis) { + this.xAxis = xAxis; + return this; + } + + public Option setXAxis(AxisOption[] xAxis) { + this.xAxis = xAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object yAxis; + + public Option setYAxis(Object yAxis) { + this.yAxis = yAxis; + return this; + } + + public Option setYAxis(Object[] yAxis) { + this.yAxis = yAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object singleAxis; + + public Option setSingleAxis(SingleAxisOption singleAxis) { + this.singleAxis = singleAxis; + return this; + } + + public Option setSingleAxis(SingleAxisOption[] singleAxis) { + this.singleAxis = singleAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object parallel; + + public Option setParallel(Object parallel) { + this.parallel = parallel; + return this; + } + + public Option setParallel(Object[] parallel) { + this.parallel = parallel; + return this; + } + + @Setter(AccessLevel.NONE) + private Object parallelAxis; + + public Option setParallelAxis(ParallelAxisOption parallelAxis) { + this.parallelAxis = parallelAxis; + return this; + } + + public Option setParallelAxis(ParallelAxisOption[] parallelAxis) { + this.parallelAxis = parallelAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object calendar; + + public Option setCalendar(Object calendar) { + this.calendar = calendar; + return this; + } + + public Option setCalendar(Object[] calendar) { + this.calendar = calendar; + return this; + } + + @Setter(AccessLevel.NONE) + private Object toolbox; + + public Option setToolbox(ToolboxOption toolbox) { + this.toolbox = toolbox; + return this; + } + + public Option setToolbox(ToolboxOption[] toolbox) { + this.toolbox = toolbox; + return this; + } + + @Setter(AccessLevel.NONE) + private Object tooltip; + + public Option setTooltip(TooltipOption tooltip) { + this.tooltip = tooltip; + return this; + } + + public Option setTooltip(TooltipOption[] tooltip) { + this.tooltip = tooltip; + return this; + } + + @Setter(AccessLevel.NONE) + private Object axisPointer; + + public Option setAxisPointer(AxisPointerOption axisPointer) { + this.axisPointer = axisPointer; + return this; + } + + public Option setAxisPointer(AxisPointerOption[] axisPointer) { + this.axisPointer = axisPointer; + return this; + } + + @Setter(AccessLevel.NONE) + private Object brush; + + public Option setBrush(Object brush) { + this.brush = brush; + return this; + } + + public Option setBrush(Object[] brush) { + this.brush = brush; + return this; + } + + @Setter(AccessLevel.NONE) + private Object legend; + + public Option setLegend(LegendOption legend) { + this.legend = legend; + return this; + } + + public Option setLegend(LegendOption[] legend) { + this.legend = legend; + return this; + } + + @Setter(AccessLevel.NONE) + private Object dataZoom; + + public Option setDataZoom(DataZoomOption dataZoom) { + this.dataZoom = dataZoom; + return this; + } + + public Option setDataZoom(DataZoomOption[] dataZoom) { + this.dataZoom = dataZoom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object visualMap; + + public Option setVisualMap(VisualMapOption visualMap) { + this.visualMap = visualMap; + return this; + } + + public Option setVisualMap(VisualMapOption[] visualMap) { + this.visualMap = visualMap; + return this; + } + + @Setter(AccessLevel.NONE) + private Object graphic; + + public Option setGraphic(Object graphic) { + this.graphic = graphic; + return this; + } + + public Option setGraphic(Object[] graphic) { + this.graphic = graphic; + return this; + } + + @Setter(AccessLevel.NONE) + private Object series; + + public Option setSeries(SeriesOption series) { + this.series = series; + return this; + } + + public Option setSeries(SeriesOption[] series) { + this.series = series; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Parallel.java b/youchain-system/src/main/java/org/icepear/echarts/Parallel.java new file mode 100644 index 0000000..7eab508 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Parallel.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.parallel.ParallelSeries; + +public class Parallel extends ParallelCoordChart { + public Parallel() { + super(Parallel.class, ParallelSeries.class); + } + + @Override + public ParallelSeries createSeries() { + return new ParallelSeries().setType("parallel"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/ParallelCoordChart.java b/youchain-system/src/main/java/org/icepear/echarts/ParallelCoordChart.java new file mode 100644 index 0000000..0fe167a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/ParallelCoordChart.java @@ -0,0 +1,65 @@ +package org.icepear.echarts; + +import java.util.ArrayList; +import java.util.List; + +import org.icepear.echarts.components.coord.parallel.CategoryParallelAxis; +import org.icepear.echarts.components.coord.parallel.LogParallelAxis; +import org.icepear.echarts.components.coord.parallel.TimeParallelAxis; +import org.icepear.echarts.components.coord.parallel.ValueParallelAxis; +import org.icepear.echarts.origin.coord.parallel.ParallelAxisOption; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class ParallelCoordChart, E extends SeriesOption> extends Chart { + protected List parallelAxes; + + public ParallelCoordChart(final Class clazz, final Class seriesClazz) { + super(clazz, seriesClazz); + parallelAxes = new ArrayList<>(); + } + + public Option getOption() { + return super.getOption().setParallelAxis(parallelAxes.toArray(new ParallelAxisOption[0])); + } + + public T addParallelAxis(Number dim) { + parallelAxes.add(new ValueParallelAxis().setDim(dim)); + return self; + } + + public T addParallelAxis(String name, Number dim) { + parallelAxes.add(new ValueParallelAxis().setName(name).setDim(dim)); + return self; + } + + public T addParallelAxis(Number dim, String[] data) { + parallelAxes.add(createCategoryParallelAxis().setDim(dim).setData(data)); + return self; + } + + public T addParallelAxis(String name, Number dim, String[] data) { + parallelAxes.add(createCategoryParallelAxis().setName(name).setDim(dim).setData(data)); + return self; + } + + public T addParallelAxis(ParallelAxisOption parallelAxis) { + parallelAxes.add(parallelAxis); + return self; + } + + protected CategoryParallelAxis createCategoryParallelAxis() { + return new CategoryParallelAxis().setType("category"); + } + + protected ValueParallelAxis createValueParallelAxis() { + return new ValueParallelAxis().setType("value"); + } + + protected LogParallelAxis createLogParallelAxis() { + return new LogParallelAxis().setType("log"); + } + + protected TimeParallelAxis createTimeParallelAxis() { + return new TimeParallelAxis().setType("time"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Pie.java b/youchain-system/src/main/java/org/icepear/echarts/Pie.java new file mode 100644 index 0000000..dad7558 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Pie.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.pie.PieSeries; + +public class Pie extends Chart { + public Pie() { + super(Pie.class, PieSeries.class); + } + + @Override + protected PieSeries createSeries() { + return new PieSeries().setType("pie"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/PolarBar.java b/youchain-system/src/main/java/org/icepear/echarts/PolarBar.java new file mode 100644 index 0000000..c94f927 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/PolarBar.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.bar.BarSeries; + +public class PolarBar extends PolarCoordChart { + public PolarBar() { + super(PolarBar.class, BarSeries.class); + } + + @Override + protected BarSeries createSeries() { + return new BarSeries().setType("bar").setCoordinateSystem("polar"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/PolarCoordChart.java b/youchain-system/src/main/java/org/icepear/echarts/PolarCoordChart.java new file mode 100644 index 0000000..9e07d9e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/PolarCoordChart.java @@ -0,0 +1,72 @@ +package org.icepear.echarts; + +import org.icepear.echarts.components.coord.polar.CategoryAngleAxis; +import org.icepear.echarts.components.coord.polar.CategoryRadiusAxis; +import org.icepear.echarts.components.coord.polar.PolarAxis; +import org.icepear.echarts.components.coord.polar.ValueAngleAxis; +import org.icepear.echarts.components.coord.polar.ValueRadiusAxis; +import org.icepear.echarts.origin.coord.polar.AngleAxisOption; +import org.icepear.echarts.origin.coord.polar.RadiusAxisOption; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class PolarCoordChart, E extends SeriesOption> extends Chart { + public PolarCoordChart(final Class clazz, final Class seriesClazz) { + super(clazz, seriesClazz); + option.setPolar(new PolarAxis()); + } + + public T setPolarAxis() { + option.setPolar(new PolarAxis()); + return self; + } + + public T setPolarAxis(String[] radius) { + option.setPolar(new PolarAxis().setRadius(radius)); + return self; + } + + public T setPolarAxis(PolarAxis polarAxis) { + option.setPolar(polarAxis); + return self; + } + + public T setAngleAxis() { + option.setAngleAxis(new CategoryAngleAxis()); + return self; + } + + public T setAngleAxis(Number max) { + option.setAngleAxis(new ValueAngleAxis().setMax(max)); + return self; + } + + public T setAngleAxis(String[] categories) { + option.setAngleAxis(new CategoryAngleAxis().setData(categories)); + return self; + } + + public T setAngleAxis(AngleAxisOption angleAxis) { + option.setAngleAxis(angleAxis); + return self; + } + + public T setRadiusAxis() { + option.setRadiusAxis(new ValueRadiusAxis()); + return self; + } + + public T setRadiusAxis(Number max) { + option.setRadiusAxis(new ValueRadiusAxis().setMax(max)); + return self; + } + + public T setRadiusAxis(String[] categories) { + option.setRadiusAxis(new CategoryRadiusAxis().setData(categories)); + return self; + } + + public T setRadiusAxis(RadiusAxisOption radiusAxis) { + option.setRadiusAxis(radiusAxis); + return self; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/PolarLine.java b/youchain-system/src/main/java/org/icepear/echarts/PolarLine.java new file mode 100644 index 0000000..012e8ce --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/PolarLine.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.line.LineSeries; + +public class PolarLine extends PolarCoordChart { + public PolarLine() { + super(PolarLine.class, LineSeries.class); + } + + @Override + protected LineSeries createSeries() { + return new LineSeries().setType("line").setCoordinateSystem("polar"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/PolarScatter.java b/youchain-system/src/main/java/org/icepear/echarts/PolarScatter.java new file mode 100644 index 0000000..985f75b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/PolarScatter.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.scatter.ScatterSeries; + +public class PolarScatter extends PolarCoordChart { + public PolarScatter() { + super(PolarScatter.class, ScatterSeries.class); + } + + @Override + protected ScatterSeries createSeries() { + return new ScatterSeries().setType("scatter").setCoordinateSystem("polar"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Radar.java b/youchain-system/src/main/java/org/icepear/echarts/Radar.java new file mode 100644 index 0000000..782f174 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Radar.java @@ -0,0 +1,13 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.radar.RadarSeries; + +public class Radar extends RadarCoordChart { + public Radar() { + super(Radar.class, RadarSeries.class); + } + + public RadarSeries createSeries() { + return new RadarSeries().setType("radar"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/RadarCoordChart.java b/youchain-system/src/main/java/org/icepear/echarts/RadarCoordChart.java new file mode 100644 index 0000000..de11e60 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/RadarCoordChart.java @@ -0,0 +1,21 @@ +package org.icepear.echarts; + +import org.icepear.echarts.components.coord.radar.RadarAxis; +import org.icepear.echarts.components.coord.radar.RadarIndicator; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class RadarCoordChart, E extends SeriesOption> extends Chart { + public RadarCoordChart(final Class clazz, final Class seriesClazz) { + super(clazz, seriesClazz); + } + + public T setRadarAxis(RadarIndicator[] indicators) { + option.setRadar(new RadarAxis().setIndicator(indicators)); + return self; + } + + public T setRadarAxis(RadarAxis radarAxis) { + option.setRadar(radarAxis); + return self; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Sankey.java b/youchain-system/src/main/java/org/icepear/echarts/Sankey.java new file mode 100644 index 0000000..16cf5ce --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Sankey.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.sankey.SankeySeries; + +public class Sankey extends Chart { + public Sankey() { + super(Sankey.class, SankeySeries.class); + } + + @Override + public SankeySeries createSeries() { + return new SankeySeries().setType("sankey"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Scatter.java b/youchain-system/src/main/java/org/icepear/echarts/Scatter.java new file mode 100644 index 0000000..c9d2ea3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Scatter.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.scatter.ScatterSeries; + +public class Scatter extends CartesianCoordChart { + public Scatter() { + super(Scatter.class, ScatterSeries.class); + } + + @Override + protected ScatterSeries createSeries() { + return new ScatterSeries().setType("scatter"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/SingleCoordChart.java b/youchain-system/src/main/java/org/icepear/echarts/SingleCoordChart.java new file mode 100644 index 0000000..e915634 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/SingleCoordChart.java @@ -0,0 +1,15 @@ +package org.icepear.echarts; + +import org.icepear.echarts.origin.coord.single.SingleAxisOption; +import org.icepear.echarts.origin.util.SeriesOption; + +public abstract class SingleCoordChart, E extends SeriesOption> extends Chart { + public SingleCoordChart(final Class clazz, final Class seriesClazz) { + super(clazz, seriesClazz); + } + + public T setSingleAxis(SingleAxisOption singleAxis) { + option.setSingleAxis(singleAxis); + return self; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Sunburst.java b/youchain-system/src/main/java/org/icepear/echarts/Sunburst.java new file mode 100644 index 0000000..9bdf58d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Sunburst.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.sunburst.SunburstSeries; + +public class Sunburst extends Chart { + public Sunburst() { + super(Sunburst.class, SunburstSeries.class); + } + + @Override + public SunburstSeries createSeries() { + return new SunburstSeries().setType("sunburst"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/ThemeRiver.java b/youchain-system/src/main/java/org/icepear/echarts/ThemeRiver.java new file mode 100644 index 0000000..b8c7985 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/ThemeRiver.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.themeRiver.ThemeRiverSeries; + +public class ThemeRiver extends SingleCoordChart { + public ThemeRiver() { + super(ThemeRiver.class, ThemeRiverSeries.class); + } + + @Override + public ThemeRiverSeries createSeries() { + return new ThemeRiverSeries().setType("themeRiver"); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/org/icepear/echarts/Tree.java b/youchain-system/src/main/java/org/icepear/echarts/Tree.java new file mode 100644 index 0000000..3a1ddd3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Tree.java @@ -0,0 +1,14 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.tree.TreeSeries; + +public class Tree extends Chart { + public Tree() { + super(Tree.class, TreeSeries.class); + } + + @Override + public TreeSeries createSeries() { + return new TreeSeries().setType("tree"); + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/Treemap.java b/youchain-system/src/main/java/org/icepear/echarts/Treemap.java new file mode 100644 index 0000000..fb114e0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/Treemap.java @@ -0,0 +1,15 @@ +package org.icepear.echarts; + +import org.icepear.echarts.charts.treemap.TreemapSeries; + +public class Treemap extends Chart { + public Treemap() { + super(Treemap.class, TreemapSeries.class); + } + + @Override + public TreemapSeries createSeries() { + return new TreemapSeries().setType("treemap"); + } + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarBackgroundStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarBackgroundStyle.java new file mode 100644 index 0000000..7f02560 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarBackgroundStyle.java @@ -0,0 +1,66 @@ +package org.icepear.echarts.charts.bar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarBackgroundStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class BarBackgroundStyle implements BarBackgroundStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public BarBackgroundStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public BarBackgroundStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public BarBackgroundStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public BarBackgroundStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarDataItem.java new file mode 100644 index 0000000..6672991 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarDataItem.java @@ -0,0 +1,101 @@ +package org.icepear.echarts.charts.bar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarDataItemOption; +import org.icepear.echarts.origin.chart.bar.BarItemStyleOption; +import org.icepear.echarts.origin.chart.bar.BarLabelOption; + +@Accessors(chain = true) +@Data +public class BarDataItem implements BarDataItemOption { + + private BarItemStyleOption itemStyle; + + private BarLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public BarDataItem setId(Number id) { + this.id = id; + return this; + } + + public BarDataItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public BarDataItem setName(Number name) { + this.name = name; + return this; + } + + public BarDataItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public BarDataItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public BarDataItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public BarDataItem setValue(Number value) { + this.value = value; + return this; + } + + public BarDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public BarDataItem setValue(Object value) { + this.value = value; + return this; + } + + public BarDataItem setValue(Object[] value) { + this.value = value; + return this; + } + + public BarDataItem setValue(String value) { + this.value = value; + return this; + } + + public BarDataItem setValue(String[] value) { + this.value = value; + return this; + } + + private String cursor; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarEmphasis.java new file mode 100644 index 0000000..e7b3980 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.bar; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarEmphasisOption; +import org.icepear.echarts.origin.chart.bar.BarItemStyleOption; +import org.icepear.echarts.origin.chart.bar.BarLabelOption; + +@Accessors(chain = true) +@Data +public class BarEmphasis implements BarEmphasisOption { + + private String focus; + + private BarItemStyleOption itemStyle; + + private BarLabelOption label; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarItemStyle.java new file mode 100644 index 0000000..62828d7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarItemStyle.java @@ -0,0 +1,66 @@ +package org.icepear.echarts.charts.bar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class BarItemStyle implements BarItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public BarItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public BarItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public BarItemStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public BarItemStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarLabel.java new file mode 100644 index 0000000..d3baf37 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarLabel.java @@ -0,0 +1,170 @@ +package org.icepear.echarts.charts.bar; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class BarLabel implements BarLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public BarLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public BarLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public BarLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public BarLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public BarLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public BarLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public BarLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public BarLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public BarLabel setWidth(Number width) { + this.width = width; + return this; + } + + public BarLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public BarLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public BarLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarSeries.java new file mode 100644 index 0000000..74387c6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/bar/BarSeries.java @@ -0,0 +1,396 @@ +package org.icepear.echarts.charts.bar; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.bar.BarBackgroundStyleOption; +import org.icepear.echarts.origin.chart.bar.BarDataItemOption; +import org.icepear.echarts.origin.chart.bar.BarEmphasisOption; +import org.icepear.echarts.origin.chart.bar.BarItemStyleOption; +import org.icepear.echarts.origin.chart.bar.BarLabelOption; +import org.icepear.echarts.origin.chart.bar.BarSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class BarSeries implements BarSeriesOption { + + private String mainType; + + private String type = "bar"; + + @Setter(AccessLevel.NONE) + private Object id; + + public BarSeries setId(Number id) { + this.id = id; + return this; + } + + public BarSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public BarSeries setName(Number name) { + this.name = name; + return this; + } + + public BarSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public BarSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public BarSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public BarSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public BarSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public BarSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public BarSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public BarSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public BarSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public BarSeries setColor(String color) { + this.color = color; + return this; + } + + public BarSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public BarSeries setEmphasis(BarEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public BarSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public BarSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public BarSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public BarSeries setData(BarDataItemOption[] data) { + this.data = data; + return this; + } + + public BarSeries setData(Number[] data) { + this.data = data; + return this; + } + + public BarSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public BarSeries setData(Object data) { + this.data = data; + return this; + } + + public BarSeries setData(Object[] data) { + this.data = data; + return this; + } + + public BarSeries setData(Object[][] data) { + this.data = data; + return this; + } + + public BarSeries setData(String[] data) { + this.data = data; + return this; + } + + public BarSeries setData(String[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public BarSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public BarSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public BarSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public BarSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public BarSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public BarSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public BarSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public BarSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number polarIndex; + + private String polarId; + + private Number barMinHeight; + + private Number barMinAngle; + + private Number barMaxWidth; + + private Number barMinWidth; + + @Setter(AccessLevel.NONE) + private Object barWidth; + + public BarSeries setBarWidth(Number barWidth) { + this.barWidth = barWidth; + return this; + } + + public BarSeries setBarWidth(String barWidth) { + this.barWidth = barWidth; + return this; + } + + @Setter(AccessLevel.NONE) + private Object barGap; + + public BarSeries setBarGap(Number barGap) { + this.barGap = barGap; + return this; + } + + public BarSeries setBarGap(String barGap) { + this.barGap = barGap; + return this; + } + + @Setter(AccessLevel.NONE) + private Object barCategoryGap; + + public BarSeries setBarCategoryGap(Number barCategoryGap) { + this.barCategoryGap = barCategoryGap; + return this; + } + + public BarSeries setBarCategoryGap(String barCategoryGap) { + this.barCategoryGap = barCategoryGap; + return this; + } + + private Boolean large; + + private Number largeThreshold; + + private BarItemStyleOption itemStyle; + + private BarLabelOption label; + + private String stack; + + private String sampling; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public BarSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public BarSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Boolean clip; + + private Boolean roundCap; + + private Boolean showBackground; + + private BarBackgroundStyleOption backgroundStyle; + + private Boolean realtimeSort; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotDataItem.java new file mode 100644 index 0000000..9b98f8b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotDataItem.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.boxplot; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.boxplot.BoxplotDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class BoxplotDataItem implements BoxplotDataItemOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private Object value; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotEmphasis.java new file mode 100644 index 0000000..3d7c904 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotEmphasis.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.charts.boxplot; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.boxplot.BoxplotEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class BoxplotEmphasis implements BoxplotEmphasisOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object blurScope; + + private String focus; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotSeries.java new file mode 100644 index 0000000..7ccfb89 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotSeries.java @@ -0,0 +1,316 @@ +package org.icepear.echarts.charts.boxplot; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.boxplot.BoxplotDataItemOption; +import org.icepear.echarts.origin.chart.boxplot.BoxplotEmphasisOption; +import org.icepear.echarts.origin.chart.boxplot.BoxplotSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class BoxplotSeries implements BoxplotSeriesOption { + + private String mainType; + + private String type = "boxplot"; + + @Setter(AccessLevel.NONE) + private Object id; + + public BoxplotSeries setId(Number id) { + this.id = id; + return this; + } + + public BoxplotSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public BoxplotSeries setName(Number name) { + this.name = name; + return this; + } + + public BoxplotSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public BoxplotSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public BoxplotSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public BoxplotSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public BoxplotSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public BoxplotSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public BoxplotSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public BoxplotSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public BoxplotSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public BoxplotSeries setColor(String color) { + this.color = color; + return this; + } + + public BoxplotSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public BoxplotSeries setEmphasis(BoxplotEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public BoxplotSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public BoxplotSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public BoxplotSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public BoxplotSeries setData(BoxplotDataItemOption[] data) { + this.data = data; + return this; + } + + public BoxplotSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public BoxplotSeries setData(Object data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public BoxplotSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public BoxplotSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public BoxplotSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public BoxplotSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public BoxplotSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public BoxplotSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public BoxplotSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public BoxplotSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public BoxplotSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public BoxplotSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private String layout; + + @Setter(AccessLevel.NONE) + private Object boxWidth; + + public BoxplotSeries setBoxWidth(Number[] boxWidth) { + this.boxWidth = boxWidth; + return this; + } + + public BoxplotSeries setBoxWidth(String[] boxWidth) { + this.boxWidth = boxWidth; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotTransform.java b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotTransform.java new file mode 100644 index 0000000..0e2bc85 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/BoxplotTransform.java @@ -0,0 +1,32 @@ +package org.icepear.echarts.charts.boxplot; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.boxplot.BoxplotTransformOption; +import org.icepear.echarts.origin.chart.boxplot.PrepareBoxplotDataOption; +import org.icepear.echarts.origin.data.helper.DataTransformConfigOption; + +@Accessors(chain = true) +@Data +public class BoxplotTransform implements BoxplotTransformOption { + + private String type = "boxplot"; + + @Setter(AccessLevel.NONE) + private Object config; + + public BoxplotTransform setConfig(DataTransformConfigOption config) { + this.config = config; + return this; + } + + public BoxplotTransform setConfig(PrepareBoxplotDataOption config) { + this.config = config; + return this; + } + + private Boolean print; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/PrepareBoxplotData.java b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/PrepareBoxplotData.java new file mode 100644 index 0000000..9e9dc36 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/boxplot/PrepareBoxplotData.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.charts.boxplot; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.boxplot.PrepareBoxplotDataOption; + +@Accessors(chain = true) +@Data +public class PrepareBoxplotData implements PrepareBoxplotDataOption { + + @Setter(AccessLevel.NONE) + private Object boundIQR; + + public PrepareBoxplotData setBoundIQR(Number boundIQR) { + this.boundIQR = boundIQR; + return this; + } + + public PrepareBoxplotData setBoundIQR(String boundIQR) { + this.boundIQR = boundIQR; + return this; + } + + private String itemNameFormatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickDataItem.java new file mode 100644 index 0000000..50442ca --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickDataItem.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.candlestick; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.candlestick.CandlestickDataItemOption; +import org.icepear.echarts.origin.chart.candlestick.CandlestickItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class CandlestickDataItem implements CandlestickDataItemOption { + + private CandlestickItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private Object value; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickEmphasis.java new file mode 100644 index 0000000..46f9ca7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickEmphasis.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.charts.candlestick; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.candlestick.CandlestickEmphasisOption; +import org.icepear.echarts.origin.chart.candlestick.CandlestickItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class CandlestickEmphasis implements CandlestickEmphasisOption { + + private CandlestickItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object blurScope; + + private String focus; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickItemStyle.java new file mode 100644 index 0000000..cd6a77d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickItemStyle.java @@ -0,0 +1,57 @@ +package org.icepear.echarts.charts.candlestick; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.candlestick.CandlestickItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class CandlestickItemStyle implements CandlestickItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public CandlestickItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public CandlestickItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + private Object color0; + + private Object borderColor0; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickSeries.java new file mode 100644 index 0000000..c6ef210 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/candlestick/CandlestickSeries.java @@ -0,0 +1,348 @@ +package org.icepear.echarts.charts.candlestick; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.candlestick.CandlestickDataItemOption; +import org.icepear.echarts.origin.chart.candlestick.CandlestickEmphasisOption; +import org.icepear.echarts.origin.chart.candlestick.CandlestickItemStyleOption; +import org.icepear.echarts.origin.chart.candlestick.CandlestickSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class CandlestickSeries implements CandlestickSeriesOption { + + private String mainType; + + private String type = "candlestick"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CandlestickSeries setId(Number id) { + this.id = id; + return this; + } + + public CandlestickSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CandlestickSeries setName(Number name) { + this.name = name; + return this; + } + + public CandlestickSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CandlestickSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CandlestickSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CandlestickSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CandlestickSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CandlestickSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CandlestickSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CandlestickSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CandlestickSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public CandlestickSeries setColor(String color) { + this.color = color; + return this; + } + + public CandlestickSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public CandlestickSeries setEmphasis(CandlestickEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public CandlestickSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public CandlestickSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public CandlestickSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public CandlestickSeries setData(CandlestickDataItemOption[] data) { + this.data = data; + return this; + } + + public CandlestickSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public CandlestickSeries setData(Object data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public CandlestickSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public CandlestickSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public CandlestickSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public CandlestickSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public CandlestickSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public CandlestickSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public CandlestickSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public CandlestickSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private CandlestickItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Boolean large; + + private Number largeThreshold; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public CandlestickSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public CandlestickSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private String layout; + + private Boolean clip; + + @Setter(AccessLevel.NONE) + private Object barMaxWidth; + + public CandlestickSeries setBarMaxWidth(Number barMaxWidth) { + this.barMaxWidth = barMaxWidth; + return this; + } + + public CandlestickSeries setBarMaxWidth(String barMaxWidth) { + this.barMaxWidth = barMaxWidth; + return this; + } + + @Setter(AccessLevel.NONE) + private Object barMinWidth; + + public CandlestickSeries setBarMinWidth(Number barMinWidth) { + this.barMinWidth = barMinWidth; + return this; + } + + public CandlestickSeries setBarMinWidth(String barMinWidth) { + this.barMinWidth = barMinWidth; + return this; + } + + @Setter(AccessLevel.NONE) + private Object barWidth; + + public CandlestickSeries setBarWidth(Number barWidth) { + this.barWidth = barWidth; + return this; + } + + public CandlestickSeries setBarWidth(String barWidth) { + this.barWidth = barWidth; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelDataItem.java new file mode 100644 index 0000000..2cb663d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelDataItem.java @@ -0,0 +1,100 @@ +package org.icepear.echarts.charts.funnel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.funnel.FunnelDataItemOption; +import org.icepear.echarts.origin.chart.funnel.FunnelLabelOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class FunnelDataItem implements FunnelDataItemOption { + + @Setter(AccessLevel.NONE) + private Object itemStyle; + + public FunnelDataItem setItemStyle(ItemStyleOption itemStyle) { + this.itemStyle = itemStyle; + return this; + } + + public FunnelDataItem setItemStyle(Object itemStyle) { + this.itemStyle = itemStyle; + return this; + } + + private FunnelLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public FunnelDataItem setId(Number id) { + this.id = id; + return this; + } + + public FunnelDataItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public FunnelDataItem setName(Number name) { + this.name = name; + return this; + } + + public FunnelDataItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public FunnelDataItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public FunnelDataItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public FunnelDataItem setValue(Number value) { + this.value = value; + return this; + } + + public FunnelDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public FunnelDataItem setValue(String value) { + this.value = value; + return this; + } + + public FunnelDataItem setValue(String[] value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelEmphasis.java new file mode 100644 index 0000000..16b201f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.funnel; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.funnel.FunnelEmphasisOption; +import org.icepear.echarts.origin.chart.funnel.FunnelLabelOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class FunnelEmphasis implements FunnelEmphasisOption { + + private String focus; + + private ItemStyleOption itemStyle; + + private FunnelLabelOption label; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelLabel.java new file mode 100644 index 0000000..fa370e5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelLabel.java @@ -0,0 +1,170 @@ +package org.icepear.echarts.charts.funnel; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.funnel.FunnelLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class FunnelLabel implements FunnelLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public FunnelLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public FunnelLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public FunnelLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public FunnelLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public FunnelLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public FunnelLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public FunnelLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public FunnelLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public FunnelLabel setWidth(Number width) { + this.width = width; + return this; + } + + public FunnelLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public FunnelLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public FunnelLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelSeries.java new file mode 100644 index 0000000..94b1890 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/funnel/FunnelSeries.java @@ -0,0 +1,414 @@ +package org.icepear.echarts.charts.funnel; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.funnel.FunnelDataItemOption; +import org.icepear.echarts.origin.chart.funnel.FunnelEmphasisOption; +import org.icepear.echarts.origin.chart.funnel.FunnelLabelOption; +import org.icepear.echarts.origin.chart.funnel.FunnelSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class FunnelSeries implements FunnelSeriesOption { + + private String mainType; + + private String type = "funnel"; + + @Setter(AccessLevel.NONE) + private Object id; + + public FunnelSeries setId(Number id) { + this.id = id; + return this; + } + + public FunnelSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public FunnelSeries setName(Number name) { + this.name = name; + return this; + } + + public FunnelSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public FunnelSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public FunnelSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public FunnelSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public FunnelSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public FunnelSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public FunnelSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public FunnelSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public FunnelSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public FunnelSeries setColor(String color) { + this.color = color; + return this; + } + + public FunnelSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public FunnelSeries setEmphasis(FunnelEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public FunnelSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public FunnelSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public FunnelSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public FunnelSeries setData(FunnelDataItemOption[] data) { + this.data = data; + return this; + } + + public FunnelSeries setData(Number[] data) { + this.data = data; + return this; + } + + public FunnelSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public FunnelSeries setData(Object data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public FunnelSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public FunnelSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public FunnelSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public FunnelSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public FunnelSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public FunnelSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public FunnelSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public FunnelSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private FunnelLabelOption label; + + @Setter(AccessLevel.NONE) + private Object width; + + public FunnelSeries setWidth(Number width) { + this.width = width; + return this; + } + + public FunnelSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public FunnelSeries setHeight(Number height) { + this.height = height; + return this; + } + + public FunnelSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public FunnelSeries setTop(Number top) { + this.top = top; + return this; + } + + public FunnelSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public FunnelSeries setRight(Number right) { + this.right = right; + return this; + } + + public FunnelSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public FunnelSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public FunnelSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public FunnelSeries setLeft(Number left) { + this.left = left; + return this; + } + + public FunnelSeries setLeft(String left) { + this.left = left; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public FunnelSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public FunnelSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Number min; + + private Number max; + + @Setter(AccessLevel.NONE) + private Object minSize; + + public FunnelSeries setMinSize(Number minSize) { + this.minSize = minSize; + return this; + } + + public FunnelSeries setMinSize(String minSize) { + this.minSize = minSize; + return this; + } + + @Setter(AccessLevel.NONE) + private Object maxSize; + + public FunnelSeries setMaxSize(Number maxSize) { + this.maxSize = maxSize; + return this; + } + + public FunnelSeries setMaxSize(String maxSize) { + this.maxSize = maxSize; + return this; + } + + private String sort; + + private String orient; + + private Number gap; + + private Object funnelAlign; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeAnchor.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeAnchor.java new file mode 100644 index 0000000..70a9e48 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeAnchor.java @@ -0,0 +1,39 @@ +package org.icepear.echarts.charts.gauge; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeAnchorOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class GaugeAnchor implements GaugeAnchorOption { + + private Boolean show; + + private Boolean showAbove; + + private Number size; + + private String icon; + + @Setter(AccessLevel.NONE) + private Object offsetCenter; + + public GaugeAnchor setOffsetCenter(Number[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + public GaugeAnchor setOffsetCenter(String[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + private Boolean keepAspect; + + private ItemStyleOption itemStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDataItem.java new file mode 100644 index 0000000..cbe7e79 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDataItem.java @@ -0,0 +1,36 @@ +package org.icepear.echarts.charts.gauge; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeDataItemOption; +import org.icepear.echarts.origin.chart.gauge.GaugeDetailOption; +import org.icepear.echarts.origin.chart.gauge.GaugePointerOption; +import org.icepear.echarts.origin.chart.gauge.GaugeProgressOption; +import org.icepear.echarts.origin.chart.gauge.GaugeTitleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class GaugeDataItem implements GaugeDataItemOption { + + private ItemStyleOption itemStyle; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + private Number value; + + private GaugePointerOption pointer; + + private GaugeProgressOption progress; + + private GaugeTitleOption title; + + private GaugeDetailOption detail; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDetail.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDetail.java new file mode 100644 index 0000000..5040d80 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeDetail.java @@ -0,0 +1,194 @@ +package org.icepear.echarts.charts.gauge; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeDetailOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class GaugeDetail implements GaugeDetailOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public GaugeDetail setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public GaugeDetail setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public GaugeDetail setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public GaugeDetail setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public GaugeDetail setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public GaugeDetail setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public GaugeDetail setPadding(Number padding) { + this.padding = padding; + return this; + } + + public GaugeDetail setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public GaugeDetail setWidth(Number width) { + this.width = width; + return this; + } + + public GaugeDetail setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public GaugeDetail setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public GaugeDetail setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + @Setter(AccessLevel.NONE) + private Object offsetCenter; + + public GaugeDetail setOffsetCenter(Number[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + public GaugeDetail setOffsetCenter(String[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + @Setter(AccessLevel.NONE) + private Object formatter; + + public GaugeDetail setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public GaugeDetail setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeEmphasis.java new file mode 100644 index 0000000..f468d7b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeEmphasis.java @@ -0,0 +1,18 @@ +package org.icepear.echarts.charts.gauge; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class GaugeEmphasis implements GaugeEmphasisOption { + + private String focus; + + private ItemStyleOption itemStyle; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugePointer.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugePointer.java new file mode 100644 index 0000000..ea2a433 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugePointer.java @@ -0,0 +1,52 @@ +package org.icepear.echarts.charts.gauge; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugePointerOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class GaugePointer implements GaugePointerOption { + + private String icon; + + private Boolean show; + + private Boolean showAbove; + + private Boolean keepAspect; + + private ItemStyleOption itemStyle; + + @Setter(AccessLevel.NONE) + private Object offsetCenter; + + public GaugePointer setOffsetCenter(Number[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + public GaugePointer setOffsetCenter(String[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + @Setter(AccessLevel.NONE) + private Object length; + + public GaugePointer setLength(Number length) { + this.length = length; + return this; + } + + public GaugePointer setLength(String length) { + this.length = length; + return this; + } + + private Number width; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeProgress.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeProgress.java new file mode 100644 index 0000000..f1359a9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeProgress.java @@ -0,0 +1,24 @@ +package org.icepear.echarts.charts.gauge; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeProgressOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class GaugeProgress implements GaugeProgressOption { + + private Boolean show; + + private Boolean overlap; + + private Number width; + + private Boolean roundCap; + + private Boolean clip; + + private ItemStyleOption itemStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeSeries.java new file mode 100644 index 0000000..5259959 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeSeries.java @@ -0,0 +1,366 @@ +package org.icepear.echarts.charts.gauge; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeAnchorOption; +import org.icepear.echarts.origin.chart.gauge.GaugeDataItemOption; +import org.icepear.echarts.origin.chart.gauge.GaugeDetailOption; +import org.icepear.echarts.origin.chart.gauge.GaugeEmphasisOption; +import org.icepear.echarts.origin.chart.gauge.GaugePointerOption; +import org.icepear.echarts.origin.chart.gauge.GaugeProgressOption; +import org.icepear.echarts.origin.chart.gauge.GaugeSeriesOption; +import org.icepear.echarts.origin.chart.gauge.GaugeTitleOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class GaugeSeries implements GaugeSeriesOption { + + private String mainType; + + private String type = "gauge"; + + @Setter(AccessLevel.NONE) + private Object id; + + public GaugeSeries setId(Number id) { + this.id = id; + return this; + } + + public GaugeSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public GaugeSeries setName(Number name) { + this.name = name; + return this; + } + + public GaugeSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public GaugeSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public GaugeSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public GaugeSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public GaugeSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public GaugeSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public GaugeSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public GaugeSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public GaugeSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public GaugeSeries setColor(String color) { + this.color = color; + return this; + } + + public GaugeSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public GaugeSeries setEmphasis(GaugeEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public GaugeSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public GaugeSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public GaugeSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public GaugeSeries setData(GaugeDataItemOption[] data) { + this.data = data; + return this; + } + + public GaugeSeries setData(Object data) { + this.data = data; + return this; + } + + public GaugeSeries setData(Object[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public GaugeSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public GaugeSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public GaugeSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public GaugeSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public GaugeSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public GaugeSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public GaugeSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public GaugeSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + @Setter(AccessLevel.NONE) + private Object center; + + public GaugeSeries setCenter(Number[] center) { + this.center = center; + return this; + } + + public GaugeSeries setCenter(String[] center) { + this.center = center; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public GaugeSeries setRadius(Number radius) { + this.radius = radius; + return this; + } + + public GaugeSeries setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public GaugeSeries setRadius(Object[] radius) { + this.radius = radius; + return this; + } + + public GaugeSeries setRadius(String radius) { + this.radius = radius; + return this; + } + + public GaugeSeries setRadius(String[] radius) { + this.radius = radius; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public GaugeSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public GaugeSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Number startAngle; + + private Number endAngle; + + private Boolean clockwise; + + private Number min; + + private Number max; + + private Number splitNumber; + + private Object axisLine; + + private GaugeProgressOption progress; + + private Object splitLine; + + private Object axisTick; + + private Object axisLabel; + + private GaugePointerOption pointer; + + private GaugeAnchorOption anchor; + + private GaugeTitleOption title; + + private GaugeDetailOption detail; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeTitle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeTitle.java new file mode 100644 index 0000000..e14e22c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/gauge/GaugeTitle.java @@ -0,0 +1,194 @@ +package org.icepear.echarts.charts.gauge; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.gauge.GaugeTitleOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class GaugeTitle implements GaugeTitleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public GaugeTitle setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public GaugeTitle setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public GaugeTitle setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public GaugeTitle setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public GaugeTitle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public GaugeTitle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public GaugeTitle setPadding(Number padding) { + this.padding = padding; + return this; + } + + public GaugeTitle setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public GaugeTitle setWidth(Number width) { + this.width = width; + return this; + } + + public GaugeTitle setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public GaugeTitle setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public GaugeTitle setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + @Setter(AccessLevel.NONE) + private Object offsetCenter; + + public GaugeTitle setOffsetCenter(Number[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + public GaugeTitle setOffsetCenter(String[] offsetCenter) { + this.offsetCenter = offsetCenter; + return this; + } + + @Setter(AccessLevel.NONE) + private Object formatter; + + public GaugeTitle setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public GaugeTitle setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCategoryItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCategoryItem.java new file mode 100644 index 0000000..4d4944b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCategoryItem.java @@ -0,0 +1,87 @@ +package org.icepear.echarts.charts.graph; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphCategoryItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class GraphCategoryItem implements GraphCategoryItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public GraphCategoryItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public GraphCategoryItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public GraphCategoryItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphCategoryItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphCategoryItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphCategoryItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + @Setter(AccessLevel.NONE) + private Object value; + + public GraphCategoryItem setValue(Number value) { + this.value = value; + return this; + } + + public GraphCategoryItem setValue(Object value) { + this.value = value; + return this; + } + + public GraphCategoryItem setValue(String value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCircular.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCircular.java new file mode 100644 index 0000000..61b9bb6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphCircular.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.charts.graph; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphCircularOption; + +@Accessors(chain = true) +@Data +public class GraphCircular implements GraphCircularOption { + + private Boolean rotateLabel; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeItem.java new file mode 100644 index 0000000..47123a8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeItem.java @@ -0,0 +1,143 @@ +package org.icepear.echarts.charts.graph; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphEdgeItemOption; +import org.icepear.echarts.origin.chart.graph.GraphEdgeLineStyleOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +@Accessors(chain = true) +@Data +public class GraphEdgeItem implements GraphEdgeItemOption { + + private GraphEdgeLineStyleOption lineStyle; + + private SeriesLineLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public GraphEdgeItem setId(Number id) { + this.id = id; + return this; + } + + public GraphEdgeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public GraphEdgeItem setName(Number name) { + this.name = name; + return this; + } + + public GraphEdgeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public GraphEdgeItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public GraphEdgeItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public GraphEdgeItem setValue(Number value) { + this.value = value; + return this; + } + + public GraphEdgeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public GraphEdgeItem setValue(String value) { + this.value = value; + return this; + } + + public GraphEdgeItem setValue(String[] value) { + this.value = value; + return this; + } + + @Setter(AccessLevel.NONE) + private Object source; + + public GraphEdgeItem setSource(Number source) { + this.source = source; + return this; + } + + public GraphEdgeItem setSource(String source) { + this.source = source; + return this; + } + + @Setter(AccessLevel.NONE) + private Object target; + + public GraphEdgeItem setTarget(Number target) { + this.target = target; + return this; + } + + public GraphEdgeItem setTarget(String target) { + this.target = target; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbol; + + public GraphEdgeItem setSymbol(String symbol) { + this.symbol = symbol; + return this; + } + + public GraphEdgeItem setSymbol(String[] symbol) { + this.symbol = symbol; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public GraphEdgeItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public GraphEdgeItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Boolean ignoreForceLayout; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeLineStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeLineStyle.java new file mode 100644 index 0000000..4b54671 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEdgeLineStyle.java @@ -0,0 +1,37 @@ +package org.icepear.echarts.charts.graph; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphEdgeLineStyleOption; + +@Accessors(chain = true) +@Data +public class GraphEdgeLineStyle implements GraphEdgeLineStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private Number width; + + private String color; + + private Number opacity; + + private String type; + + private Object cap; + + private Object join; + + private Number dashOffset; + + private Number miterLimit; + + private Number curveness; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEmphasis.java new file mode 100644 index 0000000..be3378c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphEmphasis.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.charts.graph; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class GraphEmphasis implements GraphEmphasisOption { + + private Object blurScope; + + private String focus; + + private Boolean scale; + + private SeriesLabelOption label; + + private SeriesLabelOption edgeLabel; + + private ItemStyleOption itemStyle; + + private LineStyleOption lineStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphForce.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphForce.java new file mode 100644 index 0000000..36234d2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphForce.java @@ -0,0 +1,47 @@ +package org.icepear.echarts.charts.graph; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphForceOption; + +@Accessors(chain = true) +@Data +public class GraphForce implements GraphForceOption { + + private String initLayout; + + @Setter(AccessLevel.NONE) + private Object repulsion; + + public GraphForce setRepulsion(Number repulsion) { + this.repulsion = repulsion; + return this; + } + + public GraphForce setRepulsion(Number[] repulsion) { + this.repulsion = repulsion; + return this; + } + + private Number gravity; + + private Number friction; + + @Setter(AccessLevel.NONE) + private Object edgeLength; + + public GraphForce setEdgeLength(Number edgeLength) { + this.edgeLength = edgeLength; + return this; + } + + public GraphForce setEdgeLength(Number[] edgeLength) { + this.edgeLength = edgeLength; + return this; + } + + private Boolean layoutAnimation; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphNodeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphNodeItem.java new file mode 100644 index 0000000..5e03334 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphNodeItem.java @@ -0,0 +1,125 @@ +package org.icepear.echarts.charts.graph; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphNodeItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class GraphNodeItem implements GraphNodeItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public GraphNodeItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public GraphNodeItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public GraphNodeItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphNodeItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphNodeItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphNodeItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String id; + + private String name; + + @Setter(AccessLevel.NONE) + private Object value; + + public GraphNodeItem setValue(Number value) { + this.value = value; + return this; + } + + public GraphNodeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public GraphNodeItem setValue(Object value) { + this.value = value; + return this; + } + + public GraphNodeItem setValue(Object[] value) { + this.value = value; + return this; + } + + public GraphNodeItem setValue(String value) { + this.value = value; + return this; + } + + public GraphNodeItem setValue(String[] value) { + this.value = value; + return this; + } + + private Number x; + + private Number y; + + private Boolean fixed; + + @Setter(AccessLevel.NONE) + private Object category; + + public GraphNodeItem setCategory(Number category) { + this.category = category; + return this; + } + + public GraphNodeItem setCategory(String category) { + this.category = category; + return this; + } + + private Boolean draggable; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphSeries.java new file mode 100644 index 0000000..c05ead8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/graph/GraphSeries.java @@ -0,0 +1,564 @@ +package org.icepear.echarts.charts.graph; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.graph.GraphBlurOption; +import org.icepear.echarts.origin.chart.graph.GraphCategoryItemOption; +import org.icepear.echarts.origin.chart.graph.GraphCircularOption; +import org.icepear.echarts.origin.chart.graph.GraphEdgeItemOption; +import org.icepear.echarts.origin.chart.graph.GraphEdgeLineStyleOption; +import org.icepear.echarts.origin.chart.graph.GraphEmphasisOption; +import org.icepear.echarts.origin.chart.graph.GraphForceOption; +import org.icepear.echarts.origin.chart.graph.GraphNodeItemOption; +import org.icepear.echarts.origin.chart.graph.GraphSelectOption; +import org.icepear.echarts.origin.chart.graph.GraphSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +@Accessors(chain = true) +@Data +public class GraphSeries implements GraphSeriesOption { + + private String mainType; + + private String type = "graph"; + + @Setter(AccessLevel.NONE) + private Object id; + + public GraphSeries setId(Number id) { + this.id = id; + return this; + } + + public GraphSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public GraphSeries setName(Number name) { + this.name = name; + return this; + } + + public GraphSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public GraphSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public GraphSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public GraphSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public GraphSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public GraphSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public GraphSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public GraphSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public GraphSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public GraphSeries setColor(String color) { + this.color = color; + return this; + } + + public GraphSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public GraphSeries setEmphasis(GraphEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public GraphSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object select; + + public GraphSeries setSelect(GraphSelectOption select) { + this.select = select; + return this; + } + + public GraphSeries setSelect(Object select) { + this.select = select; + return this; + } + + @Setter(AccessLevel.NONE) + private Object blur; + + public GraphSeries setBlur(GraphBlurOption blur) { + this.blur = blur; + return this; + } + + public GraphSeries setBlur(Object blur) { + this.blur = blur; + return this; + } + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public GraphSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public GraphSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public GraphSeries setData(GraphNodeItemOption[] data) { + this.data = data; + return this; + } + + public GraphSeries setData(Number[] data) { + this.data = data; + return this; + } + + public GraphSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public GraphSeries setData(Object data) { + this.data = data; + return this; + } + + public GraphSeries setData(Object[] data) { + this.data = data; + return this; + } + + public GraphSeries setData(Object[][] data) { + this.data = data; + return this; + } + + public GraphSeries setData(String[] data) { + this.data = data; + return this; + } + + public GraphSeries setData(String[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public GraphSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public GraphSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public GraphSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public GraphSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public GraphSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public GraphSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number polarIndex; + + private String polarId; + + private Number calendarIndex; + + private String calendarId; + + private Number geoIndex; + + private String geoId; + + private Number singleAxisIndex; + + private String singleAxisId; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public GraphSeries setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public GraphSeries setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public GraphSeries setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphSeries setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphSeries setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public GraphSeries setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + @Setter(AccessLevel.NONE) + private Object roam; + + public GraphSeries setRoam(Boolean roam) { + this.roam = roam; + return this; + } + + public GraphSeries setRoam(String roam) { + this.roam = roam; + return this; + } + + private Number[] center; + + private Number zoom; + + private Object scaleLimit; + + @Setter(AccessLevel.NONE) + private Object width; + + public GraphSeries setWidth(Number width) { + this.width = width; + return this; + } + + public GraphSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public GraphSeries setHeight(Number height) { + this.height = height; + return this; + } + + public GraphSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public GraphSeries setTop(Number top) { + this.top = top; + return this; + } + + public GraphSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public GraphSeries setRight(Number right) { + this.right = right; + return this; + } + + public GraphSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public GraphSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public GraphSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public GraphSeries setLeft(Number left) { + this.left = left; + return this; + } + + public GraphSeries setLeft(String left) { + this.left = left; + return this; + } + + private String layout; + + @Setter(AccessLevel.NONE) + private Object nodes; + + public GraphSeries setNodes(GraphNodeItemOption[] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(Number[] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(Number[][] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(Object[] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(Object[][] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(String[] nodes) { + this.nodes = nodes; + return this; + } + + public GraphSeries setNodes(String[][] nodes) { + this.nodes = nodes; + return this; + } + + private GraphEdgeItemOption[] edges; + + private GraphEdgeItemOption[] links; + + private GraphCategoryItemOption[] categories; + + private Boolean focusNodeAdjacency; + + private Number nodeScaleRatio; + + private Boolean draggable; + + @Setter(AccessLevel.NONE) + private Object edgeSymbol; + + public GraphSeries setEdgeSymbol(String edgeSymbol) { + this.edgeSymbol = edgeSymbol; + return this; + } + + public GraphSeries setEdgeSymbol(String[] edgeSymbol) { + this.edgeSymbol = edgeSymbol; + return this; + } + + @Setter(AccessLevel.NONE) + private Object edgeSymbolSize; + + public GraphSeries setEdgeSymbolSize(Number edgeSymbolSize) { + this.edgeSymbolSize = edgeSymbolSize; + return this; + } + + public GraphSeries setEdgeSymbolSize(Number[] edgeSymbolSize) { + this.edgeSymbolSize = edgeSymbolSize; + return this; + } + + private SeriesLineLabelOption edgeLabel; + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private GraphEdgeLineStyleOption lineStyle; + + private GraphCircularOption circular; + + private GraphForceOption force; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapDataItem.java new file mode 100644 index 0000000..9d2cf78 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapDataItem.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.heatmap; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.heatmap.HeatmapDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class HeatmapDataItem implements HeatmapDataItemOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private Object value; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapEmphasis.java new file mode 100644 index 0000000..03eeb62 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.heatmap; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.heatmap.HeatmapEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class HeatmapEmphasis implements HeatmapEmphasisOption { + + private String focus; + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapSeries.java new file mode 100644 index 0000000..1c01653 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/heatmap/HeatmapSeries.java @@ -0,0 +1,317 @@ +package org.icepear.echarts.charts.heatmap; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.heatmap.HeatmapDataItemOption; +import org.icepear.echarts.origin.chart.heatmap.HeatmapEmphasisOption; +import org.icepear.echarts.origin.chart.heatmap.HeatmapSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class HeatmapSeries implements HeatmapSeriesOption { + + private String mainType; + + private String type = "heatmap"; + + @Setter(AccessLevel.NONE) + private Object id; + + public HeatmapSeries setId(Number id) { + this.id = id; + return this; + } + + public HeatmapSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public HeatmapSeries setName(Number name) { + this.name = name; + return this; + } + + public HeatmapSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public HeatmapSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public HeatmapSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public HeatmapSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public HeatmapSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public HeatmapSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public HeatmapSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public HeatmapSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public HeatmapSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public HeatmapSeries setColor(String color) { + this.color = color; + return this; + } + + public HeatmapSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public HeatmapSeries setEmphasis(HeatmapEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public HeatmapSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public HeatmapSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public HeatmapSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public HeatmapSeries setData(HeatmapDataItemOption[] data) { + this.data = data; + return this; + } + + public HeatmapSeries setData(Object data) { + this.data = data; + return this; + } + + public HeatmapSeries setData(Object[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public HeatmapSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public HeatmapSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public HeatmapSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public HeatmapSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public HeatmapSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public HeatmapSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public HeatmapSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public HeatmapSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number geoIndex; + + private String geoId; + + private Number calendarIndex; + + private String calendarId; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public HeatmapSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public HeatmapSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Number blurSize; + + private Number pointSize; + + private Number maxOpacity; + + private Number minOpacity; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineAreaStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineAreaStyle.java new file mode 100644 index 0000000..30628d5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineAreaStyle.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.line; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.line.LineAreaStyleOption; + +@Accessors(chain = true) +@Data +public class LineAreaStyle implements LineAreaStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private Number opacity; + + private String origin; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineDataItem.java new file mode 100644 index 0000000..a799973 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineDataItem.java @@ -0,0 +1,73 @@ +package org.icepear.echarts.charts.line; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.line.LineDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class LineDataItem implements LineDataItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public LineDataItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public LineDataItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public LineDataItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineDataItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineDataItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineDataItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object endLabel; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + private Object value; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineEmphasis.java new file mode 100644 index 0000000..2bd417b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineEmphasis.java @@ -0,0 +1,44 @@ +package org.icepear.echarts.charts.line; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.line.LineEmphasisOption; +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class LineEmphasis implements LineEmphasisOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object endLabel; + + private Object blurScope; + + @Setter(AccessLevel.NONE) + private Object lineStyle; + + public LineEmphasis setLineStyle(LineStyleOption lineStyle) { + this.lineStyle = lineStyle; + return this; + } + + public LineEmphasis setLineStyle(Object lineStyle) { + this.lineStyle = lineStyle; + return this; + } + + private AreaStyleOption areaStyle; + + private String focus; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineSeries.java new file mode 100644 index 0000000..125d577 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/line/LineSeries.java @@ -0,0 +1,412 @@ +package org.icepear.echarts.charts.line; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.line.LineAreaStyleOption; +import org.icepear.echarts.origin.chart.line.LineDataItemOption; +import org.icepear.echarts.origin.chart.line.LineEmphasisOption; +import org.icepear.echarts.origin.chart.line.LineSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class LineSeries implements LineSeriesOption { + + private String mainType; + + private String type = "line"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LineSeries setId(Number id) { + this.id = id; + return this; + } + + public LineSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LineSeries setName(Number name) { + this.name = name; + return this; + } + + public LineSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LineSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LineSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LineSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LineSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LineSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LineSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LineSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LineSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + + + + + public LineSeries setColor(String color) { + this.color = color; + return this; + } + + public LineSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public LineSeries setEmphasis(LineEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + public LineSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public LineSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public LineSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public LineSeries setData(LineDataItemOption[] data) { + this.data = data; + return this; + } + + public LineSeries setData(Object data) { + this.data = data; + return this; + } + + public LineSeries setData(Object[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public LineSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public LineSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public LineSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public LineSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public LineSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public LineSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public LineSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public LineSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object endLabel; + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number polarIndex; + + private String polarId; + + private String stack; + + private String sampling; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public LineSeries setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public LineSeries setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public LineSeries setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineSeries setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineSeries setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public LineSeries setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public LineSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public LineSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Boolean clip; + + private LineStyleOption lineStyle; + + private LineAreaStyleOption areaStyle; + + @Setter(AccessLevel.NONE) + private Object step; + + public LineSeries setStep(Boolean step) { + this.step = step; + return this; + } + + public LineSeries setStep(String step) { + this.step = step; + return this; + } + + @Setter(AccessLevel.NONE) + private Object smooth; + + public LineSeries setSmooth(Boolean smooth) { + this.smooth = smooth; + return this; + } + + public LineSeries setSmooth(Number smooth) { + this.smooth = smooth; + return this; + } + + private String smoothMonotone; + + private Boolean connectNulls; + + private Boolean showSymbol; + + @Setter(AccessLevel.NONE) + private Object showAllSymbol; + + public LineSeries setShowAllSymbol(Boolean showAllSymbol) { + this.showAllSymbol = showAllSymbol; + return this; + } + + public LineSeries setShowAllSymbol(String showAllSymbol) { + this.showAllSymbol = showAllSymbol; + return this; + } + + private Boolean triggerLineEvent; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelDataItem.java new file mode 100644 index 0000000..db61af7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelDataItem.java @@ -0,0 +1,43 @@ +package org.icepear.echarts.charts.parallel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.parallel.ParallelDataItemOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ParallelDataItem implements ParallelDataItemOption { + + private LineStyleOption lineStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object value; + + public ParallelDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public ParallelDataItem setValue(Object[] value) { + this.value = value; + return this; + } + + public ParallelDataItem setValue(String[] value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelEmphasis.java new file mode 100644 index 0000000..b7189c0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.parallel; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.parallel.ParallelEmphasisOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ParallelEmphasis implements ParallelEmphasisOption { + + private String focus; + + private LineStyleOption lineStyle; + + private SeriesLabelOption label; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelSeries.java new file mode 100644 index 0000000..aad992d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/parallel/ParallelSeries.java @@ -0,0 +1,319 @@ +package org.icepear.echarts.charts.parallel; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.parallel.ParallelDataItemOption; +import org.icepear.echarts.origin.chart.parallel.ParallelEmphasisOption; +import org.icepear.echarts.origin.chart.parallel.ParallelSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.coord.parallel.ParallelAxisOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ParallelSeries implements ParallelSeriesOption { + + private String mainType; + + private String type = "parallel"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ParallelSeries setId(Number id) { + this.id = id; + return this; + } + + public ParallelSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ParallelSeries setName(Number name) { + this.name = name; + return this; + } + + public ParallelSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ParallelSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ParallelSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ParallelSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ParallelSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ParallelSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ParallelSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ParallelSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ParallelSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public ParallelSeries setColor(String color) { + this.color = color; + return this; + } + + public ParallelSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public ParallelSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public ParallelSeries setEmphasis(ParallelEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public ParallelSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public ParallelSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public ParallelSeries setData(Object data) { + this.data = data; + return this; + } + + public ParallelSeries setData(Object[][] data) { + this.data = data; + return this; + } + + public ParallelSeries setData(ParallelDataItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public ParallelSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public ParallelSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public ParallelSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public ParallelSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public ParallelSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public ParallelSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public ParallelSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public ParallelSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private LineStyleOption lineStyle; + + private SeriesLabelOption label; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public ParallelSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public ParallelSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Number parallelIndex; + + private String parallelId; + + private Number inactiveOpacity; + + private Number activeOpacity; + + @Setter(AccessLevel.NONE) + private Object smooth; + + public ParallelSeries setSmooth(Boolean smooth) { + this.smooth = smooth; + return this; + } + + public ParallelSeries setSmooth(Number smooth) { + this.smooth = smooth; + return this; + } + + private Boolean realtime; + + private ParallelAxisOption parallelAxisDefault; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieDataItem.java new file mode 100644 index 0000000..ca79c9e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieDataItem.java @@ -0,0 +1,91 @@ +package org.icepear.echarts.charts.pie; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieDataItemOption; +import org.icepear.echarts.origin.chart.pie.PieItemStyleOption; +import org.icepear.echarts.origin.chart.pie.PieLabelOption; + +@Accessors(chain = true) +@Data +public class PieDataItem implements PieDataItemOption { + + @Setter(AccessLevel.NONE) + private Object id; + + public PieDataItem setId(Number id) { + this.id = id; + return this; + } + + public PieDataItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public PieDataItem setName(Number name) { + this.name = name; + return this; + } + + public PieDataItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public PieDataItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public PieDataItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public PieDataItem setValue(Number value) { + this.value = value; + return this; + } + + public PieDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public PieDataItem setValue(String value) { + this.value = value; + return this; + } + + public PieDataItem setValue(String[] value) { + this.value = value; + return this; + } + + private PieItemStyleOption itemStyle; + + private PieLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String cursor; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieEmphasis.java new file mode 100644 index 0000000..a1b27e7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieEmphasis.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.pie; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieEmphasisOption; +import org.icepear.echarts.origin.chart.pie.PieItemStyleOption; +import org.icepear.echarts.origin.chart.pie.PieLabelOption; + +@Accessors(chain = true) +@Data +public class PieEmphasis implements PieEmphasisOption { + + private PieItemStyleOption itemStyle; + + private PieLabelOption label; + + private Object blurScope; + + private String focus; + + private Boolean scale; + + private Number scaleSize; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieItemStyle.java new file mode 100644 index 0000000..8be26ec --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieItemStyle.java @@ -0,0 +1,76 @@ +package org.icepear.echarts.charts.pie; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class PieItemStyle implements PieItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public PieItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public PieItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public PieItemStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public PieItemStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public PieItemStyle setBorderRadius(String borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public PieItemStyle setBorderRadius(String[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabel.java new file mode 100644 index 0000000..4945a30 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabel.java @@ -0,0 +1,229 @@ +package org.icepear.echarts.charts.pie; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class PieLabel implements PieLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public PieLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public PieLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public PieLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public PieLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public PieLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public PieLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public PieLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public PieLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public PieLabel setWidth(Number width) { + this.width = width; + return this; + } + + public PieLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object position; + + public PieLabel setPosition(Object position) { + this.position = position; + return this; + } + + public PieLabel setPosition(String position) { + this.position = position; + return this; + } + + private Number distance; + + @Setter(AccessLevel.NONE) + private Object rotate; + + public PieLabel setRotate(Boolean rotate) { + this.rotate = rotate; + return this; + } + + public PieLabel setRotate(Number rotate) { + this.rotate = rotate; + return this; + } + + public PieLabel setRotate(String rotate) { + this.rotate = rotate; + return this; + } + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public PieLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public PieLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; + + private String alignTo; + + @Setter(AccessLevel.NONE) + private Object edgeDistance; + + public PieLabel setEdgeDistance(Number edgeDistance) { + this.edgeDistance = edgeDistance; + return this; + } + + public PieLabel setEdgeDistance(String edgeDistance) { + this.edgeDistance = edgeDistance; + return this; + } + + @Setter(AccessLevel.NONE) + private Object margin; + + public PieLabel setMargin(Number margin) { + this.margin = margin; + return this; + } + + public PieLabel setMargin(String margin) { + this.margin = margin; + return this; + } + + private Number bleedMargin; + + private Number distanceToLabelLine; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabelLine.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabelLine.java new file mode 100644 index 0000000..dceb6a8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieLabelLine.java @@ -0,0 +1,41 @@ +package org.icepear.echarts.charts.pie; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieLabelLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class PieLabelLine implements PieLabelLineOption { + + private Boolean show; + + private Boolean showAbove; + + private Number length; + + private Number length2; + + @Setter(AccessLevel.NONE) + private Object smooth; + + public PieLabelLine setSmooth(Boolean smooth) { + this.smooth = smooth; + return this; + } + + public PieLabelLine setSmooth(Number smooth) { + this.smooth = smooth; + return this; + } + + private Number minTurnAngle; + + private LineStyleOption lineStyle; + + private Number maxSurfaceAngle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieSeries.java new file mode 100644 index 0000000..2e6cdc9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/pie/PieSeries.java @@ -0,0 +1,443 @@ +package org.icepear.echarts.charts.pie; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.pie.PieDataItemOption; +import org.icepear.echarts.origin.chart.pie.PieEmphasisOption; +import org.icepear.echarts.origin.chart.pie.PieItemStyleOption; +import org.icepear.echarts.origin.chart.pie.PieLabelOption; +import org.icepear.echarts.origin.chart.pie.PieSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class PieSeries implements PieSeriesOption { + + private String mainType; + + private String type = "pie"; + + @Setter(AccessLevel.NONE) + private Object id; + + public PieSeries setId(Number id) { + this.id = id; + return this; + } + + public PieSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public PieSeries setName(Number name) { + this.name = name; + return this; + } + + public PieSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public PieSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public PieSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public PieSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public PieSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public PieSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public PieSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public PieSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public PieSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public PieSeries setColor(String color) { + this.color = color; + return this; + } + + public PieSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public PieSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public PieSeries setEmphasis(PieEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public PieSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public PieSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public PieSeries setData(Number[] data) { + this.data = data; + return this; + } + + public PieSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public PieSeries setData(Object data) { + this.data = data; + return this; + } + + public PieSeries setData(PieDataItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public PieSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public PieSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public PieSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public PieSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public PieSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public PieSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public PieSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public PieSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private PieItemStyleOption itemStyle; + + private PieLabelOption label; + + @Setter(AccessLevel.NONE) + private Object center; + + public PieSeries setCenter(Number[] center) { + this.center = center; + return this; + } + + public PieSeries setCenter(String[] center) { + this.center = center; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public PieSeries setRadius(Number radius) { + this.radius = radius; + return this; + } + + public PieSeries setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public PieSeries setRadius(Object[] radius) { + this.radius = radius; + return this; + } + + public PieSeries setRadius(String radius) { + this.radius = radius; + return this; + } + + public PieSeries setRadius(String[] radius) { + this.radius = radius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public PieSeries setWidth(Number width) { + this.width = width; + return this; + } + + public PieSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public PieSeries setHeight(Number height) { + this.height = height; + return this; + } + + public PieSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public PieSeries setTop(Number top) { + this.top = top; + return this; + } + + public PieSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public PieSeries setRight(Number right) { + this.right = right; + return this; + } + + public PieSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public PieSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public PieSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public PieSeries setLeft(Number left) { + this.left = left; + return this; + } + + public PieSeries setLeft(String left) { + this.left = left; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public PieSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public PieSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private String roseType; + + private Boolean clockwise; + + private Number startAngle; + + private Number minAngle; + + private Number minShowLabelAngle; + + private Number selectedOffset; + + private Boolean avoidLabelOverlap; + + private Number percentPrecision; + + private Boolean stillShowZeroSum; + + private String animationType; + + private String animationTypeUpdate; + + private Boolean showEmptyCircle; + + private PieItemStyleOption emptyCircleStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarDataItem.java new file mode 100644 index 0000000..6dec635 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarDataItem.java @@ -0,0 +1,147 @@ +package org.icepear.echarts.charts.radar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.radar.RadarDataItemOption; +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class RadarDataItem implements RadarDataItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public RadarDataItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public RadarDataItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public RadarDataItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarDataItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarDataItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarDataItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private LineStyleOption lineStyle; + + private AreaStyleOption areaStyle; + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public RadarDataItem setId(Number id) { + this.id = id; + return this; + } + + public RadarDataItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public RadarDataItem setName(Number name) { + this.name = name; + return this; + } + + public RadarDataItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public RadarDataItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public RadarDataItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public RadarDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public RadarDataItem setValue(Number[][] value) { + this.value = value; + return this; + } + + public RadarDataItem setValue(Object[] value) { + this.value = value; + return this; + } + + public RadarDataItem setValue(Object[][] value) { + this.value = value; + return this; + } + + public RadarDataItem setValue(String[] value) { + this.value = value; + return this; + } + + public RadarDataItem setValue(String[][] value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarEmphasis.java new file mode 100644 index 0000000..174f6f8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarEmphasis.java @@ -0,0 +1,27 @@ +package org.icepear.echarts.charts.radar; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.radar.RadarEmphasisOption; +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class RadarEmphasis implements RadarEmphasisOption { + + private String focus; + + private LineStyleOption lineStyle; + + private AreaStyleOption areaStyle; + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarSeries.java new file mode 100644 index 0000000..75ff35c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/radar/RadarSeries.java @@ -0,0 +1,355 @@ +package org.icepear.echarts.charts.radar; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.radar.RadarDataItemOption; +import org.icepear.echarts.origin.chart.radar.RadarEmphasisOption; +import org.icepear.echarts.origin.chart.radar.RadarSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class RadarSeries implements RadarSeriesOption { + + private String mainType; + + private String type = "radar"; + + @Setter(AccessLevel.NONE) + private Object id; + + public RadarSeries setId(Number id) { + this.id = id; + return this; + } + + public RadarSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public RadarSeries setName(Number name) { + this.name = name; + return this; + } + + public RadarSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public RadarSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public RadarSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public RadarSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public RadarSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public RadarSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public RadarSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public RadarSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public RadarSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public RadarSeries setColor(String color) { + this.color = color; + return this; + } + + public RadarSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public RadarSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public RadarSeries setEmphasis(RadarEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public RadarSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public RadarSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public RadarSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public RadarSeries setData(Object data) { + this.data = data; + return this; + } + + public RadarSeries setData(Object[][] data) { + this.data = data; + return this; + } + + public RadarSeries setData(RadarDataItemOption[] data) { + this.data = data; + return this; + } + + public RadarSeries setData(String[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public RadarSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public RadarSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public RadarSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public RadarSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public RadarSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public RadarSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public RadarSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public RadarSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private LineStyleOption lineStyle; + + private AreaStyleOption areaStyle; + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public RadarSeries setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public RadarSeries setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public RadarSeries setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarSeries setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarSeries setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public RadarSeries setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public RadarSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public RadarSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Number radarIndex; + + private String radarId; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeItem.java new file mode 100644 index 0000000..7086d45 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeItem.java @@ -0,0 +1,125 @@ +package org.icepear.echarts.charts.sankey; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeItemOption; +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeStyleOption; + +@Accessors(chain = true) +@Data +public class SankeyEdgeItem implements SankeyEdgeItemOption { + + private SankeyEdgeStyleOption lineStyle; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public SankeyEdgeItem setId(Number id) { + this.id = id; + return this; + } + + public SankeyEdgeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public SankeyEdgeItem setName(Number name) { + this.name = name; + return this; + } + + public SankeyEdgeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public SankeyEdgeItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public SankeyEdgeItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public SankeyEdgeItem setValue(Number value) { + this.value = value; + return this; + } + + public SankeyEdgeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public SankeyEdgeItem setValue(String value) { + this.value = value; + return this; + } + + public SankeyEdgeItem setValue(String[] value) { + this.value = value; + return this; + } + + @Setter(AccessLevel.NONE) + private Object source; + + public SankeyEdgeItem setSource(Number source) { + this.source = source; + return this; + } + + public SankeyEdgeItem setSource(String source) { + this.source = source; + return this; + } + + @Setter(AccessLevel.NONE) + private Object target; + + public SankeyEdgeItem setTarget(Number target) { + this.target = target; + return this; + } + + public SankeyEdgeItem setTarget(String target) { + this.target = target; + return this; + } + + @Setter(AccessLevel.NONE) + private Object focusNodeAdjacency; + + public SankeyEdgeItem setFocusNodeAdjacency(Boolean focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } + + public SankeyEdgeItem setFocusNodeAdjacency(String focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeStyle.java new file mode 100644 index 0000000..b5144d6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEdgeStyle.java @@ -0,0 +1,37 @@ +package org.icepear.echarts.charts.sankey; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeStyleOption; + +@Accessors(chain = true) +@Data +public class SankeyEdgeStyle implements SankeyEdgeStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private Number width; + + private String color; + + private Number opacity; + + private String type; + + private Object cap; + + private Object join; + + private Number dashOffset; + + private Number miterLimit; + + private Number curveness; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEmphasis.java new file mode 100644 index 0000000..da678cb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyEmphasis.java @@ -0,0 +1,24 @@ +package org.icepear.echarts.charts.sankey; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeStyleOption; +import org.icepear.echarts.origin.chart.sankey.SankeyEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class SankeyEmphasis implements SankeyEmphasisOption { + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private SankeyEdgeStyleOption lineStyle; + + private Object blurScope; + + private String focus; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyLevel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyLevel.java new file mode 100644 index 0000000..079c071 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyLevel.java @@ -0,0 +1,22 @@ +package org.icepear.echarts.charts.sankey; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeStyleOption; +import org.icepear.echarts.origin.chart.sankey.SankeyLevelOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class SankeyLevel implements SankeyLevelOption { + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private SankeyEdgeStyleOption lineStyle; + + private Number depth; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyNodeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyNodeItem.java new file mode 100644 index 0000000..21dc255 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeyNodeItem.java @@ -0,0 +1,120 @@ +package org.icepear.echarts.charts.sankey; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyNodeItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class SankeyNodeItem implements SankeyNodeItemOption { + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public SankeyNodeItem setId(Number id) { + this.id = id; + return this; + } + + public SankeyNodeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public SankeyNodeItem setName(Number name) { + this.name = name; + return this; + } + + public SankeyNodeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public SankeyNodeItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public SankeyNodeItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public SankeyNodeItem setValue(Number value) { + this.value = value; + return this; + } + + public SankeyNodeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public SankeyNodeItem setValue(Object value) { + this.value = value; + return this; + } + + public SankeyNodeItem setValue(Object[] value) { + this.value = value; + return this; + } + + public SankeyNodeItem setValue(String value) { + this.value = value; + return this; + } + + public SankeyNodeItem setValue(String[] value) { + this.value = value; + return this; + } + + private Number localX; + + private Number localY; + + private Number depth; + + private Boolean draggable; + + @Setter(AccessLevel.NONE) + private Object focusNodeAdjacency; + + public SankeyNodeItem setFocusNodeAdjacency(Boolean focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } + + public SankeyNodeItem setFocusNodeAdjacency(String focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeySeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeySeries.java new file mode 100644 index 0000000..9bfda37 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sankey/SankeySeries.java @@ -0,0 +1,369 @@ +package org.icepear.echarts.charts.sankey; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeItemOption; +import org.icepear.echarts.origin.chart.sankey.SankeyEdgeStyleOption; +import org.icepear.echarts.origin.chart.sankey.SankeyEmphasisOption; +import org.icepear.echarts.origin.chart.sankey.SankeyLevelOption; +import org.icepear.echarts.origin.chart.sankey.SankeyNodeItemOption; +import org.icepear.echarts.origin.chart.sankey.SankeySeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class SankeySeries implements SankeySeriesOption { + + private String mainType; + + private String type = "sankey"; + + @Setter(AccessLevel.NONE) + private Object id; + + public SankeySeries setId(Number id) { + this.id = id; + return this; + } + + public SankeySeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public SankeySeries setName(Number name) { + this.name = name; + return this; + } + + public SankeySeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public SankeySeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public SankeySeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public SankeySeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public SankeySeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public SankeySeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public SankeySeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public SankeySeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public SankeySeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public SankeySeries setColor(String color) { + this.color = color; + return this; + } + + public SankeySeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public SankeySeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public SankeySeries setEmphasis(SankeyEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public SankeySeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public SankeySeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public SankeySeries setData(Object data) { + this.data = data; + return this; + } + + public SankeySeries setData(SankeyNodeItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public SankeySeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public SankeySeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public SankeySeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public SankeySeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public SankeySeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public SankeySeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private SeriesLabelOption label; + + private ItemStyleOption itemStyle; + + private SankeyEdgeStyleOption lineStyle; + + @Setter(AccessLevel.NONE) + private Object width; + + public SankeySeries setWidth(Number width) { + this.width = width; + return this; + } + + public SankeySeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public SankeySeries setHeight(Number height) { + this.height = height; + return this; + } + + public SankeySeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public SankeySeries setTop(Number top) { + this.top = top; + return this; + } + + public SankeySeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public SankeySeries setRight(Number right) { + this.right = right; + return this; + } + + public SankeySeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public SankeySeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public SankeySeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public SankeySeries setLeft(Number left) { + this.left = left; + return this; + } + + public SankeySeries setLeft(String left) { + this.left = left; + return this; + } + + private String orient; + + private Number nodeWidth; + + private Number nodeGap; + + private Boolean draggable; + + @Setter(AccessLevel.NONE) + private Object focusNodeAdjacency; + + public SankeySeries setFocusNodeAdjacency(Boolean focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } + + public SankeySeries setFocusNodeAdjacency(String focusNodeAdjacency) { + this.focusNodeAdjacency = focusNodeAdjacency; + return this; + } + + private Number layoutIterations; + + private SankeyNodeItemOption[] nodes; + + private SankeyEdgeItemOption[] edges; + + private SankeyEdgeItemOption[] links; + + private SankeyLevelOption[] levels; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterDataItem.java new file mode 100644 index 0000000..7c32bcb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterDataItem.java @@ -0,0 +1,141 @@ +package org.icepear.echarts.charts.scatter; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.scatter.ScatterDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ScatterDataItem implements ScatterDataItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public ScatterDataItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public ScatterDataItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public ScatterDataItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterDataItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterDataItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterDataItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public ScatterDataItem setId(Number id) { + this.id = id; + return this; + } + + public ScatterDataItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ScatterDataItem setName(Number name) { + this.name = name; + return this; + } + + public ScatterDataItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public ScatterDataItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public ScatterDataItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public ScatterDataItem setValue(Number value) { + this.value = value; + return this; + } + + public ScatterDataItem setValue(Number[] value) { + this.value = value; + return this; + } + + public ScatterDataItem setValue(Object value) { + this.value = value; + return this; + } + + public ScatterDataItem setValue(Object[] value) { + this.value = value; + return this; + } + + public ScatterDataItem setValue(String value) { + this.value = value; + return this; + } + + public ScatterDataItem setValue(String[] value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterEmphasis.java new file mode 100644 index 0000000..1e1d3ea --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterEmphasis.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.charts.scatter; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.scatter.ScatterEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ScatterEmphasis implements ScatterEmphasisOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object blurScope; + + private String focus; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterSeries.java new file mode 100644 index 0000000..23c61a2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/scatter/ScatterSeries.java @@ -0,0 +1,392 @@ +package org.icepear.echarts.charts.scatter; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.scatter.ScatterDataItemOption; +import org.icepear.echarts.origin.chart.scatter.ScatterEmphasisOption; +import org.icepear.echarts.origin.chart.scatter.ScatterSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.OptionEncode; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class ScatterSeries implements ScatterSeriesOption { + + private String mainType; + + private String type = "scatter"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ScatterSeries setId(Number id) { + this.id = id; + return this; + } + + public ScatterSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ScatterSeries setName(Number name) { + this.name = name; + return this; + } + + public ScatterSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ScatterSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ScatterSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ScatterSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ScatterSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ScatterSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ScatterSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ScatterSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ScatterSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public ScatterSeries setColor(String color) { + this.color = color; + return this; + } + + public ScatterSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public ScatterSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public ScatterSeries setEmphasis(ScatterEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public ScatterSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public ScatterSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public ScatterSeries setData(Number[] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(Number[][] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(Object data) { + this.data = data; + return this; + } + + public ScatterSeries setData(Object[] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(Object[][] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(ScatterDataItemOption[] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(String[] data) { + this.data = data; + return this; + } + + public ScatterSeries setData(String[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public ScatterSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public ScatterSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + @Setter(AccessLevel.NONE) + private Object seriesLayoutBy; + + public ScatterSeries setSeriesLayoutBy(Object seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + public ScatterSeries setSeriesLayoutBy(String seriesLayoutBy) { + this.seriesLayoutBy = seriesLayoutBy; + return this; + } + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public ScatterSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public ScatterSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public ScatterSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public ScatterSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Number xAxisIndex; + + private Number yAxisIndex; + + private String xAxisId; + + private String yAxisId; + + private Number polarIndex; + + private String polarId; + + private Number calendarIndex; + + private String calendarId; + + private Number geoIndex; + + private String geoId; + + private Number singleAxisIndex; + + private String singleAxisId; + + private Boolean large; + + private Number largeThreshold; + + private String stack; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public ScatterSeries setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public ScatterSeries setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public ScatterSeries setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterSeries setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterSeries setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public ScatterSeries setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public ScatterSeries setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public ScatterSeries setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + private Boolean clip; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstEmphasis.java new file mode 100644 index 0000000..2744aa7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.sunburst; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstEmphasisOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstItemStyleOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLabelOption; + +@Accessors(chain = true) +@Data +public class SunburstEmphasis implements SunburstEmphasisOption { + + private SunburstItemStyleOption itemStyle; + + private SunburstLabelOption label; + + private Object blurScope; + + private String focus; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstItemStyle.java new file mode 100644 index 0000000..420c028 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstItemStyle.java @@ -0,0 +1,76 @@ +package org.icepear.echarts.charts.sunburst; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class SunburstItemStyle implements SunburstItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public SunburstItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public SunburstItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public SunburstItemStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SunburstItemStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SunburstItemStyle setBorderRadius(String borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SunburstItemStyle setBorderRadius(String[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstLabel.java new file mode 100644 index 0000000..cea94dd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstLabel.java @@ -0,0 +1,183 @@ +package org.icepear.echarts.charts.sunburst; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class SunburstLabel implements SunburstLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public SunburstLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public SunburstLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public SunburstLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public SunburstLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public SunburstLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SunburstLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public SunburstLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public SunburstLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public SunburstLabel setWidth(Number width) { + this.width = width; + return this; + } + + public SunburstLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + @Setter(AccessLevel.NONE) + private Object rotate; + + public SunburstLabel setRotate(Number rotate) { + this.rotate = rotate; + return this; + } + + public SunburstLabel setRotate(String rotate) { + this.rotate = rotate; + return this; + } + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public SunburstLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public SunburstLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; + + private Number minAngle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstNodeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstNodeItem.java new file mode 100644 index 0000000..c065a2a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstNodeItem.java @@ -0,0 +1,111 @@ +package org.icepear.echarts.charts.sunburst; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstItemStyleOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLabelOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstNodeItemOption; + +@Accessors(chain = true) +@Data +public class SunburstNodeItem implements SunburstNodeItemOption { + + private SunburstItemStyleOption itemStyle; + + private SunburstLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public SunburstNodeItem setId(Number id) { + this.id = id; + return this; + } + + public SunburstNodeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public SunburstNodeItem setName(Number name) { + this.name = name; + return this; + } + + public SunburstNodeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public SunburstNodeItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public SunburstNodeItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public SunburstNodeItem setValue(Number value) { + this.value = value; + return this; + } + + public SunburstNodeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public SunburstNodeItem setValue(Object value) { + this.value = value; + return this; + } + + public SunburstNodeItem setValue(Object[] value) { + this.value = value; + return this; + } + + public SunburstNodeItem setValue(String value) { + this.value = value; + return this; + } + + public SunburstNodeItem setValue(String[] value) { + this.value = value; + return this; + } + + private String nodeClick; + + private String link; + + private String target; + + private SunburstNodeItemOption[] children; + + private Boolean collapsed; + + private String cursor; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeries.java new file mode 100644 index 0000000..6311003 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeries.java @@ -0,0 +1,315 @@ +package org.icepear.echarts.charts.sunburst; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstEmphasisOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstItemStyleOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLabelOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLevelOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstNodeItemOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; + +@Accessors(chain = true) +@Data +public class SunburstSeries implements SunburstSeriesOption { + + private String mainType; + + private String type = "sunburst"; + + @Setter(AccessLevel.NONE) + private Object id; + + public SunburstSeries setId(Number id) { + this.id = id; + return this; + } + + public SunburstSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public SunburstSeries setName(Number name) { + this.name = name; + return this; + } + + public SunburstSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public SunburstSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public SunburstSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public SunburstSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public SunburstSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public SunburstSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public SunburstSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public SunburstSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public SunburstSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public SunburstSeries setColor(String color) { + this.color = color; + return this; + } + + public SunburstSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public SunburstSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public SunburstSeries setEmphasis(SunburstEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public SunburstSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public SunburstSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public SunburstSeries setData(Object data) { + this.data = data; + return this; + } + + public SunburstSeries setData(SunburstNodeItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public SunburstSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public SunburstSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public SunburstSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public SunburstSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public SunburstSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public SunburstSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private SunburstItemStyleOption itemStyle; + + private SunburstLabelOption label; + + @Setter(AccessLevel.NONE) + private Object center; + + public SunburstSeries setCenter(Number[] center) { + this.center = center; + return this; + } + + public SunburstSeries setCenter(String[] center) { + this.center = center; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public SunburstSeries setRadius(Number radius) { + this.radius = radius; + return this; + } + + public SunburstSeries setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public SunburstSeries setRadius(Object[] radius) { + this.radius = radius; + return this; + } + + public SunburstSeries setRadius(String radius) { + this.radius = radius; + return this; + } + + public SunburstSeries setRadius(String[] radius) { + this.radius = radius; + return this; + } + + private Boolean clockwise; + + private Number startAngle; + + private Number minAngle; + + private Boolean stillShowZeroSum; + + private String nodeClick; + + private Boolean renderLabelForZeroData; + + private SunburstLevelOption[] levels; + + private String animationType; + + private String sort; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeriesLevel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeriesLevel.java new file mode 100644 index 0000000..c31049d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/sunburst/SunburstSeriesLevel.java @@ -0,0 +1,66 @@ +package org.icepear.echarts.charts.sunburst; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.sunburst.SunburstItemStyleOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLabelOption; +import org.icepear.echarts.origin.chart.sunburst.SunburstLevelOption; + +@Accessors(chain = true) +@Data +public class SunburstSeriesLevel implements SunburstLevelOption { + + private SunburstItemStyleOption itemStyle; + + private SunburstLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object radius; + + public SunburstSeriesLevel setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public SunburstSeriesLevel setRadius(String[] radius) { + this.radius = radius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object r; + + public SunburstSeriesLevel setR(Number r) { + this.r = r; + return this; + } + + public SunburstSeriesLevel setR(String r) { + this.r = r; + return this; + } + + @Setter(AccessLevel.NONE) + private Object r0; + + public SunburstSeriesLevel setR0(Number r0) { + this.r0 = r0; + return this; + } + + public SunburstSeriesLevel setR0(String r0) { + this.r0 = r0; + return this; + } + + private Object highlight; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverEmphasis.java new file mode 100644 index 0000000..80597d8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverEmphasis.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.charts.themeRiver; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverEmphasisOption; +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverLabelOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class ThemeRiverEmphasis implements ThemeRiverEmphasisOption { + + private String focus; + + private ThemeRiverLabelOption label; + + private ItemStyleOption itemStyle; + + private Object blurScope; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverLabel.java new file mode 100644 index 0000000..9c76823 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverLabel.java @@ -0,0 +1,172 @@ +package org.icepear.echarts.charts.themeRiver; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class ThemeRiverLabel implements ThemeRiverLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public ThemeRiverLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public ThemeRiverLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public ThemeRiverLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public ThemeRiverLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public ThemeRiverLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public ThemeRiverLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public ThemeRiverLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public ThemeRiverLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public ThemeRiverLabel setWidth(Number width) { + this.width = width; + return this; + } + + public ThemeRiverLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public ThemeRiverLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public ThemeRiverLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; + + private Number margin; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverSeries.java new file mode 100644 index 0000000..9695e59 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/themeRiver/ThemeRiverSeries.java @@ -0,0 +1,349 @@ +package org.icepear.echarts.charts.themeRiver; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverEmphasisOption; +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverLabelOption; +import org.icepear.echarts.origin.chart.themeRiver.ThemeRiverSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; + +@Accessors(chain = true) +@Data +public class ThemeRiverSeries implements ThemeRiverSeriesOption { + + private String mainType; + + private String type = "themeRiver"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ThemeRiverSeries setId(Number id) { + this.id = id; + return this; + } + + public ThemeRiverSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ThemeRiverSeries setName(Number name) { + this.name = name; + return this; + } + + public ThemeRiverSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ThemeRiverSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ThemeRiverSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ThemeRiverSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ThemeRiverSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ThemeRiverSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ThemeRiverSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ThemeRiverSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ThemeRiverSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public ThemeRiverSeries setColor(String color) { + this.color = color; + return this; + } + + public ThemeRiverSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public ThemeRiverSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public ThemeRiverSeries setEmphasis(ThemeRiverEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public ThemeRiverSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public ThemeRiverSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public ThemeRiverSeries setData(Object data) { + this.data = data; + return this; + } + + public ThemeRiverSeries setData(Object[][] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public ThemeRiverSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public ThemeRiverSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public ThemeRiverSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public ThemeRiverSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public ThemeRiverSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public ThemeRiverSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ThemeRiverLabelOption label; + + private ItemStyleOption itemStyle; + + private Number singleAxisIndex; + + private String singleAxisId; + + @Setter(AccessLevel.NONE) + private Object width; + + public ThemeRiverSeries setWidth(Number width) { + this.width = width; + return this; + } + + public ThemeRiverSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public ThemeRiverSeries setHeight(Number height) { + this.height = height; + return this; + } + + public ThemeRiverSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public ThemeRiverSeries setTop(Number top) { + this.top = top; + return this; + } + + public ThemeRiverSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public ThemeRiverSeries setRight(Number right) { + this.right = right; + return this; + } + + public ThemeRiverSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public ThemeRiverSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public ThemeRiverSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public ThemeRiverSeries setLeft(Number left) { + this.left = left; + return this; + } + + public ThemeRiverSeries setLeft(String left) { + this.left = left; + return this; + } + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ThemeRiverSeries setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ThemeRiverSeries setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeEmphasis.java new file mode 100644 index 0000000..ee41a4c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeEmphasis.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.tree; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.tree.TreeEmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class TreeEmphasis implements TreeEmphasisOption { + + private ItemStyleOption itemStyle; + + private Object lineStyle; + + private SeriesLabelOption label; + + private Object blurScope; + + private String focus; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeLeaves.java b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeLeaves.java new file mode 100644 index 0000000..25dab8e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeLeaves.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.charts.tree; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.tree.TreeLeavesOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class TreeLeaves implements TreeLeavesOption { + + private ItemStyleOption itemStyle; + + private Object lineStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeNodeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeNodeItem.java new file mode 100644 index 0000000..052e605 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeNodeItem.java @@ -0,0 +1,151 @@ +package org.icepear.echarts.charts.tree; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.tree.TreeNodeItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class TreeNodeItem implements TreeNodeItemOption { + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public TreeNodeItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public TreeNodeItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public TreeNodeItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeNodeItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeNodeItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeNodeItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private ItemStyleOption itemStyle; + + private Object lineStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public TreeNodeItem setId(Number id) { + this.id = id; + return this; + } + + public TreeNodeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TreeNodeItem setName(Number name) { + this.name = name; + return this; + } + + public TreeNodeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object groupId; + + public TreeNodeItem setGroupId(Number groupId) { + this.groupId = groupId; + return this; + } + + public TreeNodeItem setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + private Boolean selected; + + @Setter(AccessLevel.NONE) + private Object value; + + public TreeNodeItem setValue(Number value) { + this.value = value; + return this; + } + + public TreeNodeItem setValue(Number[] value) { + this.value = value; + return this; + } + + public TreeNodeItem setValue(Object value) { + this.value = value; + return this; + } + + public TreeNodeItem setValue(Object[] value) { + this.value = value; + return this; + } + + public TreeNodeItem setValue(String value) { + this.value = value; + return this; + } + + public TreeNodeItem setValue(String[] value) { + this.value = value; + return this; + } + + private TreeNodeItemOption[] children; + + private Boolean collapsed; + + private String link; + + private String target; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeSeries.java new file mode 100644 index 0000000..ddae674 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/tree/TreeSeries.java @@ -0,0 +1,424 @@ +package org.icepear.echarts.charts.tree; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.tree.TreeEmphasisOption; +import org.icepear.echarts.origin.chart.tree.TreeLeavesOption; +import org.icepear.echarts.origin.chart.tree.TreeNodeItemOption; +import org.icepear.echarts.origin.chart.tree.TreeSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class TreeSeries implements TreeSeriesOption { + + private String mainType; + + private String type = "tree"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TreeSeries setId(Number id) { + this.id = id; + return this; + } + + public TreeSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TreeSeries setName(Number name) { + this.name = name; + return this; + } + + public TreeSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TreeSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TreeSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TreeSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TreeSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TreeSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TreeSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TreeSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TreeSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public TreeSeries setColor(String color) { + this.color = color; + return this; + } + + public TreeSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public TreeSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public TreeSeries setEmphasis(TreeEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public TreeSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public TreeSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public TreeSeries setData(Object data) { + this.data = data; + return this; + } + + public TreeSeries setData(TreeNodeItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public TreeSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public TreeSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public TreeSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public TreeSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public TreeSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public TreeSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private ItemStyleOption itemStyle; + + private Object lineStyle; + + private SeriesLabelOption label; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public TreeSeries setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public TreeSeries setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public TreeSeries setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeSeries setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeSeries setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public TreeSeries setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public TreeSeries setWidth(Number width) { + this.width = width; + return this; + } + + public TreeSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public TreeSeries setHeight(Number height) { + this.height = height; + return this; + } + + public TreeSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public TreeSeries setTop(Number top) { + this.top = top; + return this; + } + + public TreeSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public TreeSeries setRight(Number right) { + this.right = right; + return this; + } + + public TreeSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public TreeSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public TreeSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public TreeSeries setLeft(Number left) { + this.left = left; + return this; + } + + public TreeSeries setLeft(String left) { + this.left = left; + return this; + } + + @Setter(AccessLevel.NONE) + private Object roam; + + public TreeSeries setRoam(Boolean roam) { + this.roam = roam; + return this; + } + + public TreeSeries setRoam(String roam) { + this.roam = roam; + return this; + } + + private Number[] center; + + private Number zoom; + + private Object scaleLimit; + + private String layout; + + private String edgeShape; + + @Setter(AccessLevel.NONE) + private Object edgeForkPosition; + + public TreeSeries setEdgeForkPosition(Number edgeForkPosition) { + this.edgeForkPosition = edgeForkPosition; + return this; + } + + public TreeSeries setEdgeForkPosition(String edgeForkPosition) { + this.edgeForkPosition = edgeForkPosition; + return this; + } + + private Number nodeScaleRatio; + + private String orient; + + private Boolean expandAndCollapse; + + private Number initialTreeDepth; + + private TreeLeavesOption leaves; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/Breadcrumb.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/Breadcrumb.java new file mode 100644 index 0000000..c7eece0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/Breadcrumb.java @@ -0,0 +1,101 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.BreadcrumbEmphasisItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.BreadcrumbItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.BreadcrumbOption; + +@Accessors(chain = true) +@Data +public class Breadcrumb implements BreadcrumbOption { + + @Setter(AccessLevel.NONE) + private Object width; + + public Breadcrumb setWidth(Number width) { + this.width = width; + return this; + } + + public Breadcrumb setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public Breadcrumb setHeight(Number height) { + this.height = height; + return this; + } + + public Breadcrumb setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public Breadcrumb setTop(Number top) { + this.top = top; + return this; + } + + public Breadcrumb setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public Breadcrumb setRight(Number right) { + this.right = right; + return this; + } + + public Breadcrumb setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public Breadcrumb setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public Breadcrumb setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public Breadcrumb setLeft(Number left) { + this.left = left; + return this; + } + + public Breadcrumb setLeft(String left) { + this.left = left; + return this; + } + + private Boolean show; + + private Number emptyItemWidth; + + private BreadcrumbItemStyleOption itemStyle; + + private BreadcrumbEmphasisItemStyleOption emphasis; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbEmphasisItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbEmphasisItemStyle.java new file mode 100644 index 0000000..1721017 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbEmphasisItemStyle.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.BreadcrumbEmphasisItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.BreadcrumbItemStyleOption; + +@Accessors(chain = true) +@Data +public class BreadcrumbEmphasisItemStyle implements BreadcrumbEmphasisItemStyleOption { + + private BreadcrumbItemStyleOption itemStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbItemStyle.java new file mode 100644 index 0000000..dbdc99f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/BreadcrumbItemStyle.java @@ -0,0 +1,56 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.BreadcrumbItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class BreadcrumbItemStyle implements BreadcrumbItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public BreadcrumbItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public BreadcrumbItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + private LabelOption textStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapEmphasis.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapEmphasis.java new file mode 100644 index 0000000..8b97602 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapEmphasis.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapEmphasisOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLabelOption; + +@Accessors(chain = true) +@Data +public class TreemapEmphasis implements TreemapEmphasisOption { + + private TreemapSeriesItemStyleOption itemStyle; + + private TreemapSeriesLabelOption label; + + private TreemapSeriesLabelOption upperLabel; + + private Object blurScope; + + private String focus; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeries.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeries.java new file mode 100644 index 0000000..230111c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeries.java @@ -0,0 +1,447 @@ +package org.icepear.echarts.charts.treemap; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.BreadcrumbOption; +import org.icepear.echarts.origin.chart.treemap.TreemapEmphasisOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLabelOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLevelOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesNodeItemOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.LabelLayoutOption; +import org.icepear.echarts.origin.util.LabelLineOption; + +@Accessors(chain = true) +@Data +public class TreemapSeries implements TreemapSeriesOption { + + private String mainType; + + private String type = "treemap"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TreemapSeries setId(Number id) { + this.id = id; + return this; + } + + public TreemapSeries setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TreemapSeries setName(Number name) { + this.name = name; + return this; + } + + public TreemapSeries setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TreemapSeries setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TreemapSeries setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TreemapSeries setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TreemapSeries setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TreemapSeries setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TreemapSeries setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TreemapSeries setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TreemapSeries setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object color; + + public TreemapSeries setColor(String color) { + this.color = color; + return this; + } + + public TreemapSeries setColor(String[] color) { + this.color = color; + return this; + } + + private String[][] colorLayer; + + @Setter(AccessLevel.NONE) + private Object emphasis; + + public TreemapSeries setEmphasis(Object emphasis) { + this.emphasis = emphasis; + return this; + } + + public TreemapSeries setEmphasis(TreemapEmphasisOption emphasis) { + this.emphasis = emphasis; + return this; + } + + private Object select; + + private Object blur; + + private MarkAreaOption markArea; + + private MarkLineOption markLine; + + private MarkPointOption markPoint; + + private Object tooltip; + + private Boolean silent; + + private String blendMode; + + private String cursor; + + @Setter(AccessLevel.NONE) + private Object dataGroupId; + + public TreemapSeries setDataGroupId(Number dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + public TreemapSeries setDataGroupId(String dataGroupId) { + this.dataGroupId = dataGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object data; + + public TreemapSeries setData(Object data) { + this.data = data; + return this; + } + + public TreemapSeries setData(TreemapSeriesNodeItemOption[] data) { + this.data = data; + return this; + } + + private String colorBy; + + private Boolean legendHoverLink; + + @Setter(AccessLevel.NONE) + private Object progressive; + + public TreemapSeries setProgressive(Boolean progressive) { + this.progressive = progressive; + return this; + } + + public TreemapSeries setProgressive(Number progressive) { + this.progressive = progressive; + return this; + } + + private Number progressiveThreshold; + + private String progressiveChunkMode; + + private String coordinateSystem; + + private Number hoverLayerThreshold; + + private String seriesLayoutBy; + + private LabelLineOption labelLine; + + private LabelLayoutOption labelLayout; + + private Object stateAnimation; + + @Setter(AccessLevel.NONE) + private Object universalTransition; + + public TreemapSeries setUniversalTransition(Boolean universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + public TreemapSeries setUniversalTransition(Object universalTransition) { + this.universalTransition = universalTransition; + return this; + } + + private Map selectedMap; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public TreemapSeries setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public TreemapSeries setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private TreemapSeriesItemStyleOption itemStyle; + + private TreemapSeriesLabelOption label; + + private TreemapSeriesLabelOption upperLabel; + + @Setter(AccessLevel.NONE) + private Object width; + + public TreemapSeries setWidth(Number width) { + this.width = width; + return this; + } + + public TreemapSeries setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public TreemapSeries setHeight(Number height) { + this.height = height; + return this; + } + + public TreemapSeries setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public TreemapSeries setTop(Number top) { + this.top = top; + return this; + } + + public TreemapSeries setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public TreemapSeries setRight(Number right) { + this.right = right; + return this; + } + + public TreemapSeries setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public TreemapSeries setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public TreemapSeries setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public TreemapSeries setLeft(Number left) { + this.left = left; + return this; + } + + public TreemapSeries setLeft(String left) { + this.left = left; + return this; + } + + @Setter(AccessLevel.NONE) + private Object roam; + + public TreemapSeries setRoam(Boolean roam) { + this.roam = roam; + return this; + } + + public TreemapSeries setRoam(String roam) { + this.roam = roam; + return this; + } + + private Number[] center; + + private Number zoom; + + private Object scaleLimit; + + @Setter(AccessLevel.NONE) + private Object visualDimension; + + public TreemapSeries setVisualDimension(Number visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + public TreemapSeries setVisualDimension(String visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + private String colorMappingBy; + + private Number visualMin; + + private Number visualMax; + + @Setter(AccessLevel.NONE) + private Object colorAlpha; + + public TreemapSeries setColorAlpha(Number[] colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + public TreemapSeries setColorAlpha(String colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + @Setter(AccessLevel.NONE) + private Object colorSaturation; + + public TreemapSeries setColorSaturation(Number[] colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + public TreemapSeries setColorSaturation(String colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + private Number visibleMin; + + private Number childrenVisibleMin; + + @Setter(AccessLevel.NONE) + private Object size; + + public TreemapSeries setSize(Number[] size) { + this.size = size; + return this; + } + + public TreemapSeries setSize(String[] size) { + this.size = size; + return this; + } + + @Setter(AccessLevel.NONE) + private Object sort; + + public TreemapSeries setSort(Boolean sort) { + this.sort = sort; + return this; + } + + public TreemapSeries setSort(String sort) { + this.sort = sort; + return this; + } + + private String clipWindow; + + private Number squareRatio; + + private Number leafDepth; + + private String drillDownIcon; + + private Number zoomToNodeRatio; + + private String nodeClick; + + private BreadcrumbOption breadcrumb; + + private TreemapSeriesLevelOption[] levels; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesItemStyle.java new file mode 100644 index 0000000..5c6e554 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesItemStyle.java @@ -0,0 +1,74 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesItemStyleOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class TreemapSeriesItemStyle implements TreemapSeriesItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + @Setter(AccessLevel.NONE) + private Object decal; + + public TreemapSeriesItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public TreemapSeriesItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public TreemapSeriesItemStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public TreemapSeriesItemStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + private Number colorAlpha; + + private Number colorSaturation; + + private Number borderColorSaturation; + + private Number gapWidth; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLabel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLabel.java new file mode 100644 index 0000000..53c1840 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLabel.java @@ -0,0 +1,172 @@ +package org.icepear.echarts.charts.treemap; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class TreemapSeriesLabel implements TreemapSeriesLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public TreemapSeriesLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public TreemapSeriesLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public TreemapSeriesLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public TreemapSeriesLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public TreemapSeriesLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public TreemapSeriesLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public TreemapSeriesLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public TreemapSeriesLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public TreemapSeriesLabel setWidth(Number width) { + this.width = width; + return this; + } + + public TreemapSeriesLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public TreemapSeriesLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public TreemapSeriesLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; + + private Boolean ellipsis; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLevel.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLevel.java new file mode 100644 index 0000000..49e92bd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesLevel.java @@ -0,0 +1,103 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLabelOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLevelOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class TreemapSeriesLevel implements TreemapSeriesLevelOption { + + @Setter(AccessLevel.NONE) + private Object visualDimension; + + public TreemapSeriesLevel setVisualDimension(Number visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + public TreemapSeriesLevel setVisualDimension(String visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + private String colorMappingBy; + + private Number visualMin; + + private Number visualMax; + + @Setter(AccessLevel.NONE) + private Object colorAlpha; + + public TreemapSeriesLevel setColorAlpha(Number[] colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + public TreemapSeriesLevel setColorAlpha(String colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + @Setter(AccessLevel.NONE) + private Object colorSaturation; + + public TreemapSeriesLevel setColorSaturation(Number[] colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + public TreemapSeriesLevel setColorSaturation(String colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + private Number visibleMin; + + private Number childrenVisibleMin; + + private TreemapSeriesItemStyleOption itemStyle; + + private TreemapSeriesLabelOption label; + + private TreemapSeriesLabelOption upperLabel; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object color; + + public TreemapSeriesLevel setColor(String color) { + this.color = color; + return this; + } + + public TreemapSeriesLevel setColor(String[] color) { + this.color = color; + return this; + } + + @Setter(AccessLevel.NONE) + private Object decal; + + public TreemapSeriesLevel setDecal(DecalObject[] decal) { + this.decal = decal; + return this; + } + + public TreemapSeriesLevel setDecal(String decal) { + this.decal = decal; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesNodeItem.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesNodeItem.java new file mode 100644 index 0000000..68b2244 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesNodeItem.java @@ -0,0 +1,144 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesItemStyleOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesLabelOption; +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesNodeItemOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class TreemapSeriesNodeItem implements TreemapSeriesNodeItemOption { + + @Setter(AccessLevel.NONE) + private Object visualDimension; + + public TreemapSeriesNodeItem setVisualDimension(Number visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + public TreemapSeriesNodeItem setVisualDimension(String visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + private String colorMappingBy; + + private Number visualMin; + + private Number visualMax; + + @Setter(AccessLevel.NONE) + private Object colorAlpha; + + public TreemapSeriesNodeItem setColorAlpha(Number[] colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + public TreemapSeriesNodeItem setColorAlpha(String colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + @Setter(AccessLevel.NONE) + private Object colorSaturation; + + public TreemapSeriesNodeItem setColorSaturation(Number[] colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + public TreemapSeriesNodeItem setColorSaturation(String colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + private Number visibleMin; + + private Number childrenVisibleMin; + + private TreemapSeriesItemStyleOption itemStyle; + + private TreemapSeriesLabelOption label; + + private TreemapSeriesLabelOption upperLabel; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object id; + + public TreemapSeriesNodeItem setId(Number id) { + this.id = id; + return this; + } + + public TreemapSeriesNodeItem setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TreemapSeriesNodeItem setName(Number name) { + this.name = name; + return this; + } + + public TreemapSeriesNodeItem setName(String name) { + this.name = name; + return this; + } + + @Setter(AccessLevel.NONE) + private Object value; + + public TreemapSeriesNodeItem setValue(Number value) { + this.value = value; + return this; + } + + public TreemapSeriesNodeItem setValue(Number[] value) { + this.value = value; + return this; + } + + private TreemapSeriesNodeItemOption[] children; + + @Setter(AccessLevel.NONE) + private Object color; + + public TreemapSeriesNodeItem setColor(String color) { + this.color = color; + return this; + } + + public TreemapSeriesNodeItem setColor(String[] color) { + this.color = color; + return this; + } + + @Setter(AccessLevel.NONE) + private Object decal; + + public TreemapSeriesNodeItem setDecal(DecalObject[] decal) { + this.decal = decal; + return this; + } + + public TreemapSeriesNodeItem setDecal(String decal) { + this.decal = decal; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesVisual.java b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesVisual.java new file mode 100644 index 0000000..7d2c39f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/charts/treemap/TreemapSeriesVisual.java @@ -0,0 +1,62 @@ +package org.icepear.echarts.charts.treemap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.chart.treemap.TreemapSeriesVisualOption; + +@Accessors(chain = true) +@Data +public class TreemapSeriesVisual implements TreemapSeriesVisualOption { + + @Setter(AccessLevel.NONE) + private Object visualDimension; + + public TreemapSeriesVisual setVisualDimension(Number visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + public TreemapSeriesVisual setVisualDimension(String visualDimension) { + this.visualDimension = visualDimension; + return this; + } + + private String colorMappingBy; + + private Number visualMin; + + private Number visualMax; + + @Setter(AccessLevel.NONE) + private Object colorAlpha; + + public TreemapSeriesVisual setColorAlpha(Number[] colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + public TreemapSeriesVisual setColorAlpha(String colorAlpha) { + this.colorAlpha = colorAlpha; + return this; + } + + @Setter(AccessLevel.NONE) + private Object colorSaturation; + + public TreemapSeriesVisual setColorSaturation(Number[] colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + public TreemapSeriesVisual setColorSaturation(String colorSaturation) { + this.colorSaturation = colorSaturation; + return this; + } + + private Number visibleMin; + + private Number childrenVisibleMin; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/axisPointer/AxisPointerLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/axisPointer/AxisPointerLabel.java new file mode 100644 index 0000000..990f594 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/axisPointer/AxisPointerLabel.java @@ -0,0 +1,172 @@ +package org.icepear.echarts.components.axisPointer; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.AxisPointerLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class AxisPointerLabel implements AxisPointerLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public AxisPointerLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public AxisPointerLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public AxisPointerLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public AxisPointerLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public AxisPointerLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public AxisPointerLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public AxisPointerLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public AxisPointerLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public AxisPointerLabel setWidth(Number width) { + this.width = width; + return this; + } + + public AxisPointerLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public AxisPointerLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public AxisPointerLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private Number margin; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisLine.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisLine.java new file mode 100644 index 0000000..05fb939 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisLine.java @@ -0,0 +1,71 @@ +package org.icepear.echarts.components.coord; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class AxisLine implements AxisLineOption { + + @Setter(AccessLevel.NONE) + private Object show; + + public AxisLine setShow(Boolean show) { + this.show = show; + return this; + } + + public AxisLine setShow(String show) { + this.show = show; + return this; + } + + private Boolean onZero; + + private Number onZeroAxisIndex; + + @Setter(AccessLevel.NONE) + private Object symbol; + + public AxisLine setSymbol(String symbol) { + this.symbol = symbol; + return this; + } + + public AxisLine setSymbol(String[] symbol) { + this.symbol = symbol; + return this; + } + + private Number[] symbolSize; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public AxisLine setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public AxisLine setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public AxisLine setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public AxisLine setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private LineStyleOption lineStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisNameTextStyle.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisNameTextStyle.java new file mode 100644 index 0000000..eed4bb1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/AxisNameTextStyle.java @@ -0,0 +1,137 @@ +package org.icepear.echarts.components.coord; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class AxisNameTextStyle implements AxisNameTextStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public AxisNameTextStyle setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public AxisNameTextStyle setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public AxisNameTextStyle setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public AxisNameTextStyle setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public AxisNameTextStyle setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public AxisNameTextStyle setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public AxisNameTextStyle setPadding(Number padding) { + this.padding = padding; + return this; + } + + public AxisNameTextStyle setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public AxisNameTextStyle setWidth(Number width) { + this.width = width; + return this; + } + + public AxisNameTextStyle setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Map rich; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisLabel.java new file mode 100644 index 0000000..80a5436 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisLabel.java @@ -0,0 +1,164 @@ +package org.icepear.echarts.components.coord; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.CategoryAxisLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class CategoryAxisLabel implements CategoryAxisLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public CategoryAxisLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public CategoryAxisLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public CategoryAxisLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public CategoryAxisLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public CategoryAxisLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public CategoryAxisLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public CategoryAxisLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public CategoryAxisLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public CategoryAxisLabel setWidth(Number width) { + this.width = width; + return this; + } + + public CategoryAxisLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private Boolean inside; + + private Number rotate; + + private Boolean showMinLabel; + + private Boolean showMaxLabel; + + private Number margin; + + private Map rich; + + private Boolean hideOverlap; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public CategoryAxisLabel setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public CategoryAxisLabel setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisTick.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisTick.java new file mode 100644 index 0000000..f921a45 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/CategoryAxisTick.java @@ -0,0 +1,48 @@ +package org.icepear.echarts.components.coord; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.CategoryAxisTickOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class CategoryAxisTick implements CategoryAxisTickOption { + + @Setter(AccessLevel.NONE) + private Object show; + + public CategoryAxisTick setShow(Boolean show) { + this.show = show; + return this; + } + + public CategoryAxisTick setShow(String show) { + this.show = show; + return this; + } + + private Boolean inside; + + private Number length; + + private LineStyleOption lineStyle; + + private Boolean alignWithLabel; + + @Setter(AccessLevel.NONE) + private Object interval; + + public CategoryAxisTick setInterval(Number interval) { + this.interval = interval; + return this; + } + + public CategoryAxisTick setInterval(String interval) { + this.interval = interval; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/LogAxisLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/LogAxisLabel.java new file mode 100644 index 0000000..4bb59a7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/LogAxisLabel.java @@ -0,0 +1,164 @@ +package org.icepear.echarts.components.coord; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.LogAxisLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class LogAxisLabel implements LogAxisLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public LogAxisLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public LogAxisLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public LogAxisLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public LogAxisLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public LogAxisLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public LogAxisLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public LogAxisLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public LogAxisLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public LogAxisLabel setWidth(Number width) { + this.width = width; + return this; + } + + public LogAxisLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private Boolean inside; + + private Number rotate; + + private Boolean showMinLabel; + + private Boolean showMaxLabel; + + private Number margin; + + private Map rich; + + private Boolean hideOverlap; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public LogAxisLabel setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public LogAxisLabel setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/MinorSplitLine.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/MinorSplitLine.java new file mode 100644 index 0000000..bc54806 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/MinorSplitLine.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.components.coord; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class MinorSplitLine implements MinorSplitLineOption { + + private Boolean show; + + private LineStyleOption lineStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitArea.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitArea.java new file mode 100644 index 0000000..98dae7c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitArea.java @@ -0,0 +1,31 @@ +package org.icepear.echarts.components.coord; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.util.AreaStyleOption; + +@Accessors(chain = true) +@Data +public class SplitArea implements SplitAreaOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object interval; + + public SplitArea setInterval(Number interval) { + this.interval = interval; + return this; + } + + public SplitArea setInterval(String interval) { + this.interval = interval; + return this; + } + + private AreaStyleOption areaStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitLine.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitLine.java new file mode 100644 index 0000000..a2305bf --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/SplitLine.java @@ -0,0 +1,31 @@ +package org.icepear.echarts.components.coord; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class SplitLine implements SplitLineOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object interval; + + public SplitLine setInterval(Number interval) { + this.interval = interval; + return this; + } + + public SplitLine setInterval(String interval) { + this.interval = interval; + return this; + } + + private LineStyleOption lineStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/TimeAxisLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/TimeAxisLabel.java new file mode 100644 index 0000000..0e72562 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/TimeAxisLabel.java @@ -0,0 +1,164 @@ +package org.icepear.echarts.components.coord; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.TimeAxisLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class TimeAxisLabel implements TimeAxisLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public TimeAxisLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public TimeAxisLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public TimeAxisLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public TimeAxisLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public TimeAxisLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public TimeAxisLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public TimeAxisLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public TimeAxisLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public TimeAxisLabel setWidth(Number width) { + this.width = width; + return this; + } + + public TimeAxisLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private Boolean inside; + + private Number rotate; + + private Boolean showMinLabel; + + private Boolean showMaxLabel; + + private Number margin; + + private Map rich; + + private Boolean hideOverlap; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public TimeAxisLabel setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public TimeAxisLabel setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/ValueAxisLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/ValueAxisLabel.java new file mode 100644 index 0000000..5ac7844 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/ValueAxisLabel.java @@ -0,0 +1,164 @@ +package org.icepear.echarts.components.coord; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.ValueAxisLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class ValueAxisLabel implements ValueAxisLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public ValueAxisLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public ValueAxisLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public ValueAxisLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public ValueAxisLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public ValueAxisLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public ValueAxisLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public ValueAxisLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public ValueAxisLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public ValueAxisLabel setWidth(Number width) { + this.width = width; + return this; + } + + public ValueAxisLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private Boolean inside; + + private Number rotate; + + private Boolean showMinLabel; + + private Boolean showMaxLabel; + + private Number margin; + + private Map rich; + + private Boolean hideOverlap; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public ValueAxisLabel setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public ValueAxisLabel setFormatter(String formatter) { + this.formatter = formatter; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/CategoryAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/CategoryAxis.java new file mode 100644 index 0000000..37b0a59 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/CategoryAxis.java @@ -0,0 +1,216 @@ +package org.icepear.echarts.components.coord.cartesian; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.cartesian.CategoryAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class CategoryAxis implements CategoryAxisOption { + + private Number gridIndex; + + private String gridId; + + private String position; + + private Number offset; + + private Object categorySortInfo; + + private String mainType; + + private String type = "category"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CategoryAxis setId(Number id) { + this.id = id; + return this; + } + + public CategoryAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CategoryAxis setName(Number name) { + this.name = name; + return this; + } + + public CategoryAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CategoryAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CategoryAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CategoryAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CategoryAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CategoryAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CategoryAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CategoryAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CategoryAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public CategoryAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public CategoryAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + @Setter(AccessLevel.NONE) + private Object axisTick; + + public CategoryAxis setAxisTick(AxisTickOption axisTick) { + this.axisTick = axisTick; + return this; + } + + public CategoryAxis setAxisTick(Object axisTick) { + this.axisTick = axisTick; + return this; + } + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public CategoryAxis setMin(Number min) { + this.min = min; + return this; + } + + public CategoryAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public CategoryAxis setMax(Number max) { + this.max = max; + return this; + } + + public CategoryAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + private Boolean boundaryGap; + + private Boolean deduplication; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/LogAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/LogAxis.java new file mode 100644 index 0000000..74c1ee1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/LogAxis.java @@ -0,0 +1,224 @@ +package org.icepear.echarts.components.coord.cartesian; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.cartesian.LogAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class LogAxis implements LogAxisOption { + + private Number gridIndex; + + private String gridId; + + private String position; + + private Number offset; + + private Object categorySortInfo; + + private String mainType; + + private String type = "log"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LogAxis setId(Number id) { + this.id = id; + return this; + } + + public LogAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LogAxis setName(Number name) { + this.name = name; + return this; + } + + public LogAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LogAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LogAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LogAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LogAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LogAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LogAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LogAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LogAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public LogAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public LogAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public LogAxis setMin(Number min) { + this.min = min; + return this; + } + + public LogAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public LogAxis setMax(Number max) { + this.max = max; + return this; + } + + public LogAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public LogAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public LogAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Number logBase; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/TimeAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/TimeAxis.java new file mode 100644 index 0000000..29c328a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/TimeAxis.java @@ -0,0 +1,222 @@ +package org.icepear.echarts.components.coord.cartesian; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.cartesian.TimeAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class TimeAxis implements TimeAxisOption { + + private Number gridIndex; + + private String gridId; + + private String position; + + private Number offset; + + private Object categorySortInfo; + + private String mainType; + + private String type = "time"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TimeAxis setId(Number id) { + this.id = id; + return this; + } + + public TimeAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TimeAxis setName(Number name) { + this.name = name; + return this; + } + + public TimeAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TimeAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TimeAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TimeAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TimeAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TimeAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TimeAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TimeAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TimeAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public TimeAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public TimeAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public TimeAxis setMin(Number min) { + this.min = min; + return this; + } + + public TimeAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public TimeAxis setMax(Number max) { + this.max = max; + return this; + } + + public TimeAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public TimeAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public TimeAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/ValueAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/ValueAxis.java new file mode 100644 index 0000000..376dfc0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/cartesian/ValueAxis.java @@ -0,0 +1,224 @@ +package org.icepear.echarts.components.coord.cartesian; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.cartesian.ValueAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class ValueAxis implements ValueAxisOption { + + private Number gridIndex; + + private String gridId; + + private String position; + + private Number offset; + + private Object categorySortInfo; + + private String mainType; + + private String type = "value"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ValueAxis setId(Number id) { + this.id = id; + return this; + } + + public ValueAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ValueAxis setName(Number name) { + this.name = name; + return this; + } + + public ValueAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ValueAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ValueAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ValueAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ValueAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ValueAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ValueAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ValueAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ValueAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public ValueAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public ValueAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public ValueAxis setMin(Number min) { + this.min = min; + return this; + } + + public ValueAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public ValueAxis setMax(Number max) { + this.max = max; + return this; + } + + public ValueAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ValueAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ValueAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/CategoryParallelAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/CategoryParallelAxis.java new file mode 100644 index 0000000..41505fb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/CategoryParallelAxis.java @@ -0,0 +1,225 @@ +package org.icepear.echarts.components.coord.parallel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.parallel.CategoryParallelAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class CategoryParallelAxis implements CategoryParallelAxisOption { + + @Setter(AccessLevel.NONE) + private Object dim; + + public CategoryParallelAxis setDim(Number dim) { + this.dim = dim; + return this; + } + + public CategoryParallelAxis setDim(Number[] dim) { + this.dim = dim; + return this; + } + + private Number parallelIndex; + + private Object areaSelectStyle; + + private Boolean realtime; + + private String mainType; + + private String type = "category"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CategoryParallelAxis setId(Number id) { + this.id = id; + return this; + } + + public CategoryParallelAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CategoryParallelAxis setName(Number name) { + this.name = name; + return this; + } + + public CategoryParallelAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CategoryParallelAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CategoryParallelAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CategoryParallelAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CategoryParallelAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CategoryParallelAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CategoryParallelAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CategoryParallelAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CategoryParallelAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public CategoryParallelAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public CategoryParallelAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + @Setter(AccessLevel.NONE) + private Object axisTick; + + public CategoryParallelAxis setAxisTick(AxisTickOption axisTick) { + this.axisTick = axisTick; + return this; + } + + public CategoryParallelAxis setAxisTick(Object axisTick) { + this.axisTick = axisTick; + return this; + } + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public CategoryParallelAxis setMin(Number min) { + this.min = min; + return this; + } + + public CategoryParallelAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public CategoryParallelAxis setMax(Number max) { + this.max = max; + return this; + } + + public CategoryParallelAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + private Boolean boundaryGap; + + private Boolean deduplication; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/LogParallelAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/LogParallelAxis.java new file mode 100644 index 0000000..5496702 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/LogParallelAxis.java @@ -0,0 +1,233 @@ +package org.icepear.echarts.components.coord.parallel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.parallel.LogParallelAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class LogParallelAxis implements LogParallelAxisOption { + + @Setter(AccessLevel.NONE) + private Object dim; + + public LogParallelAxis setDim(Number dim) { + this.dim = dim; + return this; + } + + public LogParallelAxis setDim(Number[] dim) { + this.dim = dim; + return this; + } + + private Number parallelIndex; + + private Object areaSelectStyle; + + private Boolean realtime; + + private String mainType; + + private String type = "log"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LogParallelAxis setId(Number id) { + this.id = id; + return this; + } + + public LogParallelAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LogParallelAxis setName(Number name) { + this.name = name; + return this; + } + + public LogParallelAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LogParallelAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LogParallelAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LogParallelAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LogParallelAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LogParallelAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LogParallelAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LogParallelAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LogParallelAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public LogParallelAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public LogParallelAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public LogParallelAxis setMin(Number min) { + this.min = min; + return this; + } + + public LogParallelAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public LogParallelAxis setMax(Number max) { + this.max = max; + return this; + } + + public LogParallelAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public LogParallelAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public LogParallelAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Number logBase; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/TimeParallelAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/TimeParallelAxis.java new file mode 100644 index 0000000..a8c0950 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/TimeParallelAxis.java @@ -0,0 +1,231 @@ +package org.icepear.echarts.components.coord.parallel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.parallel.TimeParallelAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class TimeParallelAxis implements TimeParallelAxisOption { + + @Setter(AccessLevel.NONE) + private Object dim; + + public TimeParallelAxis setDim(Number dim) { + this.dim = dim; + return this; + } + + public TimeParallelAxis setDim(Number[] dim) { + this.dim = dim; + return this; + } + + private Number parallelIndex; + + private Object areaSelectStyle; + + private Boolean realtime; + + private String mainType; + + private String type = "time"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TimeParallelAxis setId(Number id) { + this.id = id; + return this; + } + + public TimeParallelAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TimeParallelAxis setName(Number name) { + this.name = name; + return this; + } + + public TimeParallelAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TimeParallelAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TimeParallelAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TimeParallelAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TimeParallelAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TimeParallelAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TimeParallelAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TimeParallelAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TimeParallelAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public TimeParallelAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public TimeParallelAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public TimeParallelAxis setMin(Number min) { + this.min = min; + return this; + } + + public TimeParallelAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public TimeParallelAxis setMax(Number max) { + this.max = max; + return this; + } + + public TimeParallelAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public TimeParallelAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public TimeParallelAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/ValueParallelAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/ValueParallelAxis.java new file mode 100644 index 0000000..84e25c1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/parallel/ValueParallelAxis.java @@ -0,0 +1,233 @@ +package org.icepear.echarts.components.coord.parallel; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.parallel.ValueParallelAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class ValueParallelAxis implements ValueParallelAxisOption { + + @Setter(AccessLevel.NONE) + private Object dim; + + public ValueParallelAxis setDim(Number dim) { + this.dim = dim; + return this; + } + + public ValueParallelAxis setDim(Number[] dim) { + this.dim = dim; + return this; + } + + private Number parallelIndex; + + private Object areaSelectStyle; + + private Boolean realtime; + + private String mainType; + + private String type = "value"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ValueParallelAxis setId(Number id) { + this.id = id; + return this; + } + + public ValueParallelAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ValueParallelAxis setName(Number name) { + this.name = name; + return this; + } + + public ValueParallelAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ValueParallelAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ValueParallelAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ValueParallelAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ValueParallelAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ValueParallelAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ValueParallelAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ValueParallelAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ValueParallelAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public ValueParallelAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public ValueParallelAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public ValueParallelAxis setMin(Number min) { + this.min = min; + return this; + } + + public ValueParallelAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public ValueParallelAxis setMax(Number max) { + this.max = max; + return this; + } + + public ValueParallelAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ValueParallelAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ValueParallelAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryAngleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryAngleAxis.java new file mode 100644 index 0000000..1bcab6e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryAngleAxis.java @@ -0,0 +1,214 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.CategoryAngleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class CategoryAngleAxis implements CategoryAngleAxisOption { + + private Number polarIndex; + + private String polarId; + + private Number startAngle; + + private Boolean clockwise; + + private String mainType; + + private String type = "category"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CategoryAngleAxis setId(Number id) { + this.id = id; + return this; + } + + public CategoryAngleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CategoryAngleAxis setName(Number name) { + this.name = name; + return this; + } + + public CategoryAngleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CategoryAngleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CategoryAngleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CategoryAngleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CategoryAngleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CategoryAngleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CategoryAngleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CategoryAngleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CategoryAngleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public CategoryAngleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public CategoryAngleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + @Setter(AccessLevel.NONE) + private Object axisTick; + + public CategoryAngleAxis setAxisTick(AxisTickOption axisTick) { + this.axisTick = axisTick; + return this; + } + + public CategoryAngleAxis setAxisTick(Object axisTick) { + this.axisTick = axisTick; + return this; + } + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public CategoryAngleAxis setMin(Number min) { + this.min = min; + return this; + } + + public CategoryAngleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public CategoryAngleAxis setMax(Number max) { + this.max = max; + return this; + } + + public CategoryAngleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + private Boolean boundaryGap; + + private Boolean deduplication; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryRadiusAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryRadiusAxis.java new file mode 100644 index 0000000..86f5789 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/CategoryRadiusAxis.java @@ -0,0 +1,210 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.CategoryRadiusAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class CategoryRadiusAxis implements CategoryRadiusAxisOption { + + private Number polarIndex; + + private String polarId; + + private String mainType; + + private String type = "category"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CategoryRadiusAxis setId(Number id) { + this.id = id; + return this; + } + + public CategoryRadiusAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CategoryRadiusAxis setName(Number name) { + this.name = name; + return this; + } + + public CategoryRadiusAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CategoryRadiusAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CategoryRadiusAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CategoryRadiusAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CategoryRadiusAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CategoryRadiusAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CategoryRadiusAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CategoryRadiusAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CategoryRadiusAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public CategoryRadiusAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public CategoryRadiusAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + @Setter(AccessLevel.NONE) + private Object axisTick; + + public CategoryRadiusAxis setAxisTick(AxisTickOption axisTick) { + this.axisTick = axisTick; + return this; + } + + public CategoryRadiusAxis setAxisTick(Object axisTick) { + this.axisTick = axisTick; + return this; + } + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public CategoryRadiusAxis setMin(Number min) { + this.min = min; + return this; + } + + public CategoryRadiusAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public CategoryRadiusAxis setMax(Number max) { + this.max = max; + return this; + } + + public CategoryRadiusAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + private Boolean boundaryGap; + + private Boolean deduplication; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogAngleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogAngleAxis.java new file mode 100644 index 0000000..5668b50 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogAngleAxis.java @@ -0,0 +1,222 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.LogAngleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class LogAngleAxis implements LogAngleAxisOption { + + private Number polarIndex; + + private String polarId; + + private Number startAngle; + + private Boolean clockwise; + + private String mainType; + + private String type = "log"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LogAngleAxis setId(Number id) { + this.id = id; + return this; + } + + public LogAngleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LogAngleAxis setName(Number name) { + this.name = name; + return this; + } + + public LogAngleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LogAngleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LogAngleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LogAngleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LogAngleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LogAngleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LogAngleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LogAngleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LogAngleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public LogAngleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public LogAngleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public LogAngleAxis setMin(Number min) { + this.min = min; + return this; + } + + public LogAngleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public LogAngleAxis setMax(Number max) { + this.max = max; + return this; + } + + public LogAngleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public LogAngleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public LogAngleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Number logBase; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogRadiusAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogRadiusAxis.java new file mode 100644 index 0000000..091bcb2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/LogRadiusAxis.java @@ -0,0 +1,218 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.LogRadiusAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class LogRadiusAxis implements LogRadiusAxisOption { + + private Number polarIndex; + + private String polarId; + + private String mainType; + + private String type = "log"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LogRadiusAxis setId(Number id) { + this.id = id; + return this; + } + + public LogRadiusAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LogRadiusAxis setName(Number name) { + this.name = name; + return this; + } + + public LogRadiusAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LogRadiusAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LogRadiusAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LogRadiusAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LogRadiusAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LogRadiusAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LogRadiusAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LogRadiusAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LogRadiusAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public LogRadiusAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public LogRadiusAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public LogRadiusAxis setMin(Number min) { + this.min = min; + return this; + } + + public LogRadiusAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public LogRadiusAxis setMax(Number max) { + this.max = max; + return this; + } + + public LogRadiusAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public LogRadiusAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public LogRadiusAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Number logBase; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/PolarAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/PolarAxis.java new file mode 100644 index 0000000..528acb5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/PolarAxis.java @@ -0,0 +1,88 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.polar.PolarOption; + +@Accessors(chain = true) +@Data +public class PolarAxis implements PolarOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public PolarAxis setId(Number id) { + this.id = id; + return this; + } + + public PolarAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public PolarAxis setName(Number name) { + this.name = name; + return this; + } + + public PolarAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object center; + + public PolarAxis setCenter(Number[] center) { + this.center = center; + return this; + } + + public PolarAxis setCenter(String[] center) { + this.center = center; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public PolarAxis setRadius(Number radius) { + this.radius = radius; + return this; + } + + public PolarAxis setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public PolarAxis setRadius(Object[] radius) { + this.radius = radius; + return this; + } + + public PolarAxis setRadius(String radius) { + this.radius = radius; + return this; + } + + public PolarAxis setRadius(String[] radius) { + this.radius = radius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeAngleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeAngleAxis.java new file mode 100644 index 0000000..d160bbe --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeAngleAxis.java @@ -0,0 +1,220 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.TimeAngleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class TimeAngleAxis implements TimeAngleAxisOption { + + private Number polarIndex; + + private String polarId; + + private Number startAngle; + + private Boolean clockwise; + + private String mainType; + + private String type = "time"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TimeAngleAxis setId(Number id) { + this.id = id; + return this; + } + + public TimeAngleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TimeAngleAxis setName(Number name) { + this.name = name; + return this; + } + + public TimeAngleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TimeAngleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TimeAngleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TimeAngleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TimeAngleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TimeAngleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TimeAngleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TimeAngleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TimeAngleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public TimeAngleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public TimeAngleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public TimeAngleAxis setMin(Number min) { + this.min = min; + return this; + } + + public TimeAngleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public TimeAngleAxis setMax(Number max) { + this.max = max; + return this; + } + + public TimeAngleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public TimeAngleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public TimeAngleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeRadiusAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeRadiusAxis.java new file mode 100644 index 0000000..f6cb0b0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/TimeRadiusAxis.java @@ -0,0 +1,216 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.TimeRadiusAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class TimeRadiusAxis implements TimeRadiusAxisOption { + + private Number polarIndex; + + private String polarId; + + private String mainType; + + private String type = "time"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TimeRadiusAxis setId(Number id) { + this.id = id; + return this; + } + + public TimeRadiusAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TimeRadiusAxis setName(Number name) { + this.name = name; + return this; + } + + public TimeRadiusAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TimeRadiusAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TimeRadiusAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TimeRadiusAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TimeRadiusAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TimeRadiusAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TimeRadiusAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TimeRadiusAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TimeRadiusAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public TimeRadiusAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public TimeRadiusAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public TimeRadiusAxis setMin(Number min) { + this.min = min; + return this; + } + + public TimeRadiusAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public TimeRadiusAxis setMax(Number max) { + this.max = max; + return this; + } + + public TimeRadiusAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public TimeRadiusAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public TimeRadiusAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueAngleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueAngleAxis.java new file mode 100644 index 0000000..734c742 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueAngleAxis.java @@ -0,0 +1,222 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.ValueAngleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class ValueAngleAxis implements ValueAngleAxisOption { + + private Number polarIndex; + + private String polarId; + + private Number startAngle; + + private Boolean clockwise; + + private String mainType; + + private String type = "value"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ValueAngleAxis setId(Number id) { + this.id = id; + return this; + } + + public ValueAngleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ValueAngleAxis setName(Number name) { + this.name = name; + return this; + } + + public ValueAngleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ValueAngleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ValueAngleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ValueAngleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ValueAngleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ValueAngleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ValueAngleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ValueAngleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ValueAngleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public ValueAngleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public ValueAngleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public ValueAngleAxis setMin(Number min) { + this.min = min; + return this; + } + + public ValueAngleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public ValueAngleAxis setMax(Number max) { + this.max = max; + return this; + } + + public ValueAngleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ValueAngleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ValueAngleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueRadiusAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueRadiusAxis.java new file mode 100644 index 0000000..b91b861 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/polar/ValueRadiusAxis.java @@ -0,0 +1,218 @@ +package org.icepear.echarts.components.coord.polar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.polar.ValueRadiusAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class ValueRadiusAxis implements ValueRadiusAxisOption { + + private Number polarIndex; + + private String polarId; + + private String mainType; + + private String type = "value"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ValueRadiusAxis setId(Number id) { + this.id = id; + return this; + } + + public ValueRadiusAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ValueRadiusAxis setName(Number name) { + this.name = name; + return this; + } + + public ValueRadiusAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ValueRadiusAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ValueRadiusAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ValueRadiusAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ValueRadiusAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ValueRadiusAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ValueRadiusAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ValueRadiusAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ValueRadiusAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public ValueRadiusAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public ValueRadiusAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public ValueRadiusAxis setMin(Number min) { + this.min = min; + return this; + } + + public ValueRadiusAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public ValueRadiusAxis setMax(Number max) { + this.max = max; + return this; + } + + public ValueRadiusAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ValueRadiusAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ValueRadiusAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxis.java new file mode 100644 index 0000000..283a63c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxis.java @@ -0,0 +1,139 @@ +package org.icepear.echarts.components.coord.radar; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.radar.RadarAxisNameOption; +import org.icepear.echarts.origin.coord.radar.RadarIndicatorOption; +import org.icepear.echarts.origin.coord.radar.RadarOption; + +@Accessors(chain = true) +@Data +public class RadarAxis implements RadarOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public RadarAxis setId(Number id) { + this.id = id; + return this; + } + + public RadarAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public RadarAxis setName(Number name) { + this.name = name; + return this; + } + + public RadarAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object center; + + public RadarAxis setCenter(Number[] center) { + this.center = center; + return this; + } + + public RadarAxis setCenter(String[] center) { + this.center = center; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public RadarAxis setRadius(Number radius) { + this.radius = radius; + return this; + } + + public RadarAxis setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public RadarAxis setRadius(Object[] radius) { + this.radius = radius; + return this; + } + + public RadarAxis setRadius(String radius) { + this.radius = radius; + return this; + } + + public RadarAxis setRadius(String[] radius) { + this.radius = radius; + return this; + } + + private Number startAngle; + + private String shape; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private AxisLabelBaseOption axisLabel; + + private SplitLineOption splitLine; + + private SplitAreaOption splitArea; + + private RadarAxisNameOption axisName; + + private Number axisNameGap; + + private Boolean triggerEvent; + + private Boolean scale; + + private Number splitNumber; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public RadarAxis setBoundaryGap(Boolean boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public RadarAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public RadarAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private RadarIndicatorOption[] indicator; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxisName.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxisName.java new file mode 100644 index 0000000..a661ec2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarAxisName.java @@ -0,0 +1,170 @@ +package org.icepear.echarts.components.coord.radar; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.radar.RadarAxisNameOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class RadarAxisName implements RadarAxisNameOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public RadarAxisName setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public RadarAxisName setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public RadarAxisName setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public RadarAxisName setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public RadarAxisName setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public RadarAxisName setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public RadarAxisName setPadding(Number padding) { + this.padding = padding; + return this; + } + + public RadarAxisName setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public RadarAxisName setWidth(Number width) { + this.width = width; + return this; + } + + public RadarAxisName setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public RadarAxisName setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public RadarAxisName setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarIndicator.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarIndicator.java new file mode 100644 index 0000000..b2c3c4f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/radar/RadarIndicator.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.components.coord.radar; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.radar.RadarIndicatorOption; + +@Accessors(chain = true) +@Data +public class RadarIndicator implements RadarIndicatorOption { + + private String name; + + private String text; + + private Number min; + + private Number max; + + private Object color; + + private String axisType; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/CategorySingleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/CategorySingleAxis.java new file mode 100644 index 0000000..521d6e8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/CategorySingleAxis.java @@ -0,0 +1,288 @@ +package org.icepear.echarts.components.coord.single; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.single.CategorySingleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class CategorySingleAxis implements CategorySingleAxisOption { + + @Setter(AccessLevel.NONE) + private Object width; + + public CategorySingleAxis setWidth(Number width) { + this.width = width; + return this; + } + + public CategorySingleAxis setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public CategorySingleAxis setHeight(Number height) { + this.height = height; + return this; + } + + public CategorySingleAxis setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public CategorySingleAxis setTop(Number top) { + this.top = top; + return this; + } + + public CategorySingleAxis setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public CategorySingleAxis setRight(Number right) { + this.right = right; + return this; + } + + public CategorySingleAxis setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public CategorySingleAxis setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public CategorySingleAxis setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public CategorySingleAxis setLeft(Number left) { + this.left = left; + return this; + } + + public CategorySingleAxis setLeft(String left) { + this.left = left; + return this; + } + + private String position; + + private String orient; + + private String mainType; + + private String type = "category"; + + @Setter(AccessLevel.NONE) + private Object id; + + public CategorySingleAxis setId(Number id) { + this.id = id; + return this; + } + + public CategorySingleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public CategorySingleAxis setName(Number name) { + this.name = name; + return this; + } + + public CategorySingleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public CategorySingleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public CategorySingleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public CategorySingleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public CategorySingleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public CategorySingleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public CategorySingleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public CategorySingleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public CategorySingleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public CategorySingleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public CategorySingleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + @Setter(AccessLevel.NONE) + private Object axisTick; + + public CategorySingleAxis setAxisTick(AxisTickOption axisTick) { + this.axisTick = axisTick; + return this; + } + + public CategorySingleAxis setAxisTick(Object axisTick) { + this.axisTick = axisTick; + return this; + } + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public CategorySingleAxis setMin(Number min) { + this.min = min; + return this; + } + + public CategorySingleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public CategorySingleAxis setMax(Number max) { + this.max = max; + return this; + } + + public CategorySingleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + private Boolean boundaryGap; + + private Boolean deduplication; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/LogSingleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/LogSingleAxis.java new file mode 100644 index 0000000..98ab244 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/LogSingleAxis.java @@ -0,0 +1,296 @@ +package org.icepear.echarts.components.coord.single; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.single.LogSingleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class LogSingleAxis implements LogSingleAxisOption { + + @Setter(AccessLevel.NONE) + private Object width; + + public LogSingleAxis setWidth(Number width) { + this.width = width; + return this; + } + + public LogSingleAxis setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public LogSingleAxis setHeight(Number height) { + this.height = height; + return this; + } + + public LogSingleAxis setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public LogSingleAxis setTop(Number top) { + this.top = top; + return this; + } + + public LogSingleAxis setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public LogSingleAxis setRight(Number right) { + this.right = right; + return this; + } + + public LogSingleAxis setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public LogSingleAxis setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public LogSingleAxis setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public LogSingleAxis setLeft(Number left) { + this.left = left; + return this; + } + + public LogSingleAxis setLeft(String left) { + this.left = left; + return this; + } + + private String position; + + private String orient; + + private String mainType; + + private String type = "log"; + + @Setter(AccessLevel.NONE) + private Object id; + + public LogSingleAxis setId(Number id) { + this.id = id; + return this; + } + + public LogSingleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public LogSingleAxis setName(Number name) { + this.name = name; + return this; + } + + public LogSingleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public LogSingleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public LogSingleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public LogSingleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public LogSingleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public LogSingleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public LogSingleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public LogSingleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public LogSingleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public LogSingleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public LogSingleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public LogSingleAxis setMin(Number min) { + this.min = min; + return this; + } + + public LogSingleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public LogSingleAxis setMax(Number max) { + this.max = max; + return this; + } + + public LogSingleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public LogSingleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public LogSingleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Number logBase; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/TimeSingleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/TimeSingleAxis.java new file mode 100644 index 0000000..ba39b9d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/TimeSingleAxis.java @@ -0,0 +1,294 @@ +package org.icepear.echarts.components.coord.single; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.single.TimeSingleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class TimeSingleAxis implements TimeSingleAxisOption { + + @Setter(AccessLevel.NONE) + private Object width; + + public TimeSingleAxis setWidth(Number width) { + this.width = width; + return this; + } + + public TimeSingleAxis setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public TimeSingleAxis setHeight(Number height) { + this.height = height; + return this; + } + + public TimeSingleAxis setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public TimeSingleAxis setTop(Number top) { + this.top = top; + return this; + } + + public TimeSingleAxis setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public TimeSingleAxis setRight(Number right) { + this.right = right; + return this; + } + + public TimeSingleAxis setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public TimeSingleAxis setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public TimeSingleAxis setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public TimeSingleAxis setLeft(Number left) { + this.left = left; + return this; + } + + public TimeSingleAxis setLeft(String left) { + this.left = left; + return this; + } + + private String position; + + private String orient; + + private String mainType; + + private String type = "time"; + + @Setter(AccessLevel.NONE) + private Object id; + + public TimeSingleAxis setId(Number id) { + this.id = id; + return this; + } + + public TimeSingleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TimeSingleAxis setName(Number name) { + this.name = name; + return this; + } + + public TimeSingleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public TimeSingleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public TimeSingleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public TimeSingleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public TimeSingleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public TimeSingleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public TimeSingleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public TimeSingleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public TimeSingleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public TimeSingleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public TimeSingleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public TimeSingleAxis setMin(Number min) { + this.min = min; + return this; + } + + public TimeSingleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public TimeSingleAxis setMax(Number max) { + this.max = max; + return this; + } + + public TimeSingleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public TimeSingleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public TimeSingleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/ValueSingleAxis.java b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/ValueSingleAxis.java new file mode 100644 index 0000000..55c9850 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/coord/single/ValueSingleAxis.java @@ -0,0 +1,296 @@ +package org.icepear.echarts.components.coord.single; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisNameTextStyleOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.MinorSplitLineOption; +import org.icepear.echarts.origin.coord.MinorTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.coord.single.ValueSingleAxisOption; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; + +@Accessors(chain = true) +@Data +public class ValueSingleAxis implements ValueSingleAxisOption { + + @Setter(AccessLevel.NONE) + private Object width; + + public ValueSingleAxis setWidth(Number width) { + this.width = width; + return this; + } + + public ValueSingleAxis setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public ValueSingleAxis setHeight(Number height) { + this.height = height; + return this; + } + + public ValueSingleAxis setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public ValueSingleAxis setTop(Number top) { + this.top = top; + return this; + } + + public ValueSingleAxis setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public ValueSingleAxis setRight(Number right) { + this.right = right; + return this; + } + + public ValueSingleAxis setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public ValueSingleAxis setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public ValueSingleAxis setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public ValueSingleAxis setLeft(Number left) { + this.left = left; + return this; + } + + public ValueSingleAxis setLeft(String left) { + this.left = left; + return this; + } + + private String position; + + private String orient; + + private String mainType; + + private String type = "value"; + + @Setter(AccessLevel.NONE) + private Object id; + + public ValueSingleAxis setId(Number id) { + this.id = id; + return this; + } + + public ValueSingleAxis setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ValueSingleAxis setName(Number name) { + this.name = name; + return this; + } + + public ValueSingleAxis setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public ValueSingleAxis setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public ValueSingleAxis setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public ValueSingleAxis setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public ValueSingleAxis setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public ValueSingleAxis setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public ValueSingleAxis setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public ValueSingleAxis setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public ValueSingleAxis setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean show; + + private Boolean inverse; + + private String nameLocation; + + private Number nameRotate; + + private Object nameTruncate; + + private AxisNameTextStyleOption nameTextStyle; + + private Number nameGap; + + private Boolean silent; + + private Boolean triggerEvent; + + private Object tooltip; + + @Setter(AccessLevel.NONE) + private Object axisLabel; + + public ValueSingleAxis setAxisLabel(AxisLabelBaseOption axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + public ValueSingleAxis setAxisLabel(Object axisLabel) { + this.axisLabel = axisLabel; + return this; + } + + private CommonAxisPointerOption axisPointer; + + private AxisLineOption axisLine; + + private AxisTickOption axisTick; + + private MinorTickOption minorTick; + + private SplitLineOption splitLine; + + private MinorSplitLineOption minorSplitLine; + + private SplitAreaOption splitArea; + + @Setter(AccessLevel.NONE) + private Object min; + + public ValueSingleAxis setMin(Number min) { + this.min = min; + return this; + } + + public ValueSingleAxis setMin(String min) { + this.min = min; + return this; + } + + @Setter(AccessLevel.NONE) + private Object max; + + public ValueSingleAxis setMax(Number max) { + this.max = max; + return this; + } + + public ValueSingleAxis setMax(String max) { + this.max = max; + return this; + } + + private Object[] data; + + @Setter(AccessLevel.NONE) + private Object boundaryGap; + + public ValueSingleAxis setBoundaryGap(Number[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + public ValueSingleAxis setBoundaryGap(String[] boundaryGap) { + this.boundaryGap = boundaryGap; + return this; + } + + private Number splitNumber; + + private Number interval; + + private Number minInterval; + + private Number maxInterval; + + private Boolean scale; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/dataZoom/DataZoom.java b/youchain-system/src/main/java/org/icepear/echarts/components/dataZoom/DataZoom.java new file mode 100644 index 0000000..4af75b1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/dataZoom/DataZoom.java @@ -0,0 +1,249 @@ +package org.icepear.echarts.components.dataZoom; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.dataZoom.DataZoomOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class DataZoom implements DataZoomOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public DataZoom setId(Number id) { + this.id = id; + return this; + } + + public DataZoom setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public DataZoom setName(Number name) { + this.name = name; + return this; + } + + public DataZoom setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private String orient; + + @Setter(AccessLevel.NONE) + private Object xAxisIndex; + + public DataZoom setXAxisIndex(Number xAxisIndex) { + this.xAxisIndex = xAxisIndex; + return this; + } + + public DataZoom setXAxisIndex(Number[] xAxisIndex) { + this.xAxisIndex = xAxisIndex; + return this; + } + + @Setter(AccessLevel.NONE) + private Object xAxisId; + + public DataZoom setXAxisId(String xAxisId) { + this.xAxisId = xAxisId; + return this; + } + + public DataZoom setXAxisId(String[] xAxisId) { + this.xAxisId = xAxisId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object yAxisIndex; + + public DataZoom setYAxisIndex(Number yAxisIndex) { + this.yAxisIndex = yAxisIndex; + return this; + } + + public DataZoom setYAxisIndex(Number[] yAxisIndex) { + this.yAxisIndex = yAxisIndex; + return this; + } + + @Setter(AccessLevel.NONE) + private Object yAxisId; + + public DataZoom setYAxisId(String yAxisId) { + this.yAxisId = yAxisId; + return this; + } + + public DataZoom setYAxisId(String[] yAxisId) { + this.yAxisId = yAxisId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radiusAxisIndex; + + public DataZoom setRadiusAxisIndex(Number radiusAxisIndex) { + this.radiusAxisIndex = radiusAxisIndex; + return this; + } + + public DataZoom setRadiusAxisIndex(Number[] radiusAxisIndex) { + this.radiusAxisIndex = radiusAxisIndex; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radiusAxisId; + + public DataZoom setRadiusAxisId(String radiusAxisId) { + this.radiusAxisId = radiusAxisId; + return this; + } + + public DataZoom setRadiusAxisId(String[] radiusAxisId) { + this.radiusAxisId = radiusAxisId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object angleAxisIndex; + + public DataZoom setAngleAxisIndex(Number angleAxisIndex) { + this.angleAxisIndex = angleAxisIndex; + return this; + } + + public DataZoom setAngleAxisIndex(Number[] angleAxisIndex) { + this.angleAxisIndex = angleAxisIndex; + return this; + } + + @Setter(AccessLevel.NONE) + private Object angleAxisId; + + public DataZoom setAngleAxisId(String angleAxisId) { + this.angleAxisId = angleAxisId; + return this; + } + + public DataZoom setAngleAxisId(String[] angleAxisId) { + this.angleAxisId = angleAxisId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object singleAxisIndex; + + public DataZoom setSingleAxisIndex(Number singleAxisIndex) { + this.singleAxisIndex = singleAxisIndex; + return this; + } + + public DataZoom setSingleAxisIndex(Number[] singleAxisIndex) { + this.singleAxisIndex = singleAxisIndex; + return this; + } + + @Setter(AccessLevel.NONE) + private Object singleAxisId; + + public DataZoom setSingleAxisId(String singleAxisId) { + this.singleAxisId = singleAxisId; + return this; + } + + public DataZoom setSingleAxisId(String[] singleAxisId) { + this.singleAxisId = singleAxisId; + return this; + } + + private String filterMode; + + @Setter(AccessLevel.NONE) + private Object throttle; + + public DataZoom setThrottle(Number throttle) { + this.throttle = throttle; + return this; + } + + public DataZoom setThrottle(Object throttle) { + this.throttle = throttle; + return this; + } + + private Number start; + + private Number end; + + @Setter(AccessLevel.NONE) + private Object startValue; + + public DataZoom setStartValue(Number startValue) { + this.startValue = startValue; + return this; + } + + public DataZoom setStartValue(Object startValue) { + this.startValue = startValue; + return this; + } + + public DataZoom setStartValue(String startValue) { + this.startValue = startValue; + return this; + } + + @Setter(AccessLevel.NONE) + private Object endValue; + + public DataZoom setEndValue(Number endValue) { + this.endValue = endValue; + return this; + } + + public DataZoom setEndValue(Object endValue) { + this.endValue = endValue; + return this; + } + + public DataZoom setEndValue(String endValue) { + this.endValue = endValue; + return this; + } + + private Number minSpan; + + private Number maxSpan; + + private Number minValueSpan; + + private Number maxValueSpan; + + private String[] rangeMode; + + private Boolean realtime; + + private LabelOption textStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransform.java b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransform.java new file mode 100644 index 0000000..9f3ce8f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransform.java @@ -0,0 +1,18 @@ +package org.icepear.echarts.components.dataset; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.data.helper.DataTransformConfigOption; +import org.icepear.echarts.origin.data.helper.DataTransformOption; + +@Accessors(chain = true) +@Data +public class DataTransform implements DataTransformOption { + + private String type; + + private DataTransformConfigOption config; + + private Boolean print; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransformConfig.java b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransformConfig.java new file mode 100644 index 0000000..15ae64d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/DataTransformConfig.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.components.dataset; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.data.helper.DataTransformConfigOption; + +@Accessors(chain = true) +@Data +public class DataTransformConfig implements DataTransformConfigOption { + + private String dimension; + + @Setter(AccessLevel.NONE) + private Object value; + + public DataTransformConfig setValue(Number value) { + this.value = value; + return this; + } + + public DataTransformConfig setValue(Object value) { + this.value = value; + return this; + } + + public DataTransformConfig setValue(String value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/dataset/Dataset.java b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/Dataset.java new file mode 100644 index 0000000..2d4a0ef --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/dataset/Dataset.java @@ -0,0 +1,162 @@ +package org.icepear.echarts.components.dataset; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.dataset.DatasetOption; +import org.icepear.echarts.origin.data.helper.DataTransformOption; +import org.icepear.echarts.origin.util.OptionDataItemObject; +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class Dataset implements DatasetOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Dataset setId(Number id) { + this.id = id; + return this; + } + + public Dataset setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Dataset setName(Number name) { + this.name = name; + return this; + } + + public Dataset setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Number datasetIndex; + + @Setter(AccessLevel.NONE) + private Object datasetId; + + public Dataset setDatasetId(Number datasetId) { + this.datasetId = datasetId; + return this; + } + + public Dataset setDatasetId(String datasetId) { + this.datasetId = datasetId; + return this; + } + + private Object seriesLayoutBy; + + private Object sourceHeader; + + private Object[] dimensions; + + private OptionEncode encode; + + @Setter(AccessLevel.NONE) + private Object source; + + public Dataset setSource(Map[] source) { + this.source = source; + return this; + } + + public Dataset setSource(Map source) { + this.source = source; + return this; + } + + public Dataset setSource(Number[] source) { + this.source = source; + return this; + } + + public Dataset setSource(Number[][] source) { + this.source = source; + return this; + } + + public Dataset setSource(Number[][][] source) { + this.source = source; + return this; + } + + public Dataset setSource(Object source) { + this.source = source; + return this; + } + + public Dataset setSource(Object[] source) { + this.source = source; + return this; + } + + public Dataset setSource(Object[][] source) { + this.source = source; + return this; + } + + public Dataset setSource(Object[][][] source) { + this.source = source; + return this; + } + + public Dataset setSource(OptionDataItemObject[] source) { + this.source = source; + return this; + } + + public Dataset setSource(String[] source) { + this.source = source; + return this; + } + + public Dataset setSource(String[][] source) { + this.source = source; + return this; + } + + public Dataset setSource(String[][][] source) { + this.source = source; + return this; + } + + private Number fromDatasetIndex; + + private String fromDatasetId; + + @Setter(AccessLevel.NONE) + private Object transform; + + public Dataset setTransform(DataTransformOption transform) { + this.transform = transform; + return this; + } + + public Dataset setTransform(DataTransformOption[] transform) { + this.transform = transform; + return this; + } + + private Number fromTransformResult; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/grid/Grid.java b/youchain-system/src/main/java/org/icepear/echarts/components/grid/Grid.java new file mode 100644 index 0000000..7ceb413 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/grid/Grid.java @@ -0,0 +1,145 @@ +package org.icepear.echarts.components.grid; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.coord.cartesian.GridOption; + +@Accessors(chain = true) +@Data +public class Grid implements GridOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Grid setId(Number id) { + this.id = id; + return this; + } + + public Grid setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Grid setName(Number name) { + this.name = name; + return this; + } + + public Grid setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object width; + + public Grid setWidth(Number width) { + this.width = width; + return this; + } + + public Grid setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public Grid setHeight(Number height) { + this.height = height; + return this; + } + + public Grid setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public Grid setTop(Number top) { + this.top = top; + return this; + } + + public Grid setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public Grid setRight(Number right) { + this.right = right; + return this; + } + + public Grid setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public Grid setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public Grid setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public Grid setLeft(Number left) { + this.left = left; + return this; + } + + public Grid setLeft(String left) { + this.left = left; + return this; + } + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private Boolean show; + + private Boolean containLabel; + + private String backgroundColor; + + private Number borderWidth; + + private String borderColor; + + private Object tooltip; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/legend/Legend.java b/youchain-system/src/main/java/org/icepear/echarts/components/legend/Legend.java new file mode 100644 index 0000000..27a37ac --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/legend/Legend.java @@ -0,0 +1,277 @@ +package org.icepear.echarts.components.legend; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.legend.LegendOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class Legend implements LegendOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Legend setId(Number id) { + this.id = id; + return this; + } + + public Legend setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Legend setName(Number name) { + this.name = name; + return this; + } + + public Legend setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private String icon; + + private String inactiveColor; + + private String inactiveBorderColor; + + @Setter(AccessLevel.NONE) + private Object inactiveBorderWidth; + + public Legend setInactiveBorderWidth(Number inactiveBorderWidth) { + this.inactiveBorderWidth = inactiveBorderWidth; + return this; + } + + public Legend setInactiveBorderWidth(String inactiveBorderWidth) { + this.inactiveBorderWidth = inactiveBorderWidth; + return this; + } + + private String formatter; + + private Object itemStyle; + + private Object lineStyle; + + private LabelOption textStyle; + + @Setter(AccessLevel.NONE) + private Object symbolRotate; + + public Legend setSymbolRotate(Number symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + public Legend setSymbolRotate(String symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object width; + + public Legend setWidth(Number width) { + this.width = width; + return this; + } + + public Legend setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public Legend setHeight(Number height) { + this.height = height; + return this; + } + + public Legend setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public Legend setTop(Number top) { + this.top = top; + return this; + } + + public Legend setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public Legend setRight(Number right) { + this.right = right; + return this; + } + + public Legend setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public Legend setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public Legend setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public Legend setLeft(Number left) { + this.left = left; + return this; + } + + public Legend setLeft(String left) { + this.left = left; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Boolean show; + + private String orient; + + private String align; + + private String backgroundColor; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public Legend setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public Legend setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public Legend setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Legend setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private Number itemGap; + + private Number itemWidth; + + private Number itemHeight; + + @Setter(AccessLevel.NONE) + private Object selectedMode; + + public Legend setSelectedMode(Boolean selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + public Legend setSelectedMode(String selectedMode) { + this.selectedMode = selectedMode; + return this; + } + + private Map selected; + + @Setter(AccessLevel.NONE) + private Object selector; + + public Legend setSelector(Boolean selector) { + this.selector = selector; + return this; + } + + public Legend setSelector(Object[] selector) { + this.selector = selector; + return this; + } + + private LabelOption selectorLabel; + + private Object emphasis; + + private String selectorPosition; + + private Number selectorItemGap; + + private Number selectorButtonGap; + + @Setter(AccessLevel.NONE) + private Object data; + + public Legend setData(Object[] data) { + this.data = data; + return this; + } + + public Legend setData(String[] data) { + this.data = data; + return this; + } + + private Object tooltip; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea.java new file mode 100644 index 0000000..b57d917 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea.java @@ -0,0 +1,139 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkAreaDataItemOption; +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class MarkArea implements MarkAreaOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public MarkArea setId(Number id) { + this.id = id; + return this; + } + + public MarkArea setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public MarkArea setName(Number name) { + this.name = name; + return this; + } + + public MarkArea setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public MarkArea setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public MarkArea setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public MarkArea setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public MarkArea setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public MarkArea setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public MarkArea setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public MarkArea setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public MarkArea setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object data; + + public MarkArea setData(MarkAreaDataItemOption[] data) { + this.data = data; + return this; + } + + public MarkArea setData(Object[] data) { + this.data = data; + return this; + } + + private Object tooltip; + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private Number precision; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea1DDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea1DDataItem.java new file mode 100644 index 0000000..2a403b1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea1DDataItem.java @@ -0,0 +1,35 @@ +package org.icepear.echarts.components.marker; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkArea1DDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class MarkArea1DDataItem implements MarkArea1DDataItemOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + private Number xAxis; + + private Number yAxis; + + private Object type; + + private Number valueIndex; + + private String valueDim; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItem.java new file mode 100644 index 0000000..a0e209a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItem.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.components.marker; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkArea2DDataItemDimOption; +import org.icepear.echarts.origin.component.marker.MarkArea2DDataItemOption; + +@Accessors(chain = true) +@Data +public class MarkArea2DDataItem implements MarkArea2DDataItemOption { + + private MarkArea2DDataItemDimOption startPoint; + + private MarkArea2DDataItemDimOption endPoint; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItemDim.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItemDim.java new file mode 100644 index 0000000..7b5afe6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkArea2DDataItemDim.java @@ -0,0 +1,82 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkArea2DDataItemDimOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class MarkArea2DDataItemDim implements MarkArea2DDataItemDimOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + @Setter(AccessLevel.NONE) + private Object x; + + public MarkArea2DDataItemDim setX(Number x) { + this.x = x; + return this; + } + + public MarkArea2DDataItemDim setX(String x) { + this.x = x; + return this; + } + + @Setter(AccessLevel.NONE) + private Object y; + + public MarkArea2DDataItemDim setY(Number y) { + this.y = y; + return this; + } + + public MarkArea2DDataItemDim setY(String y) { + this.y = y; + return this; + } + + private Object[] coord; + + private Object xAxis; + + private Object yAxis; + + private Object radiusAxis; + + private Object angleAxis; + + private Object type; + + private Number valueIndex; + + private String valueDim; + + @Setter(AccessLevel.NONE) + private Object value; + + public MarkArea2DDataItemDim setValue(Number value) { + this.value = value; + return this; + } + + public MarkArea2DDataItemDim setValue(String value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine.java new file mode 100644 index 0000000..11c18d4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine.java @@ -0,0 +1,204 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkLineDataItemOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +@Accessors(chain = true) +@Data +public class MarkLine implements MarkLineOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public MarkLine setId(Number id) { + this.id = id; + return this; + } + + public MarkLine setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public MarkLine setName(Number name) { + this.name = name; + return this; + } + + public MarkLine setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public MarkLine setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public MarkLine setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public MarkLine setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public MarkLine setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public MarkLine setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public MarkLine setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public MarkLine setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public MarkLine setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object data; + + public MarkLine setData(MarkLineDataItemOption[] data) { + this.data = data; + return this; + } + + public MarkLine setData(Object[] data) { + this.data = data; + return this; + } + + private Object tooltip; + + private LineStyleOption lineStyle; + + private ItemStyleOption itemStyle; + + private SeriesLineLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + @Setter(AccessLevel.NONE) + private Object symbol; + + public MarkLine setSymbol(String symbol) { + this.symbol = symbol; + return this; + } + + public MarkLine setSymbol(String[] symbol) { + this.symbol = symbol; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public MarkLine setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public MarkLine setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolRotate; + + public MarkLine setSymbolRotate(Number symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + public MarkLine setSymbolRotate(Number[] symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public MarkLine setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private Number precision; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine1DDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine1DDataItem.java new file mode 100644 index 0000000..03f4dd5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine1DDataItem.java @@ -0,0 +1,124 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkLine1DDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +@Accessors(chain = true) +@Data +public class MarkLine1DDataItem implements MarkLine1DDataItemOption { + + private LineStyleOption lineStyle; + + private ItemStyleOption itemStyle; + + private SeriesLineLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + @Setter(AccessLevel.NONE) + private Object xAxis; + + public MarkLine1DDataItem setXAxis(Number xAxis) { + this.xAxis = xAxis; + return this; + } + + public MarkLine1DDataItem setXAxis(String xAxis) { + this.xAxis = xAxis; + return this; + } + + @Setter(AccessLevel.NONE) + private Object yAxis; + + public MarkLine1DDataItem setYAxis(Number yAxis) { + this.yAxis = yAxis; + return this; + } + + public MarkLine1DDataItem setYAxis(String yAxis) { + this.yAxis = yAxis; + return this; + } + + private Object type; + + private Number valueIndex; + + private String valueDim; + + @Setter(AccessLevel.NONE) + private Object symbol; + + public MarkLine1DDataItem setSymbol(String symbol) { + this.symbol = symbol; + return this; + } + + public MarkLine1DDataItem setSymbol(String[] symbol) { + this.symbol = symbol; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public MarkLine1DDataItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public MarkLine1DDataItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolRotate; + + public MarkLine1DDataItem setSymbolRotate(Number symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + public MarkLine1DDataItem setSymbolRotate(Number[] symbolRotate) { + this.symbolRotate = symbolRotate; + return this; + } + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public MarkLine1DDataItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine1DDataItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine1DDataItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine1DDataItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItem.java new file mode 100644 index 0000000..179c579 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItem.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.components.marker; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkLine2DDataItemDimOption; +import org.icepear.echarts.origin.component.marker.MarkLine2DDataItemOption; + +@Accessors(chain = true) +@Data +public class MarkLine2DDataItem implements MarkLine2DDataItemOption { + + private MarkLine2DDataItemDimOption startPoint; + + private MarkLine2DDataItemDimOption endPoint; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItemDim.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItemDim.java new file mode 100644 index 0000000..d9876c8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkLine2DDataItemDim.java @@ -0,0 +1,127 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkLine2DDataItemDimOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +@Accessors(chain = true) +@Data +public class MarkLine2DDataItemDim implements MarkLine2DDataItemDimOption { + + private LineStyleOption lineStyle; + + private ItemStyleOption itemStyle; + + private SeriesLineLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String name; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public MarkLine2DDataItemDim setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public MarkLine2DDataItemDim setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public MarkLine2DDataItemDim setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine2DDataItemDim setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine2DDataItemDim setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkLine2DDataItemDim setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + @Setter(AccessLevel.NONE) + private Object x; + + public MarkLine2DDataItemDim setX(Number x) { + this.x = x; + return this; + } + + public MarkLine2DDataItemDim setX(String x) { + this.x = x; + return this; + } + + @Setter(AccessLevel.NONE) + private Object y; + + public MarkLine2DDataItemDim setY(Number y) { + this.y = y; + return this; + } + + public MarkLine2DDataItemDim setY(String y) { + this.y = y; + return this; + } + + private Object[] coord; + + private Object xAxis; + + private Object yAxis; + + private Object radiusAxis; + + private Object angleAxis; + + private Object type; + + private Number valueIndex; + + private String valueDim; + + @Setter(AccessLevel.NONE) + private Object value; + + public MarkLine2DDataItemDim setValue(Number value) { + this.value = value; + return this; + } + + public MarkLine2DDataItemDim setValue(String value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPoint.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPoint.java new file mode 100644 index 0000000..2550395 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPoint.java @@ -0,0 +1,181 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkPointDataItemOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class MarkPoint implements MarkPointOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public MarkPoint setId(Number id) { + this.id = id; + return this; + } + + public MarkPoint setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public MarkPoint setName(Number name) { + this.name = name; + return this; + } + + public MarkPoint setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private Boolean animation; + + private Number animationThreshold; + + @Setter(AccessLevel.NONE) + private Object animationDuration; + + public MarkPoint setAnimationDuration(Number animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + public MarkPoint setAnimationDuration(Object animationDuration) { + this.animationDuration = animationDuration; + return this; + } + + private Object animationEasing; + + @Setter(AccessLevel.NONE) + private Object animationDelay; + + public MarkPoint setAnimationDelay(Number animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + public MarkPoint setAnimationDelay(Object animationDelay) { + this.animationDelay = animationDelay; + return this; + } + + @Setter(AccessLevel.NONE) + private Object animationDurationUpdate; + + public MarkPoint setAnimationDurationUpdate(Number animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + public MarkPoint setAnimationDurationUpdate(Object animationDurationUpdate) { + this.animationDurationUpdate = animationDurationUpdate; + return this; + } + + private Object animationEasingUpdate; + + @Setter(AccessLevel.NONE) + private Object animationDelayUpdate; + + public MarkPoint setAnimationDelayUpdate(Number animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + public MarkPoint setAnimationDelayUpdate(Object animationDelayUpdate) { + this.animationDelayUpdate = animationDelayUpdate; + return this; + } + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object data; + + public MarkPoint setData(MarkPointDataItemOption[] data) { + this.data = data; + return this; + } + + public MarkPoint setData(Object[] data) { + this.data = data; + return this; + } + + private Object tooltip; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public MarkPoint setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public MarkPoint setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public MarkPoint setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPoint setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPoint setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPoint setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + private Object emphasis; + + private Object select; + + private Object blur; + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Number precision; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPointDataItem.java b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPointDataItem.java new file mode 100644 index 0000000..56d125c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/marker/MarkPointDataItem.java @@ -0,0 +1,124 @@ +package org.icepear.echarts.components.marker; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.marker.MarkPointDataItemOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +@Accessors(chain = true) +@Data +public class MarkPointDataItem implements MarkPointDataItemOption { + + private ItemStyleOption itemStyle; + + private SeriesLabelOption label; + + private Object emphasis; + + private Object select; + + private Object blur; + + private String symbol; + + @Setter(AccessLevel.NONE) + private Object symbolSize; + + public MarkPointDataItem setSymbolSize(Number symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + public MarkPointDataItem setSymbolSize(Number[] symbolSize) { + this.symbolSize = symbolSize; + return this; + } + + private Number symbolRotate; + + private Boolean symbolKeepAspect; + + @Setter(AccessLevel.NONE) + private Object symbolOffset; + + public MarkPointDataItem setSymbolOffset(Number symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPointDataItem setSymbolOffset(Number[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPointDataItem setSymbolOffset(String symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + public MarkPointDataItem setSymbolOffset(String[] symbolOffset) { + this.symbolOffset = symbolOffset; + return this; + } + + @Setter(AccessLevel.NONE) + private Object x; + + public MarkPointDataItem setX(Number x) { + this.x = x; + return this; + } + + public MarkPointDataItem setX(String x) { + this.x = x; + return this; + } + + @Setter(AccessLevel.NONE) + private Object y; + + public MarkPointDataItem setY(Number y) { + this.y = y; + return this; + } + + public MarkPointDataItem setY(String y) { + this.y = y; + return this; + } + + private Object[] coord; + + private Object xAxis; + + private Object yAxis; + + private Object radiusAxis; + + private Object angleAxis; + + private Object type; + + private Number valueIndex; + + private String valueDim; + + @Setter(AccessLevel.NONE) + private Object value; + + public MarkPointDataItem setValue(Number value) { + this.value = value; + return this; + } + + public MarkPointDataItem setValue(String value) { + this.value = value; + return this; + } + + private String name; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaQuery.java b/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaQuery.java new file mode 100644 index 0000000..b3c2978 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaQuery.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.components.media; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.MediaQueryOption; + +@Accessors(chain = true) +@Data +public class MediaQuery implements MediaQueryOption { + + private Number minWidth; + + private Number maxWidth; + + private Number minHeight; + + private Number maxHeight; + + private Number minAspectRatio; + + private Number maxAspectRatio; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaUnit.java b/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaUnit.java new file mode 100644 index 0000000..2bb6a03 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/media/MediaUnit.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.components.media; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.ECUnitOption; +import org.icepear.echarts.origin.util.MediaQueryOption; +import org.icepear.echarts.origin.util.MediaUnitOption; + +@Accessors(chain = true) +@Data +public class MediaUnit implements MediaUnitOption { + + private MediaQueryOption query; + + private ECUnitOption option; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/AreaStyle.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/AreaStyle.java new file mode 100644 index 0000000..af0c0f8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/AreaStyle.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.components.series; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.AreaStyleOption; + +@Accessors(chain = true) +@Data +public class AreaStyle implements AreaStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private Number opacity; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/Encode.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/Encode.java new file mode 100644 index 0000000..87d6c9f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/Encode.java @@ -0,0 +1,312 @@ +package org.icepear.echarts.components.series; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.OptionEncode; + +@Accessors(chain = true) +@Data +public class Encode implements OptionEncode { + + @Setter(AccessLevel.NONE) + private Object tooltip; + + public Encode setTooltip(Number tooltip) { + this.tooltip = tooltip; + return this; + } + + public Encode setTooltip(Number[] tooltip) { + this.tooltip = tooltip; + return this; + } + + public Encode setTooltip(String tooltip) { + this.tooltip = tooltip; + return this; + } + + public Encode setTooltip(String[] tooltip) { + this.tooltip = tooltip; + return this; + } + + @Setter(AccessLevel.NONE) + private Object label; + + public Encode setLabel(Number label) { + this.label = label; + return this; + } + + public Encode setLabel(Number[] label) { + this.label = label; + return this; + } + + public Encode setLabel(String label) { + this.label = label; + return this; + } + + public Encode setLabel(String[] label) { + this.label = label; + return this; + } + + @Setter(AccessLevel.NONE) + private Object itemName; + + public Encode setItemName(Number itemName) { + this.itemName = itemName; + return this; + } + + public Encode setItemName(Number[] itemName) { + this.itemName = itemName; + return this; + } + + public Encode setItemName(String itemName) { + this.itemName = itemName; + return this; + } + + public Encode setItemName(String[] itemName) { + this.itemName = itemName; + return this; + } + + @Setter(AccessLevel.NONE) + private Object itemId; + + public Encode setItemId(Number itemId) { + this.itemId = itemId; + return this; + } + + public Encode setItemId(Number[] itemId) { + this.itemId = itemId; + return this; + } + + public Encode setItemId(String itemId) { + this.itemId = itemId; + return this; + } + + public Encode setItemId(String[] itemId) { + this.itemId = itemId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object seriesName; + + public Encode setSeriesName(Number seriesName) { + this.seriesName = seriesName; + return this; + } + + public Encode setSeriesName(Number[] seriesName) { + this.seriesName = seriesName; + return this; + } + + public Encode setSeriesName(String seriesName) { + this.seriesName = seriesName; + return this; + } + + public Encode setSeriesName(String[] seriesName) { + this.seriesName = seriesName; + return this; + } + + @Setter(AccessLevel.NONE) + private Object itemGroupId; + + public Encode setItemGroupId(Number itemGroupId) { + this.itemGroupId = itemGroupId; + return this; + } + + public Encode setItemGroupId(Number[] itemGroupId) { + this.itemGroupId = itemGroupId; + return this; + } + + public Encode setItemGroupId(String itemGroupId) { + this.itemGroupId = itemGroupId; + return this; + } + + public Encode setItemGroupId(String[] itemGroupId) { + this.itemGroupId = itemGroupId; + return this; + } + + @Setter(AccessLevel.NONE) + private Object x; + + public Encode setX(Number x) { + this.x = x; + return this; + } + + public Encode setX(Number[] x) { + this.x = x; + return this; + } + + public Encode setX(String x) { + this.x = x; + return this; + } + + public Encode setX(String[] x) { + this.x = x; + return this; + } + + @Setter(AccessLevel.NONE) + private Object y; + + public Encode setY(Number y) { + this.y = y; + return this; + } + + public Encode setY(Number[] y) { + this.y = y; + return this; + } + + public Encode setY(String y) { + this.y = y; + return this; + } + + public Encode setY(String[] y) { + this.y = y; + return this; + } + + @Setter(AccessLevel.NONE) + private Object radius; + + public Encode setRadius(Number radius) { + this.radius = radius; + return this; + } + + public Encode setRadius(Number[] radius) { + this.radius = radius; + return this; + } + + public Encode setRadius(String radius) { + this.radius = radius; + return this; + } + + public Encode setRadius(String[] radius) { + this.radius = radius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object angle; + + public Encode setAngle(Number angle) { + this.angle = angle; + return this; + } + + public Encode setAngle(Number[] angle) { + this.angle = angle; + return this; + } + + public Encode setAngle(String angle) { + this.angle = angle; + return this; + } + + public Encode setAngle(String[] angle) { + this.angle = angle; + return this; + } + + @Setter(AccessLevel.NONE) + private Object lng; + + public Encode setLng(Number lng) { + this.lng = lng; + return this; + } + + public Encode setLng(Number[] lng) { + this.lng = lng; + return this; + } + + public Encode setLng(String lng) { + this.lng = lng; + return this; + } + + public Encode setLng(String[] lng) { + this.lng = lng; + return this; + } + + @Setter(AccessLevel.NONE) + private Object lat; + + public Encode setLat(Number lat) { + this.lat = lat; + return this; + } + + public Encode setLat(Number[] lat) { + this.lat = lat; + return this; + } + + public Encode setLat(String lat) { + this.lat = lat; + return this; + } + + public Encode setLat(String[] lat) { + this.lat = lat; + return this; + } + + @Setter(AccessLevel.NONE) + private Object value; + + public Encode setValue(Number value) { + this.value = value; + return this; + } + + public Encode setValue(Number[] value) { + this.value = value; + return this; + } + + public Encode setValue(String value) { + this.value = value; + return this; + } + + public Encode setValue(String[] value) { + this.value = value; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/ItemStyle.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/ItemStyle.java new file mode 100644 index 0000000..0db654a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/ItemStyle.java @@ -0,0 +1,57 @@ +package org.icepear.echarts.components.series; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.liuxue.ColorStops; +import org.icepear.echarts.origin.util.DecalObject; +import org.icepear.echarts.origin.util.ItemStyleOption; + +import java.util.List; + +@Accessors(chain = true) +@Data +public class ItemStyle implements ItemStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Object color; + + private Number opacity; + + + @Setter(AccessLevel.NONE) + private Object decal; + + public ItemStyle setDecal(DecalObject decal) { + this.decal = decal; + return this; + } + + public ItemStyle setDecal(String decal) { + this.decal = decal; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/LineStyle.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/LineStyle.java new file mode 100644 index 0000000..7dd8485 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/LineStyle.java @@ -0,0 +1,35 @@ +package org.icepear.echarts.components.series; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class LineStyle implements LineStyleOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private Number width; + + private String color; + + private Number opacity; + + private String type; + + private Object cap; + + private Object join; + + private Number dashOffset; + + private Number miterLimit; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLabel.java new file mode 100644 index 0000000..be9de86 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLabel.java @@ -0,0 +1,170 @@ +package org.icepear.echarts.components.series; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.SeriesLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class SeriesLabel implements SeriesLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public SeriesLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public SeriesLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public SeriesLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public SeriesLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public SeriesLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SeriesLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public SeriesLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public SeriesLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public SeriesLabel setWidth(Number width) { + this.width = width; + return this; + } + + public SeriesLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public SeriesLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public SeriesLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLineLabel.java b/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLineLabel.java new file mode 100644 index 0000000..3f0e1b9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/series/SeriesLineLabel.java @@ -0,0 +1,181 @@ +package org.icepear.echarts.components.series; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.SeriesLineLabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class SeriesLineLabel implements SeriesLineLabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public SeriesLineLabel setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public SeriesLineLabel setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public SeriesLineLabel setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public SeriesLineLabel setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public SeriesLineLabel setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public SeriesLineLabel setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public SeriesLineLabel setPadding(Number padding) { + this.padding = padding; + return this; + } + + public SeriesLineLabel setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public SeriesLineLabel setWidth(Number width) { + this.width = width; + return this; + } + + public SeriesLineLabel setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + @Setter(AccessLevel.NONE) + private Object distance; + + public SeriesLineLabel setDistance(Number distance) { + this.distance = distance; + return this; + } + + public SeriesLineLabel setDistance(Number[] distance) { + this.distance = distance; + return this; + } + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public SeriesLineLabel setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public SeriesLineLabel setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; + + private String formatter; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/text/Label.java b/youchain-system/src/main/java/org/icepear/echarts/components/text/Label.java new file mode 100644 index 0000000..929ad58 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/text/Label.java @@ -0,0 +1,168 @@ +package org.icepear.echarts.components.text; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.LabelOption; +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class Label implements LabelOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public Label setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public Label setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public Label setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public Label setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public Label setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public Label setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public Label setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Label setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public Label setWidth(Number width) { + this.width = width; + return this; + } + + public Label setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; + + private Boolean show; + + private String position; + + private Number distance; + + private Number rotate; + + private Number[] offset; + + private Number minMargin; + + private Object overflow; + + private Boolean silent; + + @Setter(AccessLevel.NONE) + private Object precision; + + public Label setPrecision(Number precision) { + this.precision = precision; + return this; + } + + public Label setPrecision(String precision) { + this.precision = precision; + return this; + } + + private Boolean valueAnimation; + + private Map rich; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/text/LabelLayout.java b/youchain-system/src/main/java/org/icepear/echarts/components/text/LabelLayout.java new file mode 100644 index 0000000..a1f7c0f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/text/LabelLayout.java @@ -0,0 +1,63 @@ +package org.icepear.echarts.components.text; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.LabelLayoutOption; + +@Accessors(chain = true) +@Data +public class LabelLayout implements LabelLayoutOption { + + private String moveOverlap; + + private Boolean hideOverlap; + + private Boolean draggable; + + @Setter(AccessLevel.NONE) + private Object x; + + public LabelLayout setX(Number x) { + this.x = x; + return this; + } + + public LabelLayout setX(String x) { + this.x = x; + return this; + } + + @Setter(AccessLevel.NONE) + private Object y; + + public LabelLayout setY(Number y) { + this.y = y; + return this; + } + + public LabelLayout setY(String y) { + this.y = y; + return this; + } + + private Number dx; + + private Number dy; + + private Number rotate; + + private String align; + + private String verticalAlign; + + private Number width; + + private Number height; + + private Number fontSize; + + private Number[] labelLinePoints; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/text/Text.java b/youchain-system/src/main/java/org/icepear/echarts/components/text/Text.java new file mode 100644 index 0000000..f7f3990 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/text/Text.java @@ -0,0 +1,132 @@ +package org.icepear.echarts.components.text; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.util.TextCommonOption; + +@Accessors(chain = true) +@Data +public class Text implements TextCommonOption { + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + private String color; + + private String fontStyle; + + private String fontWeight; + + private String fontFamily; + + @Setter(AccessLevel.NONE) + private Object fontSize; + + public Text setFontSize(Number fontSize) { + this.fontSize = fontSize; + return this; + } + + public Text setFontSize(String fontSize) { + this.fontSize = fontSize; + return this; + } + + private String align; + + private String verticalAlign; + + private String baseline; + + private Number opacity; + + private Number lineHeight; + + @Setter(AccessLevel.NONE) + private Object backgroundColor; + + public Text setBackgroundColor(Object backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + public Text setBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Number borderDashOffset; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public Text setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public Text setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public Text setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Text setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + @Setter(AccessLevel.NONE) + private Object width; + + public Text setWidth(Number width) { + this.width = width; + return this; + } + + public Text setWidth(String width) { + this.width = width; + return this; + } + + private Number height; + + private String textBorderColor; + + private Number textBorderWidth; + + private String textBorderType; + + private Number textBorderDashOffset; + + private Number textShadowBlur; + + private String textShadowColor; + + private Number textShadowOffsetX; + + private Number textShadowOffsetY; + + private String tag; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/title/Title.java b/youchain-system/src/main/java/org/icepear/echarts/components/title/Title.java new file mode 100644 index 0000000..a3375e4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/title/Title.java @@ -0,0 +1,196 @@ +package org.icepear.echarts.components.title; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.title.TitleOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class Title implements TitleOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Title setId(Number id) { + this.id = id; + return this; + } + + public Title setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Title setName(Number name) { + this.name = name; + return this; + } + + public Title setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object width; + + public Title setWidth(Number width) { + this.width = width; + return this; + } + + public Title setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public Title setHeight(Number height) { + this.height = height; + return this; + } + + public Title setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public Title setTop(Number top) { + this.top = top; + return this; + } + + public Title setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public Title setRight(Number right) { + this.right = right; + return this; + } + + public Title setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public Title setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public Title setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public Title setLeft(Number left) { + this.left = left; + return this; + } + + public Title setLeft(String left) { + this.left = left; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Boolean show; + + private String text; + + private String link; + + private String target; + + private String subtext; + + private String sublink; + + private String subtarget; + + private String textAlign; + + private String textVerticalAlign; + + private String textBaseline; + + private String backgroundColor; + + @Setter(AccessLevel.NONE) + private Object padding; + + public Title setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Title setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private Number itemGap; + + private LabelOption textStyle; + + private LabelOption subtextStyle; + + private Boolean triggerEvent; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public Title setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public Title setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/Toolbox.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/Toolbox.java new file mode 100644 index 0000000..55be1fd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/Toolbox.java @@ -0,0 +1,193 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; +import org.icepear.echarts.origin.component.toolbox.ToolboxOption; +import org.icepear.echarts.origin.util.CommonTooltipOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class Toolbox implements ToolboxOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Toolbox setId(Number id) { + this.id = id; + return this; + } + + public Toolbox setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Toolbox setName(Number name) { + this.name = name; + return this; + } + + public Toolbox setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object width; + + public Toolbox setWidth(Number width) { + this.width = width; + return this; + } + + public Toolbox setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public Toolbox setHeight(Number height) { + this.height = height; + return this; + } + + public Toolbox setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public Toolbox setTop(Number top) { + this.top = top; + return this; + } + + public Toolbox setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public Toolbox setRight(Number right) { + this.right = right; + return this; + } + + public Toolbox setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public Toolbox setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public Toolbox setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public Toolbox setLeft(Number left) { + this.left = left; + return this; + } + + public Toolbox setLeft(String left) { + this.left = left; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Boolean show; + + private String orient; + + private String backgroundColor; + + @Setter(AccessLevel.NONE) + private Object borderRadius; + + public Toolbox setBorderRadius(Number borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + public Toolbox setBorderRadius(Number[] borderRadius) { + this.borderRadius = borderRadius; + return this; + } + + @Setter(AccessLevel.NONE) + private Object padding; + + public Toolbox setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Toolbox setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private Number itemSize; + + private Number itemGap; + + private Boolean showTitle; + + private ItemStyleOption iconStyle; + + private Object emphasis; + + private LabelOption textStyle; + + private CommonTooltipOption tooltip; + + private Map feature; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxBrushFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxBrushFeature.java new file mode 100644 index 0000000..f50595c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxBrushFeature.java @@ -0,0 +1,53 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxBrushFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxBrushFeature implements ToolboxBrushFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxBrushFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxBrushFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxBrushFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxBrushFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; + + private Object[] type; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataViewFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataViewFeature.java new file mode 100644 index 0000000..88d617b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataViewFeature.java @@ -0,0 +1,71 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxDataViewFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxDataViewFeature implements ToolboxDataViewFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxDataViewFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxDataViewFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxDataViewFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxDataViewFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; + + private Boolean readOnly; + + private Object optionToContent; + + private Object contentToOption; + + private String[] lang; + + private String backgroundColor; + + private String textColor; + + private String textareaColor; + + private String textareaBorderColor; + + private String buttonColor; + + private String buttonTextColor; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataZoomFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataZoomFeature.java new file mode 100644 index 0000000..2cc1af2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDataZoomFeature.java @@ -0,0 +1,66 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxDataZoomFeatureOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +@Accessors(chain = true) +@Data +public class ToolboxDataZoomFeature implements ToolboxDataZoomFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxDataZoomFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxDataZoomFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxDataZoomFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxDataZoomFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; + + private Object[] type; + + private String filterMode; + + private Object xAxisIndex; + + private Object yAxisIndex; + + private Object xAxisId; + + private Object yAxisId; + + private ItemStyleOption brushStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDefaultFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDefaultFeature.java new file mode 100644 index 0000000..c7a63cf --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxDefaultFeature.java @@ -0,0 +1,51 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxDefaultFeature implements ToolboxFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxDefaultFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxDefaultFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxDefaultFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxDefaultFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxMagicTypeFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxMagicTypeFeature.java new file mode 100644 index 0000000..2dc3cb3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxMagicTypeFeature.java @@ -0,0 +1,57 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxMagicTypeFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxMagicTypeFeature implements ToolboxMagicTypeFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxMagicTypeFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxMagicTypeFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxMagicTypeFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxMagicTypeFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; + + private Object[] type; + + private String option; + + private Object seriesIndex; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxRestoreFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxRestoreFeature.java new file mode 100644 index 0000000..c71622c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxRestoreFeature.java @@ -0,0 +1,51 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxRestoreFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxRestoreFeature implements ToolboxRestoreFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxRestoreFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxRestoreFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxRestoreFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxRestoreFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxSaveAsImageFeature.java b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxSaveAsImageFeature.java new file mode 100644 index 0000000..8ba96df --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/toolbox/ToolboxSaveAsImageFeature.java @@ -0,0 +1,65 @@ +package org.icepear.echarts.components.toolbox; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.toolbox.feature.ToolboxSaveAsImageFeatureOption; + +@Accessors(chain = true) +@Data +public class ToolboxSaveAsImageFeature implements ToolboxSaveAsImageFeatureOption { + + private Boolean show; + + @Setter(AccessLevel.NONE) + private Object title; + + public ToolboxSaveAsImageFeature setTitle(Map title) { + this.title = title; + return this; + } + + public ToolboxSaveAsImageFeature setTitle(String title) { + this.title = title; + return this; + } + + @Setter(AccessLevel.NONE) + private Object icon; + + public ToolboxSaveAsImageFeature setIcon(Map icon) { + this.icon = icon; + return this; + } + + public ToolboxSaveAsImageFeature setIcon(String icon) { + this.icon = icon; + return this; + } + + private Object iconStyle; + + private Object emphasis; + + private Map iconStatus; + + private Object onclick; + + private String type; + + private String backgroundColor; + + private String connectedBackgroundColor; + + private String name; + + private String[] excludeComponents; + + private Number pixelRatio; + + private String[] lang; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/Tooltip.java b/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/Tooltip.java new file mode 100644 index 0000000..477b9a0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/Tooltip.java @@ -0,0 +1,148 @@ +package org.icepear.echarts.components.tooltip; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.tooltip.TooltipAxisPointerOption; +import org.icepear.echarts.origin.component.tooltip.TooltipOption; + +@Accessors(chain = true) +@Data +public class Tooltip implements TooltipOption { + + private Boolean show; + + private String triggerOn; + + private Boolean alwaysShowContent; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public Tooltip setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public Tooltip setFormatter(String formatter) { + this.formatter = formatter; + return this; + } + + @Setter(AccessLevel.NONE) + private Object position; + + public Tooltip setPosition(Number[] position) { + this.position = position; + return this; + } + + public Tooltip setPosition(Object position) { + this.position = position; + return this; + } + + public Tooltip setPosition(String[] position) { + this.position = position; + return this; + } + + private Boolean confine; + + private String align; + + private String verticalAlign; + + private Number showDelay; + + private Number hideDelay; + + private Number transitionDuration; + + private Boolean enterable; + + private String backgroundColor; + + private String borderColor; + + private Number borderRadius; + + private Number borderWidth; + + private Number shadowBlur; + + private String shadowColor; + + private Number shadowOffsetX; + + private Number shadowOffsetY; + + @Setter(AccessLevel.NONE) + private Object padding; + + public Tooltip setPadding(Number padding) { + this.padding = padding; + return this; + } + + public Tooltip setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private String extraCssText; + + private Object textStyle; + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public Tooltip setId(Number id) { + this.id = id; + return this; + } + + public Tooltip setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public Tooltip setName(Number name) { + this.name = name; + return this; + } + + public Tooltip setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + private TooltipAxisPointerOption axisPointer; + + private Boolean showContent; + + private String trigger; + + private String displayMode; + + private String renderMode; + + private Boolean appendToBody; + + private String className; + + private String order; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/TooltipAxisPointer.java b/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/TooltipAxisPointer.java new file mode 100644 index 0000000..475d985 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/tooltip/TooltipAxisPointer.java @@ -0,0 +1,105 @@ +package org.icepear.echarts.components.tooltip; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.tooltip.TooltipAxisPointerOption; +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +@Accessors(chain = true) +@Data +public class TooltipAxisPointer implements TooltipAxisPointerOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public TooltipAxisPointer setId(Number id) { + this.id = id; + return this; + } + + public TooltipAxisPointer setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public TooltipAxisPointer setName(Number name) { + this.name = name; + return this; + } + + public TooltipAxisPointer setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object show; + + public TooltipAxisPointer setShow(Boolean show) { + this.show = show; + return this; + } + + public TooltipAxisPointer setShow(String show) { + this.show = show; + return this; + } + + private String triggerOn; + + private Boolean snap; + + private Boolean triggerTooltip; + + private Object value; + + private String status; + + private Object label; + + @Setter(AccessLevel.NONE) + private Object animation; + + public TooltipAxisPointer setAnimation(Boolean animation) { + this.animation = animation; + return this; + } + + public TooltipAxisPointer setAnimation(String animation) { + this.animation = animation; + return this; + } + + private Number animationDurationUpdate; + + private Object animationEasingUpdate; + + private LineStyleOption lineStyle; + + private AreaStyleOption shadowStyle; + + private Object handle; + + private Object[] seriesDataIndices; + + private Object[] link; + + private String axis; + + private Object crossStyle; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/ContinousVisualMap.java b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/ContinousVisualMap.java new file mode 100644 index 0000000..89067a6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/ContinousVisualMap.java @@ -0,0 +1,273 @@ +package org.icepear.echarts.components.visualMap; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.visualMap.ContinousVisualMapOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class ContinousVisualMap implements ContinousVisualMapOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public ContinousVisualMap setId(Number id) { + this.id = id; + return this; + } + + public ContinousVisualMap setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public ContinousVisualMap setName(Number name) { + this.name = name; + return this; + } + + public ContinousVisualMap setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object width; + + public ContinousVisualMap setWidth(Number width) { + this.width = width; + return this; + } + + public ContinousVisualMap setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public ContinousVisualMap setHeight(Number height) { + this.height = height; + return this; + } + + public ContinousVisualMap setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public ContinousVisualMap setTop(Number top) { + this.top = top; + return this; + } + + public ContinousVisualMap setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public ContinousVisualMap setRight(Number right) { + this.right = right; + return this; + } + + public ContinousVisualMap setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public ContinousVisualMap setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public ContinousVisualMap setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public ContinousVisualMap setLeft(Number left) { + this.left = left; + return this; + } + + public ContinousVisualMap setLeft(String left) { + this.left = left; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Boolean show; + + private String align; + + private Boolean realtime; + + @Setter(AccessLevel.NONE) + private Object seriesIndex; + + public ContinousVisualMap setSeriesIndex(Number seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + public ContinousVisualMap setSeriesIndex(Number[] seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + public ContinousVisualMap setSeriesIndex(String seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + private Number min; + + private Number max; + + private Number dimension; + + private Object controller; + + private Object target; + + private Number itemWidth; + + private Number itemHeight; + + private Boolean inverse; + + private String orient; + + private String backgroundColor; + + private String contentColor; + + private String inactiveColor; + + @Setter(AccessLevel.NONE) + private Object padding; + + public ContinousVisualMap setPadding(Number padding) { + this.padding = padding; + return this; + } + + public ContinousVisualMap setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private Number textGap; + + private Number precision; + + private String[] color; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public ContinousVisualMap setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public ContinousVisualMap setFormatter(String formatter) { + this.formatter = formatter; + return this; + } + + private String[] text; + + private LabelOption textStyle; + + private Object categories; + + private Boolean calculable; + + private Number[] range; + + private Boolean hoverLink; + + private Number hoverLinkDataSize; + + private Boolean hoverLinkOnHandle; + + private String handleIcon; + + @Setter(AccessLevel.NONE) + private Object handleSize; + + public ContinousVisualMap setHandleSize(Number handleSize) { + this.handleSize = handleSize; + return this; + } + + public ContinousVisualMap setHandleSize(String handleSize) { + this.handleSize = handleSize; + return this; + } + + private ItemStyleOption handleStyle; + + private String indicatorIcon; + + @Setter(AccessLevel.NONE) + private Object indicatorSize; + + public ContinousVisualMap setIndicatorSize(Number indicatorSize) { + this.indicatorSize = indicatorSize; + return this; + } + + public ContinousVisualMap setIndicatorSize(String indicatorSize) { + this.indicatorSize = indicatorSize; + return this; + } + + private ItemStyleOption indicatorStyle; + + private Object emphasis; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/PiecewiseVisualMap.java b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/PiecewiseVisualMap.java new file mode 100644 index 0000000..b8d8a18 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/PiecewiseVisualMap.java @@ -0,0 +1,260 @@ +package org.icepear.echarts.components.visualMap; + +import java.util.Map; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.visualMap.PiecewiseVisualMapOption; +import org.icepear.echarts.origin.component.visualMap.VisualPieceOption; +import org.icepear.echarts.origin.util.LabelOption; + +@Accessors(chain = true) +@Data +public class PiecewiseVisualMap implements PiecewiseVisualMapOption { + + private String mainType; + + private String type; + + @Setter(AccessLevel.NONE) + private Object id; + + public PiecewiseVisualMap setId(Number id) { + this.id = id; + return this; + } + + public PiecewiseVisualMap setId(String id) { + this.id = id; + return this; + } + + @Setter(AccessLevel.NONE) + private Object name; + + public PiecewiseVisualMap setName(Number name) { + this.name = name; + return this; + } + + public PiecewiseVisualMap setName(String name) { + this.name = name; + return this; + } + + private Number z; + + private Number zlevel; + + @Setter(AccessLevel.NONE) + private Object width; + + public PiecewiseVisualMap setWidth(Number width) { + this.width = width; + return this; + } + + public PiecewiseVisualMap setWidth(String width) { + this.width = width; + return this; + } + + @Setter(AccessLevel.NONE) + private Object height; + + public PiecewiseVisualMap setHeight(Number height) { + this.height = height; + return this; + } + + public PiecewiseVisualMap setHeight(String height) { + this.height = height; + return this; + } + + @Setter(AccessLevel.NONE) + private Object top; + + public PiecewiseVisualMap setTop(Number top) { + this.top = top; + return this; + } + + public PiecewiseVisualMap setTop(String top) { + this.top = top; + return this; + } + + @Setter(AccessLevel.NONE) + private Object right; + + public PiecewiseVisualMap setRight(Number right) { + this.right = right; + return this; + } + + public PiecewiseVisualMap setRight(String right) { + this.right = right; + return this; + } + + @Setter(AccessLevel.NONE) + private Object bottom; + + public PiecewiseVisualMap setBottom(Number bottom) { + this.bottom = bottom; + return this; + } + + public PiecewiseVisualMap setBottom(String bottom) { + this.bottom = bottom; + return this; + } + + @Setter(AccessLevel.NONE) + private Object left; + + public PiecewiseVisualMap setLeft(Number left) { + this.left = left; + return this; + } + + public PiecewiseVisualMap setLeft(String left) { + this.left = left; + return this; + } + + private String borderColor; + + private Number borderWidth; + + private String borderType; + + private Object borderCap; + + private Object borderJoin; + + private Number borderDashOffset; + + private Number borderMiterLimit; + + private Boolean show; + + private String align; + + private Boolean realtime; + + @Setter(AccessLevel.NONE) + private Object seriesIndex; + + public PiecewiseVisualMap setSeriesIndex(Number seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + public PiecewiseVisualMap setSeriesIndex(Number[] seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + public PiecewiseVisualMap setSeriesIndex(String seriesIndex) { + this.seriesIndex = seriesIndex; + return this; + } + + private Number min; + + private Number max; + + private Number dimension; + + private Object controller; + + private Object target; + + private Number itemWidth; + + private Number itemHeight; + + private Boolean inverse; + + private String orient; + + private String backgroundColor; + + private String contentColor; + + private String inactiveColor; + + @Setter(AccessLevel.NONE) + private Object padding; + + public PiecewiseVisualMap setPadding(Number padding) { + this.padding = padding; + return this; + } + + public PiecewiseVisualMap setPadding(Number[] padding) { + this.padding = padding; + return this; + } + + private Number textGap; + + private Number precision; + + private String[] color; + + @Setter(AccessLevel.NONE) + private Object formatter; + + public PiecewiseVisualMap setFormatter(Object formatter) { + this.formatter = formatter; + return this; + } + + public PiecewiseVisualMap setFormatter(String formatter) { + this.formatter = formatter; + return this; + } + + private String[] text; + + private LabelOption textStyle; + + @Setter(AccessLevel.NONE) + private Object categories; + + public PiecewiseVisualMap setCategories(Object categories) { + this.categories = categories; + return this; + } + + public PiecewiseVisualMap setCategories(String[] categories) { + this.categories = categories; + return this; + } + + private Boolean minOpen; + + private Boolean maxOpen; + + private String itemSymbol; + + private VisualPieceOption[] pieces; + + private Number splitNumber; + + private Map selected; + + private String selectedMode; + + private Boolean showLabel; + + private Number itemGap; + + private Boolean hoverLink; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/VisualPiece.java b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/VisualPiece.java new file mode 100644 index 0000000..7bf0ae7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/components/visualMap/VisualPiece.java @@ -0,0 +1,48 @@ +package org.icepear.echarts.components.visualMap; + +import lombok.Data; +import lombok.experimental.Accessors; + +import org.icepear.echarts.origin.component.visualMap.VisualPieceOption; +import org.icepear.echarts.origin.util.DecalObject; + +@Accessors(chain = true) +@Data +public class VisualPiece implements VisualPieceOption { + + private String symbol; + + private Number symbolSize; + + private String color; + + private Number colorAlpha; + + private Number opacity; + + private Number colorLightness; + + private Number colorSaturation; + + private Number colorHue; + + private DecalObject decal; + + private Number liftZ; + + private Number min; + + private Number max; + + private Number lt; + + private Number gt; + + private Number lte; + + private Number gte; + + private Number value; + + private String label; +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLabel.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLabel.java new file mode 100644 index 0000000..48ccada --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLabel.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; +import org.icepear.echarts.components.series.LineStyle; +@Data +public class AxisLabel { + private int distance; + private int fontSize; + private String color; + private boolean show; + public AxisLabel(int distance, int fontSize, String color) { + show=true; + this.distance = distance; + this.fontSize = fontSize; + this.color = color; + } + public AxisLabel() { + show=false; + } + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLine.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLine.java new file mode 100644 index 0000000..82680a6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisLine.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.icepear.echarts.components.series.LineStyle; +@Slf4j +@Data +public class AxisLine { + private LineStyle lineStyle; + private boolean show=true; + public AxisLine setLineStyle(LineStyle lineStyle){ + + this.lineStyle=lineStyle; + return this; + } + + public AxisLine setShow(boolean show){ + this.show=show; + return this; + } + + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisTick.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisTick.java new file mode 100644 index 0000000..c4b03df --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/AxisTick.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; +import org.icepear.echarts.components.series.LineStyle; +@Data +public class AxisTick { + private int distance; + private int splitNumber; + private LineStyle lineStyle; + private boolean show; + public AxisTick(int distance, int splitNumber, LineStyle lineStyle) { + show=true; + this.distance = distance; + this.splitNumber = splitNumber; + this.lineStyle = lineStyle; + } + public AxisTick() { + show=false; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/ColorStops.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/ColorStops.java new file mode 100644 index 0000000..42535be --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/ColorStops.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; + +@Data +public class ColorStops { + private int offset; + private String color; + + public ColorStops(int offset,String color){ + this.offset=offset; + this.color=color; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/JianBianColor.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/JianBianColor.java new file mode 100644 index 0000000..3c0845c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/JianBianColor.java @@ -0,0 +1,27 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; + +import java.util.List; +@Data +public class JianBianColor { + private String type; + private double x; + private double y; + + private double x2; + private double y2; + + private List colorStops; + + private boolean global; + public JianBianColor(String type, double x, double y, double x2, double y2, List colorStops,boolean global) { + this.type = type; + this.x = x; + this.y = y; + this.x2 = x2; + this.y2 = y2; + this.colorStops = colorStops; + this.global=global; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/liuxue/SplitLine.java b/youchain-system/src/main/java/org/icepear/echarts/liuxue/SplitLine.java new file mode 100644 index 0000000..9053212 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/liuxue/SplitLine.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.liuxue; + +import lombok.Data; +import org.icepear.echarts.components.series.LineStyle; +@Data +public class SplitLine { + private int distance; + private int length; + private LineStyle lineStyle; + private boolean show; + public SplitLine(int distance, int length, LineStyle lineStyle) { + show=true; + this.distance = distance; + this.length = length; + this.lineStyle = lineStyle; + } + public SplitLine() { + show=false; + } +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarBackgroundStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarBackgroundStyleOption.java new file mode 100644 index 0000000..22eb033 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarBackgroundStyleOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L84 + */ +public interface BarBackgroundStyleOption extends ItemStyleOption { + + BarBackgroundStyleOption setBorderRadius(Number borderRadius); + + BarBackgroundStyleOption setBorderRadius(Number[] borderRadius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarDataItemOption.java new file mode 100644 index 0000000..7547709 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarDataItemOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.DefaultOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L59 + */ +public interface BarDataItemOption extends BarStateOption, StatesOptionMixin, DefaultOptionDataItemObject { + + BarDataItemOption setCursor(String cursor); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarEmphasisOption.java new file mode 100644 index 0000000..4bfcaf6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L52 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface BarEmphasisOption extends DefaultStatesMixinEmpasis, BarStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarItemStyleOption.java new file mode 100644 index 0000000..40ee674 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarItemStyleOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L55 + */ +public interface BarItemStyleOption extends ItemStyleOption { + + BarItemStyleOption setBorderRadius(Number borderRadius); + + BarItemStyleOption setBorderRadius(Number[] borderRadius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarLabelOption.java new file mode 100644 index 0000000..ba24687 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarLabelOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L43 + */ +public interface BarLabelOption extends SeriesLabelOption { + + BarLabelOption setPosition(String position); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarSeriesOption.java new file mode 100644 index 0000000..da2723e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarSeriesOption.java @@ -0,0 +1,42 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesSamplingOptionMixin; +import org.icepear.echarts.origin.util.SeriesStackOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L65 + */ +public interface BarSeriesOption extends BaseBarSeriesOption, BarStateOption, SeriesStackOptionMixin, + SeriesSamplingOptionMixin, SeriesEncodeOptionMixin { + + BarSeriesOption setType(String type); + + BarSeriesOption setCoordinateSystem(String coordinateSystem); + + BarSeriesOption setClip(Boolean clip); + + BarSeriesOption setRoundCap(Boolean roundCap); + + BarSeriesOption setShowBackground(Boolean showBackground); + + BarSeriesOption setBackgroundStyle(BarBackgroundStyleOption backgroundStyle); + + BarSeriesOption setData(BarDataItemOption[] data); + + BarSeriesOption setData(Number[] data); + + BarSeriesOption setData(Number[][] data); + + BarSeriesOption setData(Object[] data); + + BarSeriesOption setData(Object[][] data); + + BarSeriesOption setData(String[] data); + + BarSeriesOption setData(String[][] data); + + BarSeriesOption setRealtimeSort(Boolean realtimeSort); + + BarSeriesOption setEmphasis(BarEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarStateOption.java new file mode 100644 index 0000000..83bcf8e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BarStateOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.bar; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BarSeries.ts#L46 + */ +public interface BarStateOption { + + BarStateOption setItemStyle(BarItemStyleOption itemStyle); + + BarStateOption setLabel(BarLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BaseBarSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BaseBarSeriesOption.java new file mode 100644 index 0000000..94905f9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/bar/BaseBarSeriesOption.java @@ -0,0 +1,35 @@ +package org.icepear.echarts.origin.chart.bar; + +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnPolarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/bar/BaseBarSeries.ts#L34 + */ +public interface BaseBarSeriesOption extends SeriesOption, SeriesOnCartesianOptionMixin, SeriesOnPolarOptionMixin { + + BaseBarSeriesOption setBarMinHeight(Number barMinHeight); + + BaseBarSeriesOption setBarMinAngle(Number barMinAngle); + + BaseBarSeriesOption setBarMaxWidth(Number barMaxWidth); + + BaseBarSeriesOption setBarMinWidth(Number barMinWidth); + + BaseBarSeriesOption setBarWidth(Number barWidth); + + BaseBarSeriesOption setBarWidth(String barWidth); + + BaseBarSeriesOption setBarGap(Number barGap); + + BaseBarSeriesOption setBarGap(String barGap); + + BaseBarSeriesOption setBarCategoryGap(Number barCategoryGap); + + BaseBarSeriesOption setBarCategoryGap(String barCategoryGap); + + BaseBarSeriesOption setLarge(Boolean large); + + BaseBarSeriesOption setLargeThreshold(Number largeThreshold); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotDataItemOption.java new file mode 100644 index 0000000..3180136 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotDataItemOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.boxplot; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/boxplot/BoxplotSeries.ts#L46 + */ +public interface BoxplotDataItemOption extends BoxplotStateOption, StatesOptionMixin { + + BoxplotDataItemOption setValue(Object value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotEmphasisOption.java new file mode 100644 index 0000000..1a2e078 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotEmphasisOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.boxplot; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/boxplot/BoxplotSeries.ts#L52 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface BoxplotEmphasisOption extends BoxplotStateOption, EmphasisOption { + + BoxplotEmphasisOption setFocus(String focus); + + BoxplotEmphasisOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotSeriesOption.java new file mode 100644 index 0000000..c12e36f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotSeriesOption.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.origin.chart.boxplot; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/boxplot/BoxplotSeries.ts#L58 + */ +public interface BoxplotSeriesOption + extends SeriesOption, BoxplotStateOption, SeriesOnCartesianOptionMixin, SeriesEncodeOptionMixin { + + BoxplotSeriesOption setType(String type); + + BoxplotSeriesOption setCoordinateSystem(String coordinateSystem); + + BoxplotSeriesOption setLayout(String layout); + + BoxplotSeriesOption setBoxWidth(Number[] boxWidth); + + BoxplotSeriesOption setBoxWidth(String[] boxWidth); + + BoxplotSeriesOption setData(BoxplotDataItemOption[] data); + + BoxplotSeriesOption setData(Number[][] data); + + BoxplotSeriesOption setEmphasis(BoxplotEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotStateOption.java new file mode 100644 index 0000000..147df0d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.boxplot; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/boxplot/BoxplotSeries.ts#L41 + */ +public interface BoxplotStateOption { + + BoxplotStateOption setItemStyle(ItemStyleOption itemStyle); + + BoxplotStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotTransformOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotTransformOption.java new file mode 100644 index 0000000..c582958 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/BoxplotTransformOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.boxplot; + +import org.icepear.echarts.origin.data.helper.DataTransformOption; + +/** + * https://github.com/apache/echarts/blob/f3471f0a7080e68f8819f7b000d32d73fb0820fb/src/chart/boxplot/boxplotTransform.ts#L26 + */ +public interface BoxplotTransformOption extends DataTransformOption { + + BoxplotTransformOption setType(String type); + + BoxplotTransformOption setConfig(PrepareBoxplotDataOption config); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/PrepareBoxplotDataOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/PrepareBoxplotDataOption.java new file mode 100644 index 0000000..1acfc8c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/boxplot/PrepareBoxplotDataOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.boxplot; + +/** + * https://github.com/apache/echarts/blob/f3471f0a7080e68f8819f7b000d32d73fb0820fb/src/chart/boxplot/prepareBoxplotData.ts#L23 + */ +public interface PrepareBoxplotDataOption { + + PrepareBoxplotDataOption setBoundIQR(Number boundIQR); + + PrepareBoxplotDataOption setBoundIQR(String boundIQR); + + PrepareBoxplotDataOption setItemNameFormatter(String itemNameFormatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickDataItemOption.java new file mode 100644 index 0000000..89a9dd3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickDataItemOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.candlestick; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/candlestick/CandlestickSeries.ts#L51 + */ +public interface CandlestickDataItemOption extends CandlestickStateOption, StatesOptionMixin { + + CandlestickDataItemOption setValue(Object value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickEmphasisOption.java new file mode 100644 index 0000000..d259e4d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickEmphasisOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.candlestick; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/candlestick/CandlestickSeries.ts#L57 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface CandlestickEmphasisOption extends CandlestickStateOption, EmphasisOption { + + CandlestickEmphasisOption setFocus(String focus); + + CandlestickEmphasisOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickItemStyleOption.java new file mode 100644 index 0000000..5a44f65 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickItemStyleOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.candlestick; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/candlestick/CandlestickSeries.ts#L43 + */ +public interface CandlestickItemStyleOption extends ItemStyleOption { + + CandlestickItemStyleOption setColor0(Object color0); + + CandlestickItemStyleOption setBorderColor0(Object borderColor0); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickSeriesOption.java new file mode 100644 index 0000000..c7e65a9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickSeriesOption.java @@ -0,0 +1,39 @@ +package org.icepear.echarts.origin.chart.candlestick; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesLargeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/candlestick/CandlestickSeries.ts#L63 + */ +public interface CandlestickSeriesOption extends SeriesOption, CandlestickStateOption, SeriesOnCartesianOptionMixin, + SeriesLargeOptionMixin, SeriesEncodeOptionMixin { + + CandlestickSeriesOption setType(String type); + + CandlestickSeriesOption setCoordinateSystem(String coordinateSystem); + + CandlestickSeriesOption setLayout(String layout); + + CandlestickSeriesOption setClip(Boolean clip); + + CandlestickSeriesOption setBarMaxWidth(Number barMaxWidth); + + CandlestickSeriesOption setBarMaxWidth(String barMaxWidth); + + CandlestickSeriesOption setBarMinWidth(Number barMinWidth); + + CandlestickSeriesOption setBarMinWidth(String barMinWidth); + + CandlestickSeriesOption setBarWidth(Number barWidth); + + CandlestickSeriesOption setBarWidth(String barWidth); + + CandlestickSeriesOption setData(CandlestickDataItemOption[] data); + + CandlestickSeriesOption setData(Number[][] data); + + CandlestickSeriesOption setEmphasis(CandlestickEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickStateOption.java new file mode 100644 index 0000000..68a5056 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/candlestick/CandlestickStateOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.candlestick; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/candlestick/CandlestickSeries.ts#L47 + */ +public interface CandlestickStateOption { + + CandlestickStateOption setItemStyle(CandlestickItemStyleOption itemStyle); + + CandlestickStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelDataItemOption.java new file mode 100644 index 0000000..c2b3a71 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelDataItemOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.funnel; + +import org.icepear.echarts.origin.util.NumericOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/funnel/FunnelSeries.ts#L64 + */ +public interface FunnelDataItemOption extends FunnelStateOption, StatesOptionMixin, NumericOptionDataItemObject { + + FunnelDataItemOption setItemStyle(Object itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelEmphasisOption.java new file mode 100644 index 0000000..977c26e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.funnel; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/funnel/FunnelSeries.ts#L52 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface FunnelEmphasisOption extends DefaultStatesMixinEmpasis, FunnelStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelLabelOption.java new file mode 100644 index 0000000..4249b53 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelLabelOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.funnel; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/funnel/FunnelSeries.ts#L46 + */ +public interface FunnelLabelOption extends SeriesLabelOption { + + FunnelLabelOption setPosition(String position); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelSeriesOption.java new file mode 100644 index 0000000..b495d78 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelSeriesOption.java @@ -0,0 +1,42 @@ +package org.icepear.echarts.origin.chart.funnel; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/funnel/FunnelSeries.ts#L74 + */ +public interface FunnelSeriesOption + extends SeriesOption, FunnelStateOption, BoxLayoutOptionMixin, SeriesEncodeOptionMixin { + + FunnelSeriesOption setType(String type); + + FunnelSeriesOption setMin(Number min); + + FunnelSeriesOption setMax(Number max); + + FunnelSeriesOption setMinSize(Number minSize); + + FunnelSeriesOption setMinSize(String minSize); + + FunnelSeriesOption setMaxSize(Number maxSize); + + FunnelSeriesOption setMaxSize(String maxSize); + + FunnelSeriesOption setSort(String sort); + + FunnelSeriesOption setOrient(String orient); + + FunnelSeriesOption setGap(Number gap); + + FunnelSeriesOption setFunnelAlign(Object funnelAlign); + + FunnelSeriesOption setData(FunnelDataItemOption[] data); + + FunnelSeriesOption setData(Number[] data); + + FunnelSeriesOption setData(Number[][] data); + + FunnelSeriesOption setEmphasis(FunnelEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelStateOption.java new file mode 100644 index 0000000..8f41e77 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/funnel/FunnelStateOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.funnel; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/funnel/FunnelSeries.ts#L58 + */ +public interface FunnelStateOption { + + FunnelStateOption setItemStyle(ItemStyleOption itemStyle); + + FunnelStateOption setLabel(FunnelLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeAnchorOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeAnchorOption.java new file mode 100644 index 0000000..111f4d0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeAnchorOption.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L62 + */ +public interface GaugeAnchorOption { + + GaugeAnchorOption setShow(Boolean show); + + GaugeAnchorOption setShowAbove(Boolean showAbove); + + GaugeAnchorOption setSize(Number size); + + GaugeAnchorOption setIcon(String icon); + + GaugeAnchorOption setOffsetCenter(Number[] offsetCenter); + + GaugeAnchorOption setOffsetCenter(String[] offsetCenter); + + GaugeAnchorOption setKeepAspect(Boolean keepAspect); + + GaugeAnchorOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDataItemOption.java new file mode 100644 index 0000000..71f64b0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDataItemOption.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L114 + */ +public interface GaugeDataItemOption extends GaugeStateOption, StatesOptionMixin { + + GaugeDataItemOption setName(String name); + + GaugeDataItemOption setValue(Number value); + + GaugeDataItemOption setPointer(GaugePointerOption pointer); + + GaugeDataItemOption setProgress(GaugeProgressOption progress); + + GaugeDataItemOption setTitle(GaugeTitleOption title); + + GaugeDataItemOption setDetail(GaugeDetailOption detail); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDetailOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDetailOption.java new file mode 100644 index 0000000..3414db3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeDetailOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L94 + */ +public interface GaugeDetailOption extends LabelOption { + + GaugeDetailOption setOffsetCenter(Number[] offsetCenter); + + GaugeDetailOption setOffsetCenter(String[] offsetCenter); + + GaugeDetailOption setFormatter(Object formatter); + + GaugeDetailOption setFormatter(String formatter); + + GaugeDetailOption setValueAnimation(Boolean valueAnimation); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeEmphasisOption.java new file mode 100644 index 0000000..d22ada6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L108 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface GaugeEmphasisOption extends DefaultStatesMixinEmpasis, GaugeStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugePointerOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugePointerOption.java new file mode 100644 index 0000000..315df25 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugePointerOption.java @@ -0,0 +1,29 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L45 + */ +public interface GaugePointerOption { + + GaugePointerOption setIcon(String icon); + + GaugePointerOption setShow(Boolean show); + + GaugePointerOption setShowAbove(Boolean showAbove); + + GaugePointerOption setKeepAspect(Boolean keepAspect); + + GaugePointerOption setItemStyle(ItemStyleOption itemStyle); + + GaugePointerOption setOffsetCenter(Number[] offsetCenter); + + GaugePointerOption setOffsetCenter(String[] offsetCenter); + + GaugePointerOption setLength(Number length); + + GaugePointerOption setLength(String length); + + GaugePointerOption setWidth(Number width); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeProgressOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeProgressOption.java new file mode 100644 index 0000000..0c43f2f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeProgressOption.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L72 + */ +public interface GaugeProgressOption { + + GaugeProgressOption setShow(Boolean show); + + GaugeProgressOption setOverlap(Boolean overlap); + + GaugeProgressOption setWidth(Number width); + + GaugeProgressOption setRoundCap(Boolean roundCap); + + GaugeProgressOption setClip(Boolean clip); + + GaugeProgressOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeSeriesOption.java new file mode 100644 index 0000000..c4890be --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeSeriesOption.java @@ -0,0 +1,57 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.CircleLayoutOptionMixin; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L123 + */ +public interface GaugeSeriesOption + extends SeriesOption, GaugeStateOption, CircleLayoutOptionMixin, SeriesEncodeOptionMixin { + + GaugeSeriesOption setType(String type); + + GaugeSeriesOption setRadius(Number radius); + + GaugeSeriesOption setRadius(String radius); + + GaugeSeriesOption setStartAngle(Number startAngle); + + GaugeSeriesOption setEndAngle(Number endAngle); + + GaugeSeriesOption setClockwise(Boolean clockwise); + + GaugeSeriesOption setMin(Number min); + + GaugeSeriesOption setMax(Number max); + + GaugeSeriesOption setSplitNumber(Number splitNumber); + + GaugeSeriesOption setItemStyle(ItemStyleOption itemStyle); + + GaugeSeriesOption setAxisLine(Object axisLine); + + GaugeSeriesOption setProgress(GaugeProgressOption progress); + + GaugeSeriesOption setSplitLine(Object splitLine); + + GaugeSeriesOption setAxisTick(Object axisTick); + + GaugeSeriesOption setAxisLabel(Object axisLabel); + + GaugeSeriesOption setPointer(GaugePointerOption pointer); + + GaugeSeriesOption setAnchor(GaugeAnchorOption anchor); + + GaugeSeriesOption setTitle(GaugeTitleOption title); + + GaugeSeriesOption setDetail(GaugeDetailOption detail); + + GaugeSeriesOption setData(GaugeDataItemOption[] data); + + GaugeSeriesOption setData(Object[] data); + + GaugeSeriesOption setEmphasis(GaugeEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeStateOption.java new file mode 100644 index 0000000..29a3da8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeStateOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L110 + */ +public interface GaugeStateOption { + + GaugeStateOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeTitleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeTitleOption.java new file mode 100644 index 0000000..296aaff --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/gauge/GaugeTitleOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.gauge; + +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/gauge/GaugeSeries.ts#L81 + */ +public interface GaugeTitleOption extends LabelOption { + + GaugeTitleOption setOffsetCenter(Number[] offsetCenter); + + GaugeTitleOption setOffsetCenter(String[] offsetCenter); + + GaugeTitleOption setFormatter(Object formatter); + + GaugeTitleOption setFormatter(String formatter); + + GaugeTitleOption setValueAnimation(Boolean valueAnimation); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphBlurOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphBlurOption.java new file mode 100644 index 0000000..c672152 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphBlurOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L193 + */ +public interface GraphBlurOption { + + GraphBlurOption setLabel(SeriesLabelOption label); + + GraphBlurOption setEdgeLabel(SeriesLabelOption edgeLabel); + + GraphBlurOption setItemStyle(ItemStyleOption itemStyle); + + GraphBlurOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCategoryItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCategoryItemOption.java new file mode 100644 index 0000000..1e5fa6b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCategoryItemOption.java @@ -0,0 +1,18 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L132 + */ +public interface GraphCategoryItemOption extends SymbolOptionMixin, GraphNodeStateOption, StatesOptionMixin { + + GraphCategoryItemOption setName(String name); + + GraphCategoryItemOption setValue(Number value); + + GraphCategoryItemOption setValue(Object value); + + GraphCategoryItemOption setValue(String value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCircularOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCircularOption.java new file mode 100644 index 0000000..0907a5a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphCircularOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.chart.graph; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L208 + */ +public interface GraphCircularOption { + + GraphCircularOption setRotateLabel(Boolean rotateLabel); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeItemOption.java new file mode 100644 index 0000000..1df29eb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeItemOption.java @@ -0,0 +1,22 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.NumericGraphEdgeItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L115 + */ +public interface GraphEdgeItemOption extends GraphEdgeStateOption, StatesOptionMixin, NumericGraphEdgeItemObject { + + GraphEdgeItemOption setValue(Number value); + + GraphEdgeItemOption setSymbol(String symbol); + + GraphEdgeItemOption setSymbol(String[] symbol); + + GraphEdgeItemOption setSymbolSize(Number symbolSize); + + GraphEdgeItemOption setSymbolSize(Number[] symbolSize); + + GraphEdgeItemOption setIgnoreForceLayout(Boolean ignoreForceLayout); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeLineStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeLineStyleOption.java new file mode 100644 index 0000000..506a3b7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeLineStyleOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L61 + */ +public interface GraphEdgeLineStyleOption extends LineStyleOption { + + GraphEdgeLineStyleOption setCurveness(Number curveness); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeStateOption.java new file mode 100644 index 0000000..c93c1dc --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEdgeStateOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L111 + */ +public interface GraphEdgeStateOption { + + GraphEdgeStateOption setLineStyle(GraphEdgeLineStyleOption lineStyle); + + GraphEdgeStateOption setLabel(SeriesLineLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEmphasisOption.java new file mode 100644 index 0000000..fa62362 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphEmphasisOption.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.EmphasisOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L184 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface GraphEmphasisOption extends EmphasisOption { + + GraphEmphasisOption setFocus(String focus); + + GraphEmphasisOption setScale(Boolean scale); + + GraphEmphasisOption setLabel(SeriesLabelOption label); + + GraphEmphasisOption setEdgeLabel(SeriesLabelOption edgeLabel); + + GraphEmphasisOption setItemStyle(ItemStyleOption itemStyle); + + GraphEmphasisOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphForceOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphForceOption.java new file mode 100644 index 0000000..f020a26 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphForceOption.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.origin.chart.graph; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L213 + */ +public interface GraphForceOption { + + GraphForceOption setInitLayout(String initLayout); + + GraphForceOption setRepulsion(Number repulsion); + + GraphForceOption setRepulsion(Number[] repulsion); + + GraphForceOption setGravity(Number gravity); + + GraphForceOption setFriction(Number friction); + + GraphForceOption setEdgeLength(Number edgeLength); + + GraphForceOption setEdgeLength(Number[] edgeLength); + + GraphForceOption setLayoutAnimation(Boolean layoutAnimation); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeItemOption.java new file mode 100644 index 0000000..c350bea --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeItemOption.java @@ -0,0 +1,38 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L82 + */ +public interface GraphNodeItemOption extends SymbolOptionMixin, GraphNodeStateOption, StatesOptionMixin { + + GraphNodeItemOption setId(String id); + + GraphNodeItemOption setName(String name); + + GraphNodeItemOption setValue(Number value); + + GraphNodeItemOption setValue(Number[] value); + + GraphNodeItemOption setValue(Object value); + + GraphNodeItemOption setValue(Object[] value); + + GraphNodeItemOption setValue(String value); + + GraphNodeItemOption setValue(String[] value); + + GraphNodeItemOption setX(Number x); + + GraphNodeItemOption setY(Number y); + + GraphNodeItemOption setFixed(Boolean fixed); + + GraphNodeItemOption setCategory(Number category); + + GraphNodeItemOption setCategory(String category); + + GraphNodeItemOption setDraggable(Boolean draggable); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeStateOption.java new file mode 100644 index 0000000..b47c615 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphNodeStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L65 + */ +public interface GraphNodeStateOption { + + GraphNodeStateOption setItemStyle(ItemStyleOption itemStyle); + + GraphNodeStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSelectOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSelectOption.java new file mode 100644 index 0000000..f1166c0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSelectOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L200 + */ +public interface GraphSelectOption { + + GraphSelectOption setLabel(SeriesLabelOption label); + + GraphSelectOption setEdgeLabel(SeriesLabelOption edgeLabel); + + GraphSelectOption setItemStyle(ItemStyleOption itemStyle); + + GraphSelectOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSeriesOption.java new file mode 100644 index 0000000..befc9c8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/graph/GraphSeriesOption.java @@ -0,0 +1,96 @@ +package org.icepear.echarts.origin.chart.graph; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.RoamOptionMixin; +import org.icepear.echarts.origin.util.SeriesLabelOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; +import org.icepear.echarts.origin.util.SeriesOnCalendarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnGeoOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnPolarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnSingleOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/graph/GraphSeries.ts#L139 + */ +public interface GraphSeriesOption + extends SeriesOption, SeriesOnCartesianOptionMixin, SeriesOnPolarOptionMixin, SeriesOnCalendarOptionMixin, + SeriesOnGeoOptionMixin, SeriesOnSingleOptionMixin, SymbolOptionMixin, RoamOptionMixin, BoxLayoutOptionMixin { + + GraphSeriesOption setType(String type); + + GraphSeriesOption setCoordinateSystem(String coordinateSystem); + + GraphSeriesOption setLegendHoverLink(Boolean legendHoverLink); + + GraphSeriesOption setLayout(String layout); + + GraphSeriesOption setData(GraphNodeItemOption[] data); + + GraphSeriesOption setData(Number[] data); + + GraphSeriesOption setData(Number[][] data); + + GraphSeriesOption setData(Object[] data); + + GraphSeriesOption setData(Object[][] data); + + GraphSeriesOption setData(String[] data); + + GraphSeriesOption setData(String[][] data); + + GraphSeriesOption setNodes(GraphNodeItemOption[] nodes); + + GraphSeriesOption setNodes(Number[] nodes); + + GraphSeriesOption setNodes(Number[][] nodes); + + GraphSeriesOption setNodes(Object[] nodes); + + GraphSeriesOption setNodes(Object[][] nodes); + + GraphSeriesOption setNodes(String[] nodes); + + GraphSeriesOption setNodes(String[][] nodes); + + GraphSeriesOption setEdges(GraphEdgeItemOption[] edges); + + GraphSeriesOption setLinks(GraphEdgeItemOption[] links); + + GraphSeriesOption setCategories(GraphCategoryItemOption[] categories); + + GraphSeriesOption setFocusNodeAdjacency(Boolean focusNodeAdjacency); + + GraphSeriesOption setNodeScaleRatio(Number nodeScaleRatio); + + GraphSeriesOption setDraggable(Boolean draggable); + + GraphSeriesOption setEdgeSymbol(String edgeSymbol); + + GraphSeriesOption setEdgeSymbol(String[] edgeSymbol); + + GraphSeriesOption setEdgeSymbolSize(Number edgeSymbolSize); + + GraphSeriesOption setEdgeSymbolSize(Number[] edgeSymbolSize); + + GraphSeriesOption setEdgeLabel(SeriesLineLabelOption edgeLabel); + + GraphSeriesOption setLabel(SeriesLabelOption label); + + GraphSeriesOption setItemStyle(ItemStyleOption itemStyle); + + GraphSeriesOption setLineStyle(GraphEdgeLineStyleOption lineStyle); + + GraphSeriesOption setEmphasis(GraphEmphasisOption emphasis); + + GraphSeriesOption setBlur(GraphBlurOption blur); + + GraphSeriesOption setSelect(GraphSelectOption select); + + GraphSeriesOption setCircular(GraphCircularOption circular); + + GraphSeriesOption setForce(GraphForceOption force); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapDataItemOption.java new file mode 100644 index 0000000..3281141 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapDataItemOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.heatmap; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/heatmap/HeatmapSeries.ts#L53 + */ +public interface HeatmapDataItemOption extends HeatmapStateOption, StatesOptionMixin { + + HeatmapDataItemOption setValue(Object value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapEmphasisOption.java new file mode 100644 index 0000000..a6693a8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.heatmap; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/heatmap/HeatmapSeries.ts#L51 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface HeatmapEmphasisOption extends DefaultStatesMixinEmpasis, HeatmapStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapSeriesOption.java new file mode 100644 index 0000000..9144d60 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapSeriesOption.java @@ -0,0 +1,32 @@ +package org.icepear.echarts.origin.chart.heatmap; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCalendarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnGeoOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/heatmap/HeatmapSeries.ts#L58 + */ +public interface HeatmapSeriesOption extends SeriesOption, HeatmapStateOption, SeriesOnCartesianOptionMixin, + SeriesOnGeoOptionMixin, SeriesOnCalendarOptionMixin, SeriesEncodeOptionMixin { + + HeatmapSeriesOption setType(String type); + + HeatmapSeriesOption setCoordinateSystem(String coordinateSystem); + + HeatmapSeriesOption setBlurSize(Number blurSize); + + HeatmapSeriesOption setPointSize(Number pointSize); + + HeatmapSeriesOption setMaxOpacity(Number maxOpacity); + + HeatmapSeriesOption setMinOpacity(Number minOpacity); + + HeatmapSeriesOption setData(HeatmapDataItemOption[] data); + + HeatmapSeriesOption setData(Object[][] data); + + HeatmapSeriesOption setEmphasis(HeatmapEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapStateOption.java new file mode 100644 index 0000000..396b7d1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/heatmap/HeatmapStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.heatmap; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/heatmap/HeatmapSeries.ts#L44 + */ +public interface HeatmapStateOption { + + HeatmapStateOption setItemStyle(ItemStyleOption itemStyle); + + HeatmapStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineAreaStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineAreaStyleOption.java new file mode 100644 index 0000000..6103424 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineAreaStyleOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.line; + +import org.icepear.echarts.origin.util.AreaStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L103 + */ +public interface LineAreaStyleOption extends AreaStyleOption { + + LineAreaStyleOption setOrigin(String origin); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineDataItemOption.java new file mode 100644 index 0000000..b05b48e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineDataItemOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.line; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L61 + */ +public interface LineDataItemOption extends SymbolOptionMixin, LineStateOption, StatesOptionMixin { + + LineDataItemOption setName(String name); + + LineDataItemOption setValue(Object value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineEmphasisOption.java new file mode 100644 index 0000000..eadb622 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineEmphasisOption.java @@ -0,0 +1,24 @@ +package org.icepear.echarts.origin.chart.line; + +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.EmphasisOption; +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L74 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L55 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L48 + */ +public interface LineEmphasisOption extends LineStateOption, EmphasisOption { + + LineEmphasisOption setLineStyle(LineStyleOption lineStyle); + + LineEmphasisOption setLineStyle(Object lineStyle); + + LineEmphasisOption setAreaStyle(AreaStyleOption areaStyle); + + LineEmphasisOption setFocus(String focus); + + LineEmphasisOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineSeriesOption.java new file mode 100644 index 0000000..e0bfea5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineSeriesOption.java @@ -0,0 +1,59 @@ +package org.icepear.echarts.origin.chart.line; + +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesLabelOption; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnPolarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; +import org.icepear.echarts.origin.util.SeriesSamplingOptionMixin; +import org.icepear.echarts.origin.util.SeriesStackOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L73 + */ +public interface LineSeriesOption + extends SeriesOption, LineStateOption, SeriesOnCartesianOptionMixin, SeriesOnPolarOptionMixin, + SeriesStackOptionMixin, SeriesSamplingOptionMixin, SymbolOptionMixin, SeriesEncodeOptionMixin { + + LineSeriesOption setType(String type); + + LineSeriesOption setCoordinateSystem(String coordinateSystem); + + LineSeriesOption setClip(Boolean clip); + + LineSeriesOption setLabel(SeriesLabelOption label); + + LineSeriesOption setEndLabel(Object endLabel); + + LineSeriesOption setLineStyle(LineStyleOption lineStyle); + + LineSeriesOption setAreaStyle(LineAreaStyleOption areaStyle); + + LineSeriesOption setStep(Boolean step); + + LineSeriesOption setStep(String step); + + LineSeriesOption setSmooth(Boolean smooth); + + LineSeriesOption setSmooth(Number smooth); + + LineSeriesOption setSmoothMonotone(String smoothMonotone); + + LineSeriesOption setConnectNulls(Boolean connectNulls); + + LineSeriesOption setShowSymbol(Boolean showSymbol); + + LineSeriesOption setShowAllSymbol(Boolean showAllSymbol); + + LineSeriesOption setShowAllSymbol(String showAllSymbol); + + LineSeriesOption setData(LineDataItemOption[] data); + + LineSeriesOption setData(Object[] data); + + LineSeriesOption setTriggerLineEvent(Boolean triggerLineEvent); + + LineSeriesOption setEmphasis(LineEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineStateOption.java new file mode 100644 index 0000000..a4f2896 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/line/LineStateOption.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.chart.line; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/line/LineSeries.ts#L55 + */ +public interface LineStateOption { + + LineStateOption setItemStyle(ItemStyleOption itemStyle); + + LineStateOption setLabel(SeriesLabelOption label); + + LineStateOption setEndLabel(Object endLabel); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelDataItemOption.java new file mode 100644 index 0000000..e9a4c5b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelDataItemOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.chart.parallel; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/parallel/ParallelSeries.ts#L56 + */ +public interface ParallelDataItemOption extends ParallelStateOption, StatesOptionMixin { + + ParallelDataItemOption setValue(Number[] value); + + ParallelDataItemOption setValue(Object[] value); + + ParallelDataItemOption setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelEmphasisOption.java new file mode 100644 index 0000000..7c1bbb6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.parallel; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/parallel/ParallelSeries.ts#L49 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface ParallelEmphasisOption extends DefaultStatesMixinEmpasis, ParallelStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelSeriesOption.java new file mode 100644 index 0000000..76b2d13 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelSeriesOption.java @@ -0,0 +1,39 @@ +package org.icepear.echarts.origin.chart.parallel; + +import org.icepear.echarts.origin.coord.parallel.ParallelAxisOption; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/parallel/ParallelSeries.ts#L60 + */ +public interface ParallelSeriesOption extends SeriesOption, ParallelStateOption, SeriesEncodeOptionMixin { + + ParallelSeriesOption setType(String type); + + ParallelSeriesOption setCoordinateSystem(String coordinateSystem); + + ParallelSeriesOption setParallelIndex(Number parallelIndex); + + ParallelSeriesOption setParallelId(String parallelId); + + ParallelSeriesOption setInactiveOpacity(Number inactiveOpacity); + + ParallelSeriesOption setActiveOpacity(Number activeOpacity); + + ParallelSeriesOption setSmooth(Boolean smooth); + + ParallelSeriesOption setSmooth(Number smooth); + + ParallelSeriesOption setRealtime(Boolean realtime); + + ParallelSeriesOption setTooltip(Object tooltip); + + ParallelSeriesOption setParallelAxisDefault(ParallelAxisOption parallelAxisDefault); + + ParallelSeriesOption setData(Object[][] data); + + ParallelSeriesOption setData(ParallelDataItemOption[] data); + + ParallelSeriesOption setEmphasis(ParallelEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelStateOption.java new file mode 100644 index 0000000..1b04f47 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/parallel/ParallelStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.parallel; + +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/parallel/ParallelSeries.ts#L51 + */ +public interface ParallelStateOption { + + ParallelStateOption setLineStyle(LineStyleOption lineStyle); + + ParallelStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieDataItemOption.java new file mode 100644 index 0000000..c30e6fc --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieDataItemOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.NumericOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L95 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L640 + */ +public interface PieDataItemOption extends NumericOptionDataItemObject, PieStateOption, StatesOptionMixin { + + PieDataItemOption setCursor(String cursor); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieEmphasisOption.java new file mode 100644 index 0000000..66f064d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieEmphasisOption.java @@ -0,0 +1,18 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L101 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L59 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L87 + */ +public interface PieEmphasisOption extends PieStateOption, EmphasisOption { + + PieEmphasisOption setFocus(String focus); + + PieEmphasisOption setScale(Boolean scale); + + PieEmphasisOption setScaleSize(Number scaleSize); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieItemStyleOption.java new file mode 100644 index 0000000..769c266 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieItemStyleOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L43 + */ +public interface PieItemStyleOption extends ItemStyleOption { + + PieItemStyleOption setBorderRadius(Number borderRadius); + + PieItemStyleOption setBorderRadius(Number[] borderRadius); + + PieItemStyleOption setBorderRadius(String borderRadius); + + PieItemStyleOption setBorderRadius(String[] borderRadius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelLineOption.java new file mode 100644 index 0000000..6911d3e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelLineOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.LabelLineOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L79 + */ +public interface PieLabelLineOption extends LabelLineOption { + + PieLabelLineOption setMaxSurfaceAngle(Number maxSurfaceAngle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelOption.java new file mode 100644 index 0000000..c0a6bef --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieLabelOption.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L59 + */ +public interface PieLabelOption extends SeriesLabelOption { + + PieLabelOption setRotate(Boolean rotate); + + PieLabelOption setRotate(Number rotate); + + PieLabelOption setRotate(String rotate); + + PieLabelOption setAlignTo(String alignTo); + + PieLabelOption setEdgeDistance(Number edgeDistance); + + PieLabelOption setEdgeDistance(String edgeDistance); + + PieLabelOption setMargin(Number margin); + + PieLabelOption setMargin(String margin); + + PieLabelOption setBleedMargin(Number bleedMargin); + + PieLabelOption setDistanceToLabelLine(Number distanceToLabelLine); + + PieLabelOption setPosition(Object position); + + PieLabelOption setPosition(String position); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieSeriesOption.java new file mode 100644 index 0000000..12d3e6c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieSeriesOption.java @@ -0,0 +1,49 @@ +package org.icepear.echarts.origin.chart.pie; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.CircleLayoutOptionMixin; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L100 + */ +public interface PieSeriesOption + extends SeriesOption, PieStateOption, CircleLayoutOptionMixin, BoxLayoutOptionMixin, SeriesEncodeOptionMixin { + + PieSeriesOption setType(String type); + + PieSeriesOption setRoseType(String roseType); + + PieSeriesOption setClockwise(Boolean clockwise); + + PieSeriesOption setStartAngle(Number startAngle); + + PieSeriesOption setMinAngle(Number minAngle); + + PieSeriesOption setMinShowLabelAngle(Number minShowLabelAngle); + + PieSeriesOption setSelectedOffset(Number selectedOffset); + + PieSeriesOption setAvoidLabelOverlap(Boolean avoidLabelOverlap); + + PieSeriesOption setPercentPrecision(Number percentPrecision); + + PieSeriesOption setStillShowZeroSum(Boolean stillShowZeroSum); + + PieSeriesOption setAnimationType(String animationType); + + PieSeriesOption setAnimationTypeUpdate(String animationTypeUpdate); + + PieSeriesOption setShowEmptyCircle(Boolean showEmptyCircle); + + PieSeriesOption setEmptyCircleStyle(PieItemStyleOption emptyCircleStyle); + + PieSeriesOption setData(Number[] data); + + PieSeriesOption setData(Number[][] data); + + PieSeriesOption setData(PieDataItemOption[] data); + + PieSeriesOption setEmphasis(PieEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieStateOption.java new file mode 100644 index 0000000..bce4e9d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/pie/PieStateOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.pie; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/chart/pie/PieSeries.ts#L59 + */ +public interface PieStateOption { + + PieStateOption setItemStyle(PieItemStyleOption itemStyle); + + PieStateOption setLabel(PieLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarDataItemOption.java new file mode 100644 index 0000000..e4ccde7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarDataItemOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.radar; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/radar/RadarSeries.ts#L56 + */ +public interface RadarDataItemOption + extends SymbolOptionMixin, RadarStateOption, StatesOptionMixin, RadarOptionDataItemObject { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarEmphasisOption.java new file mode 100644 index 0000000..d0de09c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.radar; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/radar/RadarSeries.ts#L48 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface RadarEmphasisOption extends DefaultStatesMixinEmpasis, RadarStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarOptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarOptionDataItemObject.java new file mode 100644 index 0000000..d6cb7fd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarOptionDataItemObject.java @@ -0,0 +1,22 @@ +package org.icepear.echarts.origin.chart.radar; + +import org.icepear.echarts.origin.util.OptionDataItemObject; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/radar/RadarSeries.ts#L59 + */ +public interface RadarOptionDataItemObject extends OptionDataItemObject { + + RadarOptionDataItemObject setValue(Number[] value); + + RadarOptionDataItemObject setValue(Number[][] value); + + RadarOptionDataItemObject setValue(Object[] value); + + RadarOptionDataItemObject setValue(Object[][] value); + + RadarOptionDataItemObject setValue(String[] value); + + RadarOptionDataItemObject setValue(String[][] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarSeriesOption.java new file mode 100644 index 0000000..352f9b3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarSeriesOption.java @@ -0,0 +1,29 @@ +package org.icepear.echarts.origin.chart.radar; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/radar/RadarSeries.ts#L62 + */ +public interface RadarSeriesOption extends SeriesOption, RadarStateOption, SymbolOptionMixin, SeriesEncodeOptionMixin { + + RadarSeriesOption setType(String type); + + RadarSeriesOption setCoordinateSystem(String coordinateSystem); + + RadarSeriesOption setRadarIndex(Number radarIndex); + + RadarSeriesOption setRadarId(String radarId); + + RadarSeriesOption setData(Number[][] data); + + RadarSeriesOption setData(Object[][] data); + + RadarSeriesOption setData(RadarDataItemOption[] data); + + RadarSeriesOption setData(String[][] data); + + RadarSeriesOption setEmphasis(RadarEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarStateOption.java new file mode 100644 index 0000000..17144ed --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/radar/RadarStateOption.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.origin.chart.radar; + +import org.icepear.echarts.origin.util.AreaStyleOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/radar/RadarSeries.ts#L50 + */ +public interface RadarStateOption { + + RadarStateOption setLineStyle(LineStyleOption lineStyle); + + RadarStateOption setAreaStyle(AreaStyleOption areaStyle); + + RadarStateOption setLabel(SeriesLabelOption label); + + RadarStateOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyBothStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyBothStateOption.java new file mode 100644 index 0000000..15b9ecd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyBothStateOption.java @@ -0,0 +1,8 @@ +package org.icepear.echarts.origin.chart.sankey; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L56 + */ +public interface SankeyBothStateOption extends SankeyNodeStateOption, SankeyEdgeStateOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeItemOption.java new file mode 100644 index 0000000..11d8ac9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeItemOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.NumericGraphEdgeItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L83 + */ +public interface SankeyEdgeItemOption extends SankeyEdgeStateOption, StatesOptionMixin, NumericGraphEdgeItemObject { + + SankeyEdgeItemOption setFocusNodeAdjacency(Boolean focusNodeAdjacency); + + SankeyEdgeItemOption setFocusNodeAdjacency(String focusNodeAdjacency); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStateOption.java new file mode 100644 index 0000000..ff7b2fa --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStateOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.chart.sankey; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L52 + */ +public interface SankeyEdgeStateOption { + + SankeyEdgeStateOption setLineStyle(SankeyEdgeStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStyleOption.java new file mode 100644 index 0000000..a999f21 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEdgeStyleOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L58 + */ +public interface SankeyEdgeStyleOption extends LineStyleOption { + + SankeyEdgeStyleOption setCurveness(Number curveness); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEmphasisOption.java new file mode 100644 index 0000000..6223058 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L63 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface SankeyEmphasisOption extends SankeyBothStateOption, EmphasisOption { + + SankeyEmphasisOption setFocus(String focus); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyLevelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyLevelOption.java new file mode 100644 index 0000000..b899325 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyLevelOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.chart.sankey; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L90 + */ +public interface SankeyLevelOption extends SankeyNodeStateOption, SankeyEdgeStateOption { + + SankeyLevelOption setDepth(Number depth); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeItemOption.java new file mode 100644 index 0000000..6915234 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeItemOption.java @@ -0,0 +1,24 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.DefaultOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L68 + */ +public interface SankeyNodeItemOption extends SankeyNodeStateOption, StatesOptionMixin, DefaultOptionDataItemObject { + + SankeyNodeItemOption setId(String id); + + SankeyNodeItemOption setLocalX(Number localX); + + SankeyNodeItemOption setLocalY(Number localY); + + SankeyNodeItemOption setDepth(Number depth); + + SankeyNodeItemOption setDraggable(Boolean draggable); + + SankeyNodeItemOption setFocusNodeAdjacency(Boolean focusNodeAdjacency); + + SankeyNodeItemOption setFocusNodeAdjacency(String focusNodeAdjacency); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeStateOption.java new file mode 100644 index 0000000..2347773 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeyNodeStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L47 + */ +public interface SankeyNodeStateOption { + + SankeyNodeStateOption setLabel(SeriesLabelOption label); + + SankeyNodeStateOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeySeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeySeriesOption.java new file mode 100644 index 0000000..661a41c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sankey/SankeySeriesOption.java @@ -0,0 +1,42 @@ +package org.icepear.echarts.origin.chart.sankey; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sankey/SankeySeries.ts#L94 + */ +public interface SankeySeriesOption extends SeriesOption, SankeyBothStateOption, BoxLayoutOptionMixin { + + SankeySeriesOption setType(String type); + + SankeySeriesOption setColor(String[] color); + + SankeySeriesOption setCoordinateSystem(String coordinateSystem); + + SankeySeriesOption setOrient(String orient); + + SankeySeriesOption setNodeWidth(Number nodeWidth); + + SankeySeriesOption setNodeGap(Number nodeGap); + + SankeySeriesOption setDraggable(Boolean draggable); + + SankeySeriesOption setFocusNodeAdjacency(Boolean focusNodeAdjacency); + + SankeySeriesOption setFocusNodeAdjacency(String focusNodeAdjacency); + + SankeySeriesOption setLayoutIterations(Number layoutIterations); + + SankeySeriesOption setData(SankeyNodeItemOption[] data); + + SankeySeriesOption setNodes(SankeyNodeItemOption[] nodes); + + SankeySeriesOption setEdges(SankeyEdgeItemOption[] edges); + + SankeySeriesOption setLinks(SankeyEdgeItemOption[] links); + + SankeySeriesOption setLevels(SankeyLevelOption[] levels); + + SankeySeriesOption setEmphasis(SankeyEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterDataItemOption.java new file mode 100644 index 0000000..35ee224 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterDataItemOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.scatter; + +import org.icepear.echarts.origin.util.DefaultOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/scatter/ScatterSeries.ts#L57 + */ +public interface ScatterDataItemOption + extends SymbolOptionMixin, ScatterStateOption, StatesOptionMixin, DefaultOptionDataItemObject { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterEmphasisOption.java new file mode 100644 index 0000000..d44eb43 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterEmphasisOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.scatter; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/scatter/ScatterSeries.ts#L51 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface ScatterEmphasisOption extends ScatterStateOption, EmphasisOption { + + ScatterEmphasisOption setFocus(String focus); + + ScatterEmphasisOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterSeriesOption.java new file mode 100644 index 0000000..1a480f0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterSeriesOption.java @@ -0,0 +1,44 @@ +package org.icepear.echarts.origin.chart.scatter; + +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; +import org.icepear.echarts.origin.util.SeriesLargeOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCalendarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnCartesianOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnGeoOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnPolarOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnSingleOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; +import org.icepear.echarts.origin.util.SeriesStackOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/scatter/ScatterSeries.ts#L62 + */ +public interface ScatterSeriesOption extends SeriesOption, ScatterStateOption, SeriesOnCartesianOptionMixin, + SeriesOnPolarOptionMixin, SeriesOnCalendarOptionMixin, SeriesOnGeoOptionMixin, SeriesOnSingleOptionMixin, + SeriesLargeOptionMixin, SeriesStackOptionMixin, SymbolOptionMixin, SeriesEncodeOptionMixin { + + ScatterSeriesOption setType(String type); + + ScatterSeriesOption setCoordinateSystem(String coordinateSystem); + + ScatterSeriesOption setCursor(String cursor); + + ScatterSeriesOption setClip(Boolean clip); + + ScatterSeriesOption setData(Number[] data); + + ScatterSeriesOption setData(Number[][] data); + + ScatterSeriesOption setData(Object[] data); + + ScatterSeriesOption setData(Object[][] data); + + ScatterSeriesOption setData(ScatterDataItemOption[] data); + + ScatterSeriesOption setData(String[] data); + + ScatterSeriesOption setData(String[][] data); + + ScatterSeriesOption setEmphasis(ScatterEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterStateOption.java new file mode 100644 index 0000000..5dd7afe --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/scatter/ScatterStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.scatter; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/chart/scatter/ScatterSeries.ts#L45 + */ +public interface ScatterStateOption { + + ScatterStateOption setItemStyle(ItemStyleOption itemStyle); + + ScatterStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstEmphasisOption.java new file mode 100644 index 0000000..13796ce --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L69 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface SunburstEmphasisOption extends SunburstStateOption, EmphasisOption { + + SunburstEmphasisOption setFocus(String focus); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstItemStyleOption.java new file mode 100644 index 0000000..194a0d4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstItemStyleOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L41 + */ +public interface SunburstItemStyleOption extends ItemStyleOption { + + SunburstItemStyleOption setBorderRadius(Number borderRadius); + + SunburstItemStyleOption setBorderRadius(Number[] borderRadius); + + SunburstItemStyleOption setBorderRadius(String borderRadius); + + SunburstItemStyleOption setBorderRadius(String[] borderRadius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLabelOption.java new file mode 100644 index 0000000..465d330 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLabelOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L53 + */ +public interface SunburstLabelOption extends SeriesLabelOption { + + SunburstLabelOption setRotate(Number rotate); + + SunburstLabelOption setRotate(String rotate); + + SunburstLabelOption setMinAngle(Number minAngle); + + SunburstLabelOption setSilent(Boolean silent); + + SunburstLabelOption setPosition(String position); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLevelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLevelOption.java new file mode 100644 index 0000000..dfa7733 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstLevelOption.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L95 + */ +public interface SunburstLevelOption extends SunburstStateOption, StatesOptionMixin { + + SunburstLevelOption setRadius(Number[] radius); + + SunburstLevelOption setRadius(String[] radius); + + SunburstLevelOption setR(Number r); + + SunburstLevelOption setR(String r); + + SunburstLevelOption setR0(Number r0); + + SunburstLevelOption setR0(String r0); + + SunburstLevelOption setHighlight(Object highlight); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstNodeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstNodeItemOption.java new file mode 100644 index 0000000..cbe66e1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstNodeItemOption.java @@ -0,0 +1,22 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.DefaultOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L79 + */ +public interface SunburstNodeItemOption extends SunburstStateOption, StatesOptionMixin, DefaultOptionDataItemObject { + + SunburstNodeItemOption setNodeClick(String nodeClick); + + SunburstNodeItemOption setLink(String link); + + SunburstNodeItemOption setTarget(String target); + + SunburstNodeItemOption setChildren(SunburstNodeItemOption[] children); + + SunburstNodeItemOption setCollapsed(Boolean collapsed); + + SunburstNodeItemOption setCursor(String cursor); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstSeriesOption.java new file mode 100644 index 0000000..25a9e00 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstSeriesOption.java @@ -0,0 +1,35 @@ +package org.icepear.echarts.origin.chart.sunburst; + +import org.icepear.echarts.origin.util.CircleLayoutOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L120 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L860 + */ +public interface SunburstSeriesOption extends SeriesOption, SunburstStateOption, CircleLayoutOptionMixin { + + SunburstSeriesOption setType(String type); + + SunburstSeriesOption setClockwise(Boolean clockwise); + + SunburstSeriesOption setStartAngle(Number startAngle); + + SunburstSeriesOption setMinAngle(Number minAngle); + + SunburstSeriesOption setStillShowZeroSum(Boolean stillShowZeroSum); + + SunburstSeriesOption setNodeClick(String nodeClick); + + SunburstSeriesOption setRenderLabelForZeroData(Boolean renderLabelForZeroData); + + SunburstSeriesOption setLevels(SunburstLevelOption[] levels); + + SunburstSeriesOption setAnimationType(String animationType); + + SunburstSeriesOption setSort(String sort); + + SunburstSeriesOption setData(SunburstNodeItemOption[] data); + + SunburstSeriesOption setEmphasis(SunburstEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstStateOption.java new file mode 100644 index 0000000..432bc63 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/sunburst/SunburstStateOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.sunburst; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/sunburst/SunburstSeries.ts#L74 + */ +public interface SunburstStateOption { + + SunburstStateOption setItemStyle(SunburstItemStyleOption itemStyle); + + SunburstStateOption setLabel(SunburstLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverEmphasisOption.java new file mode 100644 index 0000000..096f46f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.themeRiver; + +import org.icepear.echarts.origin.util.DefaultStatesMixinEmpasis; +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/themeRiver/ThemeRiverSeries.ts#L54 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface ThemeRiverEmphasisOption extends DefaultStatesMixinEmpasis, ThemeRiverStateOption, EmphasisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverLabelOption.java new file mode 100644 index 0000000..6130e28 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverLabelOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.chart.themeRiver; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/themeRiver/ThemeRiverSeries.ts#L47 + */ +public interface ThemeRiverLabelOption extends SeriesLabelOption { + + ThemeRiverLabelOption setMargin(Number margin); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverSeriesOption.java new file mode 100644 index 0000000..55e6ab5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverSeriesOption.java @@ -0,0 +1,26 @@ +package org.icepear.echarts.origin.chart.themeRiver; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.SeriesOnSingleOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/themeRiver/ThemeRiverSeries.ts#L61 + */ +public interface ThemeRiverSeriesOption + extends SeriesOption, ThemeRiverStateOption, SeriesOnSingleOptionMixin, BoxLayoutOptionMixin { + + ThemeRiverSeriesOption setType(String type); + + ThemeRiverSeriesOption setColor(String[] color); + + ThemeRiverSeriesOption setCoordinateSystem(String coordinateSystem); + + ThemeRiverSeriesOption setBoundaryGap(Number[] boundaryGap); + + ThemeRiverSeriesOption setBoundaryGap(String[] boundaryGap); + + ThemeRiverSeriesOption setData(Object[][] data); + + ThemeRiverSeriesOption setEmphasis(ThemeRiverEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverStateOption.java new file mode 100644 index 0000000..6773f98 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/themeRiver/ThemeRiverStateOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.themeRiver; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/themeRiver/ThemeRiverSeries.ts#L56 + */ +public interface ThemeRiverStateOption { + + ThemeRiverStateOption setLabel(ThemeRiverLabelOption label); + + ThemeRiverStateOption setItemStyle(ItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeEmphasisOption.java new file mode 100644 index 0000000..968fca0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeEmphasisOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.chart.tree; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/tree/TreeSeries.ts#L57 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface TreeEmphasisOption extends TreeStateOption, EmphasisOption { + + TreeEmphasisOption setFocus(String focus); + + TreeEmphasisOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeLeavesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeLeavesOption.java new file mode 100644 index 0000000..25d4c10 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeLeavesOption.java @@ -0,0 +1,10 @@ +package org.icepear.echarts.origin.chart.tree; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/tree/TreeSeries.ts#L79 + */ +public interface TreeLeavesOption extends TreeStateOption, StatesOptionMixin { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeNodeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeNodeItemOption.java new file mode 100644 index 0000000..e49cd95 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeNodeItemOption.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.origin.chart.tree; + +import org.icepear.echarts.origin.util.DefaultOptionDataItemObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/tree/TreeSeries.ts#L63 + */ +public interface TreeNodeItemOption + extends SymbolOptionMixin, TreeStateOption, StatesOptionMixin, DefaultOptionDataItemObject { + + TreeNodeItemOption setChildren(TreeNodeItemOption[] children); + + TreeNodeItemOption setCollapsed(Boolean collapsed); + + TreeNodeItemOption setLink(String link); + + TreeNodeItemOption setTarget(String target); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeSeriesOption.java new file mode 100644 index 0000000..896e15d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeSeriesOption.java @@ -0,0 +1,37 @@ +package org.icepear.echarts.origin.chart.tree; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.RoamOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/tree/TreeSeries.ts#L83 + */ +public interface TreeSeriesOption + extends SeriesOption, TreeStateOption, SymbolOptionMixin, BoxLayoutOptionMixin, RoamOptionMixin { + + TreeSeriesOption setType(String type); + + TreeSeriesOption setLayout(String layout); + + TreeSeriesOption setEdgeShape(String edgeShape); + + TreeSeriesOption setEdgeForkPosition(Number edgeForkPosition); + + TreeSeriesOption setEdgeForkPosition(String edgeForkPosition); + + TreeSeriesOption setNodeScaleRatio(Number nodeScaleRatio); + + TreeSeriesOption setOrient(String orient); + + TreeSeriesOption setExpandAndCollapse(Boolean expandAndCollapse); + + TreeSeriesOption setInitialTreeDepth(Number initialTreeDepth); + + TreeSeriesOption setLeaves(TreeLeavesOption leaves); + + TreeSeriesOption setData(TreeNodeItemOption[] data); + + TreeSeriesOption setEmphasis(TreeEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeStateOption.java new file mode 100644 index 0000000..a1ff847 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/tree/TreeStateOption.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.chart.tree; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/tree/TreeSeries.ts#L47 + */ +public interface TreeStateOption { + + TreeStateOption setItemStyle(ItemStyleOption itemStyle); + + TreeStateOption setLineStyle(Object lineStyle); + + TreeStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbEmphasisItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbEmphasisItemStyleOption.java new file mode 100644 index 0000000..0ee93a5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbEmphasisItemStyleOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.chart.treemap; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L205 + */ +public interface BreadcrumbEmphasisItemStyleOption { + + BreadcrumbEmphasisItemStyleOption setItemStyle(BreadcrumbItemStyleOption itemStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbItemStyleOption.java new file mode 100644 index 0000000..3d1cae6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbItemStyleOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L51 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1090 + */ +public interface BreadcrumbItemStyleOption extends ItemStyleOption { + + BreadcrumbItemStyleOption setTextStyle(LabelOption textStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbOption.java new file mode 100644 index 0000000..648f726 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/BreadcrumbOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L198 + */ +public interface BreadcrumbOption extends BoxLayoutOptionMixin { + + BreadcrumbOption setShow(Boolean show); + + BreadcrumbOption setHeight(Number height); + + BreadcrumbOption setEmptyItemWidth(Number emptyItemWidth); + + BreadcrumbOption setItemStyle(BreadcrumbItemStyleOption itemStyle); + + BreadcrumbOption setEmphasis(BreadcrumbEmphasisItemStyleOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapEmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapEmphasisOption.java new file mode 100644 index 0000000..5b83ea9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapEmphasisOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.EmphasisOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L87 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface TreemapEmphasisOption extends TreemapStateOption, EmphasisOption { + + TreemapEmphasisOption setFocus(String focus); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesItemStyleOption.java new file mode 100644 index 0000000..bafb8d4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesItemStyleOption.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L61 + */ +public interface TreemapSeriesItemStyleOption extends ItemStyleOption { + + TreemapSeriesItemStyleOption setBorderRadius(Number borderRadius); + + TreemapSeriesItemStyleOption setBorderRadius(Number[] borderRadius); + + TreemapSeriesItemStyleOption setColorAlpha(Number colorAlpha); + + TreemapSeriesItemStyleOption setColorSaturation(Number colorSaturation); + + TreemapSeriesItemStyleOption setBorderColorSaturation(Number borderColorSaturation); + + TreemapSeriesItemStyleOption setGapWidth(Number gapWidth); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLabelOption.java new file mode 100644 index 0000000..e9fa35e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLabelOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L56 + */ +public interface TreemapSeriesLabelOption extends SeriesLabelOption { + + TreemapSeriesLabelOption setEllipsis(Boolean ellipsis); + + TreemapSeriesLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLevelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLevelOption.java new file mode 100644 index 0000000..533a0c6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesLevelOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.DecalObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L129 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L69 + */ +public interface TreemapSeriesLevelOption extends TreemapSeriesVisualOption, TreemapStateOption, StatesOptionMixin { + + TreemapSeriesLevelOption setColor(String color); + + TreemapSeriesLevelOption setColor(String[] color); + + TreemapSeriesLevelOption setDecal(DecalObject[] decal); + + TreemapSeriesLevelOption setDecal(String decal); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesNodeItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesNodeItemOption.java new file mode 100644 index 0000000..f8d2260 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesNodeItemOption.java @@ -0,0 +1,34 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.DecalObject; +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L136 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L624 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L625 + */ +public interface TreemapSeriesNodeItemOption extends TreemapSeriesVisualOption, TreemapStateOption, StatesOptionMixin { + + TreemapSeriesNodeItemOption setId(Number id); + + TreemapSeriesNodeItemOption setId(String id); + + TreemapSeriesNodeItemOption setName(Number name); + + TreemapSeriesNodeItemOption setName(String name); + + TreemapSeriesNodeItemOption setValue(Number value); + + TreemapSeriesNodeItemOption setValue(Number[] value); + + TreemapSeriesNodeItemOption setChildren(TreemapSeriesNodeItemOption[] children); + + TreemapSeriesNodeItemOption setColor(String color); + + TreemapSeriesNodeItemOption setColor(String[] color); + + TreemapSeriesNodeItemOption setDecal(DecalObject[] decal); + + TreemapSeriesNodeItemOption setDecal(String decal); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesOption.java new file mode 100644 index 0000000..c21cb9b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesOption.java @@ -0,0 +1,42 @@ +package org.icepear.echarts.origin.chart.treemap; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.RoamOptionMixin; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L150 + */ +public interface TreemapSeriesOption + extends SeriesOption, TreemapStateOption, BoxLayoutOptionMixin, RoamOptionMixin, TreemapSeriesVisualOption { + + TreemapSeriesOption setType(String type); + + TreemapSeriesOption setSize(Number[] size); + + TreemapSeriesOption setSize(String[] size); + + TreemapSeriesOption setSort(Boolean sort); + + TreemapSeriesOption setSort(String sort); + + TreemapSeriesOption setClipWindow(String clipWindow); + + TreemapSeriesOption setSquareRatio(Number squareRatio); + + TreemapSeriesOption setLeafDepth(Number leafDepth); + + TreemapSeriesOption setDrillDownIcon(String drillDownIcon); + + TreemapSeriesOption setZoomToNodeRatio(Number zoomToNodeRatio); + + TreemapSeriesOption setNodeClick(String nodeClick); + + TreemapSeriesOption setBreadcrumb(BreadcrumbOption breadcrumb); + + TreemapSeriesOption setLevels(TreemapSeriesLevelOption[] levels); + + TreemapSeriesOption setData(TreemapSeriesNodeItemOption[] data); + + TreemapSeriesOption setEmphasis(TreemapEmphasisOption emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesVisualOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesVisualOption.java new file mode 100644 index 0000000..fab555d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapSeriesVisualOption.java @@ -0,0 +1,29 @@ +package org.icepear.echarts.origin.chart.treemap; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L99 + */ +public interface TreemapSeriesVisualOption { + + TreemapSeriesVisualOption setVisualDimension(Number visualDimension); + + TreemapSeriesVisualOption setVisualDimension(String visualDimension); + + TreemapSeriesVisualOption setColorMappingBy(String colorMappingBy); + + TreemapSeriesVisualOption setVisualMin(Number visualMin); + + TreemapSeriesVisualOption setVisualMax(Number visualMax); + + TreemapSeriesVisualOption setColorAlpha(Number[] colorAlpha); + + TreemapSeriesVisualOption setColorAlpha(String colorAlpha); + + TreemapSeriesVisualOption setColorSaturation(Number[] colorSaturation); + + TreemapSeriesVisualOption setColorSaturation(String colorSaturation); + + TreemapSeriesVisualOption setVisibleMin(Number visibleMin); + + TreemapSeriesVisualOption setChildrenVisibleMin(Number childrenVisibleMin); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapStateOption.java new file mode 100644 index 0000000..e8073a4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/chart/treemap/TreemapStateOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.chart.treemap; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/chart/treemap/TreemapSeries.ts#L93 + */ +public interface TreemapStateOption { + + TreemapStateOption setItemStyle(TreemapSeriesItemStyleOption itemStyle); + + TreemapStateOption setLabel(TreemapSeriesLabelOption label); + + TreemapStateOption setUpperLabel(TreemapSeriesLabelOption upperLabel); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/axisPointer/AxisPointerOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/axisPointer/AxisPointerOption.java new file mode 100644 index 0000000..6d6acd0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/axisPointer/AxisPointerOption.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.component.axisPointer; + +import org.icepear.echarts.origin.util.CommonAxisPointerOption; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/axisPointer/AxisPointerModel.ts#L61 + */ +public interface AxisPointerOption extends ComponentOption, CommonAxisPointerOption { + + AxisPointerOption setMainType(String mainType); + + AxisPointerOption setType(String type); + + AxisPointerOption setLink(Object[] link); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataZoom/DataZoomOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataZoom/DataZoomOption.java new file mode 100644 index 0000000..5bd232e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataZoom/DataZoomOption.java @@ -0,0 +1,90 @@ +package org.icepear.echarts.origin.component.dataZoom; + +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/4569dc1d8b712dafb80b16e31c4fed0118e3acbd/src/component/dataZoom/DataZoomModel.ts#L38 + */ +public interface DataZoomOption extends ComponentOption { + + DataZoomOption setMainType(String mainType); + + DataZoomOption setOrient(String orient); + + DataZoomOption setXAxisIndex(Number xAxisIndex); + + DataZoomOption setXAxisIndex(Number[] xAxisIndex); + + DataZoomOption setXAxisId(String xAxisId); + + DataZoomOption setXAxisId(String[] xAxisId); + + DataZoomOption setYAxisIndex(Number yAxisIndex); + + DataZoomOption setYAxisIndex(Number[] yAxisIndex); + + DataZoomOption setYAxisId(String yAxisId); + + DataZoomOption setYAxisId(String[] yAxisId); + + DataZoomOption setRadiusAxisIndex(Number radiusAxisIndex); + + DataZoomOption setRadiusAxisIndex(Number[] radiusAxisIndex); + + DataZoomOption setRadiusAxisId(String radiusAxisId); + + DataZoomOption setRadiusAxisId(String[] radiusAxisId); + + DataZoomOption setAngleAxisIndex(Number angleAxisIndex); + + DataZoomOption setAngleAxisIndex(Number[] angleAxisIndex); + + DataZoomOption setAngleAxisId(String angleAxisId); + + DataZoomOption setAngleAxisId(String[] angleAxisId); + + DataZoomOption setSingleAxisIndex(Number singleAxisIndex); + + DataZoomOption setSingleAxisIndex(Number[] singleAxisIndex); + + DataZoomOption setSingleAxisId(String singleAxisId); + + DataZoomOption setSingleAxisId(String[] singleAxisId); + + DataZoomOption setFilterMode(String filterMode); + + DataZoomOption setThrottle(Number throttle); + + DataZoomOption setThrottle(Object throttle); + + DataZoomOption setStart(Number start); + + DataZoomOption setEnd(Number end); + + DataZoomOption setStartValue(Number startValue); + + DataZoomOption setStartValue(Object startValue); + + DataZoomOption setStartValue(String startValue); + + DataZoomOption setEndValue(Number endValue); + + DataZoomOption setEndValue(Object endValue); + + DataZoomOption setEndValue(String endValue); + + DataZoomOption setMinSpan(Number minSpan); + + DataZoomOption setMaxSpan(Number maxSpan); + + DataZoomOption setMinValueSpan(Number minValueSpan); + + DataZoomOption setMaxValueSpan(Number maxValueSpan); + + DataZoomOption setRangeMode(String[] rangeMode); + + DataZoomOption setRealtime(Boolean realtime); + + DataZoomOption setTextStyle(LabelOption textStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataset/DatasetOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataset/DatasetOption.java new file mode 100644 index 0000000..1e1c274 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/dataset/DatasetOption.java @@ -0,0 +1,57 @@ +package org.icepear.echarts.origin.component.dataset; + +import java.util.Map; + +import org.icepear.echarts.origin.data.helper.DataTransformOption; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.OptionDataItemObject; +import org.icepear.echarts.origin.util.SeriesEncodeOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/dataset/install.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L583 + */ +public interface DatasetOption extends ComponentOption, SeriesEncodeOptionMixin { + + DatasetOption setMainType(String mainType); + + DatasetOption setSeriesLayoutBy(Object seriesLayoutBy); + + DatasetOption setSourceHeader(Object sourceHeader); + + DatasetOption setSource(Map[] source); + + DatasetOption setSource(Map source); + + DatasetOption setSource(Number[] source); + + DatasetOption setSource(Number[][] source); + + DatasetOption setSource(Number[][][] source); + + DatasetOption setSource(Object source); + + DatasetOption setSource(Object[] source); + + DatasetOption setSource(Object[][] source); + + DatasetOption setSource(Object[][][] source); + + DatasetOption setSource(OptionDataItemObject[] source); + + DatasetOption setSource(String[] source); + + DatasetOption setSource(String[][] source); + + DatasetOption setSource(String[][][] source); + + DatasetOption setFromDatasetIndex(Number fromDatasetIndex); + + DatasetOption setFromDatasetId(String fromDatasetId); + + DatasetOption setTransform(DataTransformOption transform); + + DatasetOption setTransform(DataTransformOption[] transform); + + DatasetOption setFromTransformResult(Number fromTransformResult); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendOption.java new file mode 100644 index 0000000..ddacf77 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendOption.java @@ -0,0 +1,64 @@ +package org.icepear.echarts.origin.component.legend; + +import java.util.Map; + +import org.icepear.echarts.origin.util.BorderOptionMixin; +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/legend/LegendModel.ts#L159 + */ +public interface LegendOption extends ComponentOption, LegendStyleOption, BoxLayoutOptionMixin, BorderOptionMixin { + + LegendOption setMainType(String mainType); + + LegendOption setShow(Boolean show); + + LegendOption setOrient(String orient); + + LegendOption setAlign(String align); + + LegendOption setBackgroundColor(String backgroundColor); + + LegendOption setBorderRadius(Number borderRadius); + + LegendOption setBorderRadius(Number[] borderRadius); + + LegendOption setPadding(Number padding); + + LegendOption setPadding(Number[] padding); + + LegendOption setItemGap(Number itemGap); + + LegendOption setItemWidth(Number itemWidth); + + LegendOption setItemHeight(Number itemHeight); + + LegendOption setSelectedMode(Boolean selectedMode); + + LegendOption setSelectedMode(String selectedMode); + + LegendOption setSelected(Map selected); + + LegendOption setSelector(Boolean selector); + + LegendOption setSelector(Object[] selector); + + LegendOption setSelectorLabel(LabelOption selectorLabel); + + LegendOption setEmphasis(Object emphasis); + + LegendOption setSelectorPosition(String selectorPosition); + + LegendOption setSelectorItemGap(Number selectorItemGap); + + LegendOption setSelectorButtonGap(Number selectorButtonGap); + + LegendOption setData(Object[] data); + + LegendOption setData(String[] data); + + LegendOption setTooltip(Object tooltip); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendStyleOption.java new file mode 100644 index 0000000..f03cd47 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/legend/LegendStyleOption.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.origin.component.legend; + +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/legend/LegendModel.ts#L86 + */ +public interface LegendStyleOption { + + LegendStyleOption setIcon(String icon); + + LegendStyleOption setInactiveColor(String inactiveColor); + + LegendStyleOption setInactiveBorderColor(String inactiveBorderColor); + + LegendStyleOption setInactiveBorderWidth(Number inactiveBorderWidth); + + LegendStyleOption setInactiveBorderWidth(String inactiveBorderWidth); + + LegendStyleOption setFormatter(String formatter); + + LegendStyleOption setItemStyle(Object itemStyle); + + LegendStyleOption setLineStyle(Object lineStyle); + + LegendStyleOption setTextStyle(LabelOption textStyle); + + LegendStyleOption setSymbolRotate(Number symbolRotate); + + LegendStyleOption setSymbolRotate(String symbolRotate); + + LegendStyleOption setSymbolKeepAspect(Boolean symbolKeepAspect); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea1DDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea1DDataItemOption.java new file mode 100644 index 0000000..01bc0b0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea1DDataItemOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L36 + */ +public interface MarkArea1DDataItemOption extends MarkAreaDataItemOptionBase, MarkAreaDataItemOption { + + MarkArea1DDataItemOption setXAxis(Number xAxis); + + MarkArea1DDataItemOption setYAxis(Number yAxis); + + MarkArea1DDataItemOption setType(Object type); + + MarkArea1DDataItemOption setValueIndex(Number valueIndex); + + MarkArea1DDataItemOption setValueDim(String valueDim); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemDimOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemDimOption.java new file mode 100644 index 0000000..70de597 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemDimOption.java @@ -0,0 +1,8 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L48 + */ +public interface MarkArea2DDataItemDimOption extends MarkAreaDataItemOptionBase, MarkerPositionOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemOption.java new file mode 100644 index 0000000..c132131 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkArea2DDataItemOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L52 + */ +public interface MarkArea2DDataItemOption extends MarkAreaDataItemOption { + + MarkArea2DDataItemOption setStartPoint(MarkArea2DDataItemDimOption startPoint); + + MarkArea2DDataItemOption setEndPoint(MarkArea2DDataItemDimOption endPoint); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOption.java new file mode 100644 index 0000000..0ec9c6a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOption.java @@ -0,0 +1,8 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L65 + */ +public interface MarkAreaDataItemOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOptionBase.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOptionBase.java new file mode 100644 index 0000000..d24d44b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaDataItemOptionBase.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L30 + */ +public interface MarkAreaDataItemOptionBase extends MarkAreaStateOption, StatesOptionMixin { + + MarkAreaDataItemOptionBase setName(String name); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaOption.java new file mode 100644 index 0000000..7d5b8c7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L59 + */ +public interface MarkAreaOption extends MarkerOption, MarkAreaStateOption, StatesOptionMixin { + + MarkAreaOption setMainType(String mainType); + + MarkAreaOption setPrecision(Number precision); + + MarkAreaOption setData(MarkAreaDataItemOption[] data); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaStateOption.java new file mode 100644 index 0000000..afdd6d6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkAreaStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkAreaModel.ts#L25 + */ +public interface MarkAreaStateOption { + + MarkAreaStateOption setItemStyle(ItemStyleOption itemStyle); + + MarkAreaStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine1DDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine1DDataItemOption.java new file mode 100644 index 0000000..e724e4d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine1DDataItemOption.java @@ -0,0 +1,41 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L45 + */ +public interface MarkLine1DDataItemOption extends MarkLineDataItemOptionBase, MarkLineDataItemOption { + + MarkLine1DDataItemOption setXAxis(Number xAxis); + + MarkLine1DDataItemOption setXAxis(String xAxis); + + MarkLine1DDataItemOption setYAxis(Number yAxis); + + MarkLine1DDataItemOption setYAxis(String yAxis); + + MarkLine1DDataItemOption setType(Object type); + + MarkLine1DDataItemOption setValueIndex(Number valueIndex); + + MarkLine1DDataItemOption setValueDim(String valueDim); + + MarkLine1DDataItemOption setSymbol(String symbol); + + MarkLine1DDataItemOption setSymbol(String[] symbol); + + MarkLine1DDataItemOption setSymbolSize(Number symbolSize); + + MarkLine1DDataItemOption setSymbolSize(Number[] symbolSize); + + MarkLine1DDataItemOption setSymbolRotate(Number symbolRotate); + + MarkLine1DDataItemOption setSymbolRotate(Number[] symbolRotate); + + MarkLine1DDataItemOption setSymbolOffset(Number symbolOffset); + + MarkLine1DDataItemOption setSymbolOffset(Number[] symbolOffset); + + MarkLine1DDataItemOption setSymbolOffset(String symbolOffset); + + MarkLine1DDataItemOption setSymbolOffset(String[] symbolOffset); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemDimOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemDimOption.java new file mode 100644 index 0000000..ea22a09 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemDimOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L70 + */ +public interface MarkLine2DDataItemDimOption + extends MarkLineDataItemOptionBase, SymbolOptionMixin, MarkerPositionOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemOption.java new file mode 100644 index 0000000..5300c72 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLine2DDataItemOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L76 + */ +public interface MarkLine2DDataItemOption extends MarkLineDataItemOption { + + MarkLine2DDataItemOption setStartPoint(MarkLine2DDataItemDimOption startPoint); + + MarkLine2DDataItemOption setEndPoint(MarkLine2DDataItemDimOption endPoint); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOption.java new file mode 100644 index 0000000..8c008c6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOption.java @@ -0,0 +1,8 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L98 + */ +public interface MarkLineDataItemOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOptionBase.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOptionBase.java new file mode 100644 index 0000000..7d98148 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineDataItemOptionBase.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L39 + */ +public interface MarkLineDataItemOptionBase extends MarkLineStateOption, StatesOptionMixin { + + MarkLineDataItemOptionBase setName(String name); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineOption.java new file mode 100644 index 0000000..24446d2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineOption.java @@ -0,0 +1,36 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L83 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L76 + */ +public interface MarkLineOption extends MarkerOption, MarkLineStateOption, StatesOptionMixin { + + MarkLineOption setMainType(String mainType); + + MarkLineOption setSymbol(String symbol); + + MarkLineOption setSymbol(String[] symbol); + + MarkLineOption setSymbolSize(Number symbolSize); + + MarkLineOption setSymbolSize(Number[] symbolSize); + + MarkLineOption setSymbolRotate(Number symbolRotate); + + MarkLineOption setSymbolRotate(Number[] symbolRotate); + + MarkLineOption setSymbolOffset(Number symbolOffset); + + MarkLineOption setSymbolOffset(Number[] symbolOffset); + + MarkLineOption setSymbolOffset(String symbolOffset); + + MarkLineOption setSymbolOffset(String[] symbolOffset); + + MarkLineOption setPrecision(Number precision); + + MarkLineOption setData(MarkLineDataItemOption[] data); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineStateOption.java new file mode 100644 index 0000000..c117ac3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkLineStateOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LineStyleOption; +import org.icepear.echarts.origin.util.SeriesLineLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkLineModel.ts#L31 + */ +public interface MarkLineStateOption { + + MarkLineStateOption setLineStyle(LineStyleOption lineStyle); + + MarkLineStateOption setItemStyle(ItemStyleOption itemStyle); + + MarkLineStateOption setLabel(SeriesLineLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointDataItemOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointDataItemOption.java new file mode 100644 index 0000000..87c5156 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointDataItemOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkPointModel.ts#L40 + */ +public interface MarkPointDataItemOption + extends MarkPointStateOption, StatesOptionMixin, SymbolOptionMixin, MarkerPositionOption { + + MarkPointDataItemOption setName(String name); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointOption.java new file mode 100644 index 0000000..f2621cb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointOption.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.StatesOptionMixin; +import org.icepear.echarts.origin.util.SymbolOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkPointModel.ts#L48 + */ +public interface MarkPointOption extends MarkerOption, SymbolOptionMixin, StatesOptionMixin, MarkPointStateOption { + + MarkPointOption setMainType(String mainType); + + MarkPointOption setPrecision(Number precision); + + MarkPointOption setData(MarkPointDataItemOption[] data); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointStateOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointStateOption.java new file mode 100644 index 0000000..11fa903 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkPointStateOption.java @@ -0,0 +1,14 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.SeriesLabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkPointModel.ts#L36 + */ +public interface MarkPointStateOption { + + MarkPointStateOption setItemStyle(ItemStyleOption itemStyle); + + MarkPointStateOption setLabel(SeriesLabelOption label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerOption.java new file mode 100644 index 0000000..263f7e5 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerOption.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.component.marker; + +import org.icepear.echarts.origin.util.AnimationOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkerModel.ts#L84 + */ +public interface MarkerOption extends ComponentOption, AnimationOptionMixin { + + MarkerOption setSilent(Boolean silent); + + MarkerOption setData(Object[] data); + + MarkerOption setTooltip(Object tooltip); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerPositionOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerPositionOption.java new file mode 100644 index 0000000..667db35 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/marker/MarkerPositionOption.java @@ -0,0 +1,35 @@ +package org.icepear.echarts.origin.component.marker; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/marker/MarkerModel.ts#L48 + */ +public interface MarkerPositionOption { + + MarkerPositionOption setX(Number x); + + MarkerPositionOption setX(String x); + + MarkerPositionOption setY(Number y); + + MarkerPositionOption setY(String y); + + MarkerPositionOption setCoord(Object[] coord); + + MarkerPositionOption setXAxis(Object xAxis); + + MarkerPositionOption setYAxis(Object yAxis); + + MarkerPositionOption setRadiusAxis(Object radiusAxis); + + MarkerPositionOption setAngleAxis(Object angleAxis); + + MarkerPositionOption setType(Object type); + + MarkerPositionOption setValueIndex(Number valueIndex); + + MarkerPositionOption setValueDim(String valueDim); + + MarkerPositionOption setValue(Number value); + + MarkerPositionOption setValue(String value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/title/TitleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/title/TitleOption.java new file mode 100644 index 0000000..1c4d1a2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/title/TitleOption.java @@ -0,0 +1,52 @@ +package org.icepear.echarts.origin.component.title; + +import org.icepear.echarts.origin.util.BorderOptionMixin; +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/title/install.ts#L42 + */ +public interface TitleOption extends ComponentOption, BoxLayoutOptionMixin, BorderOptionMixin { + + TitleOption setMainType(String mainType); + + TitleOption setShow(Boolean show); + + TitleOption setText(String text); + + TitleOption setLink(String link); + + TitleOption setTarget(String target); + + TitleOption setSubtext(String subtext); + + TitleOption setSublink(String sublink); + + TitleOption setSubtarget(String subtarget); + + TitleOption setTextAlign(String textAlign); + + TitleOption setTextVerticalAlign(String textVerticalAlign); + + TitleOption setTextBaseline(String textBaseline); + + TitleOption setBackgroundColor(String backgroundColor); + + TitleOption setPadding(Number padding); + + TitleOption setPadding(Number[] padding); + + TitleOption setItemGap(Number itemGap); + + TitleOption setTextStyle(LabelOption textStyle); + + TitleOption setSubtextStyle(LabelOption subtextStyle); + + TitleOption setTriggerEvent(Boolean triggerEvent); + + TitleOption setBorderRadius(Number borderRadius); + + TitleOption setBorderRadius(Number[] borderRadius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxFeatureOption.java new file mode 100644 index 0000000..d258039 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxFeatureOption.java @@ -0,0 +1,27 @@ +package org.icepear.echarts.origin.component.toolbox; + +import java.util.Map; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/featureManager.ts#L37 + */ +public interface ToolboxFeatureOption { + + ToolboxFeatureOption setShow(Boolean show); + + ToolboxFeatureOption setTitle(Map title); + + ToolboxFeatureOption setTitle(String title); + + ToolboxFeatureOption setIcon(Map icon); + + ToolboxFeatureOption setIcon(String icon); + + ToolboxFeatureOption setIconStyle(Object iconStyle); + + ToolboxFeatureOption setEmphasis(Object emphasis); + + ToolboxFeatureOption setIconStatus(Map iconStatus); + + ToolboxFeatureOption setOnclick(Object onclick); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxOption.java new file mode 100644 index 0000000..d867883 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/ToolboxOption.java @@ -0,0 +1,48 @@ +package org.icepear.echarts.origin.component.toolbox; + +import java.util.Map; + +import org.icepear.echarts.origin.util.BorderOptionMixin; +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.CommonTooltipOption; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.ItemStyleOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/ToolboxModel.ts#L42 + */ +public interface ToolboxOption extends ComponentOption, BoxLayoutOptionMixin, BorderOptionMixin { + + ToolboxOption setMainType(String mainType); + + ToolboxOption setShow(Boolean show); + + ToolboxOption setOrient(String orient); + + ToolboxOption setBackgroundColor(String backgroundColor); + + ToolboxOption setBorderRadius(Number borderRadius); + + ToolboxOption setBorderRadius(Number[] borderRadius); + + ToolboxOption setPadding(Number padding); + + ToolboxOption setPadding(Number[] padding); + + ToolboxOption setItemSize(Number itemSize); + + ToolboxOption setItemGap(Number itemGap); + + ToolboxOption setShowTitle(Boolean showTitle); + + ToolboxOption setIconStyle(ItemStyleOption iconStyle); + + ToolboxOption setEmphasis(Object emphasis); + + ToolboxOption setTextStyle(LabelOption textStyle); + + ToolboxOption setTooltip(CommonTooltipOption tooltip); + + ToolboxOption setFeature(Map feature); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxBrushFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxBrushFeatureOption.java new file mode 100644 index 0000000..5ac2d79 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxBrushFeatureOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/Brush.ts#L35 + */ +public interface ToolboxBrushFeatureOption extends ToolboxFeatureOption { + + ToolboxBrushFeatureOption setType(Object[] type); + + ToolboxBrushFeatureOption setIcon(String icon); + + ToolboxBrushFeatureOption setTitle(String title); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataViewFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataViewFeatureOption.java new file mode 100644 index 0000000..7b5178d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataViewFeatureOption.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/DataView.ts#L296 + */ +public interface ToolboxDataViewFeatureOption extends ToolboxFeatureOption { + + ToolboxDataViewFeatureOption setReadOnly(Boolean readOnly); + + ToolboxDataViewFeatureOption setOptionToContent(Object optionToContent); + + ToolboxDataViewFeatureOption setContentToOption(Object contentToOption); + + ToolboxDataViewFeatureOption setIcon(String icon); + + ToolboxDataViewFeatureOption setTitle(String title); + + ToolboxDataViewFeatureOption setLang(String[] lang); + + ToolboxDataViewFeatureOption setBackgroundColor(String backgroundColor); + + ToolboxDataViewFeatureOption setTextColor(String textColor); + + ToolboxDataViewFeatureOption setTextareaColor(String textareaColor); + + ToolboxDataViewFeatureOption setTextareaBorderColor(String textareaBorderColor); + + ToolboxDataViewFeatureOption setButtonColor(String buttonColor); + + ToolboxDataViewFeatureOption setButtonTextColor(String buttonTextColor); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataZoomFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataZoomFeatureOption.java new file mode 100644 index 0000000..e9f03bd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxDataZoomFeatureOption.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/DataZoom.ts#L57 + */ +public interface ToolboxDataZoomFeatureOption extends ToolboxFeatureOption { + + ToolboxDataZoomFeatureOption setType(Object[] type); + + ToolboxDataZoomFeatureOption setIcon(String icon); + + ToolboxDataZoomFeatureOption setTitle(String title); + + ToolboxDataZoomFeatureOption setFilterMode(String filterMode); + + ToolboxDataZoomFeatureOption setXAxisIndex(Object xAxisIndex); + + ToolboxDataZoomFeatureOption setYAxisIndex(Object yAxisIndex); + + ToolboxDataZoomFeatureOption setXAxisId(Object xAxisId); + + ToolboxDataZoomFeatureOption setYAxisId(Object yAxisId); + + ToolboxDataZoomFeatureOption setBrushStyle(ItemStyleOption brushStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxMagicTypeFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxMagicTypeFeatureOption.java new file mode 100644 index 0000000..37d2eca --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxMagicTypeFeatureOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/MagicType.ts#L43 + */ +public interface ToolboxMagicTypeFeatureOption extends ToolboxFeatureOption { + + ToolboxMagicTypeFeatureOption setType(Object[] type); + + ToolboxMagicTypeFeatureOption setIcon(String icon); + + ToolboxMagicTypeFeatureOption setTitle(String title); + + ToolboxMagicTypeFeatureOption setOption(String option); + + ToolboxMagicTypeFeatureOption setSeriesIndex(Object seriesIndex); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxRestoreFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxRestoreFeatureOption.java new file mode 100644 index 0000000..16b356c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxRestoreFeatureOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/Restore.ts#L26 + */ +public interface ToolboxRestoreFeatureOption extends ToolboxFeatureOption { + + ToolboxRestoreFeatureOption setIcon(String icon); + + ToolboxRestoreFeatureOption setTitle(String title); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxSaveAsImageFeatureOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxSaveAsImageFeatureOption.java new file mode 100644 index 0000000..ebb875b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/toolbox/feature/ToolboxSaveAsImageFeatureOption.java @@ -0,0 +1,27 @@ +package org.icepear.echarts.origin.component.toolbox.feature; + +import org.icepear.echarts.origin.component.toolbox.ToolboxFeatureOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/toolbox/feature/SaveAsImage.ts#L28 + */ +public interface ToolboxSaveAsImageFeatureOption extends ToolboxFeatureOption { + + ToolboxSaveAsImageFeatureOption setIcon(String icon); + + ToolboxSaveAsImageFeatureOption setTitle(String title); + + ToolboxSaveAsImageFeatureOption setType(String type); + + ToolboxSaveAsImageFeatureOption setBackgroundColor(String backgroundColor); + + ToolboxSaveAsImageFeatureOption setConnectedBackgroundColor(String connectedBackgroundColor); + + ToolboxSaveAsImageFeatureOption setName(String name); + + ToolboxSaveAsImageFeatureOption setExcludeComponents(String[] excludeComponents); + + ToolboxSaveAsImageFeatureOption setPixelRatio(Number pixelRatio); + + ToolboxSaveAsImageFeatureOption setLang(String[] lang); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipAxisPointerOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipAxisPointerOption.java new file mode 100644 index 0000000..e11d466 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipAxisPointerOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.component.tooltip; + +import org.icepear.echarts.origin.component.axisPointer.AxisPointerOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/tooltip/TooltipModel.ts#L38 + */ +public interface TooltipAxisPointerOption extends AxisPointerOption { + + TooltipAxisPointerOption setAxis(String axis); + + TooltipAxisPointerOption setCrossStyle(Object crossStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipOption.java new file mode 100644 index 0000000..ab89d22 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/tooltip/TooltipOption.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.origin.component.tooltip; + +import org.icepear.echarts.origin.util.CommonTooltipOption; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/tooltip/TooltipModel.ts#L35 + */ +public interface TooltipOption extends CommonTooltipOption, ComponentOption { + + TooltipOption setMainType(String mainType); + + TooltipOption setAxisPointer(TooltipAxisPointerOption axisPointer); + + TooltipOption setShowContent(Boolean showContent); + + TooltipOption setTrigger(String trigger); + + TooltipOption setDisplayMode(String displayMode); + + TooltipOption setRenderMode(String renderMode); + + TooltipOption setAppendToBody(Boolean appendToBody); + + TooltipOption setClassName(String className); + + TooltipOption setOrder(String order); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/ContinousVisualMapOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/ContinousVisualMapOption.java new file mode 100644 index 0000000..dde16ba --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/ContinousVisualMapOption.java @@ -0,0 +1,39 @@ +package org.icepear.echarts.origin.component.visualMap; + +import org.icepear.echarts.origin.util.ItemStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/component/visualMap/ContinuousModel.ts#L36 + */ +public interface ContinousVisualMapOption extends VisualMapOption { + + ContinousVisualMapOption setAlign(String align); + + ContinousVisualMapOption setCalculable(Boolean calculable); + + ContinousVisualMapOption setRange(Number[] range); + + ContinousVisualMapOption setHoverLink(Boolean hoverLink); + + ContinousVisualMapOption setHoverLinkDataSize(Number hoverLinkDataSize); + + ContinousVisualMapOption setHoverLinkOnHandle(Boolean hoverLinkOnHandle); + + ContinousVisualMapOption setHandleIcon(String handleIcon); + + ContinousVisualMapOption setHandleSize(Number handleSize); + + ContinousVisualMapOption setHandleSize(String handleSize); + + ContinousVisualMapOption setHandleStyle(ItemStyleOption handleStyle); + + ContinousVisualMapOption setIndicatorIcon(String indicatorIcon); + + ContinousVisualMapOption setIndicatorSize(Number indicatorSize); + + ContinousVisualMapOption setIndicatorSize(String indicatorSize); + + ContinousVisualMapOption setIndicatorStyle(ItemStyleOption indicatorStyle); + + ContinousVisualMapOption setEmphasis(Object emphasis); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/PiecewiseVisualMapOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/PiecewiseVisualMapOption.java new file mode 100644 index 0000000..6dc3f0e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/PiecewiseVisualMapOption.java @@ -0,0 +1,37 @@ +package org.icepear.echarts.origin.component.visualMap; + +import java.util.Map; + +/** + * https://github.com/apache/echarts/blob/0114414eed6d0f9d1bb951459517e21ae557989f/src/component/visualMap/PiecewiseModel.ts#L70 + */ +public interface PiecewiseVisualMapOption extends VisualMapOption { + + PiecewiseVisualMapOption setAlign(String align); + + PiecewiseVisualMapOption setMinOpen(Boolean minOpen); + + PiecewiseVisualMapOption setMaxOpen(Boolean maxOpen); + + PiecewiseVisualMapOption setItemWidth(Number itemWidth); + + PiecewiseVisualMapOption setItemHeight(Number itemHeight); + + PiecewiseVisualMapOption setItemSymbol(String itemSymbol); + + PiecewiseVisualMapOption setPieces(VisualPieceOption[] pieces); + + PiecewiseVisualMapOption setCategories(String[] categories); + + PiecewiseVisualMapOption setSplitNumber(Number splitNumber); + + PiecewiseVisualMapOption setSelected(Map selected); + + PiecewiseVisualMapOption setSelectedMode(String selectedMode); + + PiecewiseVisualMapOption setShowLabel(Boolean showLabel); + + PiecewiseVisualMapOption setItemGap(Number itemGap); + + PiecewiseVisualMapOption setHoverLink(Boolean hoverLink); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualMapOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualMapOption.java new file mode 100644 index 0000000..1de478f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualMapOption.java @@ -0,0 +1,70 @@ +package org.icepear.echarts.origin.component.visualMap; + +import org.icepear.echarts.origin.util.BorderOptionMixin; +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/4569dc1d8b712dafb80b16e31c4fed0118e3acbd/src/component/visualMap/VisualMapModel.ts#L56 + */ +public interface VisualMapOption extends ComponentOption, BoxLayoutOptionMixin, BorderOptionMixin { + + VisualMapOption setMainType(String mainType); + + VisualMapOption setShow(Boolean show); + + VisualMapOption setAlign(String align); + + VisualMapOption setRealtime(Boolean realtime); + + VisualMapOption setSeriesIndex(Number seriesIndex); + + VisualMapOption setSeriesIndex(Number[] seriesIndex); + + VisualMapOption setSeriesIndex(String seriesIndex); + + VisualMapOption setMin(Number min); + + VisualMapOption setMax(Number max); + + VisualMapOption setDimension(Number dimension); + + VisualMapOption setController(Object controller); + + VisualMapOption setTarget(Object target); + + VisualMapOption setItemWidth(Number itemWidth); + + VisualMapOption setItemHeight(Number itemHeight); + + VisualMapOption setInverse(Boolean inverse); + + VisualMapOption setOrient(String orient); + + VisualMapOption setBackgroundColor(String backgroundColor); + + VisualMapOption setContentColor(String contentColor); + + VisualMapOption setInactiveColor(String inactiveColor); + + VisualMapOption setPadding(Number padding); + + VisualMapOption setPadding(Number[] padding); + + VisualMapOption setTextGap(Number textGap); + + VisualMapOption setPrecision(Number precision); + + VisualMapOption setColor(String[] color); + + VisualMapOption setFormatter(Object formatter); + + VisualMapOption setFormatter(String formatter); + + VisualMapOption setText(String[] text); + + VisualMapOption setTextStyle(LabelOption textStyle); + + VisualMapOption setCategories(Object categories); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualPieceOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualPieceOption.java new file mode 100644 index 0000000..cc25738 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/component/visualMap/VisualPieceOption.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.origin.component.visualMap; + +import org.icepear.echarts.origin.util.VisualOptionUnit; + +/** + * https://github.com/apache/echarts/blob/0114414eed6d0f9d1bb951459517e21ae557989f/src/component/visualMap/PiecewiseModel.ts#L31 + */ +public interface VisualPieceOption extends VisualOptionUnit { + + VisualPieceOption setMin(Number min); + + VisualPieceOption setMax(Number max); + + VisualPieceOption setLt(Number lt); + + VisualPieceOption setGt(Number gt); + + VisualPieceOption setLte(Number lte); + + VisualPieceOption setGte(Number gte); + + VisualPieceOption setValue(Number value); + + VisualPieceOption setLabel(String label); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisBaseOptionCommon.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisBaseOptionCommon.java new file mode 100644 index 0000000..b96a05c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisBaseOptionCommon.java @@ -0,0 +1,61 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.AnimationOptionMixin; +import org.icepear.echarts.origin.util.CommonAxisPointerOption; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L30 + */ +public interface AxisBaseOptionCommon extends ComponentOption, AnimationOptionMixin { + + AxisBaseOptionCommon setType(String type); + + AxisBaseOptionCommon setShow(Boolean show); + + AxisBaseOptionCommon setInverse(Boolean inverse); + + AxisBaseOptionCommon setName(String name); + + AxisBaseOptionCommon setNameLocation(String nameLocation); + + AxisBaseOptionCommon setNameRotate(Number nameRotate); + + AxisBaseOptionCommon setNameTruncate(Object nameTruncate); + + AxisBaseOptionCommon setNameTextStyle(AxisNameTextStyleOption nameTextStyle); + + AxisBaseOptionCommon setNameGap(Number nameGap); + + AxisBaseOptionCommon setSilent(Boolean silent); + + AxisBaseOptionCommon setTriggerEvent(Boolean triggerEvent); + + AxisBaseOptionCommon setTooltip(Object tooltip); + + AxisBaseOptionCommon setAxisLabel(AxisLabelBaseOption axisLabel); + + AxisBaseOptionCommon setAxisPointer(CommonAxisPointerOption axisPointer); + + AxisBaseOptionCommon setAxisLine(AxisLineOption axisLine); + + AxisBaseOptionCommon setAxisTick(AxisTickOption axisTick); + + AxisBaseOptionCommon setMinorTick(MinorTickOption minorTick); + + AxisBaseOptionCommon setSplitLine(SplitLineOption splitLine); + + AxisBaseOptionCommon setMinorSplitLine(MinorSplitLineOption minorSplitLine); + + AxisBaseOptionCommon setSplitArea(SplitAreaOption splitArea); + + AxisBaseOptionCommon setMin(Number min); + + AxisBaseOptionCommon setMin(String min); + + AxisBaseOptionCommon setMax(Number max); + + AxisBaseOptionCommon setMax(String max); + + AxisBaseOptionCommon setData(Object[] data); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLabelBaseOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLabelBaseOption.java new file mode 100644 index 0000000..a4ba0f7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLabelBaseOption.java @@ -0,0 +1,29 @@ +package org.icepear.echarts.origin.coord; + +import java.util.Map; + +import org.icepear.echarts.origin.util.TextCommonOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L208 + */ +public interface AxisLabelBaseOption extends TextCommonOption { + + AxisLabelBaseOption setShow(Boolean show); + + AxisLabelBaseOption setInside(Boolean inside); + + AxisLabelBaseOption setRotate(Number rotate); + + AxisLabelBaseOption setShowMinLabel(Boolean showMinLabel); + + AxisLabelBaseOption setShowMaxLabel(Boolean showMaxLabel); + + AxisLabelBaseOption setMargin(Number margin); + + AxisLabelBaseOption setRich(Map rich); + + AxisLabelBaseOption setHideOverlap(Boolean hideOverlap); + + AxisLabelBaseOption setColor(String color); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLineOption.java new file mode 100644 index 0000000..2731eec --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisLineOption.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L161 + */ +public interface AxisLineOption { + + AxisLineOption setShow(Boolean show); + + AxisLineOption setShow(String show); + + AxisLineOption setOnZero(Boolean onZero); + + AxisLineOption setOnZeroAxisIndex(Number onZeroAxisIndex); + + AxisLineOption setSymbol(String symbol); + + AxisLineOption setSymbol(String[] symbol); + + AxisLineOption setSymbolSize(Number[] symbolSize); + + AxisLineOption setSymbolOffset(Number symbolOffset); + + AxisLineOption setSymbolOffset(Number[] symbolOffset); + + AxisLineOption setSymbolOffset(String symbolOffset); + + AxisLineOption setSymbolOffset(String[] symbolOffset); + + AxisLineOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisNameTextStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisNameTextStyleOption.java new file mode 100644 index 0000000..4548ace --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisNameTextStyleOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord; + +import java.util.Map; + +import org.icepear.echarts.origin.util.TextCommonOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L157 + */ +public interface AxisNameTextStyleOption extends TextCommonOption { + + AxisNameTextStyleOption setRich(Map rich); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisTickOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisTickOption.java new file mode 100644 index 0000000..babe4ea --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/AxisTickOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L172 + */ +public interface AxisTickOption { + + AxisTickOption setShow(Boolean show); + + AxisTickOption setShow(String show); + + AxisTickOption setInside(Boolean inside); + + AxisTickOption setLength(Number length); + + AxisTickOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisBaseOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisBaseOption.java new file mode 100644 index 0000000..1f21719 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisBaseOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L110 + */ +public interface CategoryAxisBaseOption extends AxisBaseOptionCommon { + + CategoryAxisBaseOption setType(String type); + + CategoryAxisBaseOption setBoundaryGap(Boolean boundaryGap); + + CategoryAxisBaseOption setAxisLabel(Object axisLabel); + + CategoryAxisBaseOption setData(Object[] data); + + CategoryAxisBaseOption setDeduplication(Boolean deduplication); + + CategoryAxisBaseOption setAxisTick(Object axisTick); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisLabelOption.java new file mode 100644 index 0000000..038e69b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisLabelOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L226 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L201 + */ +public interface CategoryAxisLabelOption extends AxisLabelBaseOption { + + CategoryAxisLabelOption setFormatter(Object formatter); + + CategoryAxisLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisTickOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisTickOption.java new file mode 100644 index 0000000..0697b0c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/CategoryAxisTickOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L131 + */ +public interface CategoryAxisTickOption extends AxisTickOption { + + CategoryAxisTickOption setAlignWithLabel(Boolean alignWithLabel); + + CategoryAxisTickOption setInterval(Number interval); + + CategoryAxisTickOption setInterval(String interval); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisBaseOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisBaseOption.java new file mode 100644 index 0000000..3889c7c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisBaseOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L148 + */ +public interface LogAxisBaseOption extends NumericAxisBaseOptionCommon { + + LogAxisBaseOption setType(String type); + + LogAxisBaseOption setAxisLabel(Object axisLabel); + + LogAxisBaseOption setLogBase(Number logBase); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisLabelOption.java new file mode 100644 index 0000000..e50b1ca --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/LogAxisLabelOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L226 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L201 + */ +public interface LogAxisLabelOption extends AxisLabelBaseOption { + + LogAxisLabelOption setFormatter(Object formatter); + + LogAxisLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorSplitLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorSplitLineOption.java new file mode 100644 index 0000000..421f345 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorSplitLineOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L244 + */ +public interface MinorSplitLineOption { + + MinorSplitLineOption setShow(Boolean show); + + MinorSplitLineOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorTickOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorTickOption.java new file mode 100644 index 0000000..38cef5d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/MinorTickOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L230 + */ +public interface MinorTickOption { + + MinorTickOption setShow(Boolean show); + + MinorTickOption setSplitNumber(Number splitNumber); + + MinorTickOption setLength(Number length); + + MinorTickOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/NumericAxisBaseOptionCommon.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/NumericAxisBaseOptionCommon.java new file mode 100644 index 0000000..14f435c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/NumericAxisBaseOptionCommon.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L84 + */ +public interface NumericAxisBaseOptionCommon extends AxisBaseOptionCommon { + + NumericAxisBaseOptionCommon setBoundaryGap(Number[] boundaryGap); + + NumericAxisBaseOptionCommon setBoundaryGap(String[] boundaryGap); + + NumericAxisBaseOptionCommon setSplitNumber(Number splitNumber); + + NumericAxisBaseOptionCommon setInterval(Number interval); + + NumericAxisBaseOptionCommon setMinInterval(Number minInterval); + + NumericAxisBaseOptionCommon setMaxInterval(Number maxInterval); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitAreaOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitAreaOption.java new file mode 100644 index 0000000..000be24 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitAreaOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.AreaStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L249 + */ +public interface SplitAreaOption { + + SplitAreaOption setShow(Boolean show); + + SplitAreaOption setInterval(Number interval); + + SplitAreaOption setInterval(String interval); + + SplitAreaOption setAreaStyle(AreaStyleOption areaStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitLineOption.java new file mode 100644 index 0000000..a203109 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/SplitLineOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.coord; + +import org.icepear.echarts.origin.util.LineStyleOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L237 + */ +public interface SplitLineOption { + + SplitLineOption setShow(Boolean show); + + SplitLineOption setInterval(Number interval); + + SplitLineOption setInterval(String interval); + + SplitLineOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisBaseOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisBaseOption.java new file mode 100644 index 0000000..5ea93a9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisBaseOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L153 + */ +public interface TimeAxisBaseOption extends NumericAxisBaseOptionCommon { + + TimeAxisBaseOption setType(String type); + + TimeAxisBaseOption setAxisLabel(Object axisLabel); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisLabelOption.java new file mode 100644 index 0000000..77f60c2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/TimeAxisLabelOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L226 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L201 + */ +public interface TimeAxisLabelOption extends AxisLabelBaseOption { + + TimeAxisLabelOption setFormatter(Object formatter); + + TimeAxisLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisBaseOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisBaseOption.java new file mode 100644 index 0000000..f70333a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisBaseOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L137 + */ +public interface ValueAxisBaseOption extends NumericAxisBaseOptionCommon { + + ValueAxisBaseOption setType(String type); + + ValueAxisBaseOption setAxisLabel(Object axisLabel); + + ValueAxisBaseOption setScale(Boolean scale); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisLabelOption.java new file mode 100644 index 0000000..892ac50 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/ValueAxisLabelOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.coord; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L226 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L201 + */ +public interface ValueAxisLabelOption extends AxisLabelBaseOption { + + ValueAxisLabelOption setFormatter(Object formatter); + + ValueAxisLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/AxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/AxisOption.java new file mode 100644 index 0000000..dd2fcab --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/AxisOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.coord.cartesian; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L45 + */ +public interface AxisOption extends CartesianAxisOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CartesianAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CartesianAxisOption.java new file mode 100644 index 0000000..1f2245a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CartesianAxisOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.coord.cartesian; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L33 + */ +public interface CartesianAxisOption { + + CartesianAxisOption setGridIndex(Number gridIndex); + + CartesianAxisOption setGridId(String gridId); + + CartesianAxisOption setPosition(String position); + + CartesianAxisOption setOffset(Number offset); + + CartesianAxisOption setCategorySortInfo(Object categorySortInfo); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CategoryAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CategoryAxisOption.java new file mode 100644 index 0000000..30d9ae2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/CategoryAxisOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.cartesian; + +import org.icepear.echarts.origin.coord.CategoryAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L33 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L45 + */ +public interface CategoryAxisOption extends AxisOption, CategoryAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/GridOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/GridOption.java new file mode 100644 index 0000000..e301b12 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/GridOption.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.origin.coord.cartesian; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; +import org.icepear.echarts.origin.util.ShadowOptionMixin; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/GridModel.ts#L26 + */ +public interface GridOption extends ComponentOption, BoxLayoutOptionMixin, ShadowOptionMixin { + + GridOption setMainType(String mainType); + + GridOption setShow(Boolean show); + + GridOption setContainLabel(Boolean containLabel); + + GridOption setBackgroundColor(String backgroundColor); + + GridOption setBorderWidth(Number borderWidth); + + GridOption setBorderColor(String borderColor); + + GridOption setTooltip(Object tooltip); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/LogAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/LogAxisOption.java new file mode 100644 index 0000000..aaea88f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/LogAxisOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.cartesian; + +import org.icepear.echarts.origin.coord.LogAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L33 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L45 + */ +public interface LogAxisOption extends AxisOption, LogAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/TimeAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/TimeAxisOption.java new file mode 100644 index 0000000..b7fca01 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/TimeAxisOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.cartesian; + +import org.icepear.echarts.origin.coord.TimeAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L33 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L45 + */ +public interface TimeAxisOption extends AxisOption, TimeAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/ValueAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/ValueAxisOption.java new file mode 100644 index 0000000..414c149 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/cartesian/ValueAxisOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.cartesian; + +import org.icepear.echarts.origin.coord.ValueAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L33 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L42 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/cartesian/AxisModel.ts#L45 + */ +public interface ValueAxisOption extends AxisOption, ValueAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/CategoryParallelAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/CategoryParallelAxisOption.java new file mode 100644 index 0000000..f5450b2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/CategoryParallelAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.parallel; + +import org.icepear.echarts.origin.coord.CategoryAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/parallel/AxisModel.ts#L43 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface CategoryParallelAxisOption extends ParallelAxisOption, CategoryAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/LogParallelAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/LogParallelAxisOption.java new file mode 100644 index 0000000..d6c0e65 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/LogParallelAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.parallel; + +import org.icepear.echarts.origin.coord.LogAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/parallel/AxisModel.ts#L43 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface LogParallelAxisOption extends ParallelAxisOption, LogAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ParallelAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ParallelAxisOption.java new file mode 100644 index 0000000..16f3a03 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ParallelAxisOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.coord.parallel; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/parallel/AxisModel.ts#L43 + */ +public interface ParallelAxisOption { + + ParallelAxisOption setDim(Number dim); + + ParallelAxisOption setDim(Number[] dim); + + ParallelAxisOption setParallelIndex(Number parallelIndex); + + ParallelAxisOption setAreaSelectStyle(Object areaSelectStyle); + + ParallelAxisOption setRealtime(Boolean realtime); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/TimeParallelAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/TimeParallelAxisOption.java new file mode 100644 index 0000000..136b76e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/TimeParallelAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.parallel; + +import org.icepear.echarts.origin.coord.TimeAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/parallel/AxisModel.ts#L43 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface TimeParallelAxisOption extends ParallelAxisOption, TimeAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ValueParallelAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ValueParallelAxisOption.java new file mode 100644 index 0000000..a8ebae6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/parallel/ValueParallelAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.parallel; + +import org.icepear.echarts.origin.coord.ValueAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/parallel/AxisModel.ts#L43 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface ValueParallelAxisOption extends ParallelAxisOption, ValueAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/AngleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/AngleAxisOption.java new file mode 100644 index 0000000..42cda47 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/AngleAxisOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.coord.polar; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L30 + */ +public interface AngleAxisOption { + + AngleAxisOption setPolarIndex(Number polarIndex); + + AngleAxisOption setPolarId(String polarId); + + AngleAxisOption setStartAngle(Number startAngle); + + AngleAxisOption setClockwise(Boolean clockwise); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryAngleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryAngleAxisOption.java new file mode 100644 index 0000000..83089e8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryAngleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.CategoryAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L30 + */ +public interface CategoryAngleAxisOption extends AngleAxisOption, CategoryAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryRadiusAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryRadiusAxisOption.java new file mode 100644 index 0000000..c230f0b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/CategoryRadiusAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.CategoryAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L47 + */ +public interface CategoryRadiusAxisOption extends RadiusAxisOption, CategoryAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogAngleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogAngleAxisOption.java new file mode 100644 index 0000000..3d02fcc --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogAngleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.LogAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L30 + */ +public interface LogAngleAxisOption extends AngleAxisOption, LogAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogRadiusAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogRadiusAxisOption.java new file mode 100644 index 0000000..b41695b --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/LogRadiusAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.LogAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L47 + */ +public interface LogRadiusAxisOption extends RadiusAxisOption, LogAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/PolarOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/PolarOption.java new file mode 100644 index 0000000..f9efb16 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/PolarOption.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.util.CircleLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/PolarModel.ts#L25 + */ +public interface PolarOption extends ComponentOption, CircleLayoutOptionMixin { + + PolarOption setMainType(String mainType); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/RadiusAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/RadiusAxisOption.java new file mode 100644 index 0000000..eae5ea6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/RadiusAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L47 + */ +public interface RadiusAxisOption { + + RadiusAxisOption setPolarIndex(Number polarIndex); + + RadiusAxisOption setPolarId(String polarId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeAngleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeAngleAxisOption.java new file mode 100644 index 0000000..67f4b95 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeAngleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.TimeAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L30 + */ +public interface TimeAngleAxisOption extends AngleAxisOption, TimeAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeRadiusAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeRadiusAxisOption.java new file mode 100644 index 0000000..7d2588a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/TimeRadiusAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.TimeAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L47 + */ +public interface TimeRadiusAxisOption extends RadiusAxisOption, TimeAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueAngleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueAngleAxisOption.java new file mode 100644 index 0000000..0a31b9d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueAngleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.ValueAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L30 + */ +public interface ValueAngleAxisOption extends AngleAxisOption, ValueAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueRadiusAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueRadiusAxisOption.java new file mode 100644 index 0000000..608d0f0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/polar/ValueRadiusAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.polar; + +import org.icepear.echarts.origin.coord.ValueAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/axisCommonTypes.ts#L257 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/polar/AxisModel.ts#L47 + */ +public interface ValueRadiusAxisOption extends RadiusAxisOption, ValueAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarAxisNameOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarAxisNameOption.java new file mode 100644 index 0000000..008ffc3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarAxisNameOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.radar; + +import org.icepear.echarts.origin.util.LabelOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/radar/RadarModel.ts#L71 + */ +public interface RadarAxisNameOption extends LabelOption { + + RadarAxisNameOption setShow(Boolean show); + + RadarAxisNameOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarIndicatorOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarIndicatorOption.java new file mode 100644 index 0000000..030c309 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarIndicatorOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.coord.radar; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/coord/radar/RadarModel.ts#L44 + */ +public interface RadarIndicatorOption { + + RadarIndicatorOption setName(String name); + + RadarIndicatorOption setText(String text); + + RadarIndicatorOption setMin(Number min); + + RadarIndicatorOption setMax(Number max); + + RadarIndicatorOption setColor(Object color); + + RadarIndicatorOption setAxisType(String axisType); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarOption.java new file mode 100644 index 0000000..9909277 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/radar/RadarOption.java @@ -0,0 +1,49 @@ +package org.icepear.echarts.origin.coord.radar; + +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; +import org.icepear.echarts.origin.coord.AxisLineOption; +import org.icepear.echarts.origin.coord.AxisTickOption; +import org.icepear.echarts.origin.coord.SplitAreaOption; +import org.icepear.echarts.origin.coord.SplitLineOption; +import org.icepear.echarts.origin.util.CircleLayoutOptionMixin; +import org.icepear.echarts.origin.util.ComponentOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/coord/radar/RadarModel.ts#L54 + */ +public interface RadarOption extends ComponentOption, CircleLayoutOptionMixin { + + RadarOption setMainType(String mainType); + + RadarOption setStartAngle(Number startAngle); + + RadarOption setShape(String shape); + + RadarOption setAxisLine(AxisLineOption axisLine); + + RadarOption setAxisTick(AxisTickOption axisTick); + + RadarOption setAxisLabel(AxisLabelBaseOption axisLabel); + + RadarOption setSplitLine(SplitLineOption splitLine); + + RadarOption setSplitArea(SplitAreaOption splitArea); + + RadarOption setAxisName(RadarAxisNameOption axisName); + + RadarOption setAxisNameGap(Number axisNameGap); + + RadarOption setTriggerEvent(Boolean triggerEvent); + + RadarOption setScale(Boolean scale); + + RadarOption setSplitNumber(Number splitNumber); + + RadarOption setBoundaryGap(Boolean boundaryGap); + + RadarOption setBoundaryGap(Number[] boundaryGap); + + RadarOption setBoundaryGap(String[] boundaryGap); + + RadarOption setIndicator(RadarIndicatorOption[] indicator); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/CategorySingleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/CategorySingleAxisOption.java new file mode 100644 index 0000000..1c8e3dd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/CategorySingleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.single; + +import org.icepear.echarts.origin.coord.CategoryAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/single/AxisModel.ts#L32 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface CategorySingleAxisOption extends SingleAxisOption, CategoryAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/LogSingleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/LogSingleAxisOption.java new file mode 100644 index 0000000..85b287e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/LogSingleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.single; + +import org.icepear.echarts.origin.coord.LogAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/single/AxisModel.ts#L32 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface LogSingleAxisOption extends SingleAxisOption, LogAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/SingleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/SingleAxisOption.java new file mode 100644 index 0000000..c106dcc --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/SingleAxisOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.coord.single; + +import org.icepear.echarts.origin.util.BoxLayoutOptionMixin; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/single/AxisModel.ts#L32 + */ +public interface SingleAxisOption extends BoxLayoutOptionMixin { + + SingleAxisOption setPosition(String position); + + SingleAxisOption setOrient(String orient); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/TimeSingleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/TimeSingleAxisOption.java new file mode 100644 index 0000000..7ae33d9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/TimeSingleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.single; + +import org.icepear.echarts.origin.coord.TimeAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/single/AxisModel.ts#L32 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface TimeSingleAxisOption extends SingleAxisOption, TimeAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/ValueSingleAxisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/ValueSingleAxisOption.java new file mode 100644 index 0000000..87f2c68 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/coord/single/ValueSingleAxisOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.coord.single; + +import org.icepear.echarts.origin.coord.ValueAxisBaseOption; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/single/AxisModel.ts#L32 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/coord/axisCommonTypes.ts#L257 + */ +public interface ValueSingleAxisOption extends SingleAxisOption, ValueAxisBaseOption { + +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformConfigOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformConfigOption.java new file mode 100644 index 0000000..272bff8 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformConfigOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.data.helper; + +/** + * https://echarts.apache.org/examples/en/editor.html?c=data-transform-multiple-pie + */ +public interface DataTransformConfigOption { + + DataTransformConfigOption setDimension(String dimension); + + DataTransformConfigOption setValue(Number value); + + DataTransformConfigOption setValue(Object value); + + DataTransformConfigOption setValue(String value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformOption.java new file mode 100644 index 0000000..1f3343e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/data/helper/DataTransformOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.data.helper; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/data/helper/transform.ts#L43 + */ +public interface DataTransformOption { + + DataTransformOption setType(String type); + + DataTransformOption setConfig(DataTransformConfigOption config); + + DataTransformOption setPrint(Boolean print); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/export/EChartsOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/export/EChartsOption.java new file mode 100644 index 0000000..038d27e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/export/EChartsOption.java @@ -0,0 +1,126 @@ +package org.icepear.echarts.origin.export; + +import org.icepear.echarts.origin.component.axisPointer.AxisPointerOption; +import org.icepear.echarts.origin.component.dataZoom.DataZoomOption; +import org.icepear.echarts.origin.component.dataset.DatasetOption; +import org.icepear.echarts.origin.component.legend.LegendOption; +import org.icepear.echarts.origin.component.title.TitleOption; +import org.icepear.echarts.origin.component.toolbox.ToolboxOption; +import org.icepear.echarts.origin.component.tooltip.TooltipOption; +import org.icepear.echarts.origin.component.visualMap.VisualMapOption; +import org.icepear.echarts.origin.coord.cartesian.AxisOption; +import org.icepear.echarts.origin.coord.cartesian.GridOption; +import org.icepear.echarts.origin.coord.parallel.ParallelAxisOption; +import org.icepear.echarts.origin.coord.polar.AngleAxisOption; +import org.icepear.echarts.origin.coord.polar.PolarOption; +import org.icepear.echarts.origin.coord.polar.RadiusAxisOption; +import org.icepear.echarts.origin.coord.radar.RadarOption; +import org.icepear.echarts.origin.coord.single.SingleAxisOption; +import org.icepear.echarts.origin.util.ECBasicOption; +import org.icepear.echarts.origin.util.SeriesOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/export/option.ts#L246 + */ +public interface EChartsOption extends ECBasicOption { + + EChartsOption setDataset(DatasetOption dataset); + + EChartsOption setDataset(DatasetOption[] dataset); + + EChartsOption setAria(Object aria); + + EChartsOption setTitle(TitleOption title); + + EChartsOption setTitle(TitleOption[] title); + + EChartsOption setGrid(GridOption grid); + + EChartsOption setGrid(GridOption[] grid); + + EChartsOption setRadar(RadarOption radar); + + EChartsOption setRadar(RadarOption[] radar); + + EChartsOption setPolar(PolarOption polar); + + EChartsOption setPolar(PolarOption[] polar); + + EChartsOption setGeo(Object geo); + + EChartsOption setGeo(Object[] geo); + + EChartsOption setAngleAxis(AngleAxisOption angleAxis); + + EChartsOption setAngleAxis(AngleAxisOption[] angleAxis); + + EChartsOption setRadiusAxis(RadiusAxisOption radiusAxis); + + EChartsOption setRadiusAxis(RadiusAxisOption[] radiusAxis); + + EChartsOption setXAxis(AxisOption xAxis); + + EChartsOption setXAxis(AxisOption[] xAxis); + + EChartsOption setYAxis(Object yAxis); + + EChartsOption setYAxis(Object[] yAxis); + + EChartsOption setSingleAxis(SingleAxisOption singleAxis); + + EChartsOption setSingleAxis(SingleAxisOption[] singleAxis); + + EChartsOption setParallel(Object parallel); + + EChartsOption setParallel(Object[] parallel); + + EChartsOption setParallelAxis(ParallelAxisOption parallelAxis); + + EChartsOption setParallelAxis(ParallelAxisOption[] parallelAxis); + + EChartsOption setCalendar(Object calendar); + + EChartsOption setCalendar(Object[] calendar); + + EChartsOption setToolbox(ToolboxOption toolbox); + + EChartsOption setToolbox(ToolboxOption[] toolbox); + + EChartsOption setTooltip(TooltipOption tooltip); + + EChartsOption setTooltip(TooltipOption[] tooltip); + + EChartsOption setAxisPointer(AxisPointerOption axisPointer); + + EChartsOption setAxisPointer(AxisPointerOption[] axisPointer); + + EChartsOption setBrush(Object brush); + + EChartsOption setBrush(Object[] brush); + + EChartsOption setTimeline(Object timeline); + + EChartsOption setLegend(LegendOption legend); + + EChartsOption setLegend(LegendOption[] legend); + + EChartsOption setDataZoom(DataZoomOption dataZoom); + + EChartsOption setDataZoom(DataZoomOption[] dataZoom); + + EChartsOption setVisualMap(VisualMapOption visualMap); + + EChartsOption setVisualMap(VisualMapOption[] visualMap); + + EChartsOption setGraphic(Object graphic); + + EChartsOption setGraphic(Object[] graphic); + + EChartsOption setSeries(SeriesOption series); + + EChartsOption setSeries(SeriesOption[] series); + + EChartsOption setOptions(EChartsOption[] options); + + EChartsOption setBaseOption(EChartsOption baseOption); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/export/SeriesInjectedOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/export/SeriesInjectedOption.java new file mode 100644 index 0000000..36cbc94 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/export/SeriesInjectedOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.export; + +import org.icepear.echarts.origin.component.marker.MarkAreaOption; +import org.icepear.echarts.origin.component.marker.MarkLineOption; +import org.icepear.echarts.origin.component.marker.MarkPointOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/export/option.ts#L173 + */ +public interface SeriesInjectedOption { + + SeriesInjectedOption setMarkArea(MarkAreaOption markArea); + + SeriesInjectedOption setMarkLine(MarkLineOption markLine); + + SeriesInjectedOption setMarkPoint(MarkPointOption markPoint); + + SeriesInjectedOption setTooltip(Object tooltip); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/AnimationOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AnimationOptionMixin.java new file mode 100644 index 0000000..18792e6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AnimationOptionMixin.java @@ -0,0 +1,31 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L880 + */ +public interface AnimationOptionMixin { + + AnimationOptionMixin setAnimation(Boolean animation); + + AnimationOptionMixin setAnimationThreshold(Number animationThreshold); + + AnimationOptionMixin setAnimationDuration(Number animationDuration); + + AnimationOptionMixin setAnimationDuration(Object animationDuration); + + AnimationOptionMixin setAnimationEasing(Object animationEasing); + + AnimationOptionMixin setAnimationDelay(Number animationDelay); + + AnimationOptionMixin setAnimationDelay(Object animationDelay); + + AnimationOptionMixin setAnimationDurationUpdate(Number animationDurationUpdate); + + AnimationOptionMixin setAnimationDurationUpdate(Object animationDurationUpdate); + + AnimationOptionMixin setAnimationEasingUpdate(Object animationEasingUpdate); + + AnimationOptionMixin setAnimationDelayUpdate(Number animationDelayUpdate); + + AnimationOptionMixin setAnimationDelayUpdate(Object animationDelayUpdate); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/AreaStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AreaStyleOption.java new file mode 100644 index 0000000..9e12f83 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AreaStyleOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L997 + */ +public interface AreaStyleOption extends ShadowOptionMixin { + + AreaStyleOption setColor(String color); + + AreaStyleOption setOpacity(Number opacity); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/AxisPointerLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AxisPointerLabelOption.java new file mode 100644 index 0000000..dda242d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/AxisPointerLabelOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1441 + */ +public interface AxisPointerLabelOption extends LabelOption { + + AxisPointerLabelOption setPrecision(Number precision); + + AxisPointerLabelOption setPrecision(String precision); + + AxisPointerLabelOption setMargin(Number margin); + + AxisPointerLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/BorderOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/BorderOptionMixin.java new file mode 100644 index 0000000..e85243d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/BorderOptionMixin.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L848 + */ +public interface BorderOptionMixin { + + BorderOptionMixin setBorderColor(String borderColor); + + BorderOptionMixin setBorderWidth(Number borderWidth); + + BorderOptionMixin setBorderType(String borderType); + + BorderOptionMixin setBorderCap(Object borderCap); + + BorderOptionMixin setBorderJoin(Object borderJoin); + + BorderOptionMixin setBorderDashOffset(Number borderDashOffset); + + BorderOptionMixin setBorderMiterLimit(Number borderMiterLimit); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/BoxLayoutOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/BoxLayoutOptionMixin.java new file mode 100644 index 0000000..5ae2537 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/BoxLayoutOptionMixin.java @@ -0,0 +1,31 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L825 + */ +public interface BoxLayoutOptionMixin { + + BoxLayoutOptionMixin setWidth(Number width); + + BoxLayoutOptionMixin setWidth(String width); + + BoxLayoutOptionMixin setHeight(Number height); + + BoxLayoutOptionMixin setHeight(String height); + + BoxLayoutOptionMixin setTop(Number top); + + BoxLayoutOptionMixin setTop(String top); + + BoxLayoutOptionMixin setRight(Number right); + + BoxLayoutOptionMixin setRight(String right); + + BoxLayoutOptionMixin setBottom(Number bottom); + + BoxLayoutOptionMixin setBottom(String bottom); + + BoxLayoutOptionMixin setLeft(Number left); + + BoxLayoutOptionMixin setLeft(String left); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/CategoryOptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CategoryOptionDataItemObject.java new file mode 100644 index 0000000..c051631 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CategoryOptionDataItemObject.java @@ -0,0 +1,12 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L641 + */ +public interface CategoryOptionDataItemObject extends OptionDataItemObject { + + CategoryOptionDataItemObject setValue(String value); + + CategoryOptionDataItemObject setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/CircleLayoutOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CircleLayoutOptionMixin.java new file mode 100644 index 0000000..771822a --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CircleLayoutOptionMixin.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L834 + */ +public interface CircleLayoutOptionMixin { + + CircleLayoutOptionMixin setCenter(Number[] center); + + CircleLayoutOptionMixin setCenter(String[] center); + + CircleLayoutOptionMixin setRadius(Number radius); + + CircleLayoutOptionMixin setRadius(Number[] radius); + + CircleLayoutOptionMixin setRadius(Object[] radius); + + CircleLayoutOptionMixin setRadius(String radius); + + CircleLayoutOptionMixin setRadius(String[] radius); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ColorPaletteOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ColorPaletteOptionMixin.java new file mode 100644 index 0000000..88ed2ea --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ColorPaletteOptionMixin.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L764 + */ +public interface ColorPaletteOptionMixin { + + ColorPaletteOptionMixin setColor(String color); + + ColorPaletteOptionMixin setColor(String[] color); + + ColorPaletteOptionMixin setColorLayer(String[][] colorLayer); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonAxisPointerOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonAxisPointerOption.java new file mode 100644 index 0000000..1d4fbe0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonAxisPointerOption.java @@ -0,0 +1,41 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1408 + */ +public interface CommonAxisPointerOption { + + CommonAxisPointerOption setShow(Boolean show); + + CommonAxisPointerOption setShow(String show); + + CommonAxisPointerOption setTriggerOn(String triggerOn); + + CommonAxisPointerOption setType(String type); + + CommonAxisPointerOption setSnap(Boolean snap); + + CommonAxisPointerOption setTriggerTooltip(Boolean triggerTooltip); + + CommonAxisPointerOption setValue(Object value); + + CommonAxisPointerOption setStatus(String status); + + CommonAxisPointerOption setLabel(Object label); + + CommonAxisPointerOption setAnimation(Boolean animation); + + CommonAxisPointerOption setAnimation(String animation); + + CommonAxisPointerOption setAnimationDurationUpdate(Number animationDurationUpdate); + + CommonAxisPointerOption setAnimationEasingUpdate(Object animationEasingUpdate); + + CommonAxisPointerOption setLineStyle(LineStyleOption lineStyle); + + CommonAxisPointerOption setShadowStyle(AreaStyleOption shadowStyle); + + CommonAxisPointerOption setHandle(Object handle); + + CommonAxisPointerOption setSeriesDataIndices(Object[] seriesDataIndices); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonTooltipOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonTooltipOption.java new file mode 100644 index 0000000..e3405d4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/CommonTooltipOption.java @@ -0,0 +1,61 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1295 + */ +public interface CommonTooltipOption { + + CommonTooltipOption setShow(Boolean show); + + CommonTooltipOption setTriggerOn(String triggerOn); + + CommonTooltipOption setAlwaysShowContent(Boolean alwaysShowContent); + + CommonTooltipOption setFormatter(Object formatter); + + CommonTooltipOption setFormatter(String formatter); + + CommonTooltipOption setPosition(Number[] position); + + CommonTooltipOption setPosition(Object position); + + CommonTooltipOption setPosition(String[] position); + + CommonTooltipOption setConfine(Boolean confine); + + CommonTooltipOption setAlign(String align); + + CommonTooltipOption setVerticalAlign(String verticalAlign); + + CommonTooltipOption setShowDelay(Number showDelay); + + CommonTooltipOption setHideDelay(Number hideDelay); + + CommonTooltipOption setTransitionDuration(Number transitionDuration); + + CommonTooltipOption setEnterable(Boolean enterable); + + CommonTooltipOption setBackgroundColor(String backgroundColor); + + CommonTooltipOption setBorderColor(String borderColor); + + CommonTooltipOption setBorderRadius(Number borderRadius); + + CommonTooltipOption setBorderWidth(Number borderWidth); + + CommonTooltipOption setShadowBlur(Number shadowBlur); + + CommonTooltipOption setShadowColor(String shadowColor); + + CommonTooltipOption setShadowOffsetX(Number shadowOffsetX); + + CommonTooltipOption setShadowOffsetY(Number shadowOffsetY); + + CommonTooltipOption setPadding(Number padding); + + CommonTooltipOption setPadding(Number[] padding); + + CommonTooltipOption setExtraCssText(String extraCssText); + + CommonTooltipOption setTextStyle(Object textStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ComponentOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ComponentOption.java new file mode 100644 index 0000000..e65b919 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ComponentOption.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1491 + */ +public interface ComponentOption { + + ComponentOption setMainType(String mainType); + + ComponentOption setType(String type); + + ComponentOption setId(Number id); + + ComponentOption setId(String id); + + ComponentOption setName(Number name); + + ComponentOption setName(String name); + + ComponentOption setZ(Number z); + + ComponentOption setZlevel(Number zlevel); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/DateOptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DateOptionDataItemObject.java new file mode 100644 index 0000000..2c8de42 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DateOptionDataItemObject.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L642 + */ +public interface DateOptionDataItemObject extends OptionDataItemObject { + + DateOptionDataItemObject setValue(Number value); + + DateOptionDataItemObject setValue(Number[] value); + + DateOptionDataItemObject setValue(Object value); + + DateOptionDataItemObject setValue(Object[] value); + + DateOptionDataItemObject setValue(String value); + + DateOptionDataItemObject setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/DecalObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DecalObject.java new file mode 100644 index 0000000..61b1d85 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DecalObject.java @@ -0,0 +1,37 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L707 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L708 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L709 + */ +public interface DecalObject { + + DecalObject setSymbol(String symbol); + + DecalObject setSymbol(String[] symbol); + + DecalObject setSymbolSize(Number symbolSize); + + DecalObject setSymbolKeepAspect(Boolean symbolKeepAspect); + + DecalObject setColor(String color); + + DecalObject setBackgroundColor(String backgroundColor); + + DecalObject setDashArrayX(Number dashArrayX); + + DecalObject setDashArrayX(Number[] dashArrayX); + + DecalObject setDashArrayX(Number[][] dashArrayX); + + DecalObject setDashArrayY(Number dashArrayY); + + DecalObject setDashArrayY(Number[] dashArrayY); + + DecalObject setRotation(Number rotation); + + DecalObject setMaxTileWidth(Number maxTileWidth); + + DecalObject setMaxTileHeight(Number maxTileHeight); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultOptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultOptionDataItemObject.java new file mode 100644 index 0000000..3c48301 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultOptionDataItemObject.java @@ -0,0 +1,20 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L638 + */ +public interface DefaultOptionDataItemObject extends OptionDataItemObject { + + DefaultOptionDataItemObject setValue(Number value); + + DefaultOptionDataItemObject setValue(Number[] value); + + DefaultOptionDataItemObject setValue(Object value); + + DefaultOptionDataItemObject setValue(Object[] value); + + DefaultOptionDataItemObject setValue(String value); + + DefaultOptionDataItemObject setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultStatesMixinEmpasis.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultStatesMixinEmpasis.java new file mode 100644 index 0000000..580089d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/DefaultStatesMixinEmpasis.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1520 + */ +public interface DefaultStatesMixinEmpasis { + + DefaultStatesMixinEmpasis setFocus(String focus); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECBasicOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECBasicOption.java new file mode 100644 index 0000000..8208fdd --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECBasicOption.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L575 + */ +public interface ECBasicOption extends ECUnitOption { + + ECBasicOption setBaseOption(ECUnitOption baseOption); + + ECBasicOption setTimeline(ComponentOption timeline); + + ECBasicOption setTimeline(ComponentOption[] timeline); + + ECBasicOption setOptions(ECUnitOption[] options); + + ECBasicOption setMedia(MediaUnitOption[] media); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECUnitOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECUnitOption.java new file mode 100644 index 0000000..d751c5c --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ECUnitOption.java @@ -0,0 +1,29 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L519 + */ +public interface ECUnitOption extends AnimationOptionMixin, ColorPaletteOptionMixin { + + ECUnitOption setBaseOption(Object baseOption); + + ECUnitOption setOptions(Object options); + + ECUnitOption setMedia(Object media); + + ECUnitOption setTimeline(ComponentOption timeline); + + ECUnitOption setTimeline(ComponentOption[] timeline); + + ECUnitOption setBackgroundColor(String backgroundColor); + + ECUnitOption setDarkMode(Boolean darkMode); + + ECUnitOption setDarkMode(String darkMode); + + ECUnitOption setTextStyle(Object textStyle); + + ECUnitOption setUseUTC(Boolean useUTC); + + ECUnitOption setStateAnimation(Object stateAnimation); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/EmphasisOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/EmphasisOption.java new file mode 100644 index 0000000..e521c51 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/EmphasisOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1541 + */ +public interface EmphasisOption { + + EmphasisOption setBlurScope(Object blurScope); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ItemStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ItemStyleOption.java new file mode 100644 index 0000000..c74a4b3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ItemStyleOption.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L971 + */ +public interface ItemStyleOption extends ShadowOptionMixin, BorderOptionMixin { + + ItemStyleOption setColor(Object color); + + ItemStyleOption setOpacity(Number opacity); + + ItemStyleOption setDecal(DecalObject decal); + + ItemStyleOption setDecal(String decal); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLayoutOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLayoutOption.java new file mode 100644 index 0000000..ca2625e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLayoutOption.java @@ -0,0 +1,39 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1189 + */ +public interface LabelLayoutOption { + + LabelLayoutOption setMoveOverlap(String moveOverlap); + + LabelLayoutOption setHideOverlap(Boolean hideOverlap); + + LabelLayoutOption setDraggable(Boolean draggable); + + LabelLayoutOption setX(Number x); + + LabelLayoutOption setX(String x); + + LabelLayoutOption setY(Number y); + + LabelLayoutOption setY(String y); + + LabelLayoutOption setDx(Number dx); + + LabelLayoutOption setDy(Number dy); + + LabelLayoutOption setRotate(Number rotate); + + LabelLayoutOption setAlign(String align); + + LabelLayoutOption setVerticalAlign(String verticalAlign); + + LabelLayoutOption setWidth(Number width); + + LabelLayoutOption setHeight(Number height); + + LabelLayoutOption setFontSize(Number fontSize); + + LabelLayoutOption setLabelLinePoints(Number[] labelLinePoints); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLineOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLineOption.java new file mode 100644 index 0000000..a2b467f --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelLineOption.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1147 + */ +public interface LabelLineOption { + + LabelLineOption setShow(Boolean show); + + LabelLineOption setShowAbove(Boolean showAbove); + + LabelLineOption setLength(Number length); + + LabelLineOption setLength2(Number length2); + + LabelLineOption setSmooth(Boolean smooth); + + LabelLineOption setSmooth(Number smooth); + + LabelLineOption setMinTurnAngle(Number minTurnAngle); + + LabelLineOption setLineStyle(LineStyleOption lineStyle); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelOption.java new file mode 100644 index 0000000..51b9464 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LabelOption.java @@ -0,0 +1,33 @@ +package org.icepear.echarts.origin.util; + +import java.util.Map; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1090 + */ +public interface LabelOption extends TextCommonOption { + + LabelOption setShow(Boolean show); + + LabelOption setPosition(String position); + + LabelOption setDistance(Number distance); + + LabelOption setRotate(Number rotate); + + LabelOption setOffset(Number[] offset); + + LabelOption setMinMargin(Number minMargin); + + LabelOption setOverflow(Object overflow); + + LabelOption setSilent(Boolean silent); + + LabelOption setPrecision(Number precision); + + LabelOption setPrecision(String precision); + + LabelOption setValueAnimation(Boolean valueAnimation); + + LabelOption setRich(Map rich); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineLabelOption.java new file mode 100644 index 0000000..082bb76 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineLabelOption.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1126 + */ +public interface LineLabelOption extends LabelOption { + + LineLabelOption setPosition(String position); + + LineLabelOption setDistance(Number distance); + + LineLabelOption setDistance(Number[] distance); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineStyleOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineStyleOption.java new file mode 100644 index 0000000..89dc6e0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/LineStyleOption.java @@ -0,0 +1,23 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L982 + */ +public interface LineStyleOption extends ShadowOptionMixin { + + LineStyleOption setWidth(Number width); + + LineStyleOption setColor(String color); + + LineStyleOption setOpacity(Number opacity); + + LineStyleOption setType(String type); + + LineStyleOption setCap(Object cap); + + LineStyleOption setJoin(Object join); + + LineStyleOption setDashOffset(Number dashOffset); + + LineStyleOption setMiterLimit(Number miterLimit); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaQueryOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaQueryOption.java new file mode 100644 index 0000000..92766fa --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaQueryOption.java @@ -0,0 +1,19 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L743 + */ +public interface MediaQueryOption { + + MediaQueryOption setMinWidth(Number minWidth); + + MediaQueryOption setMaxWidth(Number maxWidth); + + MediaQueryOption setMinHeight(Number minHeight); + + MediaQueryOption setMaxHeight(Number maxHeight); + + MediaQueryOption setMinAspectRatio(Number minAspectRatio); + + MediaQueryOption setMaxAspectRatio(Number maxAspectRatio); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaUnitOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaUnitOption.java new file mode 100644 index 0000000..c0b1a06 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/MediaUnitOption.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L751 + */ +public interface MediaUnitOption { + + MediaUnitOption setQuery(MediaQueryOption query); + + MediaUnitOption setOption(ECUnitOption option); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericGraphEdgeItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericGraphEdgeItemObject.java new file mode 100644 index 0000000..31e15d6 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericGraphEdgeItemObject.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L626 + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L640 + */ +public interface NumericGraphEdgeItemObject extends NumericOptionDataItemObject { + + NumericGraphEdgeItemObject setSource(Number source); + + NumericGraphEdgeItemObject setSource(String source); + + NumericGraphEdgeItemObject setTarget(Number target); + + NumericGraphEdgeItemObject setTarget(String target); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericOptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericOptionDataItemObject.java new file mode 100644 index 0000000..605eed9 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/NumericOptionDataItemObject.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L640 + */ +public interface NumericOptionDataItemObject extends OptionDataItemObject { + + NumericOptionDataItemObject setValue(Number value); + + NumericOptionDataItemObject setValue(Number[] value); + + NumericOptionDataItemObject setValue(String value); + + NumericOptionDataItemObject setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionDataItemObject.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionDataItemObject.java new file mode 100644 index 0000000..edcf6bb --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionDataItemObject.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L615 + */ +public interface OptionDataItemObject { + + OptionDataItemObject setId(Number id); + + OptionDataItemObject setId(String id); + + OptionDataItemObject setName(Number name); + + OptionDataItemObject setName(String name); + + OptionDataItemObject setGroupId(Number groupId); + + OptionDataItemObject setGroupId(String groupId); + + OptionDataItemObject setSelected(Boolean selected); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncode.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncode.java new file mode 100644 index 0000000..14938de --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncode.java @@ -0,0 +1,63 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L669 + */ +public interface OptionEncode extends OptionEncodeVisualDimensions { + + OptionEncode setX(Number x); + + OptionEncode setX(Number[] x); + + OptionEncode setX(String x); + + OptionEncode setX(String[] x); + + OptionEncode setY(Number y); + + OptionEncode setY(Number[] y); + + OptionEncode setY(String y); + + OptionEncode setY(String[] y); + + OptionEncode setRadius(Number radius); + + OptionEncode setRadius(Number[] radius); + + OptionEncode setRadius(String radius); + + OptionEncode setRadius(String[] radius); + + OptionEncode setAngle(Number angle); + + OptionEncode setAngle(Number[] angle); + + OptionEncode setAngle(String angle); + + OptionEncode setAngle(String[] angle); + + OptionEncode setLng(Number lng); + + OptionEncode setLng(Number[] lng); + + OptionEncode setLng(String lng); + + OptionEncode setLng(String[] lng); + + OptionEncode setLat(Number lat); + + OptionEncode setLat(Number[] lat); + + OptionEncode setLat(String lat); + + OptionEncode setLat(String[] lat); + + OptionEncode setValue(Number value); + + OptionEncode setValue(Number[] value); + + OptionEncode setValue(String value); + + OptionEncode setValue(String[] value); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncodeVisualDimensions.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncodeVisualDimensions.java new file mode 100644 index 0000000..00479c4 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/OptionEncodeVisualDimensions.java @@ -0,0 +1,55 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L656 + */ +public interface OptionEncodeVisualDimensions { + + OptionEncodeVisualDimensions setTooltip(Number tooltip); + + OptionEncodeVisualDimensions setTooltip(Number[] tooltip); + + OptionEncodeVisualDimensions setTooltip(String tooltip); + + OptionEncodeVisualDimensions setTooltip(String[] tooltip); + + OptionEncodeVisualDimensions setLabel(Number label); + + OptionEncodeVisualDimensions setLabel(Number[] label); + + OptionEncodeVisualDimensions setLabel(String label); + + OptionEncodeVisualDimensions setLabel(String[] label); + + OptionEncodeVisualDimensions setItemName(Number itemName); + + OptionEncodeVisualDimensions setItemName(Number[] itemName); + + OptionEncodeVisualDimensions setItemName(String itemName); + + OptionEncodeVisualDimensions setItemName(String[] itemName); + + OptionEncodeVisualDimensions setItemId(Number itemId); + + OptionEncodeVisualDimensions setItemId(Number[] itemId); + + OptionEncodeVisualDimensions setItemId(String itemId); + + OptionEncodeVisualDimensions setItemId(String[] itemId); + + OptionEncodeVisualDimensions setSeriesName(Number seriesName); + + OptionEncodeVisualDimensions setSeriesName(Number[] seriesName); + + OptionEncodeVisualDimensions setSeriesName(String seriesName); + + OptionEncodeVisualDimensions setSeriesName(String[] seriesName); + + OptionEncodeVisualDimensions setItemGroupId(Number itemGroupId); + + OptionEncodeVisualDimensions setItemGroupId(Number[] itemGroupId); + + OptionEncodeVisualDimensions setItemGroupId(String itemGroupId); + + OptionEncodeVisualDimensions setItemGroupId(String[] itemGroupId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/RoamOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/RoamOptionMixin.java new file mode 100644 index 0000000..9c5aff0 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/RoamOptionMixin.java @@ -0,0 +1,17 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/566ba8e83dd283ba359fe9aceee0d4a12dbcd6c7/src/util/types.ts#L921 + */ +public interface RoamOptionMixin { + + RoamOptionMixin setRoam(Boolean roam); + + RoamOptionMixin setRoam(String roam); + + RoamOptionMixin setCenter(Number[] center); + + RoamOptionMixin setZoom(Number zoom); + + RoamOptionMixin setScaleLimit(Object scaleLimit); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesEncodeOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesEncodeOptionMixin.java new file mode 100644 index 0000000..6aadd08 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesEncodeOptionMixin.java @@ -0,0 +1,21 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1711 + */ +public interface SeriesEncodeOptionMixin { + + SeriesEncodeOptionMixin setDatasetIndex(Number datasetIndex); + + SeriesEncodeOptionMixin setDatasetId(Number datasetId); + + SeriesEncodeOptionMixin setDatasetId(String datasetId); + + SeriesEncodeOptionMixin setSeriesLayoutBy(Object seriesLayoutBy); + + SeriesEncodeOptionMixin setSourceHeader(Object sourceHeader); + + SeriesEncodeOptionMixin setDimensions(Object[] dimensions); + + SeriesEncodeOptionMixin setEncode(OptionEncode encode); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLabelOption.java new file mode 100644 index 0000000..e6171b2 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLabelOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1119 + */ +public interface SeriesLabelOption extends LabelOption { + + SeriesLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLargeOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLargeOptionMixin.java new file mode 100644 index 0000000..6c9c028 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLargeOptionMixin.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/util/types.ts#L1697 + */ +public interface SeriesLargeOptionMixin { + + SeriesLargeOptionMixin setLarge(Boolean large); + + SeriesLargeOptionMixin setLargeThreshold(Number largeThreshold); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLineLabelOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLineLabelOption.java new file mode 100644 index 0000000..bdddae1 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesLineLabelOption.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1160 + */ +public interface SeriesLineLabelOption extends LineLabelOption { + + SeriesLineLabelOption setFormatter(String formatter); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCalendarOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCalendarOptionMixin.java new file mode 100644 index 0000000..ddb1446 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCalendarOptionMixin.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/util/types.ts#L1692 + */ +public interface SeriesOnCalendarOptionMixin { + + SeriesOnCalendarOptionMixin setCalendarIndex(Number calendarIndex); + + SeriesOnCalendarOptionMixin setCalendarId(String calendarId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCartesianOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCartesianOptionMixin.java new file mode 100644 index 0000000..5c35d8e --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnCartesianOptionMixin.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1669 + */ +public interface SeriesOnCartesianOptionMixin { + + SeriesOnCartesianOptionMixin setXAxisIndex(Number xAxisIndex); + + SeriesOnCartesianOptionMixin setYAxisIndex(Number yAxisIndex); + + SeriesOnCartesianOptionMixin setXAxisId(String xAxisId); + + SeriesOnCartesianOptionMixin setYAxisId(String yAxisId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnGeoOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnGeoOptionMixin.java new file mode 100644 index 0000000..bb500ee --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnGeoOptionMixin.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/util/types.ts#L1687 + */ +public interface SeriesOnGeoOptionMixin { + + SeriesOnGeoOptionMixin setGeoIndex(Number geoIndex); + + SeriesOnGeoOptionMixin setGeoId(String geoId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnPolarOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnPolarOptionMixin.java new file mode 100644 index 0000000..7cfa5b3 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnPolarOptionMixin.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1677 + */ +public interface SeriesOnPolarOptionMixin { + + SeriesOnPolarOptionMixin setPolarIndex(Number polarIndex); + + SeriesOnPolarOptionMixin setPolarId(String polarId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnSingleOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnSingleOptionMixin.java new file mode 100644 index 0000000..cb33e57 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOnSingleOptionMixin.java @@ -0,0 +1,11 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/1277d7ae81f2b1c7ede4e1731820a1c06bd16cf0/src/util/types.ts#L1682 + */ +public interface SeriesOnSingleOptionMixin { + + SeriesOnSingleOptionMixin setSingleAxisIndex(Number singleAxisIndex); + + SeriesOnSingleOptionMixin setSingleAxisId(String singleAxisId); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOption.java new file mode 100644 index 0000000..013d759 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesOption.java @@ -0,0 +1,61 @@ +package org.icepear.echarts.origin.util; + +import java.util.Map; + +import org.icepear.echarts.origin.export.SeriesInjectedOption; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1587 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/export/option.ts#L181 + */ +public interface SeriesOption extends ComponentOption, AnimationOptionMixin, ColorPaletteOptionMixin, StatesOptionMixin, + SeriesInjectedOption { + + SeriesOption setMainType(String mainType); + + SeriesOption setSilent(Boolean silent); + + SeriesOption setBlendMode(String blendMode); + + SeriesOption setCursor(String cursor); + + SeriesOption setDataGroupId(Number dataGroupId); + + SeriesOption setDataGroupId(String dataGroupId); + + SeriesOption setData(Object data); + + SeriesOption setColorBy(String colorBy); + + SeriesOption setLegendHoverLink(Boolean legendHoverLink); + + SeriesOption setProgressive(Boolean progressive); + + SeriesOption setProgressive(Number progressive); + + SeriesOption setProgressiveThreshold(Number progressiveThreshold); + + SeriesOption setProgressiveChunkMode(String progressiveChunkMode); + + SeriesOption setCoordinateSystem(String coordinateSystem); + + SeriesOption setHoverLayerThreshold(Number hoverLayerThreshold); + + SeriesOption setSeriesLayoutBy(String seriesLayoutBy); + + SeriesOption setLabelLine(LabelLineOption labelLine); + + SeriesOption setLabelLayout(LabelLayoutOption labelLayout); + + SeriesOption setStateAnimation(Object stateAnimation); + + SeriesOption setUniversalTransition(Boolean universalTransition); + + SeriesOption setUniversalTransition(Object universalTransition); + + SeriesOption setSelectedMap(Map selectedMap); + + SeriesOption setSelectedMode(Boolean selectedMode); + + SeriesOption setSelectedMode(String selectedMode); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesSamplingOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesSamplingOptionMixin.java new file mode 100644 index 0000000..4513292 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesSamplingOptionMixin.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1707 + */ +public interface SeriesSamplingOptionMixin { + + SeriesSamplingOptionMixin setSampling(String sampling); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesStackOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesStackOptionMixin.java new file mode 100644 index 0000000..4b2a768 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SeriesStackOptionMixin.java @@ -0,0 +1,9 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1701 + */ +public interface SeriesStackOptionMixin { + + SeriesStackOptionMixin setStack(String stack); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/ShadowOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ShadowOptionMixin.java new file mode 100644 index 0000000..029fcec --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/ShadowOptionMixin.java @@ -0,0 +1,15 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L841 + */ +public interface ShadowOptionMixin { + + ShadowOptionMixin setShadowBlur(Number shadowBlur); + + ShadowOptionMixin setShadowColor(String shadowColor); + + ShadowOptionMixin setShadowOffsetX(Number shadowOffsetX); + + ShadowOptionMixin setShadowOffsetY(Number shadowOffsetY); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/StatesOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/StatesOptionMixin.java new file mode 100644 index 0000000..b28613d --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/StatesOptionMixin.java @@ -0,0 +1,13 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1534 + */ +public interface StatesOptionMixin { + + StatesOptionMixin setEmphasis(Object emphasis); + + StatesOptionMixin setSelect(Object select); + + StatesOptionMixin setBlur(Object blur); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/SymbolOptionMixin.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SymbolOptionMixin.java new file mode 100644 index 0000000..58f2086 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/SymbolOptionMixin.java @@ -0,0 +1,25 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L950 + */ +public interface SymbolOptionMixin { + + SymbolOptionMixin setSymbol(String symbol); + + SymbolOptionMixin setSymbolSize(Number symbolSize); + + SymbolOptionMixin setSymbolSize(Number[] symbolSize); + + SymbolOptionMixin setSymbolRotate(Number symbolRotate); + + SymbolOptionMixin setSymbolKeepAspect(Boolean symbolKeepAspect); + + SymbolOptionMixin setSymbolOffset(Number symbolOffset); + + SymbolOptionMixin setSymbolOffset(Number[] symbolOffset); + + SymbolOptionMixin setSymbolOffset(String symbolOffset); + + SymbolOptionMixin setSymbolOffset(String[] symbolOffset); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/TextCommonOption.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/TextCommonOption.java new file mode 100644 index 0000000..358f470 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/TextCommonOption.java @@ -0,0 +1,73 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1044 + */ +public interface TextCommonOption extends ShadowOptionMixin { + + TextCommonOption setColor(String color); + + TextCommonOption setFontStyle(String fontStyle); + + TextCommonOption setFontWeight(String fontWeight); + + TextCommonOption setFontFamily(String fontFamily); + + TextCommonOption setFontSize(Number fontSize); + + TextCommonOption setFontSize(String fontSize); + + TextCommonOption setAlign(String align); + + TextCommonOption setVerticalAlign(String verticalAlign); + + TextCommonOption setBaseline(String baseline); + + TextCommonOption setOpacity(Number opacity); + + TextCommonOption setLineHeight(Number lineHeight); + + TextCommonOption setBackgroundColor(Object backgroundColor); + + TextCommonOption setBackgroundColor(String backgroundColor); + + TextCommonOption setBorderColor(String borderColor); + + TextCommonOption setBorderWidth(Number borderWidth); + + TextCommonOption setBorderType(String borderType); + + TextCommonOption setBorderDashOffset(Number borderDashOffset); + + TextCommonOption setBorderRadius(Number borderRadius); + + TextCommonOption setBorderRadius(Number[] borderRadius); + + TextCommonOption setPadding(Number padding); + + TextCommonOption setPadding(Number[] padding); + + TextCommonOption setWidth(Number width); + + TextCommonOption setWidth(String width); + + TextCommonOption setHeight(Number height); + + TextCommonOption setTextBorderColor(String textBorderColor); + + TextCommonOption setTextBorderWidth(Number textBorderWidth); + + TextCommonOption setTextBorderType(String textBorderType); + + TextCommonOption setTextBorderDashOffset(Number textBorderDashOffset); + + TextCommonOption setTextShadowBlur(Number textShadowBlur); + + TextCommonOption setTextShadowColor(String textShadowColor); + + TextCommonOption setTextShadowOffsetX(Number textShadowOffsetX); + + TextCommonOption setTextShadowOffsetY(Number textShadowOffsetY); + + TextCommonOption setTag(String tag); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/origin/util/VisualOptionUnit.java b/youchain-system/src/main/java/org/icepear/echarts/origin/util/VisualOptionUnit.java new file mode 100644 index 0000000..2f463e7 --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/origin/util/VisualOptionUnit.java @@ -0,0 +1,28 @@ +package org.icepear.echarts.origin.util; + +/** + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1005 + * https://github.com/apache/echarts/blob/790687df55a5dbe286e52cf182c0983938efd367/src/util/types.ts#L1025 + */ +public interface VisualOptionUnit { + + VisualOptionUnit setSymbol(String symbol); + + VisualOptionUnit setSymbolSize(Number symbolSize); + + VisualOptionUnit setColor(String color); + + VisualOptionUnit setColorAlpha(Number colorAlpha); + + VisualOptionUnit setOpacity(Number opacity); + + VisualOptionUnit setColorLightness(Number colorLightness); + + VisualOptionUnit setColorSaturation(Number colorSaturation); + + VisualOptionUnit setColorHue(Number colorHue); + + VisualOptionUnit setDecal(DecalObject decal); + + VisualOptionUnit setLiftZ(Number liftZ); +} diff --git a/youchain-system/src/main/java/org/icepear/echarts/render/ChartMeta.java b/youchain-system/src/main/java/org/icepear/echarts/render/ChartMeta.java new file mode 100644 index 0000000..e2e3fab --- /dev/null +++ b/youchain-system/src/main/java/org/icepear/echarts/render/ChartMeta.java @@ -0,0 +1,16 @@ +package org.icepear.echarts.render; + +import lombok.Data; + +@Data +public class ChartMeta { + private String height; + private String width; + private String option; + + public ChartMeta(String height, String width, String option) { + this.height = height; + this.width = width; + this.option = option; + } +} diff --git a/youchain-system/src/main/resources/banner.txt b/youchain-system/src/main/resources/banner.txt new file mode 100644 index 0000000..22171df --- /dev/null +++ b/youchain-system/src/main/resources/banner.txt @@ -0,0 +1,8 @@ + + ██╗ ██╗ ██████╗ ██╗ ██╗ ██████╗██╗ ██╗ █████╗ ██╗███╗ ██╗ + ╚██╗ ██╔╝██╔═══██╗██║ ██║██╔════╝██║ ██║██╔══██╗██║████╗ ██║ + ╚████╔╝ ██║ ██║██║ ██║██║ ███████║███████║██║██╔██╗ ██║ + ╚██╔╝ ██║ ██║██║ ██║██║ ██╔══██║██╔══██║██║██║╚██╗██║ + ██║ ╚██████╔╝╚██████╔╝╚██████╗██║ ██║██║ ██║██║██║ ╚████║ + ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ + diff --git a/youchain-system/src/main/resources/config/application-dev.yml b/youchain-system/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000..80aca02 --- /dev/null +++ b/youchain-system/src/main/resources/config/application-dev.yml @@ -0,0 +1,126 @@ +#配置数据源 +spring: + datasource: + druid: + db-type: com.alibaba.druid.pool.DruidDataSource + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + url: jdbc:log4jdbc:mysql://${DB_HOST:139.196.165.224}:${DB_PORT:53306}/${DB_NAME:huanyuankams}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false + username: ${DB_USER:root} + password: ${DB_PWD:Youchain@56} + # 初始连接数 139.196.165.224 kams4_prod huanyuankams 47.103.100.52 + initial-size: 5 + # 最小连接数 + min-idle: 15 + # 最大连接数 + max-active: 30 + # 超时时间(以秒数为单位) + remove-abandoned-timeout: 30000 + # 获取连接超时时间 + max-wait: 30000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 60000 + # 连接在池中最小生存的时间 + min-evictable-idle-time-millis: 300000 + # 连接在池中最大生存的时间 + max-evictable-idle-time-millis: 900000 + # 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除 + test-while-idle: true + # 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个 + test-on-borrow: true + # 是否在归还到池中前进行检验 + test-on-return: false + # 检测连接是否有效 + validation-query: select 1 + # 配置监控统计 + webStatFilter: + enabled: true + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + filter: + stat: + enabled: true + # 记录慢SQL + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + +# 登录相关配置 +login: + # 是否限制单用户登录 + single-login: false + # Redis用户登录缓存配置 + user-cache: + # 存活时间/秒 + idle-time: 7200 + # 验证码 + login-code: + # 验证码类型配置 查看 LoginProperties 类 + code-type: arithmetic + # 登录图形验证码有效时间/分钟 + expiration: 2 + # 验证码高度 + width: 111 + # 验证码宽度 + height: 36 + # 内容长度 + length: 2 + # 字体名称,为空则使用默认字体 + font-name: + # 字体大小 + font-size: 25 + +#jwt +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html + token-validity-in-seconds: 14400000 + # 在线用户key + online-key: online-token- + # 验证码 + code-key: code-key- + # token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 + detect: 7200000 + # 续期时间范围,默认1小时,单位毫秒 + renew: 3600000 + +#是否允许生成代码,生产环境设置为false +generator: + enabled: true + +#是否开启 swagger-ui +swagger: + enabled: true + +# IP 本地解析 +ip: + local-parsing: true + +# 文件存储路径 +file: + mac: + path: ~/file/ + avatar: ~/avatar/ + linux: + path: /home/eladmin/file/ + avatar: /home/eladmin/avatar/ + windows: + path: C:\eladmin\file\ + avatar: C:\eladmin\avatar\ + # 文件大小 /M + maxSize: 200 + avatarMaxSize: 5 +minidao: + base-package: org.jeecg.modules.jmreport.desreport.dao* + db-type: mysql +task: + onOff: + zCJXBTask: true diff --git a/youchain-system/src/main/resources/config/application-prod.yml b/youchain-system/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000..6232ff9 --- /dev/null +++ b/youchain-system/src/main/resources/config/application-prod.yml @@ -0,0 +1,135 @@ +#配置数据源 +spring: + datasource: + druid: + db-type: com.alibaba.druid.pool.DruidDataSource + driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:53306}/${DB_NAME:kams4_prod}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false + username: ${DB_USER:root} + password: ${DB_PWD:Youchain@56} + # 初始连接数 + initial-size: 5 + # 最小连接数 + min-idle: 15 + # 最大连接数 + max-active: 30 + # 获取连接超时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 60000 + # 连接在池中最小生存的时间 + min-evictable-idle-time-millis: 300000 + # 连接在池中最大生存的时间 + max-evictable-idle-time-millis: 900000 + # 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除 + test-while-idle: true + # 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个 + test-on-borrow: true + # 是否在归还到池中前进行检验 + test-on-return: false + # 检测连接是否有效 + validation-query: select 1 + # 配置监控统计 + webStatFilter: + enabled: true + stat-view-servlet: + allow: + enabled: true + # 控制台管理用户名和密码 + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + # 记录慢SQL + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + +# 登录相关配置 +login: + # 是否限制单用户登录 + single-login: false + # Redis用户登录缓存配置 + user-cache: + # 存活时间/秒 + idle-time: 7200 + # 验证码 + login-code: + # 验证码类型配置 查看 LoginProperties 类 + code-type: arithmetic + # 登录图形验证码有效时间/分钟 + expiration: 2 + # 验证码高度 + width: 111 + # 验证码宽度 + height: 36 + # 内容长度 + length: 2 + # 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可 + font-name: + # 字体大小 + font-size: 25 + +#jwt +jwt: + header: Authorization + # 令牌前缀 + token-start-with: Bearer + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html + token-validity-in-seconds: 7200000 + # 在线用户key + online-key: online-token- + # 验证码 + code-key: code-key- + # token 续期检查时间范围(默认30分钟,单位默认毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 + detect: 1800000 + # 续期时间范围,默认 1小时,这里单位毫秒 + renew: 3600000 + +# IP 本地解析 +ip: + local-parsing: true + +#是否允许生成代码,生产环境设置为false +generator: + enabled: false + +#如果生产环境要开启swagger,需要配置请求地址 +#springfox: +# documentation: +# swagger: +# v2: +# host: # 接口域名或外网ip + +#是否开启 swagger-ui +swagger: + enabled: false + +# 文件存储路径 +file: + mac: + path: ~/file/ + avatar: ~/avatar/ + linux: + path: /home/eladmin/file/ + avatar: /home/eladmin/avatar/ + windows: + path: C:\eladmin\file\ + avatar: C:\eladmin\avatar\ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 +minidao: + base-package: org.jeecg.modules.jmreport.desreport.dao* + db-type: mysql +task: + onOff: + zCJXBTask: true diff --git a/youchain-system/src/main/resources/config/application.yml b/youchain-system/src/main/resources/config/application.yml new file mode 100644 index 0000000..75f23a5 --- /dev/null +++ b/youchain-system/src/main/resources/config/application.yml @@ -0,0 +1,81 @@ +server: + port: 8000 +# port: 8000 +spring: + main: + allow-circular-references: true + freemarker: + check-template-location: false + profiles: + #active: prod + active: dev + jackson: + time-zone: GMT+8 + data: + redis: + repositories: + enabled: false +# pid: +# file: /自行指定位置/eladmin.pid + + #配置 Jpa + jpa: + show-sql: false + hibernate: + ddl-auto: none + open-in-view: true + properties: + hibernate: + dialect: org.hibernate.dialect.MySQL5InnoDBDialect + + + redis: + #数据库索引 + database: ${REDIS_DB:1} +# database: ${REDIS_DB:2} +# host: ${REDIS_HOST:47.100.54.81} + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} +# port: ${REDIS_PORT:6380} + password: ${REDIS_PWD:} +# password: ${REDIS_PWD:123abc} + #连接超时时间 + timeout: 5000 + +task: + pool: + # 核心线程池大小 + core-pool-size: 10 + # 最大线程数 + max-pool-size: 30 + # 活跃时间 + keep-alive-seconds: 60 + # 队列容量 + queue-capacity: 50 +netty: + # boss线程数量 + boss: 4 + # worker线程数量 + worker: 2 + # 连接超时时间 + timeout: 6000 + # 服务器主端口 + port: 8502 + # 服务器备用端口 + portSalve: 8503 + # 服务器地址 + host: 47.100.54.81 + +#七牛云 +qiniu: + # 文件大小 /M + max-size: 15 + +#邮箱验证码有效时间/秒 +code: + expiration: 300 + +#密码加密传输,前端公钥加密,后端私钥解密 +rsa: + private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== + licenseKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxZQwZ6yk55wG10wn1Id34avNXV2VHf4tHM2zRolkfbOKHDRCiv32zMfELIIW91CtzB+1X/u1+3CDl2hDuYPphqLukTyp/1rKoLRoVYnWu2Ti2L+6tiwZMc5AfylAponRA/tSa3ttk+5DebaPOIk9iUTMmDpMR3SBwHGFacU6qWCR1mKxiOk78OL9nC/r24XzfvmWjvcbXs7If9F5ND2VS9e5WeOv6yMFuXSh/V5qZAkyDbEV76Tto21nLuNFLUD3iNcUYeyrns8D9UAIdDtp4sUvIADBnWlVtXNt+68a8BnlYptvpW9m0MCJZlmIzxAQY4RrpHnXF29yQB9AuPwjzwIDAQAB diff --git a/youchain-system/src/main/resources/generator.properties b/youchain-system/src/main/resources/generator.properties new file mode 100644 index 0000000..2ed9370 --- /dev/null +++ b/youchain-system/src/main/resources/generator.properties @@ -0,0 +1,27 @@ +#数据库类型转Java类型 +tinyint=Integer +smallint=Integer +mediumint=Integer +int=Integer +integer=Integer + +bigint=Long + +float=Float + +double=Double + +decimal=BigDecimal + +bit=Boolean + +char=String +varchar=String +tinytext=String +text=String +mediumtext=String +longtext=String + +date=Timestamp +datetime=Timestamp +timestamp=Timestamp \ No newline at end of file diff --git a/youchain-system/src/main/resources/log4jdbc.log4j2.properties b/youchain-system/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..302525f --- /dev/null +++ b/youchain-system/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,4 @@ +# If you use SLF4J. First, you need to tell log4jdbc-log4j2 that you want to use the SLF4J logger +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.auto.load.popular.drivers=false +log4jdbc.drivers=com.mysql.cj.jdbc.Driver \ No newline at end of file diff --git a/youchain-system/src/main/resources/logback.xml b/youchain-system/src/main/resources/logback.xml new file mode 100644 index 0000000..3f8f9d8 --- /dev/null +++ b/youchain-system/src/main/resources/logback.xml @@ -0,0 +1,45 @@ + + + elAdmin + + + + + + + ${log.pattern} + ${log.charset} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/email/email.ftl b/youchain-system/src/main/resources/template/email/email.ftl new file mode 100644 index 0000000..606d490 --- /dev/null +++ b/youchain-system/src/main/resources/template/email/email.ftl @@ -0,0 +1,48 @@ + + + + + + + +
+
+

尊敬的用户,您好:

+

您正在申请邮箱验证,您的验证码为:

+

${code}

+
+
+
+ Copyright ©${.now?string("yyyy")} ELADMIN 后台管理系统 All Rights Reserved. +
+ +
+
+ + diff --git a/youchain-system/src/main/resources/template/email/taskAlarm.ftl b/youchain-system/src/main/resources/template/email/taskAlarm.ftl new file mode 100644 index 0000000..a29b078 --- /dev/null +++ b/youchain-system/src/main/resources/template/email/taskAlarm.ftl @@ -0,0 +1,69 @@ + + + + + + + +
+
+

任务信息:

+ + + + + + + + + + + + + + + + + +
任务名称Bean名称执行方法参数内容Cron表达式描述内容
${task.jobName}${task.beanName}${task.methodName}${(task.params)!""}${task.cronExpression}${(task.description)!""}
+
+
+

异常信息:

+
+                ${msg}
+            
+
+
+
+
+ Copyright ©${.now?string("yyyy")} ELADMIN 后台管理系统 All Rights Reserved. +
+ +
+ + + diff --git a/youchain-system/src/main/resources/template/generator/admin/Controller.ftl b/youchain-system/src/main/resources/template/generator/admin/Controller.ftl new file mode 100644 index 0000000..f149c93 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Controller.ftl @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.rest; + +import com.youchain.annotation.Log; +import ${package}.domain.${className}; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}QueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author ${author} +* @date ${date} +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "${apiAlias}管理") +@RequestMapping("/api/${changeClassName}") +public class ${className}Controller { + + private final ${className}Service ${changeClassName}Service; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('${changeClassName}:list')") + public void export${className}(HttpServletResponse response, ${className}QueryCriteria criteria) throws Exception { + ${changeClassName}Service.download(${changeClassName}Service.queryAll(criteria), response); + } + + @GetMapping + @Log("查询${apiAlias}") + @ApiOperation("查询${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:list')") + public ResponseEntity query${className}(${className}QueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增${apiAlias}") + @ApiOperation("新增${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:add')") + public ResponseEntity create${className}(@Validated @RequestBody ${className} resources){ + return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改${apiAlias}") + @ApiOperation("修改${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:edit')") + public ResponseEntity update${className}(@Validated @RequestBody ${className} resources){ + ${changeClassName}Service.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除${apiAlias}") + @ApiOperation("删除${apiAlias}") + @PreAuthorize("@el.check('${changeClassName}:del')") + public ResponseEntity delete${className}(@RequestBody ${pkColumnType}[] ids) { + ${changeClassName}Service.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/Dto.ftl b/youchain-system/src/main/resources/template/generator/admin/Dto.ftl new file mode 100644 index 0000000..ac81d98 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Dto.ftl @@ -0,0 +1,54 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if hasTimestamp> +import java.sql.Timestamp; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import java.io.Serializable; +<#if !auto && pkColumnType = 'Long'> +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.serializer.ToStringSerializer; + + +/** +* @website https://eladmin.vip +* @description / +* @author ${author} +* @date ${date} +**/ +@Data +public class ${className}Dto implements Serializable { +<#if columns??> + <#list columns as column> + + <#if column.remark != ''> + /** ${column.remark} */ + + <#if column.columnKey = 'PRI'> + <#if !auto && pkColumnType = 'Long'> + /** 防止精度丢失 */ + @JSONField(serializeUsing = ToStringSerializer.class) + + + private ${column.columnType} ${column.changeColumnName}; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/Entity.ftl b/youchain-system/src/main/resources/template/generator/admin/Entity.ftl new file mode 100644 index 0000000..5129d2a --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Entity.ftl @@ -0,0 +1,86 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +<#if isNotNullColumns??> +import javax.validation.constraints.*; + +<#if hasDateAnnotation> +import javax.persistence.Entity; +import com.youchain.base.BaseEntity; +import javax.persistence.Table; +import org.hibernate.annotations.*; + +<#if hasTimestamp> +import java.sql.Timestamp; + +<#if hasBigDecimal> +import java.math.BigDecimal; + +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author ${author} +* @date ${date} +**/ +@Entity +@Data +@Table(name="${tableName}") +public class ${className} extends BaseEntity implements Serializable { +<#if columns??> + <#list columns as column> + + <#if column.columnKey = 'PRI'> + @Id + <#if auto> + @GeneratedValue(strategy = GenerationType.IDENTITY) + + + @Column(name = "`${column.columnName}`"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) + <#if column.istNotNull && column.columnKey != 'PRI'> + <#if column.columnType = 'String'> + @NotBlank + <#else> + @NotNull + + + <#if (column.dateAnnotation)?? && column.dateAnnotation != ''> + <#if column.dateAnnotation = 'CreationTimestamp'> + @CreationTimestamp + <#else> + @UpdateTimestamp + + + <#if column.remark != ''> + @ApiModelProperty(value = "${column.remark}") + <#else> + @ApiModelProperty(value = "${column.changeColumnName}") + + private ${column.columnType} ${column.changeColumnName}; + + + + public void copy(${className} source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/resources/template/generator/admin/Mapper.ftl b/youchain-system/src/main/resources/template/generator/admin/Mapper.ftl new file mode 100644 index 0000000..60db4e1 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Mapper.ftl @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.service.mapstruct; + +import com.youchain.base.BaseMapper; +import ${package}.domain.${className}; +import ${package}.service.dto.${className}Dto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author ${author} +* @date ${date} +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ${className}Mapper extends BaseMapper<${className}Dto, ${className}> { + +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/QueryCriteria.ftl b/youchain-system/src/main/resources/template/generator/admin/QueryCriteria.ftl new file mode 100644 index 0000000..3a79aad --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/QueryCriteria.ftl @@ -0,0 +1,81 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.service.dto; + +import lombok.Data; +<#if queryHasTimestamp> +import java.sql.Timestamp; + +<#if queryHasBigDecimal> +import java.math.BigDecimal; + +<#if betweens??> +import java.util.List; + +<#if queryColumns??> +import com.youchain.annotation.Query; + + +/** +* @website https://eladmin.vip +* @author ${author} +* @date ${date} +**/ +@Data +public class ${className}QueryCriteria{ +<#if queryColumns??> + <#list queryColumns as column> + +<#if column.queryType = '='> + /** 精确 */ + @Query + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'Like'> + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '!='> + /** 不等于 */ + @Query(type = Query.Type.NOT_EQUAL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = 'NotNull'> + /** 不为空 */ + @Query(type = Query.Type.NOT_NULL) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '>='> + /** 大于等于 */ + @Query(type = Query.Type.GREATER_THAN) + private ${column.columnType} ${column.changeColumnName}; + +<#if column.queryType = '<='> + /** 小于等于 */ + @Query(type = Query.Type.LESS_THAN) + private ${column.columnType} ${column.changeColumnName}; + + + +<#if betweens??> + <#list betweens as column> + /** BETWEEN */ + @Query(type = Query.Type.BETWEEN) + private List<${column.columnType}> ${column.changeColumnName}; + + +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/Repository.ftl b/youchain-system/src/main/resources/template/generator/admin/Repository.ftl new file mode 100644 index 0000000..dac1e92 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Repository.ftl @@ -0,0 +1,40 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.repository; + +import ${package}.domain.${className}; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author ${author} +* @date ${date} +**/ +public interface ${className}Repository extends JpaRepository<${className}, ${pkColumnType}>, JpaSpecificationExecutor<${className}> { +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + /** + * 根据 ${column.capitalColumnName} 查询 + * @param ${column.columnName} / + * @return / + */ + ${className} findBy${column.capitalColumnName}(${column.columnType} ${column.columnName}); + + + +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/Service.ftl b/youchain-system/src/main/resources/template/generator/admin/Service.ftl new file mode 100644 index 0000000..1821cd1 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/Service.ftl @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.service; + +import ${package}.domain.${className}; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author ${author} +* @date ${date} +**/ +public interface ${className}Service { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(${className}QueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List<${className}Dto> + */ + List<${className}Dto> queryAll(${className}QueryCriteria criteria); + + /** + * 根据ID查询 + * @param ${pkChangeColName} ID + * @return ${className}Dto + */ + ${className}Dto findById(${pkColumnType} ${pkChangeColName}); + + /** + * 创建 + * @param resources / + * @return ${className}Dto + */ + ${className}Dto create(${className} resources); + + /** + * 编辑 + * @param resources / + */ + void update(${className} resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(${pkColumnType}[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List<${className}Dto> all, HttpServletResponse response) throws Exception; +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/admin/ServiceImpl.ftl b/youchain-system/src/main/resources/template/generator/admin/ServiceImpl.ftl new file mode 100644 index 0000000..9aac1ff --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/admin/ServiceImpl.ftl @@ -0,0 +1,157 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package ${package}.service.impl; + +import ${package}.domain.${className}; +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + <#if column_index = 1> +import EntityExistException; + + + + +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import ${package}.repository.${className}Repository; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}Dto; +import ${package}.service.dto.${className}QueryCriteria; +import ${package}.service.mapstruct.${className}Mapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +<#if !auto && pkColumnType = 'Long'> +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.IdUtil; + +<#if !auto && pkColumnType = 'String'> +import cn.hutool.core.util.IdUtil; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author ${author} +* @date ${date} +**/ +@Service +@RequiredArgsConstructor +public class ${className}ServiceImpl implements ${className}Service { + + private final ${className}Repository ${changeClassName}Repository; + private final ${className}Mapper ${changeClassName}Mapper; + + @Override + public Map queryAll(${className}QueryCriteria criteria, Pageable pageable){ + Page<${className}> page = ${changeClassName}Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(${changeClassName}Mapper::toDto)); + } + + @Override + public List<${className}Dto> queryAll(${className}QueryCriteria criteria){ + return ${changeClassName}Mapper.toDto(${changeClassName}Repository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public ${className}Dto findById(${pkColumnType} ${pkChangeColName}) { + ${className} ${changeClassName} = ${changeClassName}Repository.findById(${pkChangeColName}).orElseGet(${className}::new); + ValidationUtil.isNull(${changeClassName}.get${pkCapitalColName}(),"${className}","${pkChangeColName}",${pkChangeColName}); + return ${changeClassName}Mapper.toDto(${changeClassName}); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ${className}Dto create(${className} resources) { +<#if !auto && pkColumnType = 'Long'> + Snowflake snowflake = IdUtil.createSnowflake(1, 1); + resources.set${pkCapitalColName}(snowflake.nextId()); + +<#if !auto && pkColumnType = 'String'> + resources.set${pkCapitalColName}(IdUtil.simpleUUID()); + +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + if(${changeClassName}Repository.findBy${column.capitalColumnName}(resources.get${column.capitalColumnName}()) != null){ + throw new EntityExistException(${className}.class,"${column.columnName}",resources.get${column.capitalColumnName}()); + } + + + + return ${changeClassName}Mapper.toDto(${changeClassName}Repository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(${className} resources) { + ${className} ${changeClassName} = ${changeClassName}Repository.findById(resources.get${pkCapitalColName}()).orElseGet(${className}::new); + ValidationUtil.isNull( ${changeClassName}.get${pkCapitalColName}(),"${className}","id",resources.get${pkCapitalColName}()); +<#if columns??> + <#list columns as column> + <#if column.columnKey = 'UNI'> + <#if column_index = 1> + ${className} ${changeClassName}1 = null; + + ${changeClassName}1 = ${changeClassName}Repository.findBy${column.capitalColumnName}(resources.get${column.capitalColumnName}()); + if(${changeClassName}1 != null && !${changeClassName}1.get${pkCapitalColName}().equals(${changeClassName}.get${pkCapitalColName}())){ + throw new EntityExistException(${className}.class,"${column.columnName}",resources.get${column.capitalColumnName}()); + } + + + + ${changeClassName}.copy(resources); + ${changeClassName}Repository.save(${changeClassName}); + } + + @Override + public void deleteAll(${pkColumnType}[] ids) { + for (${pkColumnType} ${pkChangeColName} : ids) { + ${changeClassName}Repository.deleteById(${pkChangeColName}); + } + } + + @Override + public void download(List<${className}Dto> all, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (${className}Dto ${changeClassName} : all) { + Map map = new LinkedHashMap<>(); + <#list columns as column> + <#if column.columnKey != 'PRI'> + <#if column.remark != ''> + map.put("${column.remark}", ${changeClassName}.get${column.capitalColumnName}()); + <#else> + map.put(" ${column.changeColumnName}", ${changeClassName}.get${column.capitalColumnName}()); + + + + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/resources/template/generator/front/api.ftl b/youchain-system/src/main/resources/template/generator/front/api.ftl new file mode 100644 index 0000000..9587d0d --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/front/api.ftl @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/${changeClassName}', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/${changeClassName}/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/${changeClassName}', + method: 'put', + data + }) +} + +export default { add, edit, del } diff --git a/youchain-system/src/main/resources/template/generator/front/index.ftl b/youchain-system/src/main/resources/template/generator/front/index.ftl new file mode 100644 index 0000000..3046c47 --- /dev/null +++ b/youchain-system/src/main/resources/template/generator/front/index.ftl @@ -0,0 +1,169 @@ +<#--noinspection ALL--> + + + + + diff --git a/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java b/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java new file mode 100644 index 0000000..ee2b181 --- /dev/null +++ b/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java @@ -0,0 +1,52 @@ +package com.youchain; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import java.util.ArrayList; +import java.util.List; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class EladminSystemApplicationTests { + + @Test + public void contextLoads() { + } + + public static void main(String[] args) { + } + + private static final int MAX_TASK_COUNT = 4; + private static final long TIMEOUT_MS = 600000; // 10分钟,以毫秒为单位 + private long lastTaskTime = System.currentTimeMillis(); + private List taskQueue = new ArrayList<>(MAX_TASK_COUNT); + + @Test + public void test(){ + List taskLists=new ArrayList<>(); + taskLists.add(1); + taskLists.add(2); + taskLists.add(3); + taskLists.add(4); + taskLists.add(5); + taskLists.add(6); + + for(Integer id:taskLists) { + try { + taskQueue.add(id); + if (taskQueue.size() >= MAX_TASK_COUNT) { + System.out.println("任务已满足,当前任务数:" + taskQueue.size()); + taskQueue.clear(); + lastTaskTime = System.currentTimeMillis(); + } else if (System.currentTimeMillis() - lastTaskTime >= TIMEOUT_MS) { + System.out.println("超过10分钟未满足4个任务,当前任务数:" + taskQueue.size()); + taskQueue.clear(); + lastTaskTime = System.currentTimeMillis(); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + System.out.println(id); + } + } +} + diff --git a/youchain-system/src/test/java/com/youchain/RedisTest.java b/youchain-system/src/test/java/com/youchain/RedisTest.java new file mode 100644 index 0000000..bfee5aa --- /dev/null +++ b/youchain-system/src/test/java/com/youchain/RedisTest.java @@ -0,0 +1,16 @@ +package com.youchain; + +import com.youchain.utils.RedisUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class RedisTest { + @Autowired + private RedisUtils redisUtils; + @Test + public void testDel(){ + redisUtils.del(); + } +} diff --git a/youchain-system/src/test/java/com/youchain/testMain.java b/youchain-system/src/test/java/com/youchain/testMain.java new file mode 100644 index 0000000..91dd84f --- /dev/null +++ b/youchain-system/src/test/java/com/youchain/testMain.java @@ -0,0 +1,38 @@ +package com.youchain; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.junit.jupiter.api.Test; + +public class testMain { + @Test + public static void main(String[] args) { + String resultJson="{\n" + + " \"data\": [\n" + + " {\n" + + " \"containerCode\": \"qht1188\",\n" + + " \"nodeCode\": \"MA1151-HBM02\",\n" + + " \"orientation\": \"-179.87\",\n" + + " \"containerModelCode\": \"JINGZHOU_qht_160\",\n" + + " \"emptyFullStatus\": 0,\n" + + " \"inMapStatus\": 0,\n" + + " \"isCarry\": 0,\n" + + " \"containerCheckCode\": \"qht1188\"\n" + + " }\n" + + " ],\n" + + " \"code\": \"0\",\n" + + " \"message\": null,\n" + + " \"success\": true\n" + + "}"; + JSONObject resulObject = JSON.parseObject(resultJson); + String code = resulObject.getString("code") == null ? "" : resulObject.getString("code"); + if(code.equals("0")){ + String data=resulObject.getString("data") == null ? "" : resulObject.getString("data"); + JSONArray jsonArray=JSON.parseArray(data); + JSONObject dataObject=JSON.parseObject(jsonArray.get(0).toString()); + String isCarry=dataObject.getString("isCarry") == null ? "" : dataObject.getString("isCarry"); + System.out.println(isCarry); + } + } +} diff --git a/youchain-system/youchain-system.iml b/youchain-system/youchain-system.iml new file mode 100644 index 0000000..8c54e3b --- /dev/null +++ b/youchain-system/youchain-system.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/youchain-tongyong/pom.xml b/youchain-tongyong/pom.xml new file mode 100644 index 0000000..a424c04 --- /dev/null +++ b/youchain-tongyong/pom.xml @@ -0,0 +1,40 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + youchain-tongyong + 通用模块 + + + + 0.11.2 + + 5.8.0 + + + + com.youchain + youchain-common + 2.6 + + + com.youchain + youchain-logging + 2.6 + compile + + + + + + + + + \ No newline at end of file diff --git a/youchain-tools/pom.xml b/youchain-tools/pom.xml new file mode 100644 index 0000000..a9aa60c --- /dev/null +++ b/youchain-tools/pom.xml @@ -0,0 +1,64 @@ + + + + youchain + com.youchain + 2.6 + + 4.0.0 + + youchain-tools + 工具模块 + + + 1.4.7 + 7.9.3 + 4.22.57.ALL + + + + + + com.youchain + youchain-logging + 2.6 + + + + + + + javax.mail + mail + ${mail.version} + + + + + com.qiniu + qiniu-java-sdk + ${qiniu.version} + + + + + com.alipay.sdk + alipay-sdk-java + ${alipay.version} + + + com.youchain + youchain-common + 2.6 + compile + + + com.youchain + youchain-logging + 2.6 + compile + + + diff --git a/youchain-tools/src/main/java/com/youchain/config/MultipartConfig.java b/youchain-tools/src/main/java/com/youchain/config/MultipartConfig.java new file mode 100644 index 0000000..63e8c8e --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/config/MultipartConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.config; + +import org.springframework.boot.web.servlet.MultipartConfigFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import javax.servlet.MultipartConfigElement; +import java.io.File; + +/** + * @date 2018-12-28 + * @author https://blog.csdn.net/llibin1024530411/article/details/79474953 + */ +@Configuration +public class MultipartConfig { + + /** + * 文件上传临时路径 + */ + @Bean + MultipartConfigElement multipartConfigElement() { + MultipartConfigFactory factory = new MultipartConfigFactory(); + String location = System.getProperty("user.home") + "/.eladmin/file/tmp"; + File tmpFile = new File(location); + if (!tmpFile.exists()) { + if (!tmpFile.mkdirs()) { + System.out.println("create was not successful."); + } + } + factory.setLocation(location); + return factory.createMultipartConfig(); + } +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/domain/AlipayConfig.java b/youchain-tools/src/main/java/com/youchain/domain/AlipayConfig.java new file mode 100644 index 0000000..a93cd04 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/AlipayConfig.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 支付宝配置类 + * @author Liu Xue + * @date 2018-12-31 + */ +@Data +@Entity +@Table(name = "tool_alipay_config") +public class AlipayConfig implements Serializable { + + @Id + @Column(name = "config_id") + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @NotBlank + @ApiModelProperty(value = "应用ID") + private String appId; + + @NotBlank + @ApiModelProperty(value = "商户私钥") + private String privateKey; + + @NotBlank + @ApiModelProperty(value = "支付宝公钥") + private String publicKey; + + @ApiModelProperty(value = "签名方式") + private String signType="RSA2"; + + @Column(name = "gateway_url") + @ApiModelProperty(value = "支付宝开放安全地址", hidden = true) + private String gatewayUrl = "https://openapi.alipaydev.com/gateway.do"; + + @ApiModelProperty(value = "编码", hidden = true) + private String charset= "utf-8"; + + @NotBlank + @ApiModelProperty(value = "异步通知地址") + private String notifyUrl; + + @NotBlank + @ApiModelProperty(value = "订单完成后返回的页面") + private String returnUrl; + + @ApiModelProperty(value = "类型") + private String format="JSON"; + + @NotBlank + @ApiModelProperty(value = "商户号") + private String sysServiceProviderId; + +} diff --git a/youchain-tools/src/main/java/com/youchain/domain/EmailConfig.java b/youchain-tools/src/main/java/com/youchain/domain/EmailConfig.java new file mode 100644 index 0000000..023bced --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/EmailConfig.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 邮件配置类,数据存覆盖式存入数据存 + * @author Liu Xue + * @date 2018-12-26 + */ +@Entity +@Data +@Table(name = "tool_email_config") +public class EmailConfig implements Serializable { + + @Id + @Column(name = "config_id") + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @NotBlank + @ApiModelProperty(value = "邮件服务器SMTP地址") + private String host; + + @NotBlank + @ApiModelProperty(value = "邮件服务器 SMTP 端口") + private String port; + + @NotBlank + @ApiModelProperty(value = "发件者用户名") + private String user; + + @NotBlank + @ApiModelProperty(value = "密码") + private String pass; + + @NotBlank + @ApiModelProperty(value = "收件人") + private String fromUser; +} diff --git a/youchain-tools/src/main/java/com/youchain/domain/LocalStorage.java b/youchain-tools/src/main/java/com/youchain/domain/LocalStorage.java new file mode 100644 index 0000000..4f889c3 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/LocalStorage.java @@ -0,0 +1,73 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.youchain.base.BaseEntity; +import javax.persistence.*; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Getter +@Setter +@Entity +@Table(name="tool_local_storage") +@NoArgsConstructor +public class LocalStorage extends BaseEntity implements Serializable { + + @Id + @Column(name = "storage_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ApiModelProperty(value = "真实文件名") + private String realName; + + @ApiModelProperty(value = "文件名") + private String name; + + @ApiModelProperty(value = "后缀") + private String suffix; + + @ApiModelProperty(value = "路径") + private String path; + + @ApiModelProperty(value = "类型") + private String type; + + @ApiModelProperty(value = "大小") + private String size; + + public LocalStorage(String realName,String name, String suffix, String path, String type, String size) { + this.realName = realName; + this.name = name; + this.suffix = suffix; + this.path = path; + this.type = type; + this.size = size; + } + + public void copy(LocalStorage source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/domain/QiniuConfig.java b/youchain-tools/src/main/java/com/youchain/domain/QiniuConfig.java new file mode 100644 index 0000000..e00accc --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/QiniuConfig.java @@ -0,0 +1,69 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 七牛云对象存储配置类 + * @author Liu Xue + * @date 2018-12-31 + */ +@Data +@Entity +@Table(name = "tool_qiniu_config") +public class QiniuConfig implements Serializable { + + @Id + @Column(name = "config_id") + @ApiModelProperty(value = "ID") + private Long id; + + @NotBlank + @ApiModelProperty(value = "accessKey") + private String accessKey; + + @NotBlank + @ApiModelProperty(value = "secretKey") + private String secretKey; + + @NotBlank + @ApiModelProperty(value = "存储空间名称作为唯一的 Bucket 识别符") + private String bucket; + + /** + * Zone表示与机房的对应关系 + * 华东 Zone.zone0() + * 华北 Zone.zone1() + * 华南 Zone.zone2() + * 北美 Zone.zoneNa0() + * 东南亚 Zone.zoneAs0() + */ + @NotBlank + @ApiModelProperty(value = "Zone表示与机房的对应关系") + private String zone; + + @NotBlank + @ApiModelProperty(value = "外链域名,可自定义,需在七牛云绑定") + private String host; + + @ApiModelProperty(value = "空间类型:公开/私有") + private String type = "公开"; +} diff --git a/youchain-tools/src/main/java/com/youchain/domain/QiniuContent.java b/youchain-tools/src/main/java/com/youchain/domain/QiniuContent.java new file mode 100644 index 0000000..0e55146 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/QiniuContent.java @@ -0,0 +1,64 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.annotations.UpdateTimestamp; +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * 上传成功后,存储结果 + * @author Liu Xue + * @date 2018-12-31 + */ +@Data +@Entity +@Table(name = "tool_qiniu_content") +public class QiniuContent implements Serializable { + + @Id + @Column(name = "content_id") + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "name") + @ApiModelProperty(value = "文件名") + private String key; + + @ApiModelProperty(value = "空间名") + private String bucket; + + @ApiModelProperty(value = "大小") + private String size; + + @ApiModelProperty(value = "文件地址") + private String url; + + @ApiModelProperty(value = "文件类型") + private String suffix; + + @ApiModelProperty(value = "空间类型:公开/私有") + private String type = "公开"; + + @UpdateTimestamp + @ApiModelProperty(value = "创建或更新时间") + @Column(name = "update_time") + private Timestamp updateTime; +} diff --git a/youchain-tools/src/main/java/com/youchain/domain/vo/EmailVo.java b/youchain-tools/src/main/java/com/youchain/domain/vo/EmailVo.java new file mode 100644 index 0000000..c74778a --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/vo/EmailVo.java @@ -0,0 +1,44 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * 发送邮件时,接收参数的类 + * @author 郑杰 + * @date 2018/09/28 12:02:14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class EmailVo { + + /** 收件人,支持多个收件人 */ + @NotEmpty + private List tos; + + @NotBlank + private String subject; + + @NotBlank + private String content; +} diff --git a/youchain-tools/src/main/java/com/youchain/domain/vo/TradeVo.java b/youchain-tools/src/main/java/com/youchain/domain/vo/TradeVo.java new file mode 100644 index 0000000..5650738 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/domain/vo/TradeVo.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import javax.validation.constraints.NotBlank; +import java.sql.Date; +import java.sql.Timestamp; + +/** + * 交易详情,按需应该存入数据库,这里存入数据库,仅供临时测试 + * @author Liu Xue + * @date 2018-12-31 + */ +@Data +public class TradeVo { + + /** (必填)商品描述 */ + @NotBlank + private String body; + + /** (必填)商品名称 */ + @NotBlank + private String subject; + + /** (必填)商户订单号,应该由后台生成 */ + @ApiModelProperty(hidden = true) + private String outTradeNo; + + /** (必填)第三方订单号 */ + @ApiModelProperty(hidden = true) + private String tradeNo; + + /** (必填)价格 */ + @NotBlank + private String totalAmount; + + /** 订单状态,已支付,未支付,作废 */ + @ApiModelProperty(hidden = true) + private String state; + + /** 创建时间,存入数据库时需要 */ + @ApiModelProperty(hidden = true) + private Timestamp createTime; + + /** 作废时间,存入数据库时需要 */ + @ApiModelProperty(hidden = true) + private Date cancelTime; +} diff --git a/youchain-tools/src/main/java/com/youchain/repository/AliPayRepository.java b/youchain-tools/src/main/java/com/youchain/repository/AliPayRepository.java new file mode 100644 index 0000000..4e23f95 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/repository/AliPayRepository.java @@ -0,0 +1,26 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.AlipayConfig; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +public interface AliPayRepository extends JpaRepository { +} diff --git a/youchain-tools/src/main/java/com/youchain/repository/EmailRepository.java b/youchain-tools/src/main/java/com/youchain/repository/EmailRepository.java new file mode 100644 index 0000000..80eb419 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/repository/EmailRepository.java @@ -0,0 +1,26 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.EmailConfig; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +public interface EmailRepository extends JpaRepository { +} diff --git a/youchain-tools/src/main/java/com/youchain/repository/LocalStorageRepository.java b/youchain-tools/src/main/java/com/youchain/repository/LocalStorageRepository.java new file mode 100644 index 0000000..a1c1a6c --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/repository/LocalStorageRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.LocalStorage; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +public interface LocalStorageRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/repository/QiNiuConfigRepository.java b/youchain-tools/src/main/java/com/youchain/repository/QiNiuConfigRepository.java new file mode 100644 index 0000000..aaa8c2e --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/repository/QiNiuConfigRepository.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.QiniuConfig; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +public interface QiNiuConfigRepository extends JpaRepository { + + /** + * 编辑类型 + * @param type + */ + @Modifying + @Query(value = "update QiniuConfig set type = ?1") + void update(String type); +} diff --git a/youchain-tools/src/main/java/com/youchain/repository/QiniuContentRepository.java b/youchain-tools/src/main/java/com/youchain/repository/QiniuContentRepository.java new file mode 100644 index 0000000..ae42093 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/repository/QiniuContentRepository.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.repository; + +import com.youchain.domain.QiniuContent; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +public interface QiniuContentRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据key查询 + * @param key 文件名 + * @return QiniuContent + */ + QiniuContent findByKey(String key); +} diff --git a/youchain-tools/src/main/java/com/youchain/rest/AliPayController.java b/youchain-tools/src/main/java/com/youchain/rest/AliPayController.java new file mode 100644 index 0000000..a823b7a --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/rest/AliPayController.java @@ -0,0 +1,134 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.annotation.AnonymousAccess; +import com.youchain.annotation.Log; +import com.youchain.annotation.rest.AnonymousGetMapping; +import com.youchain.domain.vo.TradeVo; +import com.youchain.domain.AlipayConfig; +import com.youchain.utils.AliPayStatusEnum; +import com.youchain.utils.AlipayUtils; +import com.youchain.service.AliPayService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/aliPay") +@Api(tags = "工具:支付宝管理") +public class AliPayController { + + private final AlipayUtils alipayUtils; + private final AliPayService alipayService; + + @GetMapping + public ResponseEntity queryAliConfig() { + return new ResponseEntity<>(alipayService.find(), HttpStatus.OK); + } + + @Log("配置支付宝") + @ApiOperation("配置支付宝") + @PutMapping + public ResponseEntity updateAliPayConfig(@Validated @RequestBody AlipayConfig alipayConfig) { + alipayService.config(alipayConfig); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("支付宝PC网页支付") + @ApiOperation("PC网页支付") + @PostMapping(value = "/toPayAsPC") + public ResponseEntity toPayAsPc(@Validated @RequestBody TradeVo trade) throws Exception { + AlipayConfig aliPay = alipayService.find(); + trade.setOutTradeNo(alipayUtils.getOrderCode()); + String payUrl = alipayService.toPayAsPc(aliPay, trade); + return ResponseEntity.ok(payUrl); + } + + @Log("支付宝手机网页支付") + @ApiOperation("手机网页支付") + @PostMapping(value = "/toPayAsWeb") + public ResponseEntity toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception { + AlipayConfig alipay = alipayService.find(); + trade.setOutTradeNo(alipayUtils.getOrderCode()); + String payUrl = alipayService.toPayAsWeb(alipay, trade); + return ResponseEntity.ok(payUrl); + } + + @ApiIgnore + @AnonymousGetMapping("/return") + @ApiOperation("支付之后跳转的链接") + public ResponseEntity returnPage(HttpServletRequest request, HttpServletResponse response) { + AlipayConfig alipay = alipayService.find(); + response.setContentType("text/html;charset=" + alipay.getCharset()); + //内容验签,防止黑客篡改参数 + if (alipayUtils.rsaCheck(request, alipay)) { + //商户订单号 + String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //支付宝交易号 + String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + + // 根据业务需要返回数据,这里统一返回OK + return new ResponseEntity<>("payment successful", HttpStatus.OK); + } else { + // 根据业务需要返回数据 + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + @ApiIgnore + @RequestMapping("/notify") + @AnonymousAccess + @ApiOperation("支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理") + public ResponseEntity notify(HttpServletRequest request) { + AlipayConfig alipay = alipayService.find(); + Map parameterMap = request.getParameterMap(); + //内容验签,防止黑客篡改参数 + if (alipayUtils.rsaCheck(request, alipay)) { + //交易状态 + String tradeStatus = new String(request.getParameter("trade_status").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + // 商户订单号 + String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //支付宝交易号 + String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //付款金额 + String totalAmount = new String(request.getParameter("total_amount").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + //验证 + if (tradeStatus.equals(AliPayStatusEnum.SUCCESS.getValue()) || tradeStatus.equals(AliPayStatusEnum.FINISHED.getValue())) { + // 验证通过后应该根据业务需要处理订单 + } + return new ResponseEntity<>(HttpStatus.OK); + } + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/rest/EmailController.java b/youchain-tools/src/main/java/com/youchain/rest/EmailController.java new file mode 100644 index 0000000..5447093 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/rest/EmailController.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.domain.vo.EmailVo; +import com.youchain.domain.EmailConfig; +import com.youchain.service.EmailService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 发送邮件 + * @author 郑杰 + * @date 2018/09/28 6:55:53 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("api/email") +@Api(tags = "工具:邮件管理") +public class EmailController { + + private final EmailService emailService; + + @GetMapping + public ResponseEntity queryEmailConfig(){ + return new ResponseEntity<>(emailService.find(),HttpStatus.OK); + } + + @Log("配置邮件") + @PutMapping + @ApiOperation("配置邮件") + public ResponseEntity updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { + emailService.config(emailConfig,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("发送邮件") + @PostMapping + @ApiOperation("发送邮件") + public ResponseEntity sendEmail(@Validated @RequestBody EmailVo emailVo){ + emailService.send(emailVo,emailService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/rest/LocalStorageController.java b/youchain-tools/src/main/java/com/youchain/rest/LocalStorageController.java new file mode 100644 index 0000000..513936f --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/rest/LocalStorageController.java @@ -0,0 +1,101 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import lombok.RequiredArgsConstructor; +import com.youchain.annotation.Log; +import com.youchain.domain.LocalStorage; +import com.youchain.exception.BadRequestException; +import com.youchain.service.LocalStorageService; +import com.youchain.service.dto.LocalStorageQueryCriteria; +import com.youchain.utils.FileUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "工具:本地存储管理") +@RequestMapping("/api/localStorage") +public class LocalStorageController { + + private final LocalStorageService localStorageService; + + @GetMapping + @ApiOperation("查询文件") + @PreAuthorize("@el.check('storage:list')") + public ResponseEntity queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('storage:list')") + public void exportFile(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws Exception { + localStorageService.download(localStorageService.queryAll(criteria), response); + } + + @PostMapping + @ApiOperation("上传文件") + @PreAuthorize("@el.check('storage:add')") + public ResponseEntity createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){ + log.error(""+name); + localStorageService.create(name, file); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @ApiOperation("上传图片") + @PostMapping("/pictures") + public ResponseEntity uploadPicture(@RequestParam MultipartFile file){ + // 判断文件是否为图片 + String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); + if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){ + throw new BadRequestException("只能上传图片"); + } + LocalStorage localStorage = localStorageService.create(null, file); + return new ResponseEntity<>(localStorage, HttpStatus.OK); + } + + @PutMapping + @Log("修改文件") + @ApiOperation("修改文件") + @PreAuthorize("@el.check('storage:edit')") + public ResponseEntity updateFile(@Validated @RequestBody LocalStorage resources){ + localStorageService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除文件") + @DeleteMapping + @ApiOperation("多选删除") + public ResponseEntity deleteFile(@RequestBody Long[] ids) { + localStorageService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/rest/QiniuController.java b/youchain-tools/src/main/java/com/youchain/rest/QiniuController.java new file mode 100644 index 0000000..f562745 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/rest/QiniuController.java @@ -0,0 +1,122 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.youchain.annotation.Log; +import com.youchain.domain.QiniuConfig; +import com.youchain.domain.QiniuContent; +import com.youchain.service.dto.QiniuQueryCriteria; +import com.youchain.service.QiNiuService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 发送邮件 + * @author 郑杰 + * @date 2018/09/28 6:55:53 + */ +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/qiNiuContent") +@Api(tags = "工具:七牛云存储管理") +public class QiniuController { + + private final QiNiuService qiNiuService; + + @GetMapping(value = "/config") + public ResponseEntity queryQiNiuConfig(){ + return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK); + } + + @Log("配置七牛云存储") + @ApiOperation("配置七牛云存储") + @PutMapping(value = "/config") + public ResponseEntity updateQiNiuConfig(@Validated @RequestBody QiniuConfig qiniuConfig){ + qiNiuService.config(qiniuConfig); + qiNiuService.update(qiniuConfig.getType()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + public void exportQiNiu(HttpServletResponse response, QiniuQueryCriteria criteria) throws Exception { + qiNiuService.downloadList(qiNiuService.queryAll(criteria), response); + } + + @ApiOperation("查询文件") + @GetMapping + public ResponseEntity queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("上传文件") + @ApiOperation("上传文件") + @PostMapping + public ResponseEntity uploadQiNiu(@RequestParam MultipartFile file){ + QiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.find()); + Map map = new HashMap<>(3); + map.put("id",qiniuContent.getId()); + map.put("errno",0); + map.put("data",new String[]{qiniuContent.getUrl()}); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @Log("同步七牛云数据") + @ApiOperation("同步七牛云数据") + @PostMapping(value = "/synchronize") + public ResponseEntity synchronizeQiNiu(){ + qiNiuService.synchronize(qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("下载文件") + @ApiOperation("下载文件") + @GetMapping(value = "/download/{id}") + public ResponseEntity downloadQiNiu(@PathVariable Long id){ + Map map = new HashMap<>(1); + map.put("url", qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find())); + return new ResponseEntity<>(map,HttpStatus.OK); + } + + @Log("删除文件") + @ApiOperation("删除文件") + @DeleteMapping(value = "/{id}") + public ResponseEntity deleteQiNiu(@PathVariable Long id){ + qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("删除多张图片") + @ApiOperation("删除多张图片") + @DeleteMapping + public ResponseEntity deleteAllQiNiu(@RequestBody Long[] ids) { + qiNiuService.deleteAll(ids, qiNiuService.find()); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/service/AliPayService.java b/youchain-tools/src/main/java/com/youchain/service/AliPayService.java new file mode 100644 index 0000000..20fe048 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/AliPayService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.AlipayConfig; +import com.youchain.domain.vo.TradeVo; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +public interface AliPayService { + + /** + * 查询配置 + * @return AlipayConfig + */ + AlipayConfig find(); + + /** + * 更新配置 + * @param alipayConfig 支付宝配置 + * @return AlipayConfig + */ + AlipayConfig config(AlipayConfig alipayConfig); + + /** + * 处理来自PC的交易请求 + * @param alipay 支付宝配置 + * @param trade 交易详情 + * @return String + * @throws Exception 异常 + */ + String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception; + + /** + * 处理来自手机网页的交易请求 + * @param alipay 支付宝配置 + * @param trade 交易详情 + * @return String + * @throws Exception 异常 + */ + String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception; +} diff --git a/youchain-tools/src/main/java/com/youchain/service/EmailService.java b/youchain-tools/src/main/java/com/youchain/service/EmailService.java new file mode 100644 index 0000000..12b4f15 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/EmailService.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.EmailConfig; +import com.youchain.domain.vo.EmailVo; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +public interface EmailService { + + /** + * 更新邮件配置 + * @param emailConfig 邮箱配置 + * @param old / + * @return / + * @throws Exception / + */ + EmailConfig config(EmailConfig emailConfig, EmailConfig old) throws Exception; + + /** + * 查询配置 + * @return EmailConfig 邮件配置 + */ + EmailConfig find(); + + /** + * 发送邮件 + * @param emailVo 邮件发送的内容 + * @param emailConfig 邮件配置 + * @throws Exception / + */ + void send(EmailVo emailVo, EmailConfig emailConfig); +} diff --git a/youchain-tools/src/main/java/com/youchain/service/LocalStorageService.java b/youchain-tools/src/main/java/com/youchain/service/LocalStorageService.java new file mode 100644 index 0000000..90b230f --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/LocalStorageService.java @@ -0,0 +1,82 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.LocalStorage; +import com.youchain.service.dto.LocalStorageDto; +import com.youchain.service.dto.LocalStorageQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +public interface LocalStorageService { + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部数据 + * @param criteria 条件 + * @return / + */ + List queryAll(LocalStorageQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id / + * @return / + */ + LocalStorageDto findById(Long id); + + /** + * 上传 + * @param name 文件名称 + * @param file 文件 + * @return + */ + LocalStorage create(String name, MultipartFile file); + + /** + * 编辑 + * @param resources 文件信息 + */ + void update(LocalStorage resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param localStorageDtos 待导出的数据 + * @param response / + * @throws Exception / + */ + void download(List localStorageDtos, HttpServletResponse response) throws Exception, Exception; +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/service/QiNiuService.java b/youchain-tools/src/main/java/com/youchain/service/QiNiuService.java new file mode 100644 index 0000000..554183b --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/QiNiuService.java @@ -0,0 +1,118 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service; + +import com.youchain.domain.QiniuConfig; +import com.youchain.domain.QiniuContent; +import com.youchain.service.dto.QiniuQueryCriteria; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +public interface QiNiuService { + + /** + * 查配置 + * @return QiniuConfig + */ + QiniuConfig find(); + + /** + * 修改配置 + * @param qiniuConfig 配置 + * @return QiniuConfig + */ + QiniuConfig config(QiniuConfig qiniuConfig); + + /** + * 分页查询 + * @param criteria 条件 + * @param pageable 分页参数 + * @return / + */ + Object queryAll(QiniuQueryCriteria criteria, Pageable pageable); + + /** + * 查询全部 + * @param criteria 条件 + * @return / + */ + List queryAll(QiniuQueryCriteria criteria); + + /** + * 上传文件 + * @param file 文件 + * @param qiniuConfig 配置 + * @return QiniuContent + */ + QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig); + + /** + * 查询文件 + * @param id 文件ID + * @return QiniuContent + */ + QiniuContent findByContentId(Long id); + + /** + * 下载文件 + * @param content 文件信息 + * @param config 配置 + * @return String + */ + String download(QiniuContent content, QiniuConfig config); + + /** + * 删除文件 + * @param content 文件 + * @param config 配置 + */ + void delete(QiniuContent content, QiniuConfig config); + + /** + * 同步数据 + * @param config 配置 + */ + void synchronize(QiniuConfig config); + + /** + * 删除文件 + * @param ids 文件ID数组 + * @param config 配置 + */ + void deleteAll(Long[] ids, QiniuConfig config); + + /** + * 更新数据 + * @param type 类型 + */ + void update(String type); + + /** + * 导出数据 + * @param queryAll / + * @param response / + * @throws Exception / + */ + void downloadList(List queryAll, HttpServletResponse response) throws Exception; +} diff --git a/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageDto.java b/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageDto.java new file mode 100644 index 0000000..14234a1 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageDto.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Getter; +import lombok.Setter; +import com.youchain.base.BaseDTO; +import java.io.Serializable; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Getter +@Setter +public class LocalStorageDto extends BaseDTO implements Serializable { + + private Long id; + + private String realName; + + private String name; + + private String suffix; + + private String type; + + private String size; +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageQueryCriteria.java b/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageQueryCriteria.java new file mode 100644 index 0000000..6b92d76 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/dto/LocalStorageQueryCriteria.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; + +import com.youchain.annotation.Query; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Data +public class LocalStorageQueryCriteria{ + + @Query(blurry = "name,suffix,type,createBy,size") + private String blurry; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/service/dto/PictureQueryCriteria.java b/youchain-tools/src/main/java/com/youchain/service/dto/PictureQueryCriteria.java new file mode 100644 index 0000000..4b9f7ec --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/dto/PictureQueryCriteria.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; +import java.sql.Timestamp; +import java.util.List; + +/** + * sm.ms图床 + * + * @author Liu Xue + * @date 2019-6-4 09:52:09 + */ +@Data +public class PictureQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String filename; + + @Query(type = Query.Type.INNER_LIKE) + private String username; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-tools/src/main/java/com/youchain/service/dto/QiniuQueryCriteria.java b/youchain-tools/src/main/java/com/youchain/service/dto/QiniuQueryCriteria.java new file mode 100644 index 0000000..3ab2954 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/dto/QiniuQueryCriteria.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.dto; + +import lombok.Data; +import com.youchain.annotation.Query; + +import java.sql.Timestamp; +import java.util.List; + +/** + * @author Liu Xue + * @date 2019-6-4 09:54:37 + */ +@Data +public class QiniuQueryCriteria{ + + @Query(type = Query.Type.INNER_LIKE) + private String key; + + @Query(type = Query.Type.BETWEEN) + private List createTime; +} diff --git a/youchain-tools/src/main/java/com/youchain/service/impl/AliPayServiceImpl.java b/youchain-tools/src/main/java/com/youchain/service/impl/AliPayServiceImpl.java new file mode 100644 index 0000000..e3059fd --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/impl/AliPayServiceImpl.java @@ -0,0 +1,119 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import com.alipay.api.AlipayClient; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.request.AlipayTradePagePayRequest; +import com.alipay.api.request.AlipayTradeWapPayRequest; +import com.youchain.domain.AlipayConfig; +import com.youchain.domain.vo.TradeVo; +import com.youchain.service.AliPayService; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.repository.AliPayRepository; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "aliPay") +public class AliPayServiceImpl implements AliPayService { + + private final AliPayRepository alipayRepository; + + @Override + @Cacheable(key = "'config'") + public AlipayConfig find() { + Optional alipayConfig = alipayRepository.findById(1L); + return alipayConfig.orElseGet(AlipayConfig::new); + } + + @Override + @CachePut(key = "'config'") + @Transactional(rollbackFor = Exception.class) + public AlipayConfig config(AlipayConfig alipayConfig) { + alipayConfig.setId(1L); + return alipayRepository.save(alipayConfig); + } + + @Override + public String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception { + + if(alipay.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); + + // 创建API对应的request(电脑网页版) + AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); + + // 订单完成后返回的页面和异步通知地址 + request.setReturnUrl(alipay.getReturnUrl()); + request.setNotifyUrl(alipay.getNotifyUrl()); + // 填充订单参数 + request.setBizContent("{" + + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + + " \"total_amount\":"+trade.getTotalAmount()+"," + + " \"subject\":\""+trade.getSubject()+"\"," + + " \"body\":\""+trade.getBody()+"\"," + + " \"extend_params\":{" + + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + + " }"+ + " }");//填充业务参数 + // 调用SDK生成表单, 通过GET方式,口可以获取url + return alipayClient.pageExecute(request, "GET").getBody(); + + } + + @Override + public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception { + if(alipay.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); + + double money = Double.parseDouble(trade.getTotalAmount()); + double maxMoney = 5000; + if(money <= 0 || money >= maxMoney){ + throw new BadRequestException("测试金额过大"); + } + // 创建API对应的request(手机网页版) + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); + request.setReturnUrl(alipay.getReturnUrl()); + request.setNotifyUrl(alipay.getNotifyUrl()); + request.setBizContent("{" + + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + + " \"total_amount\":"+trade.getTotalAmount()+"," + + " \"subject\":\""+trade.getSubject()+"\"," + + " \"body\":\""+trade.getBody()+"\"," + + " \"extend_params\":{" + + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + + " }"+ + " }"); + return alipayClient.pageExecute(request, "GET").getBody(); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/service/impl/EmailServiceImpl.java b/youchain-tools/src/main/java/com/youchain/service/impl/EmailServiceImpl.java new file mode 100644 index 0000000..846b843 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/impl/EmailServiceImpl.java @@ -0,0 +1,105 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import cn.hutool.extra.mail.Mail; +import cn.hutool.extra.mail.MailAccount; +import com.youchain.domain.EmailConfig; +import com.youchain.domain.vo.EmailVo; +import com.youchain.service.EmailService; +import lombok.RequiredArgsConstructor; +import com.youchain.exception.BadRequestException; +import com.youchain.repository.EmailRepository; +import com.youchain.utils.EncryptUtils; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + +/** + * @author Liu Xue + * @date 2018-12-26 + */ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "email") +public class EmailServiceImpl implements EmailService { + + private final EmailRepository emailRepository; + + @Override + @CachePut(key = "'config'") + @Transactional(rollbackFor = Exception.class) + public EmailConfig config(EmailConfig emailConfig, EmailConfig old) throws Exception { + emailConfig.setId(1L); + if(!emailConfig.getPass().equals(old.getPass())){ + // 对称加密 + emailConfig.setPass(EncryptUtils.desEncrypt(emailConfig.getPass())); + } + return emailRepository.save(emailConfig); + } + + @Override + @Cacheable(key = "'config'") + public EmailConfig find() { + Optional emailConfig = emailRepository.findById(1L); + return emailConfig.orElseGet(EmailConfig::new); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void send(EmailVo emailVo, EmailConfig emailConfig){ + if(emailConfig.getId() == null){ + throw new BadRequestException("请先配置,再操作"); + } + // 封装 + MailAccount account = new MailAccount(); + // 设置用户 + String user = emailConfig.getFromUser().split("@")[0]; + account.setUser(user); + account.setHost(emailConfig.getHost()); + account.setPort(Integer.parseInt(emailConfig.getPort())); + account.setAuth(true); + try { + // 对称解密 + account.setPass(EncryptUtils.desDecrypt(emailConfig.getPass())); + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + account.setFrom(emailConfig.getUser()+"<"+emailConfig.getFromUser()+">"); + // ssl方式发送 + account.setSslEnable(true); + // 使用STARTTLS安全连接 + account.setStarttlsEnable(true); + String content = emailVo.getContent(); + // 发送 + try { + int size = emailVo.getTos().size(); + Mail.create(account) + .setTos(emailVo.getTos().toArray(new String[size])) + .setTitle(emailVo.getSubject()) + .setContent(content) + .setHtml(true) + //关闭session + .setUseGlobalSession(false) + .send(); + }catch (Exception e){ + throw new BadRequestException(e.getMessage()); + } + } +} diff --git a/youchain-tools/src/main/java/com/youchain/service/impl/LocalStorageServiceImpl.java b/youchain-tools/src/main/java/com/youchain/service/impl/LocalStorageServiceImpl.java new file mode 100644 index 0000000..f5b7091 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/impl/LocalStorageServiceImpl.java @@ -0,0 +1,137 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.youchain.domain.LocalStorage; +import com.youchain.service.LocalStorageService; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.config.FileProperties; +import com.youchain.service.dto.LocalStorageDto; +import com.youchain.service.dto.LocalStorageQueryCriteria; +import com.youchain.service.mapstruct.LocalStorageMapper; +import com.youchain.exception.BadRequestException; +import com.youchain.utils.*; +import com.youchain.repository.LocalStorageRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Service +@RequiredArgsConstructor +public class LocalStorageServiceImpl implements LocalStorageService { + + private final LocalStorageRepository localStorageRepository; + private final LocalStorageMapper localStorageMapper; + private final FileProperties properties; + + @Override + public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){ + Page page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(localStorageMapper::toDto)); + } + + @Override + public List queryAll(LocalStorageQueryCriteria criteria){ + return localStorageMapper.toDto(localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public LocalStorageDto findById(Long id){ + LocalStorage localStorage = localStorageRepository.findById(id).orElseGet(LocalStorage::new); + ValidationUtil.isNull(localStorage.getId(),"LocalStorage","id",id); + return localStorageMapper.toDto(localStorage); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public LocalStorage create(String name, MultipartFile multipartFile) { + FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); + String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); + if(ObjectUtil.isNull(file)){ + throw new BadRequestException("上传失败"); + } + if(type.equals(FileUtil.OTHER)){ + throw new BadRequestException("上传失败"); + } + try { + name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name; + LocalStorage localStorage = new LocalStorage( + file.getName(), + name, + suffix, + file.getPath(), + type, + FileUtil.getSize(multipartFile.getSize()) + ); + return localStorageRepository.save(localStorage); + }catch (Exception e){ + FileUtil.del(file); + throw e; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(LocalStorage resources) { + LocalStorage localStorage = localStorageRepository.findById(resources.getId()).orElseGet(LocalStorage::new); + ValidationUtil.isNull( localStorage.getId(),"LocalStorage","id",resources.getId()); + localStorage.copy(resources); + localStorageRepository.save(localStorage); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(Long[] ids) { + for (Long id : ids) { + LocalStorage storage = localStorageRepository.findById(id).orElseGet(LocalStorage::new); + FileUtil.del(storage.getPath()); + localStorageRepository.delete(storage); + } + } + + @Override + public void download(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (LocalStorageDto localStorageDTO : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("文件名", localStorageDTO.getRealName()); + map.put("备注名", localStorageDTO.getName()); + map.put("文件类型", localStorageDTO.getType()); + map.put("文件大小", localStorageDTO.getSize()); + map.put("创建者", localStorageDTO.getCreateBy()); + map.put("创建日期", localStorageDTO.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/service/impl/QiNiuServiceImpl.java b/youchain-tools/src/main/java/com/youchain/service/impl/QiNiuServiceImpl.java new file mode 100644 index 0000000..0021848 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/impl/QiNiuServiceImpl.java @@ -0,0 +1,237 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.impl; + +import com.alibaba.fastjson.JSON; +import com.qiniu.common.QiniuException; +import com.qiniu.http.Response; +import com.qiniu.storage.BucketManager; +import com.qiniu.storage.Configuration; +import com.qiniu.storage.UploadManager; +import com.qiniu.storage.model.DefaultPutRet; +import com.qiniu.storage.model.FileInfo; +import com.qiniu.util.Auth; +import com.youchain.domain.QiniuConfig; +import com.youchain.domain.QiniuContent; +import com.youchain.service.QiNiuService; +import com.youchain.utils.QiNiuUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.repository.QiniuContentRepository; +import com.youchain.service.dto.QiniuQueryCriteria; +import com.youchain.exception.BadRequestException; +import com.youchain.repository.QiNiuConfigRepository; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +/** + * @author Liu Xue + * @date 2018-12-31 + */ +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "qiNiu") +public class QiNiuServiceImpl implements QiNiuService { + + private final QiNiuConfigRepository qiNiuConfigRepository; + private final QiniuContentRepository qiniuContentRepository; + + @Value("${qiniu.max-size}") + private Long maxSize; + + @Override + @Cacheable(key = "'config'") + public QiniuConfig find() { + Optional qiniuConfig = qiNiuConfigRepository.findById(1L); + return qiniuConfig.orElseGet(QiniuConfig::new); + } + + @Override + @CachePut(key = "'config'") + @Transactional(rollbackFor = Exception.class) + public QiniuConfig config(QiniuConfig qiniuConfig) { + qiniuConfig.setId(1L); + String http = "http://", https = "https://"; + if (!(qiniuConfig.getHost().toLowerCase().startsWith(http)||qiniuConfig.getHost().toLowerCase().startsWith(https))) { + throw new BadRequestException("外链域名必须以http://或者https://开头"); + } + return qiNiuConfigRepository.save(qiniuConfig); + } + + @Override + public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){ + return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); + } + + @Override + public List queryAll(QiniuQueryCriteria criteria) { + return qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) { + FileUtil.checkSize(maxSize, file.getSize()); + if(qiniuConfig.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + // 构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(qiniuConfig.getZone())); + UploadManager uploadManager = new UploadManager(cfg); + Auth auth = Auth.create(qiniuConfig.getAccessKey(), qiniuConfig.getSecretKey()); + String upToken = auth.uploadToken(qiniuConfig.getBucket()); + try { + String key = file.getOriginalFilename(); + if(qiniuContentRepository.findByKey(key) != null) { + key = QiNiuUtil.getKey(key); + } + Response response = uploadManager.put(file.getBytes(), key, upToken); + //解析上传成功的结果 + + DefaultPutRet putRet = JSON.parseObject(response.bodyString(), DefaultPutRet.class); + QiniuContent content = qiniuContentRepository.findByKey(FileUtil.getFileNameNoEx(putRet.key)); + if(content == null){ + //存入数据库 + QiniuContent qiniuContent = new QiniuContent(); + qiniuContent.setSuffix(FileUtil.getExtensionName(putRet.key)); + qiniuContent.setBucket(qiniuConfig.getBucket()); + qiniuContent.setType(qiniuConfig.getType()); + qiniuContent.setKey(FileUtil.getFileNameNoEx(putRet.key)); + qiniuContent.setUrl(qiniuConfig.getHost()+"/"+putRet.key); + qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(file.getSize()+""))); + return qiniuContentRepository.save(qiniuContent); + } + return content; + } catch (Exception e) { + throw new BadRequestException(e.getMessage()); + } + } + + @Override + public QiniuContent findByContentId(Long id) { + QiniuContent qiniuContent = qiniuContentRepository.findById(id).orElseGet(QiniuContent::new); + ValidationUtil.isNull(qiniuContent.getId(),"QiniuContent", "id",id); + return qiniuContent; + } + + @Override + public String download(QiniuContent content,QiniuConfig config){ + String finalUrl; + String type = "公开"; + if(type.equals(content.getType())){ + finalUrl = content.getUrl(); + } else { + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + // 1小时,可以自定义链接过期时间 + long expireInSeconds = 3600; + finalUrl = auth.privateDownloadUrl(content.getUrl(), expireInSeconds); + } + return finalUrl; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(QiniuContent content, QiniuConfig config) { + //构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + BucketManager bucketManager = new BucketManager(auth, cfg); + try { + bucketManager.delete(content.getBucket(), content.getKey() + "." + content.getSuffix()); + qiniuContentRepository.delete(content); + } catch (QiniuException ex) { + qiniuContentRepository.delete(content); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void synchronize(QiniuConfig config) { + if(config.getId() == null){ + throw new BadRequestException("请先添加相应配置,再操作"); + } + //构造一个带指定Zone对象的配置类 + Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); + Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); + BucketManager bucketManager = new BucketManager(auth, cfg); + //文件名前缀 + String prefix = ""; + //每次迭代的长度限制,最大1000,推荐值 1000 + int limit = 1000; + //指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 + String delimiter = ""; + //列举空间文件列表 + BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(config.getBucket(), prefix, limit, delimiter); + while (fileListIterator.hasNext()) { + //处理获取的file list结果 + QiniuContent qiniuContent; + FileInfo[] items = fileListIterator.next(); + for (FileInfo item : items) { + if(qiniuContentRepository.findByKey(FileUtil.getFileNameNoEx(item.key)) == null){ + qiniuContent = new QiniuContent(); + qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(item.fsize+""))); + qiniuContent.setSuffix(FileUtil.getExtensionName(item.key)); + qiniuContent.setKey(FileUtil.getFileNameNoEx(item.key)); + qiniuContent.setType(config.getType()); + qiniuContent.setBucket(config.getBucket()); + qiniuContent.setUrl(config.getHost()+"/"+item.key); + qiniuContentRepository.save(qiniuContent); + } + } + } + } + + @Override + public void deleteAll(Long[] ids, QiniuConfig config) { + for (Long id : ids) { + delete(findByContentId(id), config); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(String type) { + qiNiuConfigRepository.update(type); + } + + @Override + public void downloadList(List queryAll, HttpServletResponse response) throws Exception { + List> list = new ArrayList<>(); + for (QiniuContent content : queryAll) { + Map map = new LinkedHashMap<>(); + map.put("文件名", content.getKey()); + map.put("文件类型", content.getSuffix()); + map.put("空间名称", content.getBucket()); + map.put("文件大小", content.getSize()); + map.put("空间类型", content.getType()); + map.put("创建日期", content.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/youchain-tools/src/main/java/com/youchain/service/mapstruct/LocalStorageMapper.java b/youchain-tools/src/main/java/com/youchain/service/mapstruct/LocalStorageMapper.java new file mode 100644 index 0000000..ca05940 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/service/mapstruct/LocalStorageMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.service.mapstruct; + +import com.youchain.domain.LocalStorage; +import com.youchain.service.dto.LocalStorageDto; +import com.youchain.base.BaseMapper; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author Liu Xue +* @date 2019-09-05 +*/ +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface LocalStorageMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-tools/src/main/java/com/youchain/utils/AliPayStatusEnum.java b/youchain-tools/src/main/java/com/youchain/utils/AliPayStatusEnum.java new file mode 100644 index 0000000..2efa225 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/utils/AliPayStatusEnum.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +/** + * 支付状态 + * @author zhengjie + * @date 2018/08/01 16:45:43 + */ +public enum AliPayStatusEnum { + + /** 交易成功 */ + FINISHED("TRADE_FINISHED"), + + /** 支付成功 */ + SUCCESS("TRADE_SUCCESS"), + + /** 交易创建 */ + BUYER_PAY("WAIT_BUYER_PAY"), + + /** 交易关闭 */ + CLOSED("TRADE_CLOSED"); + + private final String value; + + AliPayStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/youchain-tools/src/main/java/com/youchain/utils/AlipayUtils.java b/youchain-tools/src/main/java/com/youchain/utils/AlipayUtils.java new file mode 100644 index 0000000..24dc986 --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/utils/AlipayUtils.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import com.alipay.api.AlipayApiException; +import com.alipay.api.internal.util.AlipaySignature; +import com.youchain.domain.AlipayConfig; +import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 支付宝工具类 + * @author zhengjie + * @date 2018/09/30 14:04:35 + */ +@Component +public class AlipayUtils { + + /** + * 生成订单号 + * @return String + */ + public String getOrderCode() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + int a = (int)(Math.random() * 9000.0D) + 1000; + System.out.println(a); + Date date = new Date(); + String str = sdf.format(date); + String[] split = str.split("-"); + String s = split[0] + split[1] + split[2]; + String[] split1 = s.split(" "); + String s1 = split1[0] + split1[1]; + String[] split2 = s1.split(":"); + return split2[0] + split2[1] + split2[2] + a; + } + + /** + * 校验签名 + * @param request HttpServletRequest + * @param alipay 阿里云配置 + * @return boolean + */ + public boolean rsaCheck(HttpServletRequest request, AlipayConfig alipay){ + + // 获取支付宝POST过来反馈信息 + Map params = new HashMap<>(1); + Map requestParams = request.getParameterMap(); + for (Object o : requestParams.keySet()) { + String name = (String) o; + String[] values = requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + ","; + } + params.put(name, valueStr); + } + + try { + return AlipaySignature.rsaCheckV1(params, + alipay.getPublicKey(), + alipay.getCharset(), + alipay.getSignType()); + } catch (AlipayApiException e) { + return false; + } + } +} diff --git a/youchain-tools/src/main/java/com/youchain/utils/QiNiuUtil.java b/youchain-tools/src/main/java/com/youchain/utils/QiNiuUtil.java new file mode 100644 index 0000000..06973df --- /dev/null +++ b/youchain-tools/src/main/java/com/youchain/utils/QiNiuUtil.java @@ -0,0 +1,71 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.youchain.utils; + +import com.qiniu.storage.Region; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 七牛云存储工具类 + * @author Liu Xue + * @date 2018-12-31 + */ +public class QiNiuUtil { + + private static final String HUAD = "华东"; + + private static final String HUAB = "华北"; + + private static final String HUAN = "华南"; + + private static final String BEIM = "北美"; + + /** + * 得到机房的对应关系 + * @param zone 机房名称 + * @return Region + */ + public static Region getRegion(String zone){ + + if(HUAD.equals(zone)){ + return Region.huadong(); + } else if(HUAB.equals(zone)){ + return Region.huabei(); + } else if(HUAN.equals(zone)){ + return Region.huanan(); + } else if (BEIM.equals(zone)){ + return Region.beimei(); + // 否则就是东南亚 + } else { + return Region.qvmHuadong(); + } + } + + /** + * 默认不指定key的情况下,以文件内容的hash值作为文件名 + * @param file 文件名 + * @return String + */ + public static String getKey(String file){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = new Date(); + return FileUtil.getFileNameNoEx(file) + "-" + + sdf.format(date) + + "." + + FileUtil.getExtensionName(file); + } +}