commit da40c4c756997c6674c3402d3e1550363c44d9d8 Author: unknown Date: Thu Nov 17 12:30:16 2022 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2a3040 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/.svn/entries b/.svn/entries new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/.svn/entries @@ -0,0 +1 @@ +12 diff --git a/.svn/format b/.svn/format new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/.svn/format @@ -0,0 +1 @@ +12 diff --git a/.svn/pristine/00/00be8534da98cb0b8a15cc1f023e4ac642d820f5.svn-base b/.svn/pristine/00/00be8534da98cb0b8a15cc1f023e4ac642d820f5.svn-base new file mode 100644 index 0000000..ddc7c15 --- /dev/null +++ b/.svn/pristine/00/00be8534da98cb0b8a15cc1f023e4ac642d820f5.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/01/0174de9aab1bcbb281ad54e9b674b608f3407443.svn-base b/.svn/pristine/01/0174de9aab1bcbb281ad54e9b674b608f3407443.svn-base new file mode 100644 index 0000000..a8937bb --- /dev/null +++ b/.svn/pristine/01/0174de9aab1bcbb281ad54e9b674b608f3407443.svn-base @@ -0,0 +1,10090 @@ + + + + + 5.7.29 + InnoDB + InnoDB + lower/lower + + + 1 + utf8_general_ci + + + utf8_general_ci + + + 1 + utf8_general_ci + + + latin1_swedish_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + utf8_general_ci + + + armscii8 + 0 + + + armscii8 + 1 + + + ascii + 0 + + + ascii + 1 + + + big5 + 0 + + + big5 + 1 + + + binary + 1 + + + cp1250 + 0 + + + cp1250 + 0 + + + cp1250 + 0 + + + cp1250 + 1 + + + cp1250 + 0 + + + cp1251 + 0 + + + cp1251 + 0 + + + cp1251 + 1 + + + cp1251 + 0 + + + cp1251 + 0 + + + cp1256 + 0 + + + cp1256 + 1 + + + cp1257 + 0 + + + cp1257 + 1 + + + cp1257 + 0 + + + cp850 + 0 + + + cp850 + 1 + + + cp852 + 0 + + + cp852 + 1 + + + cp866 + 0 + + + cp866 + 1 + + + cp932 + 0 + + + cp932 + 1 + + + dec8 + 0 + + + dec8 + 1 + + + eucjpms + 0 + + + eucjpms + 1 + + + euckr + 0 + + + euckr + 1 + + + gb18030 + 0 + + + gb18030 + 1 + + + gb18030 + 0 + + + gb2312 + 0 + + + gb2312 + 1 + + + gbk + 0 + + + gbk + 1 + + + geostd8 + 0 + + + geostd8 + 1 + + + greek + 0 + + + greek + 1 + + + hebrew + 0 + + + hebrew + 1 + + + hp8 + 0 + + + hp8 + 1 + + + keybcs2 + 0 + + + keybcs2 + 1 + + + koi8r + 0 + + + koi8r + 1 + + + koi8u + 0 + + + koi8u + 1 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 0 + + + latin1 + 1 + + + latin2 + 0 + + + latin2 + 0 + + + latin2 + 0 + + + latin2 + 1 + + + latin2 + 0 + + + latin5 + 0 + + + latin5 + 1 + + + latin7 + 0 + + + latin7 + 0 + + + latin7 + 1 + + + latin7 + 0 + + + macce + 0 + + + macce + 1 + + + macroman + 0 + + + macroman + 1 + + + sjis + 0 + + + sjis + 1 + + + swe7 + 0 + + + swe7 + 1 + + + tis620 + 0 + + + tis620 + 1 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 1 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ucs2 + 0 + + + ujis + 0 + + + ujis + 1 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 1 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16 + 0 + + + utf16le + 0 + + + utf16le + 1 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 1 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf32 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 1 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 1 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + utf8mb4 + 0 + + + 管理员表 + utf8mb4_general_ci +
+ + 客服 + utf8mb4_general_ci +
+ + 医生动态表 + utf8mb4_general_ci +
+ + 病人/医生评论医生动态表 + utf8mb4_general_ci +
+ + 配送员表 + utf8mb4_general_ci +
+ + 配送员提现表 + utf8mb4_general_ci +
+ + 配送员收入记录 + utf8mb4_general_ci +
+ + 医生提现详情 + utf8mb4_general_ci +
+ + 疾病编码GB-95 +
+ + 疾病编码ICD10 +
+ + 医生表 + utf8mb4_general_ci +
+ + 医生证书上传 + utf8mb4_general_ci +
+ + utf8mb4_general_ci +
+ + 职业表 + utf8mb4_general_ci +
+ + 处方流转监管信息 +
+ + 药代表 + utf8mb4_general_ci +
+ + 病人图文咨询余额 + utf8mb4_general_ci +
+ + 患者图文咨询订单 + utf8mb4_general_ci +
+ + 医生图文咨询设置表 + utf8mb4_general_ci +
+ + 医生收入表 + utf8mb4_general_ci +
+ + 登录监管 +
+ + 职称表 + utf8mb4_general_ci +
+ + 职称表 + utf8mb4_general_ci +
+ + 职称表 + utf8mb4_general_ci +
+ + 菜单操作表 + utf8mb4_general_ci +
+ + 消息表 + utf8mb4_general_ci +
+ + 门诊类型 + utf8mb4_general_ci +
+ + 门诊号源表 + utf8mb4_general_ci +
+ + 医生门诊执业点表 + utf8mb4_general_ci +
+ + 门诊排班表 + utf8mb4_general_ci +
+ + 患者门诊预约 + utf8mb4_general_ci +
+ + 民族字典 民族代码(GB/T 3304-91) +
+ + utf8mb4_general_ci +
+ + 药师表 + utf8mb4_general_ci +
+ + 药店表 + utf8mb4_general_ci +
+ + 职称字典 +
+ + 电子处方药品明细 +
+ + 管理员表 + utf8mb4_general_ci +
+ + 个体诊所,私立医院 + utf8mb4_general_ci +
+ + + utf8mb4_general_ci +
+ + 用药指南表 + + +status顺序0-8-1-2-3-4-5-6-7 + utf8mb4_general_ci +
+ + 用药指南用药指导 + utf8mb4_general_ci +
+ + 角色表 + utf8mb4_general_ci +
+ + 医生积分记录表 + utf8mb4_general_ci +
+ + 隐私号 + utf8mb4_general_ci +
+ + 合作机构信息 +
+ + 短信验证码表 + utf8mb4_general_ci +
+ + 轮播图表 + utf8mb4_general_ci +
+ + 电话咨询订单 + utf8mb4_general_ci +
+ + 医生电话咨询设置表 + utf8mb4_general_ci +
+ + 感谢信 + utf8mb4_general_ci +
+ + 病人表 + utf8mb4_general_ci +
+ + 病人收货信息表 + utf8mb4_general_ci +
+ + 医生患者好友关系表 + utf8mb4_general_ci +
+ + 医生群组表 + utf8mb4_general_ci +
+ + 审核通知 + utf8mb4_general_ci +
+ + 预约挂号监管信息 +
+ + 电子病历监管信息 +
+ + 互联网医疗机构信息 + utf8mb4_general_ci +
+ + 医院部门编号、名称字典 +
+ + 互联网医疗机构字典 +
+ + 互联网医院设备信息 +
+ + 在线诊疗监管信息 +
+ + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + +
+
+
+
+
+
+ + 1 + 后台管理员 + int(8) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + normal + + + 3 + varchar(255)|0s + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + int(5) unsigned|0s + normal + + + 6 + 药房id,roleid=3才有 + int(10) unsigned|0s + 1 + 0 + normal + + + 7 + varchar(255)|0s + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 9 + varchar(20)|0s + normal + + + 10 + varchar(30)|0s + normal + + + 11 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(5) unsigned|0s + 1 + 1 + normal + + + 2 + 1-医生2-患者3-药店4-药代理5-药师 + tinyint(1) unsigned|0s + normal + + + 3 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + 1-文章动态;2-链接动态 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + text|0s + normal + + + 6 + mediumtext|0s + normal + + + 7 + text|0s + normal + + + 8 + 点赞的医生 + varchar(255)|0s + normal + + + 9 + 点赞的病人 + varchar(255)|0s + normal + + + 10 + int(10) unsigned|0s + 1 + 0 + normal + + + 11 + 评论的医生 + varchar(255)|0s + normal + + + 12 + 评论的病人 + varchar(255)|0s + normal + + + 13 + int(10) unsigned|0s + 1 + 0 + normal + + + 14 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 15 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(10) unsigned|0s + 1 + normal + + + 3 + 1-医生评论;2-病人评论 + tinyint(1) unsigned|0s + 1 + normal + + + 4 + int(11) unsigned|0s + 1 + normal + + + 5 + varchar(255)|0s + normal + + + 6 + int(10) unsigned|0s + 1 + 0 + normal + + + 7 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 配送员 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(20)|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 7 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 7 + 1-申请中;2-失败;3-到账 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 9 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + varchar(255)|0s + normal + + + 4 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 5 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 7 + 1-申请中;2-失败;3-到账 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 9 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + varchar(200)|0s + 1 + normal + + + 3 + varchar(200)|0s + 1 + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + varchar(200)|0s + 1 + normal + + + 3 + varchar(200)|0s + 1 + normal + + + 1 + id + 1 + + + 1 + 医生 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(50)|0s + normal + + + 3 + 阿斯克生公众号openid + varchar(255)|0s + normal + + + 4 + 绑定药师id(admin表的id) + int(11)|0s + 1 + 0 + normal + + + 5 + 暂定 + varchar(0)|0s + normal + + + 6 + doc_tel 联系手机号 + varchar(15)|0s + normal + + + 7 + varchar(255)|0s + normal + + + 8 + int(10)|0s + normal + + + 9 + varchar(255)|0s + normal + + + 10 + varchar(20)|0s + normal + + + 11 + 最近一次登录ip + varchar(30)|0s + normal + + + 12 + 审核备注 + varchar(500)|0s + '' + normal + + + 13 + 0-未填写基本资料;1-未认证;2-实人认证通过,待审核;3-已认证,审核通过 + tinyint(2) unsigned|0s + 1 + 0 + normal + + + 14 + 1-审核中;2-不通过;3-通过 + tinyint(2)|0s + 1 + normal + + + 15 + varchar(255)|0s + normal + + + 16 + 姓名 doc_name + varchar(50)|0s + normal + + + 17 + 头像 + varchar(255)|0s + normal + + + 18 + + varchar(50)|0s + normal + + + 19 + + varchar(100)|0s + normal + + + 20 + + varchar(200)|0s + normal + + + 21 + 医院 + varchar(255)|0s + normal + + + 22 + 部门 doc_dept_name 编制科室名称 + varchar(255)|0s + normal + + + 23 + 科室 + varchar(255)|0s + normal + + + 24 + 职称 title_name 职称名称 + varchar(255)|0s + normal + + + 25 + 性别 ge_name 性别名称 + varchar(20)|0s + normal + + + 26 + 学校 + varchar(255)|0s + normal + + + 27 + 学历 + varchar(255)|0s + normal + + + 28 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 29 + 简介 + varchar(255)|0s + normal + + + 30 + 擅长疾病 + varchar(255)|0s + normal + + + 31 + 荣誉 + varchar(255)|0s + normal + + + 32 + 咨询量 + int(10) unsigned|0s + 1 + 0 + normal + + + 33 + 积分 + mediumint(9) unsigned|0s + 1 + 0 + normal + + + 34 + 等级积分 + mediumint(9) unsigned|0s + 1 + 0 + normal + + + 35 + 等级 + tinyint(3) unsigned|0s + 1 + 1 + normal + + + 36 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 37 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 38 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 39 + 签到 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 40 + 发布动态,最多5分 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 41 + 评论动态,最多2分 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 42 + 提现银行名 + varchar(255)|0s + normal + + + 43 + 提现银行分行 + varchar(255)|0s + normal + + + 44 + 提现银行卡号 + varchar(255)|0s + normal + + + 45 + varchar(255)|0s + normal + + + 46 + varchar(255)|0s + normal + + + 47 + 实人认证id + varchar(200)|0s + normal + + + 48 + varchar(255)|0s + normal + + + 49 + varchar(20)|0s + normal + + + 50 + id_card 身份证号 + varchar(255)|0s + normal + + + 51 + 签约医疗机构编码 + varchar(255)|0s + 1 + '' + normal + + + 52 + 签约医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 53 + 机构内人员编码 + varchar(255)|0s + 1 + '' + normal + + + 54 + 人员类型 审方药师、诊疗医师 + varchar(255)|0s + 1 + '' + normal + + + 55 + 性别编码 + varchar(255)|0s + 1 + '' + normal + + + 56 + 民族编号 + varchar(255)|0s + 1 + '' + normal + + + 57 + 民族名称 + varchar(255)|0s + 1 + '' + normal + + + 58 + 通讯地址 + varchar(255)|0s + 1 + '' + normal + + + 59 + 学历 大学、硕士、博士 + varchar(255)|0s + 1 + '' + normal + + + 60 + 行政职务 + varchar(255)|0s + 1 + '' + normal + + + 61 + 个人简介 + varchar(255)|0s + 1 + '' + normal + + + 62 + 职称编码 + varchar(255)|0s + 1 + '' + normal + + + 63 + 医师第一执业机构编码 组织机构代码 + varchar(255)|0s + 1 + '' + normal + + + 64 + 医师第一执业机构名称 组织机构名称 + varchar(255)|0s + 1 + '' + normal + + + 65 + 编制科室编码 + varchar(255)|0s + 1 + '' + normal + + + 66 + 执业证号 + varchar(255)|0s + 1 + '' + normal + + + 67 + 执业证取得时间 + int(10)|0s + 1 + 0 + normal + + + 68 + 资格证号 + varchar(255)|0s + 1 + '' + normal + + + 69 + 资格证取得时间 + int(10)|0s + 1 + 0 + normal + + + 70 + 职称证号 + varchar(255)|0s + 1 + '' + normal + + + 71 + 职称证取得时间 + int(10)|0s + 1 + 0 + normal + + + 72 + 医师执业类别 对应执业证的执业类别 + varchar(255)|0s + 1 + '' + normal + + + 73 + 医师执业范围 对应执业证的执业范围 + varchar(255)|0s + 1 + '' + normal + + + 74 + 最近连续两个周期的医师定期考核合格是否合格 + varchar(255)|0s + 1 + '' + normal + + + 75 + 医师擅长专业 + varchar(255)|0s + 1 + '' + normal + + + 76 + 是否同意以上条款 医师是否同意多点执业备案信息表上的条款,同意填“是”,不同意填“否” + varchar(255)|0s + 1 + '' + normal + + + 77 + 医师执业起始时间 医师在互联网医院内的执业起始时间,形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 78 + 医师执业终止时间 医师在互联网医院内的执业终止时间,形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 79 + 申请拟执业医疗机构意见 对应备案信息表的医院意见 + varchar(255)|0s + 1 + '' + normal + + + 80 + 申请拟执业医疗机构-电子章 base64编码,图片背景透明,文件格式是png, 该留样为图片样式的电子章。 + mediumtext|0s + normal + + + 81 + 申请拟执业医疗机构意见时间 对应备案信息表的医院意见填写时间,形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 82 + 医师诊疗活动价格列表 列表的Json格式字符串,形如:"[{"med_class_code":"1","med_class_name": "图文问诊","price":"30"},{"med_class_code":"2","med_class_name":"语音问诊","price":"20"}]"。其中med_class_code,med_class_name,price是三个必填子项,分别表示:就诊类别编码,就诊类别名称,价格 + mediumtext|0s + normal + + + 83 + 互联网医院聘任合同列表(适合多张合同照片的情形) base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"employ_files": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"employ_files": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中employ_files是必填子项 + mediumtext|0s + normal + + + 84 + 医师数字签名留样 base64编码,图片背景透明,大小限制不超过200k,图片文件格式是png。该留样为图片样式的电子签名。 + mediumtext|0s + normal + + + 85 + 海南是否已备案 如果海南已备案,则值为“1”,只有已备案的医师才可以问诊;否则值为“0” + int(1)|0s + 1 + 0 + normal + + + 86 + 医院是否已确认 互联网医院需要确认医师信息的正确性,已确认则值为“1”,否则值为“0” + int(1)|0s + 1 + 0 + normal + + + 87 + 海南处方开具权是否备案 海南处方开具权是否备案标志,已备案则值为“1”,否则值为“0” + int(1)|0s + 0 + normal + + + 88 + 医师执业备案文件列表 base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"doc_multi_sited_record": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"doc_multi_sited_record": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中doc_multi_sited_record是必填子项 + mediumtext|0s + normal + + + 89 + 医师身份证文件列表 包含身份证正反面文件,base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"id_card": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"id_card": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中id_card是必填子项 + mediumtext|0s + normal + + + 90 + 医师执业证文件列表 base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"cert_doc_prac": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"cert_doc_prac": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中cert_doc_prac是必填子项 + mediumtext|0s + normal + + + 91 + 医师职称证文件列表 包含多个医师职称证文件,监管要求上传所有内容页的照片,base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"title_cert": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"title_cert": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中title_cert是必填子项 + mediumtext|0s + normal + + + 92 + 医师资格证文件列表 包含多个医师资格证文件,监管要求上传所有内容页的照片,base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"doc_cert": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"doc_cert": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中doc_cert是必填子项 + mediumtext|0s + normal + + + 93 + 医师认证照片文件 base64编码,图片大小限制不超过200k,图片文件格式是jpg。 + mediumtext|0s + normal + + + 94 + 创建时间 + int(10)|0s + 1 + 0 + normal + + + 95 + 更新时间 本条记录插入或更新的数据库当前时间,形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + int(10)|0s + 1 + 0 + normal + + + 96 + 删除时间 + int(10)|0s + 1 + 0 + normal + + + 97 + 申请时间 + int(10)|0s + 1 + 0 + normal + + + admin_id + btree + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + 证书图 + text|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 7 + 1-审核中;2-不通过;3-通过 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + 医生评价 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + normal + + + 3 + int(11) unsigned|0s + normal + + + 4 + text|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 职称 + int(8) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 处方号 + varchar(255)|0s + 1 + '' + normal + + + 5 + 开方医师编码 + varchar(255)|0s + 1 + '' + normal + + + 6 + 开方医师名称 + varchar(255)|0s + 1 + '' + normal + + + 7 + 审方医师编码 + varchar(255)|0s + 1 + '' + normal + + + 8 + 审方医师名称 + varchar(255)|0s + 1 + '' + normal + + + 9 + 售药药店编码 互联网医院对响应药店的内部编码 + varchar(255)|0s + 1 + '' + normal + + + 10 + 售药药店名称 + varchar(255)|0s + 1 + '' + normal + + + 11 + 售药方式 1:到店自取,2:选择配送 + int(1)|0s + 1 + 1 + normal + + + 12 + 处方确认人编码 药店确认处方的操作人员 + varchar(255)|0s + 1 + '' + normal + + + 13 + 处方确认人姓名 药店确认处方的操作人员 + varchar(255)|0s + 1 + '' + normal + + + 14 + 处方确认时间 + datetime|0s + normal + + + 15 + 现场售药操作人编码 如果选择配送,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 16 + 现场售药操作人名称 如果选择配送,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 17 + 到店自取时间 + datetime|0s + normal + + + 18 + 处方配送订单执行人编码 如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 19 + 处方配送订单执行人姓名 如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 20 + 处方配送订单执行时间 + datetime|0s + normal + + + 21 + 配送机构编码 互联网医院对配送机构的内部编码。如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 22 + 配送机构名称 如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 23 + 配送操作人 配送人姓名。如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 24 + 配送人联系方式 如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 25 + 是否及时 配送服务评价,如果到店自取,则为-1 + int(1)|0s + normal + + + 26 + 是否出错 配送服务评价,如果到店自取,则为-1 + int(1)|0s + normal + + + 27 + 出错原因 配送服务出错原因,如果到店自取,则为“-1” + varchar(255)|0s + 1 + '' + normal + + + 28 + 最后更新时间 + datetime|0s + normal + + + 1 + id + 1 + + + 1 + + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(50)|0s + normal + + + 6 + varchar(100)|0s + normal + + + 7 + varchar(255)|0s + normal + + + 8 + 邀请码 + varchar(255)|0s + normal + + + 9 + 0-未定级1-科主任2-主任科员3-科员 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 10 + 上级 + int(11) unsigned|0s + 1 + 0 + normal + + + 11 + 一级下属数量 + int(11) unsigned|0s + 1 + 0 + normal + + + 12 + int(11) unsigned|0s + 1 + 0 + normal + + + 13 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 图文咨询余额 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + 发送条数 + int(10) unsigned|0s + 1 + 0 + normal + + + 5 + timestamp|0s + CURRENT_TIMESTAMP + normal + CURRENT_TIMESTAMP + + + 1 + id + 1 + + + 1 + 图文咨询 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + int(11) unsigned|0s + 1 + normal + + + 5 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 6 + 条数 + tinyint(1) unsigned|0s + 1 + normal + + + 7 + 时间分钟 + tinyint(1) unsigned|0s + 1 + normal + + + 8 + 0-未付款;1-付款未回复;2-已回复;3-已结束;4-已退款 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 9 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 10 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 医生图文咨询设置 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + int(10) unsigned|0s + normal + + + 3 + 价格/次 + decimal(10,2 digit) unsigned|0s + 9.00 + normal + + + 4 + 服务说明 + varchar(255)|0s + normal + + + 5 + 发送条数 + tinyint(1) unsigned|0s + 20 + normal + + + 6 + 服务时长/分钟 + tinyint(1) unsigned|0s + 10 + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + varchar(255)|0s + normal + + + 4 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 5 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 6 + varchar(255)|0s + normal + + + 7 + varchar(255)|0s + normal + + + 8 + varchar(255)|0s + normal + + + 9 + 状态10-未提现20-提现中30-已提现 + tinyint(1) unsigned|0s + 1 + 10 + normal + + + 10 + datetime|0s + normal + + + 11 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 登录医师编码 + varchar(255)|0s + 1 + '' + normal + + + 5 + 登录医师姓名 + varchar(255)|0s + 1 + '' + normal + + + 6 + 登录时间 + datetime|0s + normal + + + 7 + 登录医师照片数据 + mediumtext|0s + normal + + + 8 + 最后更新时间 + timestamp|0s + normal + CURRENT_TIMESTAMP + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + 13 + normal + + + 3 + varchar(50)|0s + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + 5 + normal + + + 3 + varchar(50)|0s + normal + + + pid + btree + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + 6 + normal + + + 3 + varchar(50)|0s + normal + + + 1 + id + 1 + + + 1 + 菜单和权限 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + normal + + + 3 + varchar(255)|0s + 1 + normal + + + 4 + 等级 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 5 + 上级id + int(10) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 消息 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + 1-图文咨询;2-电话咨询;3-预约;4-用药指南 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 5 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 门诊类型 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(50)|0s + normal + + + 1 + id + 1 + + + 1 + + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + tinyint(2) unsigned|0s + 1 + normal + + + 5 + varchar(20)|0s + normal + + + 6 + varchar(20)|0s + normal + + + 7 + 挂号人 + int(11) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 执业点 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + varchar(255)|0s + 1 + normal + + + 4 + 1-按周;2-按月 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 5 + 按周排班 + text|0s + normal + + + 6 + 按月排班 + text|0s + normal + + + 7 + 是否开启预约 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 8 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 9 + 停诊有效日期 + varchar(20)|0s + normal + + + 10 + varchar(255)|0s + normal + + + 11 + 是否通知患者 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 排班 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11)|0s + 1 + normal + + + 3 + 执业点id + int(11) unsigned|0s + 1 + normal + + + 4 + 门诊类型1普通2专家3专科4特需5点诊6无 + tinyint(1) unsigned|0s + 1 + 6 + normal + + + 5 + 1-上午;2-下午;3-晚上 + tinyint(1) unsigned|0s + 1 + normal + + + 6 + 周几 + varchar(20)|0s + 1 + normal + + + 7 + 日期,年月日 + varchar(20)|0s + 1 + normal + + + 8 + 开始时间 + varchar(20)|0s + normal + + + 9 + 结束时间 + varchar(20)|0s + normal + + + 10 + 1-按时间段2-按号数 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 11 + 单次时段/分钟 + varchar(20)|0s + normal + + + 12 + 号数 + tinyint(2) unsigned|0s + normal + + + 13 + decimal(10,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 14 + 开启预约 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 门诊预约 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + int(11) unsigned|0s + 1 + normal + + + 5 + varchar(100)|0s + normal + + + 6 + varchar(30)|0s + normal + + + 7 + int(11) unsigned|0s + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 9 + tinyint(2) unsigned|0s + 1 + 0 + normal + + + 10 + varchar(20)|0s + normal + + + 11 + tinyint(1) unsigned|0s + normal + + + 12 + tinyint(1) unsigned|0s + normal + + + 13 + varchar(20)|0s + normal + + + 14 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 15 + 0未付款1已付款2已退款 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 16 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 17 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + '' + normal + + + 3 + varchar(255)|0s + 1 + '' + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + normal + + + 3 + decimal(20,2 digit)|0s + 1 + 0.00 + normal + + + 4 + 1待提现2-已提现 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 5 + timestamp|0s + 1 + '0000-00-00 00:00:00' + normal + CURRENT_TIMESTAMP + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + 药师类型1-中西成药2-饮片 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 5 + varchar(255)|0s + normal + + + 6 + 身份证号码 + varchar(255)|0s + normal + + + 7 + 身份证正面 + varchar(255)|0s + normal + + + 8 + 身份证反面 + varchar(255)|0s + normal + + + 9 + 专业技术资格正面 + varchar(255)|0s + normal + + + 10 + 专业技术资格反面 + varchar(255)|0s + normal + + + 11 + 1-待填写资料2-待审核3-通过4-不通过 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 12 + varchar(255)|0s + normal + + + 13 + timestamp|0s + CURRENT_TIMESTAMP + normal + CURRENT_TIMESTAMP + + + 1 + id + 1 + + + 1 + 药房 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + varchar(50)|0s + normal + + + 5 + varchar(100)|0s + normal + + + 6 + varchar(200)|0s + normal + + + 7 + varchar(255)|0s + normal + + + 8 + 经度 + decimal(20,7 digit) unsigned|0s + normal + + + 9 + 纬度 + decimal(20,7 digit) unsigned|0s + normal + + + 10 + varchar(50)|0s + normal + + + 11 + 是否是快递点 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 12 + 是否同城快递 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 13 + 是否中西药 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 14 + 是否草药(饮片) + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 15 + 营业执照副本 + varchar(255)|0s + normal + + + 16 + 药品经营许可证 + varchar(255)|0s + normal + + + 17 + 药品质量管理规范证书 + varchar(255)|0s + normal + + + 18 + 医疗器械 + varchar(255)|0s + normal + + + 19 + 食品经营 + varchar(255)|0s + normal + + + 20 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + CURRENT_TIMESTAMP + + + 21 + 是否开启 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 22 + 是否通过 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 23 + 1-待填写资料2-待审核3-通过4-不通过 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 24 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 编码 + varchar(255)|0s + 1 + '' + normal + + + 3 + 职称名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 1:默认 2:高亮显示部分是医师备案平台“专业技术职务任职资格”可选项 + char(1)|0s + 1 + '1' + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 药品类别 01 西药 02 中成药 + varchar(255)|0s + 1 + '' + normal + + + 3 + 处方号 互联网医院内部处方号(弃用) + varchar(255)|0s + 1 + '' + normal + + + 4 + 药品通用名称 + varchar(255)|0s + 1 + '' + normal + + + 5 + 药品通用名称 填写国药准字号编码 + varchar(255)|0s + 1 + '' + normal + + + 6 + 药品商品名称 填写国药准字号对应名称 + varchar(255)|0s + 1 + '' + normal + + + 7 + 药品分类码 从国家药品编码截取前五位 + varchar(255)|0s + 1 + '' + normal + + + 8 + 药品分类名称 + varchar(255)|0s + 1 + '' + normal + + + 9 + 药品剂型 + varchar(255)|0s + 1 + '' + normal + + + 10 + 用药途径(弃用) + varchar(255)|0s + 1 + '' + normal + + + 11 + 用药剂量-单次(弃用) + varchar(255)|0s + 1 + '' + normal + + + 12 + 用药剂量单位-单次(弃用) + varchar(255)|0s + 1 + '' + normal + + + 13 + 用药剂量-总量(弃用) + varchar(255)|0s + 1 + '' + normal + + + 14 + 用药剂量单位-总量(弃用) + varchar(255)|0s + 1 + '' + normal + + + 15 + 用药频率编码 参见药品使用频次字典(弃用) + varchar(255)|0s + 1 + '' + normal + + + 16 + 用药频率(弃用) + varchar(255)|0s + 1 + '' + normal + + + 17 + 规格 + varchar(255)|0s + 1 + '' + normal + + + 18 + 单价 + decimal(10,2 digit)|0s + 1 + 0.00 + normal + + + 19 + 金额 + decimal(10,2 digit)|0s + 1 + 0.00 + normal + + + 20 + 嘱托(弃用) + varchar(255)|0s + 1 + '' + normal + + + 21 + 抗菌药说明 非抗菌药物填“无”,抗菌药根据实际情况填写。(弃用) + varchar(255)|0s + 1 + '' + normal + + + 22 + 中药煎煮法名称(弃用) + varchar(255)|0s + '' + normal + + + 23 + 药量(单位为天) 记录这个处方中开出的该药品为几天的药量(弃用) + varchar(255)|0s + 1 + '' + normal + + + 24 + 创建时间 + int(10)|0s + 1 + 0 + normal + + + 25 + 最后更新时间 + timestamp|0s + 1 + '0000-00-00 00:00:00' + normal + CURRENT_TIMESTAMP + + + 26 + 删除标记 + int(10)|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 后台管理员 + int(8) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + normal + + + 3 + varchar(255)|0s + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + int(5) unsigned|0s + normal + + + 6 + 私人医院id,roleid=3才有 + int(10) unsigned|0s + 1 + 0 + normal + + + 7 + varchar(255)|0s + 1 + normal + + + 8 + varchar(255)|0s + normal + + + 9 + varchar(20)|0s + normal + + + 10 + varchar(30)|0s + normal + + + 11 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 药房 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + varchar(50)|0s + normal + + + 5 + varchar(100)|0s + normal + + + 6 + varchar(200)|0s + normal + + + 7 + varchar(255)|0s + normal + + + 8 + 经度 + decimal(20,7 digit) unsigned|0s + normal + + + 9 + 纬度 + decimal(20,7 digit) unsigned|0s + normal + + + 10 + varchar(50)|0s + normal + + + 11 + 是否是快递点 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 12 + 是否同城快递 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 13 + 是否中西药 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 14 + 是否草药(饮片) + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 15 + 营业执照副本 + varchar(255)|0s + normal + + + 16 + 医疗机构执业许可证 + varchar(255)|0s + normal + + + 17 + 身份证正面 + varchar(255)|0s + normal + + + 18 + 身份证反面 + varchar(255)|0s + normal + + + 19 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + CURRENT_TIMESTAMP + + + 20 + 是否开启 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 21 + 1-待填写资料2-待审核3-通过4-不通过 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 22 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + int(10)|0s + normal + + + 3 + varchar(32)|0s + normal + + + 4 + int(11) unsigned|0s + 1 + normal + + + 5 + int(11) unsigned|0s + 0 + normal + + + pid + btree + + + 1 + id + 1 + + + 1 + 处方订单 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + pres_no 处方号 + varchar(50)|0s + 1 + normal + + + 3 + 西药、中成药 = 1;草药饮片、草药颗粒 = 2; + varchar(2)|0s + 1 + '1' + normal + + + 4 + pres_class_code处方类别编码 01-西药;02-中成药;03草药饮片;04-草药颗粒(参见处方类别字典,如果该处方包含多个字典项,将多个字典项以“,“隔开,如同时包含中成药和西药,填写”01,02“) + varchar(255)|0s + 1 + '' + normal + + + 5 + 处方类别名称 + varchar(255)|0s + '' + normal + + + 6 + 1-自费;2-公费 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 7 + int(10)|0s + 1 + normal + + + 8 + pt_id 患者id + int(10) unsigned|0s + normal + + + 9 + 就诊流水号 + varchar(255)|0s + 1 + '' + normal + + + 10 + 就诊类别编码 参见就诊类别字典 + varchar(255)|0s + 1 + '' + normal + + + 11 + 就诊类别名称 + varchar(255)|0s + 1 + '' + normal + + + 12 + 药房id + int(11) unsigned|0s + 0 + normal + + + 13 + 药房药师名字 + varchar(50)|0s + normal + + + 14 + 药房管理员id + int(11)|0s + normal + + + 15 + 药师id + int(11) unsigned|0s + 0 + normal + + + 16 + pt_no 患者姓名 + varchar(50)|0s + normal + + + 17 + pt_age 患者年龄 + tinyint(1) unsigned|0s + normal + + + 18 + 性别编码 参见性别字典 0:未知的性别,1:男,2:女,9:未说明的性别 + varchar(255)|0s + 1 + '' + normal + + + 19 + ge_name 性别名称 + varchar(10)|0s + normal + + + 20 + 出生日期 + date|0s + normal + + + 21 + 民族 + varchar(50)|0s + normal + + + 22 + 婚姻 + varchar(50)|0s + normal + + + 23 + 工作 + varchar(255)|0s + normal + + + 24 + 过敏 + varchar(255)|0s + normal + + + 25 + 患者主诉及简要病史 + varchar(255)|0s + normal + + + 26 + 辅助检查结果 + varchar(255)|0s + normal + + + 27 + 省 pt_district 以国家统计局的《最新县及县以上行政区划代码》为准,填写地区代码 + varchar(50)|0s + normal + + + 28 + + varchar(100)|0s + normal + + + 29 + + varchar(100)|0s + normal + + + 30 + 地址 + text|0s + normal + + + 31 + id_no 身份证 + varchar(255)|0s + normal + + + 32 + pt_tel 电话 + varchar(50)|0s + normal + + + 33 + 经度 + decimal(20,7 digit)|0s + normal + + + 34 + 纬度 + decimal(20,7 digit)|0s + normal + + + 35 + 病情 + text|0s + normal + + + 36 + 生活指导 + text|0s + normal + + + 37 + 用药指南 + text|0s + normal + + + 38 + 注意事项 + text|0s + normal + + + 39 + 价格 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 40 + 快递费 + decimal(10,2 digit)|0s + 1 + 0.00 + normal + + + 41 + 药事咨询费 + decimal(10,2 digit)|0s + 1 + 10.00 + normal + + + 42 + 1-药店配送;2自提 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 43 + 1-自煎;2-代煎 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 44 + 0待用户完善信息1已完善待药师审核2已审核待输入价格3待用户确认价格4已确认待发货5已发货6已完成7已取消;8-待医生完善 + tinyint(2) unsigned|0s + 1 + 0 + normal + + + 45 + 快递 + varchar(50)|0s + normal + + + 46 + 快递单号 + varchar(255)|0s + normal + + + 47 + 发货时间 + datetime|0s + normal + + + 48 + text|0s + normal + + + 49 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + + + 50 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 51 + 保险类别编码 01:社会基本医疗保险,02:商业医疗保险,03:大病统筹,04:新型农村合作医疗,05:城镇居民基本医疗保险,06:公费医疗,99:其他 + varchar(255)|0s + 1 + '' + normal + + + 52 + 保险类别名称 + varchar(255)|0s + 1 + '' + normal + + + 53 + 医疗机构编码 参见互联网医院字典 + varchar(255)|0s + 1 + '' + normal + + + 54 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 55 + 就诊科室编码 参见科室字典 + varchar(255)|0s + 1 + '' + normal + + + 56 + 就诊科室名称 + varchar(255)|0s + 1 + '' + normal + + + 57 + 开方科室编码 参见科室字典 + varchar(255)|0s + 1 + '' + normal + + + 58 + 开方科室名称 + varchar(255)|0s + 1 + '' + normal + + + 59 + 开方时间 + datetime|0s + normal + + + 60 + 开方医生编码 医生在互联网医院的内部编码 + varchar(255)|0s + 1 + '' + normal + + + 61 + 开方医生姓名 + varchar(255)|0s + 1 + '' + normal + + + 62 + 开方医师照片数据 base64编码,图片大小限制不超过200k,图片文件格式是jpg + mediumtext|0s + normal + + + 63 + 审核时间 + datetime|0s + normal + + + 64 + 审核医生编码 + varchar(255)|0s + 1 + '' + normal + + + 65 + 审核医生姓名 + varchar(255)|0s + 1 + '' + normal + + + 66 + 审方时间 + datetime|0s + normal + + + 67 + 审方药师编码 + varchar(255)|0s + 1 + '' + normal + + + 68 + 审方药师姓名 + varchar(255)|0s + 1 + '' + normal + + + 69 + 诊断编码类型 表示疾病编码使用的标准,取值为:ICD10、GB-95、“-1”,-1表示其它标准情况 + varchar(255)|0s + 1 + '' + normal + + + 70 + 疾病编码 参见疾病字典,西医使用ICD10,中医使用GB-95。在疾病的字段中,如果要传多个疾病,中间使用分隔符“|”分开 + varchar(255)|0s + 1 + '' + normal + + + 71 + 疾病名称 + varchar(255)|0s + 1 + '' + normal + + + 72 + 疾病分类 用来判断药量是否超标,取值如下:0:普通,1:急性病,2:慢性病,3:未知 + int(11)|0s + 1 + 0 + normal + + + 73 + 行动不便标志 用来判断药量是否超标,取值如下:0:否,1:是,3:未知 + int(11)|0s + 1 + 0 + normal + + + 74 + 病情稳定需长期服药标志 用来判断药量是否超标,取值如下:0:否,1:是,3:未知 + int(11)|0s + 1 + 0 + normal + + + 75 + 处方有效期(单位天) + int(11)|0s + 1 + 0 + normal + + + 76 + 总金额 + decimal(10,2 digit)|0s + 1 + 0.00 + normal + + + 77 + 互联网医院处方图片列表(适合多张处方照片的情形) base64编码列表的Json格式字符串,图片文件格式是jpg,形如:"[{"pres_photos": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"pres_photos": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中pres_photos是必填子项,表示处方笺照片的base64编码 + mediumtext|0s + normal + + + 78 + 最后更新时间 + timestamp|0s + normal + CURRENT_TIMESTAMP + + + 79 + 创建时间(暂时当做就诊时间) + int(11)|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + 药品名 + varchar(255)|0s + normal + + + 4 + 规格 + varchar(50)|0s + normal + + + 5 + 计量单位 + varchar(50)|0s + normal + + + 6 + 数量 + varchar(50)|0s + normal + + + 7 + 用法用量 + varchar(255)|0s + normal + + + 8 + 药方 + text|0s + normal + + + 9 + 价格 + decimal(10,2 digit) unsigned|0s + 0.00 + normal + + + 10 + 贴数量 + varchar(50)|0s + normal + + + 11 + 药品id + int(11)|0s + 1 + 0 + normal + + + 12 + 中药煎煮法名称(为中药时) + varchar(255)|0s + normal + + + 13 + 药量(单位为天)(为中药时) + varchar(255)|0s + '' + normal + + + 14 + 用药途径(为西药时) + varchar(255)|0s + '' + normal + + + 15 + 用药剂量-单次(为西药时) + varchar(255)|0s + '' + normal + + + 16 + 用药剂量单位-单次(为西药时) + varchar(255)|0s + '' + normal + + + 17 + 用药剂量-总量(为西药时) + varchar(255)|0s + '' + normal + + + 18 + 用药剂量单位-总量(为西药时) + varchar(255)|0s + '' + normal + + + 19 + 用药频率(为西药时) + varchar(255)|0s + '' + normal + + + 20 + 用药频率编码(为西药时) + varchar(255)|0s + '' + normal + + + 21 + 嘱托(为西药时) + varchar(255)|0s + '' + normal + + + 22 + 抗菌药说明(为西药时) + varchar(255)|0s + '' + normal + + + 1 + id + 1 + + + 1 + 角色 + int(9) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + varchar(1000)|0s + normal + + + 5 + varchar(1000)|0s + normal + + + 1 + id + 1 + + + 1 + 积分记录 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + normal + + + 3 + 1-增加;2-消费 + tinyint(1) unsigned|0s + normal + + + 4 + tinyint(10) unsigned|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 隐私号 + tinyint(3) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(15)|0s + 1 + normal + + + 3 + tinyint(1) unsigned|0s + 1 + 200 + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 互联网医疗机构编码 参见互联网医院字典。标识该机构是和哪家互联网医院进行签约的。 + varchar(255)|0s + 1 + '' + normal + + + 3 + 互联网医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 机构编码 组织机构编码 + varchar(255)|0s + 1 + '' + normal + + + 5 + 机构名称 + varchar(255)|0s + 1 + '' + normal + + + 6 + 级别 + varchar(255)|0s + 1 + '' + normal + + + 7 + 性质 + varchar(255)|0s + 1 + '' + normal + + + 8 + 机构联系电话 + varchar(255)|0s + 1 + '' + normal + + + 9 + 机构负责人姓名 + varchar(255)|0s + 1 + '' + normal + + + 10 + 机构负责人电话 + varchar(255)|0s + 1 + '' + normal + + + 11 + 地址 + varchar(255)|0s + 1 + '' + normal + + + 12 + 机构简介 + varchar(255)|0s + 1 + '' + normal + + + 13 + 签约时间 + int(10)|0s + 1 + 0 + normal + + + 14 + 签约年限 + int(11)|0s + 1 + 0 + normal + + + 15 + 创建时间 + int(10)|0s + 1 + 0 + normal + + + 16 + 最后更新时间 + int(10)|0s + 1 + 0 + normal + + + 17 + 删除标记 + int(10)|0s + 1 + 0 + normal + + + web_org_code + btree + + + org_code + btree + + + 1 + id + 1 + + + 1 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + 1-app手机注册;2-微信公众号用户手机绑定;3-app重置密码;4-药房注册;5-药代表注册6-审核通知 + tinyint(2) unsigned|0s + normal + + + 4 + varchar(12)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 轮播 + int(8) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + tinyint(3) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 咨询记录 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11) unsigned|0s + 1 + normal + + + 4 + int(11) unsigned|0s + 1 + normal + + + 5 + varchar(15)|0s + normal + + + 6 + varchar(15)|0s + normal + + + 7 + 隐私号码 + varchar(15)|0s + normal + + + 8 + 绑定关系ID + varchar(20)|0s + normal + + + 9 + 通话id + varchar(30)|0s + normal + + + 10 + 时长/分 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 11 + decimal(20,2 digit) unsigned|0s + 1 + 0.00 + normal + + + 12 + 0未付款1已付款待服务2已绑定待服务3已服务4已退款 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 13 + 退款说明 + varchar(255)|0s + normal + + + 14 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + + + 15 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + CURRENT_TIMESTAMP + + + 16 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 17 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 18 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + 医生电话咨询设置 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + int(10) unsigned|0s + normal + + + 3 + 价格/次 + decimal(10,2 digit) unsigned|0s + 0.00 + normal + + + 4 + 服务说明 + varchar(255)|0s + normal + + + 5 + 服务时长/分钟 + tinyint(1) unsigned|0s + 10 + normal + + + 1 + id + 1 + + + 1 + 感谢信 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + 1-感谢信;2-福卡 + tinyint(1) unsigned|0s + 1 + 1 + normal + + + 3 + int(10) unsigned|0s + 1 + normal + + + 4 + int(10) unsigned|0s + 1 + normal + + + 5 + text|0s + normal + + + 6 + varchar(255)|0s + normal + + + 7 + decimal(20,2 digit) unsigned|0s + 0.00 + normal + + + 8 + 是否收下0-未收;1-已收 + tinyint(1) unsigned|0s + 0 + normal + + + 9 + 是否展示0-不展示;1-展示 + tinyint(1) unsigned|0s + 0 + normal + + + 10 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 用户 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + 姓名 + varchar(100)|0s + normal + + + 7 + 身份证 + varchar(50)|0s + normal + + + 8 + tinyint(1) unsigned|0s + 1 + 0 + normal + + + 9 + m男f女 + varchar(20)|0s + normal + + + 10 + varchar(255)|0s + normal + + + 11 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + varchar(255)|0s + normal + + + 4 + int(1)|0s + normal + + + 5 + varchar(10)|0s + normal + + + 6 + 民族 + varchar(50)|0s + normal + + + 7 + 婚姻 + varchar(50)|0s + normal + + + 8 + 工作 + varchar(255)|0s + normal + + + 9 + 过敏 + varchar(255)|0s + normal + + + 10 + varchar(50)|0s + normal + + + 11 + varchar(100)|0s + normal + + + 12 + varchar(255)|0s + normal + + + 13 + varchar(255)|0s + normal + + + 14 + varchar(30)|0s + normal + + + 15 + varchar(255)|0s + normal + + + 16 + decimal(20,6 digit)|0s + normal + + + 17 + decimal(20,6 digit)|0s + normal + + + 1 + id + 1 + + + 1 + int(10) unsigned|0s + 1 + 1 + normal + + + 2 + int(10) unsigned|0s + 1 + normal + + + 3 + int(10) unsigned|0s + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + 手机号 + varchar(15)|0s + normal + + + 6 + 组名 + int(11) unsigned|0s + 1 + 0 + normal + + + 7 + varchar(255)|0s + normal + + + 8 + timestamp|0s + 1 + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + 患者分组 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + int(11) unsigned|0s + 1 + normal + + + 3 + 组名 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11) unsigned|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + 1-药房/药店审核通过2-药房/药店审核不通过3-医生审核通过4-医生审核不通过 + tinyint(1) unsigned|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + timestamp|0s + CURRENT_TIMESTAMP + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 参见互联网医院字典 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 预约号 + varchar(0)|0s + 1 + '' + normal + + + 5 + 患者ID + varchar(0)|0s + 1 + '' + normal + + + 6 + 患者姓名 + varchar(0)|0s + 1 + '' + normal + + + 7 + 性别编码 + varchar(255)|0s + 1 + '' + normal + + + 8 + 性别名称 + varchar(255)|0s + 1 + '' + normal + + + 9 + 患者年龄 + varchar(255)|0s + 1 + '' + normal + + + 10 + 患者出生日期 形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 11 + 身份证号 + varchar(0)|0s + 1 + '' + normal + + + 12 + 患者手机号 + varchar(255)|0s + 1 + '' + normal + + + 13 + + varchar(255)|0s + 1 + '' + normal + + + 14 + + varchar(255)|0s + 1 + '' + normal + + + 15 + 患者所在地区 以国家统计局的《最新县及县以上行政区划代码》为准,填写地区代码 + varchar(255)|0s + 1 + '' + normal + + + 16 + 预约机构编码 + varchar(255)|0s + 1 + '' + normal + + + 17 + 预约机构名称 + varchar(255)|0s + 1 + '' + normal + + + 18 + 预约科室编码 + varchar(255)|0s + 1 + '' + normal + + + 19 + 预约科室名称 + varchar(255)|0s + 1 + '' + normal + + + 20 + 预约医生编码 + varchar(255)|0s + 1 + '' + normal + + + 21 + 预约医生名称 + varchar(255)|0s + 1 + '' + normal + + + 22 + 预约时间 形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + int(10)|0s + 1 + 0 + normal + + + 23 + 就诊日期 形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 24 + 就诊推荐时间段 二十四小时制,形式如 “hh:mm”+“-”+“hh:mm” + varchar(0)|0s + 1 + '' + normal + + + 25 + 预约挂号是否取消 0:否,1:是 + int(1)|0s + 1 + 0 + normal + + + 26 + 取消预约挂号时间 如果预约挂号取消,则更新取消时间。形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + int(10)|0s + 1 + 0 + normal + + + 27 + int(10)|0s + 1 + 0 + normal + + + 28 + 本条记录插入或更新的数据库当前时间,形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + int(10)|0s + 1 + 0 + normal + + + 29 + int(10)|0s + 0 + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 参见互联网医院字典 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 书写医师编码 医生在互联网医院的编码 + varchar(255)|0s + 1 + '' + normal + + + 5 + 书写医师姓名 + varchar(255)|0s + 1 + '' + normal + + + 6 + 患者ID + varchar(255)|0s + 1 + '' + normal + + + 7 + 就诊流水号 + varchar(255)|0s + 1 + '' + normal + + + 8 + 病例文件索引列表 + text|0s + normal + + + 9 + 病历新建时间 + datetime|0s + normal + + + 10 + 病历完成时间 + datetime|0s + normal + + + 11 + 最后更新时间 + datetime|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 参见互联网医院字典 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 通信地址 + varchar(255)|0s + 1 + '' + normal + + + 5 + 联系人姓名 + varchar(255)|0s + 1 + '' + normal + + + 6 + 联系电话 + varchar(255)|0s + 1 + '' + normal + + + 7 + 法人代表 + varchar(255)|0s + 1 + '' + normal + + + 8 + 开始日期 执业许可证有效期的开始日期,形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 9 + 截至日期 执业许可证有效期的截至日期,形式如“yyyy-MM-dd” + int(10)|0s + 1 + 0 + normal + + + 10 + 经济属性 政府公立、国企医院、国有与民营合资、民营、外资 + varchar(255)|0s + 1 + '' + normal + + + 11 + 机构类别 综合医院、中医医院、中西医结合医院、民族医院、专科医院、康复医院、妇幼保健院、等等 + varchar(255)|0s + 1 + '' + normal + + + 12 + 机构级别 三级、二级、一级 + varchar(255)|0s + 1 + '' + normal + + + 13 + 机构等次 特等、甲等、乙等、丙等、未定等次 + varchar(255)|0s + 1 + '' + normal + + + 14 + 编制床位 + int(11)|0s + 1 + 0 + normal + + + 15 + 平均开放床位 + int(11)|0s + 1 + 0 + normal + + + 16 + 机构简介 + varchar(1000)|0s + 1 + '' + normal + + + 17 + 诊疗科目列表 列表的Json格式字符串,形如:"[{"dept_code": "07","dept_name":"儿科"},{"dept_code": "05","dept_name":"妇产科"}]"。其中dept_code,dept_name是两个必填子项,分别表示诊疗科目编码、诊疗科目名称 + text|0s + normal + + + 18 + 互联网医院备案-电子签章 base64编码,图片背景透明,大小限制不超过200K,图片文件格式是png。该留样为图片样式的电子签名。 + mediumtext|0s + normal + + + 19 + 互联网医院备案-可行性报告 base64编码,文档大小限制不超过2M,文档文件格式是pdf。 + mediumtext|0s + normal + + + 20 + 互联网医院执业许可证 base64编码,文档大小限制不超过2M,文档文件格式是pdf。 + mediumtext|0s + normal + + + 21 + 互联网医院备案-医疗机构规章制度列表 base64编码列表的Json格式字符串,文档文件格式是pdf,形如:"[{"record_rules": "/9j/4AAQSkZJRgABAQEAYABgAAD"},{"record_rules": "/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中record_rules是必填子项 + mediumtext|0s + normal + + + 22 + 互联网医院备案-网络拓扑图 base64编码,文档大小限制不超过2M,文档文件格式是pdf。 + mediumtext|0s + normal + + + 23 + 资质文件列表 base64编码列表的Json格式字符串,文档文件格式是pdf,形如:"[{"file_type_code":"01","file_type_name":"病案管理","file_content":"/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中file_type_code,file_type_name,file_content是三个必填子项。互联网医院正式接入医师备案平台之前,需上传资质文件:《海南省互联网医院医师备案承诺书》,上传时要求file_type_code编码值为“02”,以此表明文件是备案承诺书文件。 + mediumtext|0s + normal + + + 24 + 最后更新时间 本条记录插入或更新的数据库当前时间,形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + int(10)|0s + 1 + normal + + + 25 + 创建时间 + int(10)|0s + 1 + 0 + normal + + + 26 + int(10)|0s + 1 + 0 + normal + + + org_code + btree + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + 1 + '' + normal + + + 3 + varchar(255)|0s + 1 + '' + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + char(7)|0s + 1 + '' + normal + + + 3 + varchar(100)|0s + 1 + '' + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 + varchar(255)|0s + 1 + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + 1 + '' + normal + + + 4 + 填表日期 + int(10)|0s + 1 + 0 + normal + + + 5 + 远程门诊设备列表 +列表的Json格式字符串,形如:"[{"eqp_name": "xx","eqp_type":"xx","basic_spec_param":"xx","quantity":"xx","eqp_mfr":"xx","purchase_date":"xx","eqp_sn":"xx","remark":"xx"},{"eqp_name": "yy","eqp_type":"yy","basic_spec_param":"yy","quantity":"yy","eqp_mfr":"yy","purchase_date":"yy","eqp_sn":"yy","remark":"yy"}]"。其中eqp_name,eqp_type,basic_spec_param,quantity,eqp_mfr,purchase_date,eqp_sn,remark是八个必填子项,分别表示设备名称、型号、基本规格参数、数量、生产厂家、购入时间、设备序列号、备注 + mediumtext|0s + normal + + + 6 + 远程会诊设备列表 json同上 + mediumtext|0s + normal + + + 7 + 远程心电诊断设备列表 json同上 + mediumtext|0s + normal + + + 8 + 远程医学影像诊断设备列表 json同上 + mediumtext|0s + normal + + + 9 + 远程病理诊断设备列表 json同上 + mediumtext|0s + normal + + + 10 + 其他诊断设备列表 json同上 + mediumtext|0s + normal + + + 11 + 附件文件列表 base64编码列表的Json格式字符串,文档文件是盖章的pdf,形如:"[{"file_type_name":"互联网医院设备台账","file_content":"/9j/4AAQSkZJRgABAQEAYABgAAD"}]"。其中file_type_name,file_content是两个必填子项 + mediumtext|0s + normal + + + 12 + 创建时间 + int(10)|0s + 1 + 0 + normal + + + 13 + 更新时间 + int(10)|0s + 1 + 0 + normal + + + 14 + 删除时间 + int(10)|0s + 1 + 0 + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + 医疗机构编码 + varchar(255)|0s + '' + normal + + + 3 + 医疗机构名称 + varchar(255)|0s + '' + normal + + + 4 + 接诊时间 + datetime|0s + normal + + + 5 + 结束时间 + datetime|0s + normal + + + 6 + 接诊科室编码 + varchar(255)|0s + '' + normal + + + 7 + 接诊科室名称 + varchar(255)|0s + '' + normal + + + 8 + 接诊医师编码 医生在互联网医院的编码 + varchar(255)|0s + '' + normal + + + 9 + 接诊医师姓名 + varchar(255)|0s + '' + normal + + + 10 + 患者ID 互联网医院内部患者标识号 + varchar(255)|0s + '' + normal + + + 11 + 就诊流水号 + varchar(0)|0s + '' + normal + + + 12 + 是否复诊 1:是,0:否 + int(1)|0s + 0 + normal + + + 13 + 初诊医院编码 + varchar(255)|0s + '' + normal + + + 14 + 初诊医院名称 + varchar(255)|0s + '' + normal + + + 15 + 就诊类别编码 参见就诊类别字典 + varchar(255)|0s + '' + normal + + + 16 + 就诊类别名称 + varchar(255)|0s + '' + normal + + + 17 + 诊疗费用 此次互联网服务收取费用 + decimal(10,2 digit)|0s + 0.00 + normal + + + 18 + 患者姓名 + varchar(255)|0s + '' + normal + + + 19 + 性别编码 + varchar(255)|0s + '' + normal + + + 20 + 性别名称 + varchar(255)|0s + '' + normal + + + 21 + 患者年龄 + int(11)|0s + 0 + normal + + + 22 + 患者出生日期 pt_birthdate + date|0s + normal + + + 23 + 身份证号 + varchar(255)|0s + '' + normal + + + 24 + 患者手机号 + varchar(255)|0s + '' + normal + + + 25 + 患者所在地区 + varchar(255)|0s + '' + normal + + + 26 + 联合参会医生列表 + varchar(255)|0s + '' + normal + + + 27 + 疾病编码 + varchar(255)|0s + '' + normal + + + 28 + 疾病名称 + varchar(255)|0s + '' + normal + + + 29 + 症状描述 + varchar(255)|0s + '' + normal + + + 30 + 现病史 + varchar(255)|0s + '' + normal + + + 31 + 既往史 + varchar(255)|0s + '' + normal + + + 32 + 咨询或就诊 如果本次诊疗属于咨询型,则填“0”;如果本次诊疗属于就诊型,则填“1” + int(1)|0s + 0 + normal + + + 33 + 诊疗过程文件索引列表 + text|0s + normal + + + 34 + 最后更新时间 本条记录插入或更新的数据库当前时间,形式如“yyyy-MM-dd”+空格+“hh:mm:ss” + timestamp|0s + normal + CURRENT_TIMESTAMP + + + 35 + 消息id + varchar(255)|0s + '' + normal + + + 36 + 回调的时间戳 + varchar(20)|0s + '' + normal + + + 37 + 路径 + text|0s + normal + + + 38 + 回调整体数据 + text|0s + normal + + + 1 + id + 1 + + + 1 + varchar(32)|0s + 1 + + + 2 + varchar(32)|0s + 1 + + + 3 + varchar(60)|0s + 1 + + + 4 + bigint(3)|0s + 1 + + + 1 + varchar(32)|0s + 1 + + + 2 + varchar(32)|0s + 1 + + + 3 + bigint(11)|0s + 1 + + + 4 + varchar(3)|0s + 1 + + + 5 + varchar(3)|0s + 1 + + + 6 + bigint(3)|0s + 1 + + + 1 + varchar(32)|0s + 1 + + + 2 + varchar(32)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + bigint(21) unsigned|0s + 1 + + + 6 + longtext|0s + + + 7 + varchar(3)|0s + 1 + + + 8 + varchar(64)|0s + 1 + + + 9 + bigint(21) unsigned|0s + + + 10 + bigint(21) unsigned|0s + + + 11 + bigint(21) unsigned|0s + + + 12 + bigint(21) unsigned|0s + + + 13 + bigint(21) unsigned|0s + + + 14 + varchar(32)|0s + + + 15 + varchar(32)|0s + + + 16 + longtext|0s + 1 + + + 17 + varchar(3)|0s + 1 + + + 18 + varchar(30)|0s + 1 + + + 19 + varchar(80)|0s + 1 + + + 20 + varchar(1024)|0s + 1 + + + 21 + longtext|0s + 1 + + + 1 + varchar(81)|0s + 1 + + + 2 + varchar(512)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 7 + varchar(3)|0s + 1 + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(8)|0s + 1 + + + 3 + varchar(80)|0s + 1 + + + 4 + varchar(3)|0s + + + 5 + varchar(3)|0s + + + 6 + varchar(3)|0s + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(93)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(8)|0s + 1 + + + 7 + longtext|0s + 1 + + + 8 + varchar(9)|0s + 1 + + + 9 + datetime|0s + + + 10 + varchar(256)|0s + + + 11 + varchar(18)|0s + + + 12 + varchar(8192)|0s + 1 + + + 13 + datetime|0s + + + 14 + datetime|0s + + + 15 + varchar(18)|0s + 1 + + + 16 + varchar(12)|0s + 1 + + + 17 + datetime|0s + 1 + + + 18 + datetime|0s + 1 + + + 19 + datetime|0s + + + 20 + varchar(64)|0s + 1 + + + 21 + bigint(10)|0s + 1 + + + 22 + varchar(32)|0s + 1 + + + 23 + varchar(32)|0s + 1 + + + 24 + varchar(32)|0s + 1 + + + 1 + bigint(4)|0s + 1 + + + 2 + varchar(4000)|0s + + + 3 + varchar(20)|0s + 1 + + + 4 + varchar(64)|0s + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + + + 7 + varchar(64)|0s + + + 8 + varchar(64)|0s + + + 9 + bigint(4)|0s + + + 10 + varchar(64)|0s + 1 + + + 11 + varchar(64)|0s + + + 12 + bigint(4)|0s + + + 13 + bigint(4)|0s + + + 14 + bigint(4)|0s + + + 15 + bigint(4)|0s + + + 16 + bigint(4)|0s + 1 + + + 17 + bigint(21) unsigned|0s + + + 18 + bigint(21) unsigned|0s + + + 19 + bigint(21) unsigned|0s + + + 20 + datetime|0s + + + 21 + datetime|0s + + + 22 + datetime|0s + + + 23 + bigint(4)|0s + + + 24 + bigint(4)|0s + + + 25 + bigint(21) unsigned|0s + + + 26 + varchar(10)|0s + + + 27 + bigint(21) unsigned|0s + + + 28 + bigint(21) unsigned|0s + + + 29 + bigint(21) unsigned|0s + + + 30 + bigint(21) unsigned|0s + + + 31 + bigint(21) unsigned|0s + + + 32 + bigint(21) unsigned|0s + + + 33 + datetime|0s + + + 34 + datetime|0s + + + 35 + datetime|0s + + + 36 + bigint(21) unsigned|0s + + + 37 + varchar(20)|0s + 1 + + + 38 + varchar(255)|0s + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(1024)|0s + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(1024)|0s + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + bigint(21) unsigned|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + varchar(64)|0s + + + 6 + bigint(21) unsigned|0s + 1 + + + 7 + bigint(21) unsigned|0s + 1 + + + 8 + varchar(3)|0s + + + 9 + bigint(21) unsigned|0s + 1 + + + 10 + bigint(21) unsigned|0s + 1 + + + 11 + bigint(21) unsigned|0s + 1 + + + 12 + varchar(1024)|0s + + + 13 + varchar(1024)|0s + + + 14 + bigint(21) unsigned|0s + 1 + + + 15 + bigint(21) unsigned|0s + 1 + + + 16 + bigint(21) unsigned|0s + 1 + + + 17 + varchar(64)|0s + + + 18 + varchar(64)|0s + + + 19 + varchar(3)|0s + + + 20 + bigint(21) unsigned|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + bigint(21) unsigned|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + varchar(64)|0s + + + 6 + bigint(21) unsigned|0s + 1 + + + 7 + bigint(21) unsigned|0s + 1 + + + 8 + varchar(3)|0s + + + 9 + bigint(21) unsigned|0s + 1 + + + 10 + bigint(21) unsigned|0s + 1 + + + 11 + bigint(21) unsigned|0s + 1 + + + 12 + varchar(1024)|0s + + + 13 + varchar(1024)|0s + + + 14 + bigint(21) unsigned|0s + 1 + + + 15 + bigint(21) unsigned|0s + 1 + + + 16 + bigint(21) unsigned|0s + 1 + + + 17 + varchar(3)|0s + + + 18 + varchar(64)|0s + + + 19 + varchar(3)|0s + + + 20 + bigint(21) unsigned|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + bigint(21) unsigned|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + bigint(21) unsigned|0s + 1 + + + 6 + bigint(21) unsigned|0s + 1 + + + 7 + bigint(21) unsigned|0s + 1 + + + 8 + bigint(21) unsigned|0s + 1 + + + 9 + bigint(21) unsigned|0s + 1 + + + 10 + bigint(21) unsigned|0s + 1 + + + 11 + bigint(21) unsigned|0s + 1 + + + 12 + bigint(21) unsigned|0s + 1 + + + 13 + double|0s + 1 + + + 14 + double|0s + 1 + + + 15 + bigint(21) unsigned|0s + 1 + + + 16 + bigint(21) unsigned|0s + 1 + + + 17 + bigint(21) unsigned|0s + 1 + + + 18 + double|0s + 1 + + + 19 + double|0s + 1 + + + 20 + double|0s + 1 + + + 21 + bigint(21) unsigned|0s + 1 + + + 22 + bigint(21) unsigned|0s + 1 + + + 23 + bigint(21) unsigned|0s + 1 + + + 24 + bigint(21) unsigned|0s + 1 + + + 25 + bigint(21) unsigned|0s + 1 + + + 26 + bigint(21) unsigned|0s + 1 + + + 27 + double|0s + 1 + + + 28 + double|0s + 1 + + + 29 + bigint(21) unsigned|0s + 1 + + + 30 + bigint(21) unsigned|0s + 1 + + + 31 + bigint(21) unsigned|0s + 1 + + + 32 + bigint(21) unsigned|0s + 1 + + + 1 + int(5)|0s + 1 + + + 2 + int(11)|0s + 1 + + + 3 + int(11)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 1 + int(5)|0s + 1 + + + 2 + int(11)|0s + 1 + + + 3 + int(11)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + bigint(21)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 1 + int(5)|0s + 1 + + + 2 + int(11)|0s + 1 + + + 3 + int(11)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + bigint(21)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 1 + varchar(192)|0s + 1 + + + 2 + varchar(192)|0s + 1 + + + 3 + varchar(192)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 7 + int(11)|0s + 1 + + + 8 + int(11)|0s + 1 + + + 1 + varchar(192)|0s + 1 + + + 2 + varchar(192)|0s + 1 + + + 3 + varchar(192)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 7 + int(11)|0s + 1 + + + 8 + int(11)|0s + 1 + + + 1 + int(5)|0s + 1 + + + 2 + int(11)|0s + 1 + + + 3 + int(11)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 1 + varchar(193)|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 1 + varchar(18)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 1 + varchar(337)|0s + 1 + + + 2 + bigint(21) unsigned|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + bigint(21) unsigned|0s + 1 + + + 6 + bigint(21) unsigned|0s + 1 + + + 1 + varchar(337)|0s + 1 + + + 2 + bigint(21) unsigned|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + bigint(21) unsigned|0s + 1 + + + 6 + bigint(21) unsigned|0s + 1 + + + 1 + varchar(81)|0s + 1 + + + 2 + varchar(18)|0s + 1 + + + 3 + varchar(32)|0s + 1 + + + 4 + varchar(32)|0s + 1 + + + 5 + varchar(1024)|0s + 1 + + + 6 + varchar(1024)|0s + + + 7 + bigint(21) unsigned|0s + + + 8 + bigint(21) unsigned|0s + + + 9 + bigint(21) unsigned|0s + + + 10 + varchar(8192)|0s + + + 1 + varchar(18)|0s + 1 + + + 2 + varchar(81)|0s + 1 + + + 3 + varchar(18)|0s + 1 + + + 4 + varchar(81)|0s + 1 + + + 1 + varchar(193)|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + bigint(21)|0s + 1 + + + 4 + bigint(21)|0s + + + 5 + bigint(21)|0s + + + 6 + double|0s + + + 7 + bigint(21)|0s + 1 + + + 8 + bigint(21)|0s + + + 9 + bigint(21)|0s + + + 10 + double|0s + + + 11 + datetime|0s + + + 12 + datetime|0s + + + 13 + bigint(21)|0s + + + 14 + datetime|0s + + + 15 + varchar(193)|0s + 1 + + + 16 + varchar(193)|0s + 1 + + + 17 + varchar(193)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 1 + int(11) unsigned|0s + 1 + + + 2 + varchar(4000)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + int(11) unsigned|0s + 1 + + + 1 + varchar(193)|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + varchar(193)|0s + 1 + + + 4 + int(11) unsigned|0s + 1 + + + 5 + int(11) unsigned|0s + 1 + + + 1 + varchar(193)|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + varchar(193)|0s + 1 + + + 4 + int(11) unsigned|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + bigint(21) unsigned|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + int(11)|0s + 1 + + + 7 + int(11)|0s + 1 + + + 8 + int(11)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(655)|0s + 1 + + + 3 + int(11)|0s + 1 + + + 4 + int(11)|0s + 1 + + + 5 + int(11)|0s + 1 + + + 6 + varchar(10)|0s + + + 7 + varchar(12)|0s + + + 8 + int(11) unsigned|0s + 1 + + + 9 + varchar(10)|0s + + + 1 + int(11) unsigned|0s + 1 + + + 2 + varchar(655)|0s + 1 + + + 3 + int(11) unsigned|0s + 1 + + + 4 + varchar(10)|0s + + + 5 + varchar(22)|0s + + + 6 + int(11) unsigned|0s + 1 + + + 7 + int(11) unsigned|0s + 1 + + + 8 + varchar(10)|0s + + + 9 + int(11) unsigned|0s + 1 + + + 10 + bigint(21) unsigned|0s + 1 + + + 11 + bigint(21) unsigned|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(193)|0s + 1 + + + 3 + varchar(193)|0s + 1 + + + 4 + bigint(21) unsigned|0s + 1 + + + 5 + bigint(21) unsigned|0s + 1 + + + 6 + bigint(21) unsigned|0s + 1 + + + 7 + bigint(21) unsigned|0s + 1 + + + 8 + bigint(21) unsigned|0s + 1 + + + 9 + int(11)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + int(11) unsigned|0s + 1 + + + 3 + int(11) unsigned|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(202)|0s + + + 3 + int(11) unsigned|0s + 1 + + + 4 + int(11) unsigned|0s + 1 + + + 5 + varchar(64)|0s + + + 6 + varchar(64)|0s + + + 1 + varchar(18)|0s + 1 + + + 2 + varchar(13)|0s + 1 + + + 3 + datetime|0s + 1 + + + 4 + varchar(81)|0s + + + 5 + datetime|0s + + + 6 + bigint(21) unsigned|0s + 1 + + + 7 + bigint(21) unsigned|0s + 1 + + + 8 + varchar(1024)|0s + + + 9 + varchar(64)|0s + + + 10 + bigint(21) unsigned|0s + 1 + + + 11 + bigint(21) unsigned|0s + 1 + + + 12 + bigint(21) unsigned|0s + 1 + + + 13 + bigint(21) unsigned|0s + 1 + + + 14 + bigint(21) unsigned|0s + 1 + + + 15 + bigint(21) unsigned|0s + 1 + + + 16 + bigint(21) unsigned|0s + 1 + + + 17 + varchar(16)|0s + 1 + + + 18 + int(1)|0s + 1 + + + 19 + int(1)|0s + 1 + + + 20 + varchar(256)|0s + + + 21 + int(1)|0s + 1 + + + 22 + bigint(21) unsigned|0s + 1 + + + 23 + int(1)|0s + 1 + + + 24 + int(1)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(512)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 7 + varchar(64)|0s + 1 + + + 8 + bigint(10)|0s + 1 + + + 9 + bigint(10)|0s + + + 10 + varchar(64)|0s + + + 11 + varchar(64)|0s + + + 12 + varchar(64)|0s + + + 1 + longtext|0s + 1 + + + 2 + longtext|0s + 1 + + + 3 + int(20)|0s + 1 + + + 4 + tinyint(1)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + int(21)|0s + 1 + + + 5 + varchar(5)|0s + + + 6 + varchar(64)|0s + + + 7 + varchar(64)|0s + 1 + + + 8 + int(21)|0s + + + 9 + int(21)|0s + + + 10 + bigint(21) unsigned|0s + + + 11 + int(21)|0s + + + 12 + bigint(21) unsigned|0s + + + 13 + varchar(64)|0s + + + 14 + varchar(64)|0s + + + 15 + longtext|0s + 1 + + + 16 + varchar(9)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + + + 5 + varchar(64)|0s + + + 6 + bigint(21) unsigned|0s + + + 7 + bigint(21) unsigned|0s + + + 8 + varchar(18)|0s + + + 9 + varchar(12)|0s + + + 10 + longtext|0s + + + 11 + longtext|0s + + + 12 + longtext|0s + + + 13 + bigint(21) unsigned|0s + 1 + + + 14 + bigint(21) unsigned|0s + 1 + + + 15 + bigint(21) unsigned|0s + 1 + + + 16 + bigint(21) unsigned|0s + + + 17 + bigint(21) unsigned|0s + 1 + + + 18 + bigint(21) unsigned|0s + 1 + + + 19 + datetime|0s + + + 20 + datetime|0s + + + 21 + datetime|0s + + + 22 + bigint(21) unsigned|0s + + + 23 + varchar(80)|0s + 1 + + + 24 + varchar(12)|0s + 1 + + + 25 + varchar(64)|0s + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(20)|0s + 1 + + + 3 + varchar(10)|0s + 1 + + + 4 + varchar(80)|0s + 1 + + + 5 + varchar(20)|0s + 1 + + + 6 + varchar(64)|0s + + + 7 + varchar(20)|0s + + + 8 + varchar(64)|0s + + + 9 + longtext|0s + + + 10 + varchar(80)|0s + + + 11 + varchar(64)|0s + 1 + + + 1 + bigint(21) unsigned|0s + 1 + + + 2 + varchar(32)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + + + 5 + varchar(16)|0s + 1 + + + 6 + int(7)|0s + 1 + + + 7 + varchar(64)|0s + + + 8 + longtext|0s + + + 1 + int(20)|0s + 1 + + + 2 + int(20)|0s + 1 + + + 3 + varchar(30)|0s + 1 + + + 4 + decimal(9,6 digit)|0s + 1 + + + 5 + decimal(9,6 digit)|0s + + + 6 + decimal(9,6 digit)|0s + + + 7 + int(20)|0s + + + 8 + int(20)|0s + + + 9 + int(20)|0s + + + 10 + int(20)|0s + + + 11 + int(20)|0s + + + 12 + int(20)|0s + + + 13 + int(20)|0s + + + 14 + int(20)|0s + + + 15 + int(20)|0s + + + 16 + varchar(30)|0s + + + 17 + varchar(20)|0s + + + 18 + int(20)|0s + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(512)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + + + 7 + varchar(64)|0s + 1 + + + 8 + varchar(64)|0s + 1 + + + 9 + varchar(64)|0s + 1 + + + 10 + varchar(64)|0s + 1 + + + 11 + varchar(64)|0s + 1 + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(512)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(9)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 7 + int(21)|0s + + + 8 + int(21)|0s + + + 9 + bigint(21) unsigned|0s + + + 10 + int(21)|0s + + + 11 + bigint(21) unsigned|0s + + + 12 + varchar(64)|0s + + + 13 + varchar(64)|0s + + + 14 + longtext|0s + + + 15 + varchar(8)|0s + 1 + + + 16 + longtext|0s + + + 17 + varchar(64)|0s + + + 18 + varchar(64)|0s + + + 19 + varchar(8)|0s + 1 + + + 20 + varchar(3)|0s + 1 + + + 21 + varchar(64)|0s + 1 + + + 22 + varchar(64)|0s + + + 23 + varchar(7)|0s + 1 + + + 24 + datetime|0s + 1 + + + 25 + datetime|0s + 1 + + + 26 + varchar(8192)|0s + 1 + + + 27 + longtext|0s + 1 + + + 28 + varchar(93)|0s + 1 + + + 29 + varchar(32)|0s + 1 + + + 30 + varchar(32)|0s + 1 + + + 31 + varchar(32)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(32)|0s + 1 + + + 4 + varchar(32)|0s + 1 + + + 5 + varchar(512)|0s + + + 1 + varchar(81)|0s + 1 + + + 2 + varchar(512)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(3)|0s + 1 + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(1024)|0s + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(1024)|0s + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + bigint(1)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 7 + bigint(2)|0s + 1 + + + 8 + varchar(64)|0s + 1 + + + 9 + varchar(1)|0s + + + 10 + bigint(21)|0s + + + 11 + bigint(3)|0s + + + 12 + varchar(10)|0s + + + 13 + varchar(3)|0s + 1 + + + 14 + varchar(16)|0s + 1 + + + 15 + varchar(16)|0s + + + 16 + varchar(1024)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(64)|0s + + + 6 + bigint(21) unsigned|0s + + + 7 + varchar(10)|0s + + + 8 + bigint(21) unsigned|0s + + + 9 + bigint(21) unsigned|0s + + + 10 + bigint(21) unsigned|0s + + + 11 + bigint(21) unsigned|0s + + + 12 + bigint(21) unsigned|0s + + + 13 + bigint(21) unsigned|0s + + + 14 + bigint(21) unsigned|0s + + + 15 + datetime|0s + + + 16 + datetime|0s + + + 17 + datetime|0s + + + 18 + varchar(32)|0s + + + 19 + bigint(21) unsigned|0s + + + 20 + varchar(255)|0s + + + 21 + varchar(2048)|0s + 1 + + + 1 + varchar(64)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + + + 4 + varchar(64)|0s + + + 5 + bigint(21) unsigned|0s + + + 6 + bigint(21) unsigned|0s + + + 7 + bigint(21) unsigned|0s + + + 8 + bigint(21) unsigned|0s + + + 9 + varchar(2048)|0s + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 1 + varchar(81)|0s + 1 + + + 2 + varchar(512)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(64)|0s + 1 + + + 5 + varchar(64)|0s + 1 + + + 6 + varchar(3)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(6)|0s + 1 + + + 5 + varchar(512)|0s + 1 + + + 6 + varchar(64)|0s + 1 + + + 7 + varchar(64)|0s + 1 + + + 8 + bigint(4)|0s + 1 + + + 9 + longtext|0s + + + 10 + longtext|0s + 1 + + + 11 + varchar(9)|0s + 1 + + + 12 + varchar(6)|0s + 1 + + + 13 + varchar(64)|0s + + + 14 + varchar(64)|0s + + + 15 + varchar(3)|0s + 1 + + + 16 + varchar(3)|0s + 1 + + + 17 + datetime(2)|0s + + + 18 + varchar(8192)|0s + 1 + + + 19 + varchar(93)|0s + 1 + + + 20 + varchar(32)|0s + 1 + + + 21 + varchar(32)|0s + 1 + + + 22 + varchar(32)|0s + 1 + + + 1 + varchar(81)|0s + 1 + + + 2 + varchar(512)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + varchar(3)|0s + 1 + + + 1 + varchar(512)|0s + 1 + + + 2 + varchar(64)|0s + 1 + + + 3 + varchar(64)|0s + 1 + + + 4 + longtext|0s + 1 + + + 5 + varchar(8)|0s + 1 + + + 6 + varchar(3)|0s + 1 + + + 7 + varchar(93)|0s + 1 + + + 8 + varchar(7)|0s + 1 + + + 9 + varchar(32)|0s + 1 + + + 10 + varchar(32)|0s + 1 + + + 1 + bigint(20)|0s + normal + + + 1 + datetime|0s + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11)|0s + 1 + 1 + normal + + + 4 + datetime|0s + normal + + + 5 + decimal(10)|0s + normal + + + 6 + varchar(255)|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + int(11)|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + datetime|0s + normal + + + 7 + datetime|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + normal + + + 2 + varchar(255)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + datetime|0s + normal + + + 5 + datetime|0s + normal + + + 1 + id + 1 + + + 1 + int(11)|0s + 1 + normal + + + 2 + int(11)|0s + normal + + + 3 + varchar(255)|0s + normal + + + 4 + decimal(10)|0s + normal + + + 5 + datetime|0s + normal + + + 6 + datetime|0s + normal + + + 1 + id + 1 + + + 1 + datetime|0s + normal + + + 2 + datetime|0s + normal + + + 3 + int(11)|0s + 1 + 1 + normal + + + 4 + varchar(255)|0s + normal + + + 5 + varchar(255)|0s + normal + + + 6 + int(11)|0s + normal + + + 1 + id + 1 + + + 1 + varchar(255)|0s + normal + + + 2 + int(11)|0s + normal + + + 3 + int(11)|0s + normal + + + 4 + varchar(255)|0s + normal + + + 5 + datetime|0s + normal + + + 6 + datetime|0s + normal + + + \ No newline at end of file diff --git a/.svn/pristine/01/01b587281fc151d1a8abd1a12c5c50dedf188d89.svn-base b/.svn/pristine/01/01b587281fc151d1a8abd1a12c5c50dedf188d89.svn-base new file mode 100644 index 0000000..39bce92 --- /dev/null +++ b/.svn/pristine/01/01b587281fc151d1a8abd1a12c5c50dedf188d89.svn-base @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: com.whn.hellospring.OrderTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.082 s - in com.whn.hellospring.OrderTest diff --git a/.svn/pristine/03/032d94b74e0e0895feb3a456f47da7cba78f5a1c.svn-base b/.svn/pristine/03/032d94b74e0e0895feb3a456f47da7cba78f5a1c.svn-base new file mode 100644 index 0000000..7501d02 --- /dev/null +++ b/.svn/pristine/03/032d94b74e0e0895feb3a456f47da7cba78f5a1c.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/04/04643cfcccedb7e4b662a212a8e001f2b3cb0c5e.svn-base b/.svn/pristine/04/04643cfcccedb7e4b662a212a8e001f2b3cb0c5e.svn-base new file mode 100644 index 0000000..c11957d --- /dev/null +++ b/.svn/pristine/04/04643cfcccedb7e4b662a212a8e001f2b3cb0c5e.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/04/0484694e6583588cb04ba46653434ee6597159ef.svn-base b/.svn/pristine/04/0484694e6583588cb04ba46653434ee6597159ef.svn-base new file mode 100644 index 0000000..3dca578 --- /dev/null +++ b/.svn/pristine/04/0484694e6583588cb04ba46653434ee6597159ef.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/04/04c0ac5eba708ae2d9fee4b68c759de10f7020ef.svn-base b/.svn/pristine/04/04c0ac5eba708ae2d9fee4b68c759de10f7020ef.svn-base new file mode 100644 index 0000000..5284979 --- /dev/null +++ b/.svn/pristine/04/04c0ac5eba708ae2d9fee4b68c759de10f7020ef.svn-base @@ -0,0 +1,33 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.CoffeeDO; +import org.apache.ibatis.annotations.Delete; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 咖啡 + */ +public interface CoffeeRepository extends JpaRepository { + + /** + * 获取一个订单下的所有咖啡 + */ + @Query(value = "SELECT * FROM t_coffee where order_id_fk=?1", nativeQuery = true) + List selectCoffeeListWithOrder(Long order_id_fk); + + + /** + * 删除一个订单下的咖啡 + */ + @Transactional //事务 + @Modifying //更新 + @Query(value = "delete FROM T_COFFEE where order_id_fk=?1", nativeQuery = true) + int deleteCoffeeByOrderId(Long order_id_fk); + + +} diff --git a/.svn/pristine/05/05b07990ae40d1eb60fe36f6fccf7d997224d50e.svn-base b/.svn/pristine/05/05b07990ae40d1eb60fe36f6fccf7d997224d50e.svn-base new file mode 100644 index 0000000..3c8147d --- /dev/null +++ b/.svn/pristine/05/05b07990ae40d1eb60fe36f6fccf7d997224d50e.svn-base @@ -0,0 +1,321 @@ +package com.whn.hellospring.utils; + + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 功能描述: + * + * @author Administrator + * @date 2021/7/23 + */ +public class HttpUtils { + + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + @Override + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + @Override + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/.svn/pristine/06/069ddb1869aa316e5bc23d2a622104fa9e84ce06.svn-base b/.svn/pristine/06/069ddb1869aa316e5bc23d2a622104fa9e84ce06.svn-base new file mode 100644 index 0000000..2fd22b9 --- /dev/null +++ b/.svn/pristine/06/069ddb1869aa316e5bc23d2a622104fa9e84ce06.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/07/07479e94be8d8c6f6e319a97593a7c35aed4a349.svn-base b/.svn/pristine/07/07479e94be8d8c6f6e319a97593a7c35aed4a349.svn-base new file mode 100644 index 0000000..56f71ff --- /dev/null +++ b/.svn/pristine/07/07479e94be8d8c6f6e319a97593a7c35aed4a349.svn-base @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/07/0762f66b458368685b34cdd262d34ed8bfe1c638.svn-base b/.svn/pristine/07/0762f66b458368685b34cdd262d34ed8bfe1c638.svn-base new file mode 100644 index 0000000..4095926 --- /dev/null +++ b/.svn/pristine/07/0762f66b458368685b34cdd262d34ed8bfe1c638.svn-base @@ -0,0 +1,40 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.OilDO; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface OilRepository extends JpaRepository { + + /** + * 分页查询所有 + * + * @param spec + * @param pageable + * @return + */ + Page findAll(Specification spec, Pageable pageable); + + @Query(value = "select * from t_oil where customer_id = ?1 ORDER BY time Desc ",nativeQuery = true) + List finAllSortByTime(Long customer_id); + + + @Query(value = "select sum(num) from t_oil where status=1 && customer_id = ?1",nativeQuery = true) + double countNum(Long customer_id); + + @Query(value = "select sum(interval_mileage) from t_oil where status=1 && customer_id = ?1",nativeQuery = true) + double countIntervalMileage(Long customer_id); + + + @Query(value = "select interval_oil_wear from t_oil where status=1 && customer_id=?1 ORDER BY time ASC",nativeQuery = true) + List findWearList(Long customer_id); + +} diff --git a/.svn/pristine/07/077e4819b41a6c6e8b06abb76a4ef05771b117b7.svn-base b/.svn/pristine/07/077e4819b41a6c6e8b06abb76a4ef05771b117b7.svn-base new file mode 100644 index 0000000..7436b81 Binary files /dev/null and b/.svn/pristine/07/077e4819b41a6c6e8b06abb76a4ef05771b117b7.svn-base differ diff --git a/.svn/pristine/07/07b86f7fc734f231fbe4cf9aad17801585134db3.svn-base b/.svn/pristine/07/07b86f7fc734f231fbe4cf9aad17801585134db3.svn-base new file mode 100644 index 0000000..615346b --- /dev/null +++ b/.svn/pristine/07/07b86f7fc734f231fbe4cf9aad17801585134db3.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/07/07ecf191ca0bf7009340bbbc2c11f2505730d691.svn-base b/.svn/pristine/07/07ecf191ca0bf7009340bbbc2c11f2505730d691.svn-base new file mode 100644 index 0000000..f854ab0 --- /dev/null +++ b/.svn/pristine/07/07ecf191ca0bf7009340bbbc2c11f2505730d691.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/07/07fe4f4b8d3df2bd4d3c2e5ac6678a1ada265f16.svn-base b/.svn/pristine/07/07fe4f4b8d3df2bd4d3c2e5ac6678a1ada265f16.svn-base new file mode 100644 index 0000000..671ec7a --- /dev/null +++ b/.svn/pristine/07/07fe4f4b8d3df2bd4d3c2e5ac6678a1ada265f16.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/08/080327ce0501128e3a29f9bc7555ae70f12d48d1.svn-base b/.svn/pristine/08/080327ce0501128e3a29f9bc7555ae70f12d48d1.svn-base new file mode 100644 index 0000000..664ced0 --- /dev/null +++ b/.svn/pristine/08/080327ce0501128e3a29f9bc7555ae70f12d48d1.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/0a/0ad8b4bc3da5165373e51cfa5976085c98141bf2.svn-base b/.svn/pristine/0a/0ad8b4bc3da5165373e51cfa5976085c98141bf2.svn-base new file mode 100644 index 0000000..c4e94e6 --- /dev/null +++ b/.svn/pristine/0a/0ad8b4bc3da5165373e51cfa5976085c98141bf2.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/0c/0c1207d8a9714ac1dcafedd2d8938bc70e706708.svn-base b/.svn/pristine/0c/0c1207d8a9714ac1dcafedd2d8938bc70e706708.svn-base new file mode 100644 index 0000000..2a6bde2 --- /dev/null +++ b/.svn/pristine/0c/0c1207d8a9714ac1dcafedd2d8938bc70e706708.svn-base @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/0c/0c6fdfa0c37ff9e9c5221d35f612d6dacdc174fa.svn-base b/.svn/pristine/0c/0c6fdfa0c37ff9e9c5221d35f612d6dacdc174fa.svn-base new file mode 100644 index 0000000..5f1a839 --- /dev/null +++ b/.svn/pristine/0c/0c6fdfa0c37ff9e9c5221d35f612d6dacdc174fa.svn-base @@ -0,0 +1,31 @@ +package com.whn.hellospring.model; + +import lombok.*; +import org.hibernate.annotations.Type; +import org.joda.money.Money; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_MENU_COFFEE") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +public class MenuCoffeeDO extends BaseEntity implements Serializable { + private Long menu_id_fk; + + private String name; + + @Column + @Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmount", + parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "CNY")}) + private Money price; + + +} + diff --git a/.svn/pristine/0c/0c9e941fd1647fa8e7ee33ca8b2daf19999101fe.svn-base b/.svn/pristine/0c/0c9e941fd1647fa8e7ee33ca8b2daf19999101fe.svn-base new file mode 100644 index 0000000..9e66e14 --- /dev/null +++ b/.svn/pristine/0c/0c9e941fd1647fa8e7ee33ca8b2daf19999101fe.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/0f/0fb3ea704a14bcb5127eaf2e6a1be1b0f2c5c2ac.svn-base b/.svn/pristine/0f/0fb3ea704a14bcb5127eaf2e6a1be1b0f2c5c2ac.svn-base new file mode 100644 index 0000000..1fd775b --- /dev/null +++ b/.svn/pristine/0f/0fb3ea704a14bcb5127eaf2e6a1be1b0f2c5c2ac.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/0f/0fb4d4bbeb9c1b78ca99455591a372ae6cd0157e.svn-base b/.svn/pristine/0f/0fb4d4bbeb9c1b78ca99455591a372ae6cd0157e.svn-base new file mode 100644 index 0000000..bbbffc9 --- /dev/null +++ b/.svn/pristine/0f/0fb4d4bbeb9c1b78ca99455591a372ae6cd0157e.svn-base @@ -0,0 +1,93 @@ +package com.whn.hellospring.common; + +import java.util.HashMap; +import java.util.Map; + +public class Status { + private boolean state; + private String errorCode; + private String message; + private Map data; + + public Status(StateMessage stateMessage) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + } + public static Status result(StateMessage stateMessage,Map dataMap){ + Status status = new Status(stateMessage); + status.setData(dataMap); + return status; + } + /** + * 返回客户端数据类型 + * + * @param stateMessage 返回客户端消息 + * @param value 返回客户端值 + */ + public Status(StateMessage stateMessage, Object value) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + data.put("result", value); + } + + + + /** + * 返回客户端数据类型 + * + * @param stateMessage 返回客户端消息 + * @param map 返回客户端数据集合 + */ + public Status(StateMessage stateMessage, Map map) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + data.putAll(map); + } + + public boolean getState() { + return state; + } + + public void setState(boolean state) { + this.state = state; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Object getData() { + return data; + } + + public void setData(Map dataMap) { + this.data = dataMap; + } + + public void setData(String key, Object value) { + this.data.put(key, value); + } + + @Override + public String toString() { + return "Status [state=" + state + ", message=" + message + ", data=" + data + "]"; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } +} diff --git a/.svn/pristine/10/10e71e50b174c042f945640bc28c044b2cc75613.svn-base b/.svn/pristine/10/10e71e50b174c042f945640bc28c044b2cc75613.svn-base new file mode 100644 index 0000000..d44e18a --- /dev/null +++ b/.svn/pristine/10/10e71e50b174c042f945640bc28c044b2cc75613.svn-base @@ -0,0 +1,163 @@ +package com.whn.hellospring; + +import com.whn.hellospring.model.*; +import com.whn.hellospring.repository.CoffeeOrderRepository; +import com.whn.hellospring.repository.CoffeeRepository; +import com.whn.hellospring.utils.DO2DTOUtil; +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; +import org.junit.jupiter.api.Test; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@SpringBootTest +class HellospringApplicationTests { + +// @Autowired +// private CoffeeRepository coffeeRepository; +// +// @Autowired +// private CoffeeOrderRepository orderRepository; +// +// +// /** +// * 查询一个订单信息,包含咖啡 +// */ +// @Test +// void queryOrder() { +// Long id = 8L; +// CoffeeOrderDO orderDO = orderRepository.queryOrderWithId(id); +// CoffeeOrderDTO orderDTO = (CoffeeOrderDTO) doToDto(orderDO, CoffeeOrderDTO.class); +// List coffeeDOList = coffeeRepository.selectCoffeeListWithOrder(id); +// List coffeeDTOList = (List) DO2DTOUtil.getInstance().doListToDtoList(coffeeDOList, CoffeeDTO.class); +// +// orderDTO.setItems(coffeeDTOList); +// System.out.println("顾客:" + orderDTO.getCustomer()); +// for (CoffeeDTO coffee : +// orderDTO.getItems()) { +// System.out.println("咖啡:" + coffee.getName()); +// } +// } +// +// +// /** +// * 创建一个订单,包含咖啡 +// */ +// @Test +// void createOrderWithCoffee() { +// //创建一个订单,包含一杯咖啡 +// CoffeeDO espresso = CoffeeDO.builder().name("订单下的咖啡3") +// .price(Money.of(CurrencyUnit.of("CNY"), 10.0)) +// .build(); +// coffeeRepository.save(espresso); +// CoffeeOrderDTO orderDTO = CoffeeOrderDTO.builder() +// .customer("me3") +// .state(OrderState.INIT) +// .build(); +// +// +// //保存订单,拆解DTO为DO +// CoffeeOrderDO order = (CoffeeOrderDO) dtoToDo(orderDTO, CoffeeOrderDO.class); +// orderRepository.save(order); +// +// //保存咖啡 +// List list = orderDTO.getItems(); +// for (CoffeeDTO coffee : list) { +// coffee.setOrder_id_fk(order.getId()); +//// coffeeRepository.save(coffee); +// } +// } +// +// /** +// * 创建一杯咖啡 +// */ +// @Test +// void createCoffee() { +// CoffeeDO espresso = CoffeeDO.builder().name("espresso") +// .price(Money.of(CurrencyUnit.of("CNY"), 20.0)) +// .build(); +// coffeeRepository.save(espresso); +// } +// +// /** +// * 获取一个订单下的咖啡列表 +// */ +// @Test +// void getCoffeeListWithOrder() { +// List list = coffeeRepository.selectCoffeeListWithOrder(1L); +// System.out.println("列表长度:" + list.size()); +// for (CoffeeDO item : list) { +// System.out.println("列表:" + item.getName()); +// } +// } +// +// +// /** +// * DTO模型转换成DO +// * +// * @param objectDto DTO 对象 +// * @param doClass DO 类型 +// * @return doClass类型的对象 +// */ +// public Object dtoToDo(Object objectDto, Class doClass) { +// if (objectDto == null) { +// return null; +// } +// Object objectDo = null; +// try { +// objectDo = doClass.newInstance(); +// BeanUtils.copyProperties(objectDto, objectDo); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return objectDo; +// } +// +// +// /** +// * DO集合转换成DTO集合 +// * +// * @param doList DO 对象集合 +// * @param dtoClass DTO 类型 +// * @return dtoClass类型的集合 +// */ +// public Object doListToDtoList(Object doList, Class dtoClass) { +// if (doList == null) { +// return null; +// } +// List dtoList = new ArrayList<>(); +// for (Object i : (List) doList) { +// Object dto = doToDto(i, dtoClass); +// if (dto != null) { +// dtoList.add(dto); +// } +// } +// return dtoList; +// } +// +// /** +// * DO转换成DTO +// * +// * @param objectDo DO 对象 +// * @param dtoClass DTO 类型 +// * @return dtoClass类型的对象 +// */ +// public Object doToDto(Object objectDo, Class dtoClass) { +// if (objectDo == null) { +// return null; +// } +// Object objectDto = null; +// try { +// objectDto = dtoClass.newInstance(); +// BeanUtils.copyProperties(objectDo, objectDto); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return objectDto; +// } +} diff --git a/.svn/pristine/11/11290865af3d9fe926447a6c5ac52ab95d3caef1.svn-base b/.svn/pristine/11/11290865af3d9fe926447a6c5ac52ab95d3caef1.svn-base new file mode 100644 index 0000000..01f19db --- /dev/null +++ b/.svn/pristine/11/11290865af3d9fe926447a6c5ac52ab95d3caef1.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/11/115ad9b16e9721b6926a9187836b6b9beae61f0b.svn-base b/.svn/pristine/11/115ad9b16e9721b6926a9187836b6b9beae61f0b.svn-base new file mode 100644 index 0000000..f14a0fb --- /dev/null +++ b/.svn/pristine/11/115ad9b16e9721b6926a9187836b6b9beae61f0b.svn-base @@ -0,0 +1,9 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#build-image) + diff --git a/.svn/pristine/12/1254d0d73600a2264d2a7b37470fa4f64fffb943.svn-base b/.svn/pristine/12/1254d0d73600a2264d2a7b37470fa4f64fffb943.svn-base new file mode 100644 index 0000000..176c1a1 Binary files /dev/null and b/.svn/pristine/12/1254d0d73600a2264d2a7b37470fa4f64fffb943.svn-base differ diff --git a/.svn/pristine/13/131de89417a4bcc468e00dc0c157ef8ad39cf0ad.svn-base b/.svn/pristine/13/131de89417a4bcc468e00dc0c157ef8ad39cf0ad.svn-base new file mode 100644 index 0000000..7dad3ce --- /dev/null +++ b/.svn/pristine/13/131de89417a4bcc468e00dc0c157ef8ad39cf0ad.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/14/141dd2fbd281333c77cbc3876b194547d9544242.svn-base b/.svn/pristine/14/141dd2fbd281333c77cbc3876b194547d9544242.svn-base new file mode 100644 index 0000000..2b9d9e3 Binary files /dev/null and b/.svn/pristine/14/141dd2fbd281333c77cbc3876b194547d9544242.svn-base differ diff --git a/.svn/pristine/14/14930c8bbef6aa3b25f4273c67c55fa9856d75c9.svn-base b/.svn/pristine/14/14930c8bbef6aa3b25f4273c67c55fa9856d75c9.svn-base new file mode 100644 index 0000000..dc3d302 Binary files /dev/null and b/.svn/pristine/14/14930c8bbef6aa3b25f4273c67c55fa9856d75c9.svn-base differ diff --git a/.svn/pristine/14/14dea6efde64b88dbb24334feddf87afe0d06856.svn-base b/.svn/pristine/14/14dea6efde64b88dbb24334feddf87afe0d06856.svn-base new file mode 100644 index 0000000..9eb8596 --- /dev/null +++ b/.svn/pristine/14/14dea6efde64b88dbb24334feddf87afe0d06856.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/16/16abb5feffe61b3047775457318431af4f65ae2c.svn-base b/.svn/pristine/16/16abb5feffe61b3047775457318431af4f65ae2c.svn-base new file mode 100644 index 0000000..a52033a Binary files /dev/null and b/.svn/pristine/16/16abb5feffe61b3047775457318431af4f65ae2c.svn-base differ diff --git a/.svn/pristine/17/1700c57145772c7524b14bdd9ab9bd774cf3c816.svn-base b/.svn/pristine/17/1700c57145772c7524b14bdd9ab9bd774cf3c816.svn-base new file mode 100644 index 0000000..b41246d --- /dev/null +++ b/.svn/pristine/17/1700c57145772c7524b14bdd9ab9bd774cf3c816.svn-base @@ -0,0 +1,99 @@ +package com.whn.hellospring.service; + + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.Map; + + +@Slf4j +@Service +public class JuheService { + + + public String getOilPrice() { + String url = "http://apis.juhe.cn/gnyj/query?key=212b6526c4f8a3899ca406a1173bafa8"; + + String result = ""; + BufferedReader in = null; + try { + String urlNameString = url; + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + Map> map = connection.getHeaderFields(); + for (String key : map.keySet()) { + System.out.println(key + "--->" + map.get(key)); + } + in = new BufferedReader(new InputStreamReader( + connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("异常" + e); + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + return result; + } + + + public static String sendPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + String result = ""; + try { + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setRequestProperty("charset", "utf-8"); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8")); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + System.out.println("sendPost" + result); + } catch (Exception e) { + System.out.println("异常" + e); + e.printStackTrace(); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return result; + } +} diff --git a/.svn/pristine/17/1799b592fc115afc954688c732a64effc1735857.svn-base b/.svn/pristine/17/1799b592fc115afc954688c732a64effc1735857.svn-base new file mode 100644 index 0000000..82d55e8 --- /dev/null +++ b/.svn/pristine/17/1799b592fc115afc954688c732a64effc1735857.svn-base @@ -0,0 +1,127 @@ + + + $PROJECT_DIR$/target/test + + + true + hellospring + war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/17/179ea773d295a142fc41ff8d24054e38267b2d5d.svn-base b/.svn/pristine/17/179ea773d295a142fc41ff8d24054e38267b2d5d.svn-base new file mode 100644 index 0000000..05c1a9d --- /dev/null +++ b/.svn/pristine/17/179ea773d295a142fc41ff8d24054e38267b2d5d.svn-base @@ -0,0 +1,44 @@ +package com.whn.hellospring.handler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * 在Money与Long之间转换的TypeHandler,处理CNY和人民币 + */ +public class MoneyTypeHandler extends BaseTypeHandler { + @Override + public void setNonNullParameter(PreparedStatement preparedStatement, int i, Money money, JdbcType jdbcType) throws SQLException { + preparedStatement.setLong(i,money.getAmountMinorLong()); //存储为Long类型,精确到分 + } + + @Override + public Money getNullableResult(ResultSet resultSet, String s) throws SQLException { + return parseMoney(resultSet.getLong(s)); + } + + @Override + public Money getNullableResult(ResultSet resultSet, int i) throws SQLException { + return parseMoney(resultSet.getLong(i)); + } + + @Override + public Money getNullableResult(CallableStatement callableStatement, int i) throws SQLException { + return parseMoney(callableStatement.getLong(i)); + } + + /** + * 将Long值转换为Money + */ + private Money parseMoney(Long value){ + return Money.ofMinor(CurrencyUnit.of("CNY"),value); + } + +} diff --git a/.svn/pristine/17/17e1f68916a81e646d27007ed8367d1b45959181.svn-base b/.svn/pristine/17/17e1f68916a81e646d27007ed8367d1b45959181.svn-base new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/.svn/pristine/17/17e1f68916a81e646d27007ed8367d1b45959181.svn-base @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.svn/pristine/19/19a00fa39b5245d2c52e8fae7ede6aee8777ed4e.svn-base b/.svn/pristine/19/19a00fa39b5245d2c52e8fae7ede6aee8777ed4e.svn-base new file mode 100644 index 0000000..5b31fe5 --- /dev/null +++ b/.svn/pristine/19/19a00fa39b5245d2c52e8fae7ede6aee8777ed4e.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1a/1a13c5b0b92bf7167b6f58b8fadac5974c1b0773.svn-base b/.svn/pristine/1a/1a13c5b0b92bf7167b6f58b8fadac5974c1b0773.svn-base new file mode 100644 index 0000000..d78c58d Binary files /dev/null and b/.svn/pristine/1a/1a13c5b0b92bf7167b6f58b8fadac5974c1b0773.svn-base differ diff --git a/.svn/pristine/1a/1a7d7e887a8523ffaee3acf0b6487f53a9d71829.svn-base b/.svn/pristine/1a/1a7d7e887a8523ffaee3acf0b6487f53a9d71829.svn-base new file mode 100644 index 0000000..252c6a1 --- /dev/null +++ b/.svn/pristine/1a/1a7d7e887a8523ffaee3acf0b6487f53a9d71829.svn-base @@ -0,0 +1,6 @@ + + + F:/ + + + \ No newline at end of file diff --git a/.svn/pristine/1b/1b010649734e39e19c8fa36099b5b64f2906c3c4.svn-base b/.svn/pristine/1b/1b010649734e39e19c8fa36099b5b64f2906c3c4.svn-base new file mode 100644 index 0000000..e16d1a3 --- /dev/null +++ b/.svn/pristine/1b/1b010649734e39e19c8fa36099b5b64f2906c3c4.svn-base @@ -0,0 +1,29 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_CUSTOMER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class CustomerDO extends BaseEntity implements Serializable { + + private String name; + + private int age; + + private String phone; + + private String pass_word; +} diff --git a/.svn/pristine/1c/1c044ef1b217644caf028f51831970a7fe327960.svn-base b/.svn/pristine/1c/1c044ef1b217644caf028f51831970a7fe327960.svn-base new file mode 100644 index 0000000..cc64971 Binary files /dev/null and b/.svn/pristine/1c/1c044ef1b217644caf028f51831970a7fe327960.svn-base differ diff --git a/.svn/pristine/1c/1c152abc4319844d98ffd26108bba301f49a5d9e.svn-base b/.svn/pristine/1c/1c152abc4319844d98ffd26108bba301f49a5d9e.svn-base new file mode 100644 index 0000000..46cf8a8 --- /dev/null +++ b/.svn/pristine/1c/1c152abc4319844d98ffd26108bba301f49a5d9e.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1d/1d478a06f000c0f778975bb8c1fab9fcdb72236f.svn-base b/.svn/pristine/1d/1d478a06f000c0f778975bb8c1fab9fcdb72236f.svn-base new file mode 100644 index 0000000..6d045ad --- /dev/null +++ b/.svn/pristine/1d/1d478a06f000c0f778975bb8c1fab9fcdb72236f.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1d/1d9e5d744fbdf1f86713062818399a41cc8d3889.svn-base b/.svn/pristine/1d/1d9e5d744fbdf1f86713062818399a41cc8d3889.svn-base new file mode 100644 index 0000000..eb21f34 Binary files /dev/null and b/.svn/pristine/1d/1d9e5d744fbdf1f86713062818399a41cc8d3889.svn-base differ diff --git a/.svn/pristine/1d/1dd6a7c1eadf5c36909ab51985401df0564a72b0.svn-base b/.svn/pristine/1d/1dd6a7c1eadf5c36909ab51985401df0564a72b0.svn-base new file mode 100644 index 0000000..7e6f096 --- /dev/null +++ b/.svn/pristine/1d/1dd6a7c1eadf5c36909ab51985401df0564a72b0.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1e/1e8c4dccc85ca478ade0fde833a940e98d59b9de.svn-base b/.svn/pristine/1e/1e8c4dccc85ca478ade0fde833a940e98d59b9de.svn-base new file mode 100644 index 0000000..f482d3c --- /dev/null +++ b/.svn/pristine/1e/1e8c4dccc85ca478ade0fde833a940e98d59b9de.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1e/1e957dce13b7b90086cd0a322c7e465072163ff3.svn-base b/.svn/pristine/1e/1e957dce13b7b90086cd0a322c7e465072163ff3.svn-base new file mode 100644 index 0000000..965ffdb --- /dev/null +++ b/.svn/pristine/1e/1e957dce13b7b90086cd0a322c7e465072163ff3.svn-base @@ -0,0 +1,26 @@ +package com.whn.hellospring.model; + +import lombok.*; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CoffeeOrderDTO implements Serializable { + private String customer; + private String customer_id; + + private Long id; + private Date createTime; + private Date updateTime; + private OrderState state; + + private List items; + +} + diff --git a/.svn/pristine/1e/1ec931d986a7ef62fa250c619d70d826dce5f847.svn-base b/.svn/pristine/1e/1ec931d986a7ef62fa250c619d70d826dce5f847.svn-base new file mode 100644 index 0000000..af41e3b --- /dev/null +++ b/.svn/pristine/1e/1ec931d986a7ef62fa250c619d70d826dce5f847.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/1f/1f631df89819a7858c95964e9846871436b140ac.svn-base b/.svn/pristine/1f/1f631df89819a7858c95964e9846871436b140ac.svn-base new file mode 100644 index 0000000..ae045ba Binary files /dev/null and b/.svn/pristine/1f/1f631df89819a7858c95964e9846871436b140ac.svn-base differ diff --git a/.svn/pristine/1f/1f96fc4053e6b8cf0910ecef24a7fc443e1e4182.svn-base b/.svn/pristine/1f/1f96fc4053e6b8cf0910ecef24a7fc443e1e4182.svn-base new file mode 100644 index 0000000..c5bd322 --- /dev/null +++ b/.svn/pristine/1f/1f96fc4053e6b8cf0910ecef24a7fc443e1e4182.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/20/20cd34abf877312ebee72089b109e863f72c7f7d.svn-base b/.svn/pristine/20/20cd34abf877312ebee72089b109e863f72c7f7d.svn-base new file mode 100644 index 0000000..0544d3d Binary files /dev/null and b/.svn/pristine/20/20cd34abf877312ebee72089b109e863f72c7f7d.svn-base differ diff --git a/.svn/pristine/22/226fdb35ac8e1ccbf1987e25733187c753232ede.svn-base b/.svn/pristine/22/226fdb35ac8e1ccbf1987e25733187c753232ede.svn-base new file mode 100644 index 0000000..f257581 --- /dev/null +++ b/.svn/pristine/22/226fdb35ac8e1ccbf1987e25733187c753232ede.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/23/2362abd74ed14476f0e7a16ff85e7e7077f7c47a.svn-base b/.svn/pristine/23/2362abd74ed14476f0e7a16ff85e7e7077f7c47a.svn-base new file mode 100644 index 0000000..f6691b9 Binary files /dev/null and b/.svn/pristine/23/2362abd74ed14476f0e7a16ff85e7e7077f7c47a.svn-base differ diff --git a/.svn/pristine/25/25d2511d8a1959170499a5e6a509486247d10e77.svn-base b/.svn/pristine/25/25d2511d8a1959170499a5e6a509486247d10e77.svn-base new file mode 100644 index 0000000..9b3aa5d --- /dev/null +++ b/.svn/pristine/25/25d2511d8a1959170499a5e6a509486247d10e77.svn-base @@ -0,0 +1,14 @@ + + + $PROJECT_DIR$/target + + + hellospring + war + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/26/2645b3140f1f885b156ed1f4fab3d38ef2a197b0.svn-base b/.svn/pristine/26/2645b3140f1f885b156ed1f4fab3d38ef2a197b0.svn-base new file mode 100644 index 0000000..d9ebb7c --- /dev/null +++ b/.svn/pristine/26/2645b3140f1f885b156ed1f4fab3d38ef2a197b0.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/26/267784d9adc981b27e5816c0fe1003024e1f81a6.svn-base b/.svn/pristine/26/267784d9adc981b27e5816c0fe1003024e1f81a6.svn-base new file mode 100644 index 0000000..eca9dd7 --- /dev/null +++ b/.svn/pristine/26/267784d9adc981b27e5816c0fe1003024e1f81a6.svn-base @@ -0,0 +1,32 @@ +package com.whn.hellospring.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class DateUtils { + + /** + * 计算两个日期之间相差的天数 + * + * @param smdate 较小的时间 + * @param bdate 较大的时间 + * @return 相差天数 + */ + public static int daysBetween(Date smdate, Date bdate) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + smdate = sdf.parse(sdf.format(smdate)); + bdate = sdf.parse(sdf.format(bdate)); + Calendar cal = Calendar.getInstance(); + cal.setTime(smdate); + long time1 = cal.getTimeInMillis(); + cal.setTime(bdate); + long time2 = cal.getTimeInMillis(); + long between_days = (time2 - time1) / (1000 * 3600 * 24); + return Integer.parseInt(String.valueOf(between_days)); + } catch (Exception e) { + return -1; + } + } +} diff --git a/.svn/pristine/27/279fa8c23aef7c590e6811b63402e2e3fade4253.svn-base b/.svn/pristine/27/279fa8c23aef7c590e6811b63402e2e3fade4253.svn-base new file mode 100644 index 0000000..3cff103 --- /dev/null +++ b/.svn/pristine/27/279fa8c23aef7c590e6811b63402e2e3fade4253.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/27/27fbfbd621d27ac9e0c1f8dc3b1fcef179e690fb.svn-base b/.svn/pristine/27/27fbfbd621d27ac9e0c1f8dc3b1fcef179e690fb.svn-base new file mode 100644 index 0000000..e4831fe --- /dev/null +++ b/.svn/pristine/27/27fbfbd621d27ac9e0c1f8dc3b1fcef179e690fb.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/29/2957b98613d23c920eac75bbbb51d013c03c3df5.svn-base b/.svn/pristine/29/2957b98613d23c920eac75bbbb51d013c03c3df5.svn-base new file mode 100644 index 0000000..d3ba010 --- /dev/null +++ b/.svn/pristine/29/2957b98613d23c920eac75bbbb51d013c03c3df5.svn-base @@ -0,0 +1,5 @@ +F:\java\workspace\hellospring\src\test\java\com\whn\hellospring\CustomerTest.java +F:\java\workspace\hellospring\src\test\java\com\whn\hellospring\HellospringApplicationTests.java +F:\java\workspace\hellospring\src\test\java\com\whn\hellospring\OrderTest.java +F:\java\workspace\hellospring\src\test\java\com\whn\hellospring\MenuTest.java +F:\java\workspace\hellospring\src\test\java\com\whn\hellospring\AppTest.java diff --git a/.svn/pristine/29/29a963c396179ce287062d6522dc60b3caeb8af6.svn-base b/.svn/pristine/29/29a963c396179ce287062d6522dc60b3caeb8af6.svn-base new file mode 100644 index 0000000..0308a21 --- /dev/null +++ b/.svn/pristine/29/29a963c396179ce287062d6522dc60b3caeb8af6.svn-base @@ -0,0 +1,44 @@ +package com.whn.hellospring.service; + +import com.whn.hellospring.model.MenuDO; +import com.whn.hellospring.repository.MenuCoffeeRepository; +import com.whn.hellospring.repository.MenuRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Slf4j +public class MenuService { + + @Autowired + private MenuRepository menuRepository; + + @Autowired + private MenuCoffeeRepository menuCoffeeRepository; + + /** + * 获取菜单类型列表 + */ + public List getMenuTypeList() { + return menuRepository.getMenuList(); + +// List returnList = new ArrayList<>(); +// for (MenuDO menudo : menuRepository.getMenuList()) { +// Optional coffeeList = menuCoffeeRepository.findById(menudo.getId()); +// +// MenuDTO menuDTO = new MenuDTO(); +// if (coffeeList.isPresent()) menuDTO.setCoffee_list(MyOptional.toList(coffeeList)); +// menuDTO.setId(menudo.getId()); +// menuDTO.setCreateTime(menudo.getCreateTime()); +// menuDTO.setUpdateTime(menudo.getUpdateTime()); +// menuDTO.setType(menudo.getType()); +// +// returnList.add(menuDTO); +// } +// return returnList; + + } +} diff --git a/.svn/pristine/2a/2a31b27ceb07b3f41738f4c4b737da227228359f.svn-base b/.svn/pristine/2a/2a31b27ceb07b3f41738f4c4b737da227228359f.svn-base new file mode 100644 index 0000000..9760f7b --- /dev/null +++ b/.svn/pristine/2a/2a31b27ceb07b3f41738f4c4b737da227228359f.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/2a/2aacd66820b5ee6e4047702d457a2378d2d2e9bb.svn-base b/.svn/pristine/2a/2aacd66820b5ee6e4047702d457a2378d2d2e9bb.svn-base new file mode 100644 index 0000000..94d185b --- /dev/null +++ b/.svn/pristine/2a/2aacd66820b5ee6e4047702d457a2378d2d2e9bb.svn-base @@ -0,0 +1,506 @@ +package com.whn.hellospring.utils + + + +import java.io.UnsupportedEncodingException +import java.text.DecimalFormat +import java.text.ParseException +import java.text.SimpleDateFormat +import java.util.Date +import java.util.regex.Pattern +import java.util.regex.PatternSyntaxException + +/** + * 字符串操作类 + */ +object StringUtil { + + + + /** + * 处理重叠字符 + * ABCCCD -> AB3CD + */ + fun overlapCharacter(list: List): String { + //排序 +// java.util.Collections.sort(list) + + var j = 0 + var finalStr = "" + while (j < list.size) { + val str = list[j] //C + //如果已经存在当前要添加的字符 ABC + C AB2C +C + if (finalStr.contains(str)) { + if (j - 1 < 0) { //第一位 C+C + finalStr = "2" + finalStr + } else { + val index = finalStr.indexOf(str) + if (index > 0) { + val timesStr = finalStr.substring(index - 1, index) //倍数2 + if (isInteger(timesStr)) {// AB2C +C + val timesInt = timesStr.toInt() + 1 + finalStr = finalStr.substring(0, finalStr.length - 2) + finalStr += timesInt.toString() + finalStr += str + } else {// ABC + C + finalStr = finalStr.substring(0, finalStr.length - 1) + finalStr += "2" + finalStr += str + } + } else { //B2C4D + B + finalStr = "2" + finalStr + } + } + } else { + finalStr += str + } + j++ + } + return finalStr + } + + + /*方法二:推荐,速度最快 + * 判断是否为整数 + * @param str 传入的字符串 + * @return 是整数返回true,否则返回false + */ + fun isInteger(str: String): Boolean { + val pattern = Pattern.compile("^[-\\+]?[\\d]*$") + return pattern.matcher(str).matches() + } + + + /** + * 保留一位小数,四舍五入 + * 使用0.00不足位补0,#.##仅保留有效位 + */ + fun doubleToString1(num: Double?): String { +// if(!isNumber(num.toString()))return "0.0" +// return DecimalFormat("0.0").format(num) + if(!isNumber(num.toString()))return "0.0" + return String.format("%.1f", num!!.toDouble()) + } + + + /** + * 保留两位小数,四舍五入 + * 使用0.00不足位补0,#.##仅保留有效位 + */ + fun doubleToString2(num: Double?): String { +// if(!isNumber(num.toString()))return "0.00" +// return DecimalFormat("0.00").format(num) + if(!isNumber(num.toString()))return "0.00" + return String.format("%.2f", num!!.toDouble()) + } + + + /** + * 四舍五入 + * 1位小数 + */ + fun rounding1(num: String?): String { + if(!isNumber(num))return "0.0" + return String.format("%.1f", num!!.toDouble()) + } + + + /** + * 四舍五入 + * 2位小数 + */ + fun rounding2(num: String?): String { + if(!isNumber(num))return "0.00" + return String.format("%.2f", num!!.toDouble()) + } + + + /** + * 按长度截取中英文混合string + * + * @param text 字符串 + * @param length 长度 + * @param endWith 末尾追加 + * @return + */ + fun subStringIncludeChinese(text: String, length: Int, + endWith: String): String { + var text = text + text = text.trim { it <= ' ' } + val textLength = text.length + var byteLength = 0 + val returnStr = StringBuffer() + var i = 0 + while (i < textLength && byteLength < length * 2) { + val str_i = text.substring(i, i + 1) + if (str_i.toByteArray().size == 1) {// 英文 + byteLength++ + } else {// 中文 + byteLength += 2 + } + returnStr.append(str_i) + i++ + } + try { + if (byteLength < text.toByteArray(charset("GBK")).size) {// getBytes("GBK")每个汉字长2,getBytes("UTF-8")每个汉字长度为3 + returnStr.append(endWith) + } + } catch (e: UnsupportedEncodingException) { + e.printStackTrace() + } + + return returnStr.toString() + } + + /** + * 获取字符串的长度,如果有中文,则每个中文字符计为2位 + * + * @param text 指定的字符串 + * @return 字符串的长度 + */ + fun getStringLengthIncludeChinese(text: String): Int { + var text = text + text = text.trim { it <= ' ' } + var valueLength = 0 + val chinese = "[\u0391-\uFFE5]" + /* 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1 */ + for (i in 0..text.length - 1) { + /* 获取一个字符 */ + val temp = text.substring(i, i + 1) + /* 判断是否为中文字符 */ + if (temp.matches(chinese.toRegex())) { + /* 中文字符长度为2 */ + valueLength += 2 + } else { + /* 其他字符长度为1 */ + valueLength += 1 + } + } + return valueLength + } + + /** + * 验证邮箱地址是否正确 + * + * @param email + * @return + */ + fun checkEmail(email: String): Boolean { + var flag = false + try { + val check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$" + val regex = Pattern.compile(check) + val matcher = regex.matcher(email) + flag = matcher.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断字符串是否是数字 + * + * @param number + * @return + */ + fun isNumber(number: String?): Boolean { + + //如果为空,false + if (!isNotNull(number)) { + return false + } + + //只有. + if (number == ".") { + return false + } + + + //如果有多个点,false + val list = number!!.split(".") + if (list.size > 2) { + return false + } + + + //如果有其他字符 false + var flag = false + try { + val p = Pattern.compile("[0-9.-]+") + val m = p.matcher(number) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是英文字母组成(不区分大小写) + * + * @param letters + * @return + */ + fun isLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Za-z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是大写字母 + * + * @param letters + * @return + */ + fun isUppercaseLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是小写字母 + * + * @param letters + * @return + */ + fun isLowercaseLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[a-z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 是否数字和字母组成 + * + * @param text + * @return + */ + fun isNumbersAndLetters(text: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Za-z0-9]+$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 包含数字,字母,下划线,不可以下划线开头 + * + * @param text + * @return + */ + fun isNumbersUnderlineLetters(text: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 是否是密码,(字母或数字开头,包含下划线) + * + * @param text + * @param lowest_median 最低位数 + * @param highest_median 最高位数 + * @return + */ + fun isPassword(text: String, lowest_median: Int, + highest_median: Int): Boolean { + var flag = false + try { + val p = Pattern + .compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{" + + lowest_median.toString() + "," + + highest_median.toString() + "}$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + // 过滤特殊字符 + @Throws(PatternSyntaxException::class) + fun StringFilter(str: String): String { + // 只允许字母和数字 + // String regEx = "[^a-zA-Z0-9]"; + // 清除掉所有特殊字符 + val regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]" + val p = Pattern.compile(regEx) + val m = p.matcher(str) + return m.replaceAll("").trim { it <= ' ' } + } + + // 中文识别 + fun hasChinese(source: String): Boolean { + val reg_charset = "([\\u4E00-\\u9FA5]*+)" + val p = Pattern.compile(reg_charset) + val m = p.matcher(source) + var hasChinese = false + while (m.find()) { + if ("" != m.group(1)) { + hasChinese = true + } + } + return hasChinese + } + + /** + * 判断是否有特殊字符 + */ + fun hasString(str: String): Boolean { + val regEx = "[`~!@#$%^&*()+=|{}':;',//[//].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"// 特殊字符 + val p = Pattern.compile(regEx) + val m = p.matcher(str) + return m.find() + } + + //获取当前时间 + fun refFormatNowDate(): String { + val nowTime = Date(System.currentTimeMillis()) + val sdFormatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + return sdFormatter.format(nowTime) + } + + + //时间格式 + fun Realtime(time: String): String { + val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + var str = "" + try { + val curDate = formatter.parse(time) + str = formatter.format(curDate) + } catch (e: ParseException) { + e.printStackTrace() + } + //获取当前时间 + return str + } + + /** + * 转换文件大小 + * + * @param fileS + * @return + */ + fun FormetFileSize(fileS: Long): String { + val df = DecimalFormat("#.00") + var fileSizeString = "" + val wrongSize = "0B" + if (fileS == 0L) { + return wrongSize + } + if (fileS < 1024) { + fileSizeString = df.format(fileS.toDouble()) + "B" + } else if (fileS < 1048576) { + fileSizeString = df.format(fileS.toDouble() / 1024) + "KB" + } else if (fileS < 1073741824) { + fileSizeString = df.format(fileS.toDouble() / 1048576) + "MB" + } else { + fileSizeString = df.format(fileS.toDouble() / 1073741824) + "GB" + } + return fileSizeString + } + + /** + * 检验数字的有效性 + * + * @param str + * @return + */ + fun isNumberTrue(str: String): Boolean { + val c = str.substring(str.length - 1, str.length) + if (c == ".") { + return false + } + val pattern = Pattern.compile("^[0-9]+(.[0-9]*)?$") + val match = pattern.matcher(str) + return match.matches() + } + + /** + * 大陆号码或香港号码均可 + */ + @Throws(PatternSyntaxException::class) + fun isPhoneLegal(str: String): Boolean { + return isChinaPhoneLegal(str) || isHKPhoneLegal(str) + } + + /** + * 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数 + * 此方法中前三位格式有: + * 13+任意数 + * 15+除4的任意数 + * 18+除1和4的任意数 + * 17+除9的任意数 + * 147 + */ + @Throws(PatternSyntaxException::class) + fun isChinaPhoneLegal(str: String): Boolean { + // String regExp = "^((13[0-9])|(15[^4])|(18[0-9])|(17[0-9])|(16[0-9])|(147))\\d{8}$"; + val regExp = "^\\d{11}$" + val p = Pattern.compile(regExp) + val m = p.matcher(str) + return m.matches() + } + + /** + * 香港手机号码8位数,5|6|8|9开头+7位任意数 + */ + @Throws(PatternSyntaxException::class) + fun isHKPhoneLegal(str: String): Boolean { + val regExp = "^(5|6|8|9)\\d{7}$" + val p = Pattern.compile(regExp) + val m = p.matcher(str) + return m.matches() + } + + +} diff --git a/.svn/pristine/2a/2accb2eded24fed86de0b215562bc225c7509588.svn-base b/.svn/pristine/2a/2accb2eded24fed86de0b215562bc225c7509588.svn-base new file mode 100644 index 0000000..5d5c261 --- /dev/null +++ b/.svn/pristine/2a/2accb2eded24fed86de0b215562bc225c7509588.svn-base @@ -0,0 +1,35 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.CoffeeOrderDO; +import org.apache.ibatis.annotations.Delete; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.transaction.annotation.Transactional; + +import javax.xml.ws.soap.MTOM; +import java.util.List; + +/** + * 订单数据操作 + */ +public interface CoffeeOrderRepository extends JpaRepository { + +// //根据咖啡名,获取订单 +// List findByItems_Name(String name); + + //根据订单id获取订单 + @Query(value = "select * from T_ORDER where id=?1",nativeQuery = true) + CoffeeOrderDO queryOrderWithId(Long id); + + //根据订单id删除订单 + @Transactional //事务 + @Modifying //更新 + @Query(value = "DELETE from T_ORDER where id=?1",nativeQuery = true) + int deleteOrderWithId(Long id); + + //根据客户,获取订单 + @Query(value = "select * from t_order where customer_id = ?1", nativeQuery = true) + List queryOrderListWithCustomerId(String customerId); + +} diff --git a/.svn/pristine/2d/2d2f1a5302a4f4a0625e8cfec2e594db605d83d9.svn-base b/.svn/pristine/2d/2d2f1a5302a4f4a0625e8cfec2e594db605d83d9.svn-base new file mode 100644 index 0000000..1083023 --- /dev/null +++ b/.svn/pristine/2d/2d2f1a5302a4f4a0625e8cfec2e594db605d83d9.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/2e/2e2e49e712d82ff249bc475450ee4e5eab5bdbf3.svn-base b/.svn/pristine/2e/2e2e49e712d82ff249bc475450ee4e5eab5bdbf3.svn-base new file mode 100644 index 0000000..af2905f --- /dev/null +++ b/.svn/pristine/2e/2e2e49e712d82ff249bc475450ee4e5eab5bdbf3.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/31/31735d2b419016ad0ba2c28d145a46e05e41d5d8.svn-base b/.svn/pristine/31/31735d2b419016ad0ba2c28d145a46e05e41d5d8.svn-base new file mode 100644 index 0000000..67d5d9e --- /dev/null +++ b/.svn/pristine/31/31735d2b419016ad0ba2c28d145a46e05e41d5d8.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/31/31e08ef5e7bc50ce55844bca6e45341bd3524a09.svn-base b/.svn/pristine/31/31e08ef5e7bc50ce55844bca6e45341bd3524a09.svn-base new file mode 100644 index 0000000..a2564eb Binary files /dev/null and b/.svn/pristine/31/31e08ef5e7bc50ce55844bca6e45341bd3524a09.svn-base differ diff --git a/.svn/pristine/32/32835787ced5df1f3bcd4e5ed94d8b15a037c66b.svn-base b/.svn/pristine/32/32835787ced5df1f3bcd4e5ed94d8b15a037c66b.svn-base new file mode 100644 index 0000000..377b7a7 --- /dev/null +++ b/.svn/pristine/32/32835787ced5df1f3bcd4e5ed94d8b15a037c66b.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/32/32d75d23d991cb4e53e2ba53fcd46d0fe21d3287.svn-base b/.svn/pristine/32/32d75d23d991cb4e53e2ba53fcd46d0fe21d3287.svn-base new file mode 100644 index 0000000..e6cc1cf Binary files /dev/null and b/.svn/pristine/32/32d75d23d991cb4e53e2ba53fcd46d0fe21d3287.svn-base differ diff --git a/.svn/pristine/33/33b9de911d8128c27e10e29b1bab999f6dd7ce1e.svn-base b/.svn/pristine/33/33b9de911d8128c27e10e29b1bab999f6dd7ce1e.svn-base new file mode 100644 index 0000000..f7fbbba --- /dev/null +++ b/.svn/pristine/33/33b9de911d8128c27e10e29b1bab999f6dd7ce1e.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/35/35fd10fc8efce0c835cdb51f8ec5e98ab4d1f183.svn-base b/.svn/pristine/35/35fd10fc8efce0c835cdb51f8ec5e98ab4d1f183.svn-base new file mode 100644 index 0000000..af46835 Binary files /dev/null and b/.svn/pristine/35/35fd10fc8efce0c835cdb51f8ec5e98ab4d1f183.svn-base differ diff --git a/.svn/pristine/36/36c0a706af7b4564a257a1bad77dbba1a2234af0.svn-base b/.svn/pristine/36/36c0a706af7b4564a257a1bad77dbba1a2234af0.svn-base new file mode 100644 index 0000000..2e3b710 Binary files /dev/null and b/.svn/pristine/36/36c0a706af7b4564a257a1bad77dbba1a2234af0.svn-base differ diff --git a/.svn/pristine/37/378ee51ad2ce5bccd9037a1efc55298113af722b.svn-base b/.svn/pristine/37/378ee51ad2ce5bccd9037a1efc55298113af722b.svn-base new file mode 100644 index 0000000..b8581a6 --- /dev/null +++ b/.svn/pristine/37/378ee51ad2ce5bccd9037a1efc55298113af722b.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/38/38f74b4eeb1e98358ea02312874efa835fcc6065.svn-base b/.svn/pristine/38/38f74b4eeb1e98358ea02312874efa835fcc6065.svn-base new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/.svn/pristine/38/38f74b4eeb1e98358ea02312874efa835fcc6065.svn-base @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/.svn/pristine/39/390bf6c50b181128ad4e3a8aa0d41d0235a86e7a.svn-base b/.svn/pristine/39/390bf6c50b181128ad4e3a8aa0d41d0235a86e7a.svn-base new file mode 100644 index 0000000..94bd32b Binary files /dev/null and b/.svn/pristine/39/390bf6c50b181128ad4e3a8aa0d41d0235a86e7a.svn-base differ diff --git a/.svn/pristine/39/39c81ee632732ced5b74d6ead71fe92fbf94fda1.svn-base b/.svn/pristine/39/39c81ee632732ced5b74d6ead71fe92fbf94fda1.svn-base new file mode 100644 index 0000000..85d7deb --- /dev/null +++ b/.svn/pristine/39/39c81ee632732ced5b74d6ead71fe92fbf94fda1.svn-base @@ -0,0 +1,118 @@ +package com.whn.hellospring.service; + +import com.whn.hellospring.model.OilDO; +import com.whn.hellospring.repository.OilRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Service +public class OilService { + + + @Autowired + private OilRepository oilRepository; + + + /** + * 油耗列表 + */ + public List getWearList(Long customer_id){ + return oilRepository.findWearList(customer_id); + } + + + + /** + * 获取有效数量num之和 + * @return + */ + public double getNumTotal(Long customer_id){ + return oilRepository.countNum(customer_id); + } + + /** + * 获取有效区间里程和 + * @return + */ + public double getIntervalMileageTotal(Long customer_id){ + return oilRepository.countIntervalMileage(customer_id); + } + + + /** + * 获取最新的一条有效记录 + */ + public OilDO getRecentlyRecord(Long customer_id) { + List recordList = oilRepository.finAllSortByTime(customer_id); + if (recordList == null || recordList.size() == 0) return null; + int index = -1; + for (int i = 0; i < recordList.size(); i++) { + OilDO oilDO = recordList.get(i); + if (oilDO.getStatus() == 1) { + index = i; + break; + } + } + if(index==-1){ + return null; + }else{ + return recordList.get(index); + } + } + + + /** + * 获取有效记录列表 + */ + public List getRecordList(Long customer_id) { + List recordList = oilRepository.finAllSortByTime(customer_id); +// Collections.reverse(recordList); + List list = new ArrayList<>(); + for (int i = 0; i < recordList.size(); i++) { + if (recordList.get(i).getStatus() == 1) { + list.add(recordList.get(i)); + } + } + log.info("list:{}", list); + return list; + } + + + /** + * 获取全部记录列表 + * 包括被删除的status = 0 + */ + public List getRecordAllList(Long customer_id) { + List recordList = oilRepository.finAllSortByTime(customer_id); +// Collections.reverse(recordList); + log.info("recordList:{}", recordList); + return recordList; + } + + + /** + * 新增更新 + */ + public OilDO addUpdateRecord(OilDO oilDO) { + OilDO save = oilRepository.save(oilDO); + return save; + } + + /** + * 删除 + * + * @return + */ + public OilDO deleteRecord(Long id) { + OilDO oilDO = oilRepository.getOne(id); + oilDO.setStatus(0); + return oilRepository.save(oilDO); + } + + +} diff --git a/.svn/pristine/3a/3afd456aa877390299aa93b7fd9f25c6cfb9a052.svn-base b/.svn/pristine/3a/3afd456aa877390299aa93b7fd9f25c6cfb9a052.svn-base new file mode 100644 index 0000000..bfb98b1 --- /dev/null +++ b/.svn/pristine/3a/3afd456aa877390299aa93b7fd9f25c6cfb9a052.svn-base @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C:\Users\sq\AppData\Roaming\Subversion + 125 + + + + + + + + + 1593671883249 + + + + + + \ No newline at end of file diff --git a/.svn/pristine/fc/fcf6e090900a015acb4aa0b82a18060f7f91be4f.svn-base b/.svn/pristine/fc/fcf6e090900a015acb4aa0b82a18060f7f91be4f.svn-base new file mode 100644 index 0000000..8c0738d --- /dev/null +++ b/.svn/pristine/fc/fcf6e090900a015acb4aa0b82a18060f7f91be4f.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/fd/fdac898054009362896c8109da4f96b13b81f9b6.svn-base b/.svn/pristine/fd/fdac898054009362896c8109da4f96b13b81f9b6.svn-base new file mode 100644 index 0000000..e6e5f12 --- /dev/null +++ b/.svn/pristine/fd/fdac898054009362896c8109da4f96b13b81f9b6.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/fd/fdb577b5f71e236e71587c9a1b29b07b23c6f182.svn-base b/.svn/pristine/fd/fdb577b5f71e236e71587c9a1b29b07b23c6f182.svn-base new file mode 100644 index 0000000..ad09392 Binary files /dev/null and b/.svn/pristine/fd/fdb577b5f71e236e71587c9a1b29b07b23c6f182.svn-base differ diff --git a/.svn/pristine/fd/fde1dffaa072aaa4d86b05844bfc466ad25849e2.svn-base b/.svn/pristine/fd/fde1dffaa072aaa4d86b05844bfc466ad25849e2.svn-base new file mode 100644 index 0000000..93b26b4 --- /dev/null +++ b/.svn/pristine/fd/fde1dffaa072aaa4d86b05844bfc466ad25849e2.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.svn/pristine/ff/ff410f32ad87ff3a4d67defedcc8434fc06941e8.svn-base b/.svn/pristine/ff/ff410f32ad87ff3a4d67defedcc8434fc06941e8.svn-base new file mode 100644 index 0000000..33e1c0d --- /dev/null +++ b/.svn/pristine/ff/ff410f32ad87ff3a4d67defedcc8434fc06941e8.svn-base @@ -0,0 +1,54 @@ +com\whn\hellospring\model\MenuCoffeeDO$MenuCoffeeDOBuilder.class +com\whn\hellospring\model\MenuDO.class +com\whn\hellospring\request\VersionRequest.class +com\whn\hellospring\model\CoffeeDO.class +com\whn\hellospring\model\CoffeeOrderDTO.class +com\whn\hellospring\model\VersionDO.class +com\whn\hellospring\model\BaseEntity.class +com\whn\hellospring\common\Status.class +com\whn\hellospring\service\AppService.class +com\whn\hellospring\controller\AppController.class +com\whn\hellospring\controller\CoffeeOrderController.class +com\whn\hellospring\service\MenuService.class +com\whn\hellospring\request\GetOrderRequest.class +com\whn\hellospring\request\CustomerLoginRequest.class +com\whn\hellospring\model\CoffeeOrderDO$CoffeeOrderDOBuilder.class +com\whn\hellospring\model\CustomerDO$CustomerDOBuilder.class +com\whn\hellospring\model\MenuCoffeeDO.class +com\whn\hellospring\repository\CoffeeRepository.class +com\whn\hellospring\model\OrderState.class +com\whn\hellospring\model\CoffeeDTO$CoffeeDTOBuilder.class +com\whn\hellospring\handler\MoneyTypeHandler.class +com\whn\hellospring\common\StateMessage.class +com\whn\hellospring\utils\MyOptional.class +com\whn\hellospring\service\CoffeeOrderService.class +com\whn\hellospring\controller\TestController.class +com\whn\hellospring\model\MenuDO$MenuDOBuilder.class +com\whn\hellospring\request\DeleteCoffeeRequest.class +com\whn\hellospring\model\VersionDO$VersionDOBuilder.class +com\whn\hellospring\common\StatusException.class +com\whn\hellospring\controller\CustomerController.class +com\whn\hellospring\repository\MenuRepository.class +com\whn\hellospring\repository\AppRepository.class +com\whn\hellospring\repository\MenuCoffeeRepository.class +com\whn\hellospring\HelloSpringApplication.class +com\whn\hellospring\mapper\CoffeeMapper.class +com\whn\hellospring\service\CustomerService.class +com\whn\hellospring\model\CoffeeOrderDTO$CoffeeOrderDTOBuilder.class +com\whn\hellospring\request\DeleteCustomerRequest.class +com\whn\hellospring\model\CoffeeOrderDO.class +com\whn\hellospring\model\CustomerDO.class +com\whn\hellospring\repository\CoffeeOrderRepository.class +com\whn\hellospring\request\DeleteOrderRequest.class +com\whn\hellospring\request\BaseRequest.class +com\whn\hellospring\request\getOrderListWithCustomerIdRequest.class +com\whn\hellospring\controller\CoffeeController.class +com\whn\hellospring\repository\BaseRepository.class +com\whn\hellospring\utils\DO2DTOUtil.class +com\whn\hellospring\controller\MenuController.class +com\whn\hellospring\model\CoffeeDO$CoffeeDOBuilder.class +com\whn\hellospring\request\GetCoffeeListByOrderIdRequest.class +com\whn\hellospring\service\CoffeeService.class +com\whn\hellospring\repository\CustomerRepository.class +com\whn\hellospring\model\CoffeeDTO.class +com\whn\hellospring\controller\BaseController.class diff --git a/.svn/pristine/ff/ffe7cfd886e120d368ab78d76f5b6a9d639dd46d.svn-base b/.svn/pristine/ff/ffe7cfd886e120d368ab78d76f5b6a9d639dd46d.svn-base new file mode 100644 index 0000000..8ba0f07 Binary files /dev/null and b/.svn/pristine/ff/ffe7cfd886e120d368ab78d76f5b6a9d639dd46d.svn-base differ diff --git a/.svn/wc.db b/.svn/wc.db new file mode 100644 index 0000000..e005b22 Binary files /dev/null and b/.svn/wc.db differ diff --git a/.svn/wc.db-journal b/.svn/wc.db-journal new file mode 100644 index 0000000..e69de29 diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..a16b543 --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5ce3c5f --- /dev/null +++ b/pom.xml @@ -0,0 +1,314 @@ + + + 4.0.0 + jar + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + com.whn + AgileTools + 0.0.1-SNAPSHOT + hellospring + Demo project for Spring Boot + + + 1.8 + 1.3.50 + 2.1.2 + 3.4.3 + 1.2.13 + + + + + + + org.aspectj + aspectjweaver + 1.8.8 + + + + org.springframework.boot + spring-boot-starter-aop + + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + + + + com.google.guava + guava + 30.1.1-jre + + + + + io.jsonwebtoken + jjwt + 0.9.0 + + + + org.apache.httpcomponents + httpcore + 4.4.5 + + + + org.apache.httpcomponents + httpclient + 4.5.2 + + + + com.alibaba + fastjson + 1.2.33 + + + + org.apache.commons + commons-lang3 + 3.6 + compile + + + + redis.clients + jedis + 2.9.0 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + com.h2database + h2 + runtime + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.joda + joda-money + LATEST + + + org.jadira.usertype + usertype.core + 6.0.1.GA + + + + + org.projectlombok + lombok + true + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis.version} + + + + + com.baomidou + dynamic-datasource-spring-boot-starter + 3.0.0 + + + + org.mybatis.generator + mybatis-generator-core + 1.3.7 + + + + commons-codec + commons-codec + 1.14 + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis.plugin.version} + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.version} + + + + + mysql + mysql-connector-java + + + + com.googlecode.log4jdbc + log4jdbc + RELEASE + + + + com.spring4all + swagger-spring-boot-starter + 1.9.0.RELEASE + + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + 1.0.0.Draft-16 + + + + org.springframework.boot + spring-boot-starter-validation + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + + test + + + org.springframework.boot + spring-boot-maven-plugin + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + 1.8 + + + + org.apache.maven.plugins + maven-compiler-plugin + + + compile + compile + + compile + + + + testCompile + test-compile + + testCompile + + + + + + + com.spotify + docker-maven-plugin + 1.2.2 + + + build-image + package + + build + + + + + testc + true + + 111 + + openjdk:8-jdk-alpine + ["sh", "-c", "java $JAVA_OPTIONS -jar /${project.build.finalName}.jar"] + + + / + ${project.build.directory} + ${project.build.finalName}.jar + + + + + + + + diff --git a/src/main/java/com/whn/hellospring/AgileToolsApplication.java b/src/main/java/com/whn/hellospring/AgileToolsApplication.java new file mode 100644 index 0000000..491093c --- /dev/null +++ b/src/main/java/com/whn/hellospring/AgileToolsApplication.java @@ -0,0 +1,184 @@ +package com.whn.hellospring; + +import com.whn.hellospring.service.JuheService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +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.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RestController; +import lombok.extern.slf4j.Slf4j; +import redis.clients.jedis.Jedis; + +//@ComponentScan("com") +//@RestController +//@Slf4j +////@EnableJpaRepositories +//@EnableTransactionManagement +////@SpringBootApplication +//@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) +////@EnableJpaRepositories(basePackages="com.whn.hellospring") +////@EntityScan(basePackages="com.whn.hellospring") + +@ComponentScan("com") +@SpringBootApplication +@RestController +@Slf4j +@EnableJpaRepositories +@EnableTransactionManagement +public class AgileToolsApplication extends SpringBootServletInitializer { + + + + + @Autowired + private JuheService juheService; + + public static void main(String[] args) { + SpringApplication.run(AgileToolsApplication.class, args); + } + + // 继承SpringBootServletInitializer 实现configure 方便打war 外部服务器部署。 + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(AgileToolsApplication.class); + } + +// @Transactional +// @Override +// public void run(ApplicationArguments args) throws Exception { +// initOrders(); + +// findOrders(); + +// testMybatis(); + +// breakPage(); + +// bucks();//初步测试 + +// oil(); + +// testRedis(); + +// calculationIntervalMileage(); + + +// } + + + private void testRedis() { + Jedis jedis = new Jedis("192.168.0.217"); + jedis.auth("root");//加入这一段代码 + System.out.println("Server is running: "+jedis.ping()); + System.out.println("connection to server sucessfully"); + jedis.set("title","hellword"); + System.out.println(jedis.get("title")); + } + + private void oil() { + juheService.getOilPrice(); + + } + + + + + /** + * 分页测试 + * Mybatis PageHelper + */ +// private void breakPage() { +// //第一页数据 +// coffeeMapper.findAllWithRowBounds(new RowBounds(1,3)) +// .forEach(c->log.info("page(1) Coffee{}",c)); +// +// //第二页数据 +// coffeeMapper.findAllWithRowBounds(new RowBounds(2,3)) +// .forEach(c->log.info("page(2) Coffee{}",c)); +// +// log.info("============================="); +// +// //page传递为0的时候会取出所有数据 +// coffeeMapper.findAllWithRowBounds(new RowBounds(1,0)) +// .forEach(c->log.info("Page(1) 所有数据 Coffee{}",c)); +// +// log.info("============================="); +// +// //使用参数来获取 +// coffeeMapper.findAllWithParam(1,3) +// .forEach(c->log.info("Page(1) 使用参数来获取3 Coffee{}",c)); +// +// +// List list = coffeeMapper.findAllWithParam(2,3); +// PageInfo page = new PageInfo<>(list); +// log.info("page{}",page); +// +// } + +// private void testMybatis() { +// Coffee c = Coffee.builder().name("espresso") +// .price(Money.of(CurrencyUnit.of("CNY"),20.0)) +// .build(); +// +// int count = coffeeMapper.save(c); +// log.info("Save{} coffee:{}",count,c); +// +// c = Coffee.builder().name("latte") +// .price(Money.of(CurrencyUnit.of("CNY"),25.0)) +// .build(); +// +// count = coffeeMapper.save(c); +// log.info("Save{} coffee:{}",count,c); +// +// c = coffeeMapper.findById(c.getId()); +// log.info("find coffee:{}",c); +// +// } + + +// @RequestMapping("/hello") +// public String hello(){ +// return "hello spring"; +// } + + + + +// private void findOrders(){ +// //获取咖啡 +// coffeeRepository +// .findAll() +// .forEach(c->log.info("Loading{}",c)); +// +// //获取前三,更新时间降序,ID升序 +// List list = orderRepository.findTop3ByOrderByUpdateTimeDescIdAsc(); +// log.info("findTop3ByOrderByUpdateTimeDescIdAsc:{}" ,getJoinedOrderId(list)); +// +// //获取Li Lei 的订单id +// list = orderRepository.findByCustomerOrderById("Li Lei"); +// log.info("findByCustomerOrderById:{}" ,getJoinedOrderId(list)); +// +// //列出订单,订单中的咖啡 +// list.forEach(o->{ +// log.info("Order{}",o.getId()); +// o.getItems().forEach(i->log.info(" Item{}",i)); +// }); +// +// //获取latte的咖啡列表 +// list = orderRepository.findByItems_Name("latte"); +// log.info("findByItems_Name:{}" ,getJoinedOrderId(list)); +// } + + +} diff --git a/src/main/java/com/whn/hellospring/common/StateMessage.java b/src/main/java/com/whn/hellospring/common/StateMessage.java new file mode 100644 index 0000000..c06a0cd --- /dev/null +++ b/src/main/java/com/whn/hellospring/common/StateMessage.java @@ -0,0 +1,55 @@ +package com.whn.hellospring.common; + +/** + * @author lfx + * 返回客户端结果定义 + */ +public enum StateMessage { + + SUCCESS(true, "000", "成功"), + PHONE_ERROR(false, "001", "手机号不匹配"), + LOSE_PARAM(false, "002", "缺少参数"), + USER_NOT_EXIST(false, "003", "用户不存在"), + USER_EXIST(false, "105", "用户已存在"), + + CAPTCHA_OVERDUE(false, "004", "验证码过期"), + CAPTCHA_FAILURE(false, "005", "验证码不匹配"), + SIGN_IN_FAILED(false, "006", "签到失败"), + LOGIN_OTHER_DEVICE(false, "007", "异常登录"), + TOKEN_ERROR(false, "008", "用户凭证错误"), + OPERATION_FAILED(false, "009", "操作失败"), + OUT_PERMISSION(false, "010", "权限不足"), + PARAMETER_FORMAT_ERROR(false, "011", "参数格式不匹配"), + ACCOUNT_EXIST(false, "016", "用户名重复"), + + + UN_KNOW_REASON(false, "9999", "未知错误!"); + private boolean state; + private String errorCode; + private String message; + + + StateMessage(boolean state, String errorCode, String message) { + this.state = state; + this.errorCode = errorCode; + this.message = message; + } + + public boolean getState() { + return state; + } + + public String getErrorCode() { + return errorCode; + } + + public String getMessage() { + return message; + } + + public StateMessage appendMessage(String append) { + this.message += append; + return this; + } + +} diff --git a/src/main/java/com/whn/hellospring/common/Status.java b/src/main/java/com/whn/hellospring/common/Status.java new file mode 100644 index 0000000..bbbffc9 --- /dev/null +++ b/src/main/java/com/whn/hellospring/common/Status.java @@ -0,0 +1,93 @@ +package com.whn.hellospring.common; + +import java.util.HashMap; +import java.util.Map; + +public class Status { + private boolean state; + private String errorCode; + private String message; + private Map data; + + public Status(StateMessage stateMessage) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + } + public static Status result(StateMessage stateMessage,Map dataMap){ + Status status = new Status(stateMessage); + status.setData(dataMap); + return status; + } + /** + * 返回客户端数据类型 + * + * @param stateMessage 返回客户端消息 + * @param value 返回客户端值 + */ + public Status(StateMessage stateMessage, Object value) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + data.put("result", value); + } + + + + /** + * 返回客户端数据类型 + * + * @param stateMessage 返回客户端消息 + * @param map 返回客户端数据集合 + */ + public Status(StateMessage stateMessage, Map map) { + this.state = stateMessage.getState(); + this.errorCode = stateMessage.getErrorCode(); + this.message = stateMessage.getMessage(); + data = new HashMap<>(); + data.putAll(map); + } + + public boolean getState() { + return state; + } + + public void setState(boolean state) { + this.state = state; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Object getData() { + return data; + } + + public void setData(Map dataMap) { + this.data = dataMap; + } + + public void setData(String key, Object value) { + this.data.put(key, value); + } + + @Override + public String toString() { + return "Status [state=" + state + ", message=" + message + ", data=" + data + "]"; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } +} diff --git a/src/main/java/com/whn/hellospring/common/StatusException.java b/src/main/java/com/whn/hellospring/common/StatusException.java new file mode 100644 index 0000000..f6e0c2f --- /dev/null +++ b/src/main/java/com/whn/hellospring/common/StatusException.java @@ -0,0 +1,23 @@ +package com.whn.hellospring.common; + + +/** + * 功能描述:异常类 + */ +public class StatusException extends Exception { + public StateMessage stateMessage; + + public StatusException(StateMessage stateMessage) { + super(); + this.stateMessage = stateMessage; + } + + public StateMessage getStateMessage() { + return stateMessage; + } + + public void setStateMessage(StateMessage stateMessage) { + this.stateMessage = stateMessage; + } + +} diff --git a/src/main/java/com/whn/hellospring/controller/AppController.java b/src/main/java/com/whn/hellospring/controller/AppController.java new file mode 100644 index 0000000..af8307d --- /dev/null +++ b/src/main/java/com/whn/hellospring/controller/AppController.java @@ -0,0 +1,36 @@ +package com.whn.hellospring.controller; + +import com.whn.hellospring.common.StateMessage; +import com.whn.hellospring.common.Status; +import com.whn.hellospring.model.VersionDO; +import com.whn.hellospring.request.VersionRequest; +import com.whn.hellospring.service.AppService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping(value = "/app") +public class AppController { + + @Autowired + AppService appService; + + /** + * 获取版本号 + */ + @GetMapping(value = "/version") + public Status getVersion(@RequestBody VersionRequest request) { + try { + List version = appService.getVersion(request.getEquipment()); + Status status = new Status(StateMessage.SUCCESS, version); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/whn/hellospring/controller/BaseController.java b/src/main/java/com/whn/hellospring/controller/BaseController.java new file mode 100644 index 0000000..69a69e5 --- /dev/null +++ b/src/main/java/com/whn/hellospring/controller/BaseController.java @@ -0,0 +1,5 @@ +package com.whn.hellospring.controller; + +public class BaseController { + +} diff --git a/src/main/java/com/whn/hellospring/controller/RoleController.java b/src/main/java/com/whn/hellospring/controller/RoleController.java new file mode 100644 index 0000000..ebcc5e2 --- /dev/null +++ b/src/main/java/com/whn/hellospring/controller/RoleController.java @@ -0,0 +1,158 @@ +package com.whn.hellospring.controller; + +import com.whn.hellospring.common.StateMessage; +import com.whn.hellospring.common.Status; +import com.whn.hellospring.log.OperationLogAnnotation; +import com.whn.hellospring.model.*; +import com.whn.hellospring.repository.PermissionRepository; +import com.whn.hellospring.request.DeleteRequest; +import com.whn.hellospring.service.RoleService; +import com.whn.hellospring.service.UserService; +import com.whn.hellospring.utils.DO2DTOUtil; +import com.whn.hellospring.utils.MergeObjectsUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + +@RestController //处理http请求,默认返回json格式数据 +@RequestMapping(value = "/role") //配置映射 +public class RoleController { + + private final String operModul = "用户模块"; + + boolean checkToken = false; + + + @Autowired + UserService userService; + + @Autowired + RoleService roleService; + + @Autowired + PermissionRepository permissionRepository; + + /** + * 新增编辑角色 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "新增编辑角色") + @PostMapping(value = "/update") + public Status updateRole(@Valid @RequestBody RoleDO request, @RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + + if(request.getId()!=null){ + + // 获取角色详情 + RoleDO roleDetail = roleService.getRoleWithId(request.getId()); + + if(roleDetail==null){ + return new Status(StateMessage.SUCCESS, "此id角色不存在"); + } + + //编辑 信息 + RoleDO roleDO = MergeObjectsUtil.mergeObjects(request, roleDetail); + roleService.updateRole(roleDO); + + return new Status(StateMessage.SUCCESS, roleDO); + }else{ + //新增 + + //用户名重复 + if(!roleService.checkName(request.getName())){ + return new Status(StateMessage.ACCOUNT_EXIST); + } + + RoleDO roleDO = roleService.updateRole(request); + RoleDTO roleDTO = (RoleDTO) DO2DTOUtil.getInstance().doToDto(roleDO, RoleDTO.class); + return new Status(StateMessage.SUCCESS, roleDTO); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + /** + * 删除角色 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "删除角色") + @PostMapping(value = "/delete") + public Status deleteRole(@RequestBody DeleteRequest request, @RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + if (roleService.deleteRole(request.getId()) == 1) { + return new Status(StateMessage.SUCCESS, "success"); + }else{ + return new Status(StateMessage.SUCCESS, "error"); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + /** + * 获取角色权限列表 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取角色权限列表") + @GetMapping(value = "/permissions") + public Status getCustomerList(@RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + List allP = roleService.findAllP(); + Status status = new Status(StateMessage.SUCCESS, allP); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + /** + * 获取角色列表 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取角色列表") + @GetMapping(value = "/list") + public Status getRoleList(@RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + List roleList = roleService.findRoleList(); + + //获取角色权限 + + //获取权限idList + List roleDTOList = (List) DO2DTOUtil.getInstance().doListToDtoList(roleList, RoleDTO.class); + for(RoleDTO mRoleDTO :roleDTOList){ + String p_id = mRoleDTO.getP_id(); + if(p_id!=null && !"".equals(p_id)){ + String[] s_p_id = p_id.split(","); + List pAll = Arrays.asList(s_p_id); + //获取权限详情 + List PermissionDOList = permissionRepository.findPermissionWithId(pAll); + if(PermissionDOList!=null) mRoleDTO.setPermissionDOList(PermissionDOList); + } + } + + Status status = new Status(StateMessage.SUCCESS, roleDTOList); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + +} diff --git a/src/main/java/com/whn/hellospring/controller/TestController.java b/src/main/java/com/whn/hellospring/controller/TestController.java new file mode 100644 index 0000000..a3e58f4 --- /dev/null +++ b/src/main/java/com/whn/hellospring/controller/TestController.java @@ -0,0 +1,16 @@ +package com.whn.hellospring.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(value = "/test") +public class TestController { + + @GetMapping(value = "/test") + public String test(){ + return "test success"; + } + +} diff --git a/src/main/java/com/whn/hellospring/controller/UserController.java b/src/main/java/com/whn/hellospring/controller/UserController.java new file mode 100644 index 0000000..2bb1d45 --- /dev/null +++ b/src/main/java/com/whn/hellospring/controller/UserController.java @@ -0,0 +1,357 @@ +package com.whn.hellospring.controller; + +import com.whn.hellospring.common.StateMessage; +import com.whn.hellospring.common.Status; +import com.whn.hellospring.log.OperationLogAnnotation; +import com.whn.hellospring.model.*; +import com.whn.hellospring.model.zentao.ZenTaoSessionDO; +import com.whn.hellospring.model.zentao.ZenTaoUserDO; +import com.whn.hellospring.request.*; +import com.whn.hellospring.service.UserService; +import com.whn.hellospring.service.ZenTaoService; +import com.whn.hellospring.utils.DO2DTOUtil; +import com.whn.hellospring.utils.MergeObjectsUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +@RestController //处理http请求,默认返回json格式数据 +@RequestMapping(value = "/user") //配置映射 +public class UserController { + + @Autowired + UserService userService; + + @Autowired + ZenTaoService zenTaoService; + + boolean checkToken = false; + + private final String operModul = "用户模块"; + + + /** + * 编辑用户 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "编辑用户") + @PostMapping(value = "/update") + public Status updateCustomer(@Valid @RequestBody UserDO request,@RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + + if(request.getId()!=null){ + + // 获取用户详情 + UserDO userDetail = userService.getUserBasic(request.getId()); + + if(userDetail==null){ + return new Status(StateMessage.SUCCESS, "此id用户不存在"); + } + + //编辑 信息 + UserDO userDO = MergeObjectsUtil.mergeObjects(request, userDetail); + userService.updateUser(userDO); + + return new Status(StateMessage.SUCCESS, userDO); + }else{ + //新增 + + //用户名重复 + if(!userService.checkAccount(request.getUserAccount())){ + return new Status(StateMessage.ACCOUNT_EXIST); + } + + UserDO userDO = userService.updateUser(request); + UserDTO userDTO = (UserDTO) DO2DTOUtil.getInstance().doToDto(userDO, UserDTO.class); + return new Status(StateMessage.SUCCESS, userDTO); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + /** + * 获取用户列表 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取用户列表") + @GetMapping(value = "/list") + public Status getCustomerList(@RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + List customerList = userService.getUserList(); + List userDTOList = (List) DO2DTOUtil.getInstance().doListToDtoList(customerList, UserDTO.class); + + //角色,权限 + for(UserDTO user :userDTOList){ + List roleList = userService.getRoleWithUserId(user.getId()); + user.setRoleList(roleList); + + List permission = userService.getPermissionWithUserId(user.getId()); + user.setPermissionDOList(permission); + } + Status status = new Status(StateMessage.SUCCESS, userDTOList); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + + /** + * 删除用户 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "删除用户") + @PostMapping(value = "/delete") + public Status postDeleteCustomer(@RequestBody DeleteRequest request, @RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + if (userService.deleteUser(request.getId()) == 1) { + return new Status(StateMessage.SUCCESS, "success"); + }else{ + return new Status(StateMessage.SUCCESS, "error"); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + /** + * 用户详情 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "用户详情") + @PostMapping(value = "/detail") + public Status detail(@RequestBody UserDetailRequest request,@RequestHeader String token) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + //用户 + UserDTO userDTO = userService.getUserDetail(request.getId()); + + //禅道 +// zenTaoService.getUserByParentUserIdAsync(request.getId(),userDTO); + + + + + if(userDTO==null){ + return new Status(StateMessage.USER_NOT_EXIST); + }else{ + return new Status(StateMessage.SUCCESS, userDTO); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + + /** + * 用户分配角色 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "用户分配角色") + @PostMapping(value = "/role") + public Status updateRole(@RequestHeader String token,@RequestBody UpdateRoleRequest request) { + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + if (userService.updateRole(request.getUserId(), request.getRoleId()) == 1) { + return new Status(StateMessage.SUCCESS, "success"); + }else{ + return new Status(StateMessage.SUCCESS, "error"); + } + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + /** + * 用户登录,返回token + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "用户登录") + @PostMapping(value = "/login") + public Status login(@RequestBody UserLoginRequest request) { + try { + String phone = request.getUserAccount(); + String password = request.getUserPassword(); + LoginResponse response = userService.login(phone, password); + Status status = new Status(StateMessage.SUCCESS, response); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + + /** + * 获取禅道sessionId + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取禅道sessionId") + @GetMapping(value = "/chandao/sessionid") + public Status getSessionId(@RequestHeader String token) { + try { + if(!userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + ZenTaoSessionDO mChanDaoSessionDO = zenTaoService.getSessionId(token); + Status status = new Status(StateMessage.SUCCESS, mChanDaoSessionDO); + return status; + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + /** + * 根据token 获取客户 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "根据token 获取客户详情") + @PostMapping(value = "/permission") + public Status getUserWithToken(@RequestHeader String token) { + try { + return userService.getUserWithTokenStatus(token); + } catch (Exception e) { + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + + + /** + * 禅道登录免密 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "禅道登录") + @PostMapping(value = "/zentao/loginmsg") + public Status chandaoLoginP(@RequestHeader String token,@RequestBody UserDetailRequest request) { + try { + ZenTaoKeyDO mZenTaoKeyDO = zenTaoService.chandaoLoginNoPassword(request.getId()); + Status status = new Status(StateMessage.SUCCESS,mZenTaoKeyDO); + return status; + } catch (Exception e) { + return new Status(StateMessage.LOGIN_OTHER_DEVICE); + } + } + +// /** +// * 禅道登录 +// */ +// @PostMapping(value = "/zentao/login") +// public Status chandaoLogin1(@RequestHeader String token,@RequestBody ZenTaoUserLoginRequest request) { +// try { +// ZenTaoLoginDO chanDaoLoginDO = zenTaoService.chandaoLogin(token,request.getUserId(),request.getSessionName(),request.getSessionContent()); +// Status status = new Status(StateMessage.SUCCESS,chanDaoLoginDO); +// return status; +// } catch (Exception e) { +// return new Status(StateMessage.LOGIN_OTHER_DEVICE); +// } +// } + +// /** +// * 禅道登录 +// */ +// @PostMapping(value = "/zentao/login2") +// public Status chandaoLogin(@RequestHeader String token) { +// try { +// UserDO user = userService.getUserWithToken(token); +// if (user == null||user.getId()==null) { +// throw new Exception("用户凭证失效"); +// } +//// ZenTaoLoginDO chanDaoLoginDO = zenTaoService.chandaoLogin(token,user); +//// Status status = new Status(StateMessage.SUCCESS,chanDaoLoginDO); +// List users = zenTaoService.getUsers(); +// Status status = new Status(StateMessage.SUCCESS); +// return status; +// } catch (Exception e) { +// return new Status(StateMessage.LOGIN_OTHER_DEVICE); +// } +// } + + /** + * 禅道信息获取 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "禅道信息获取") + @GetMapping(value = "/zentao/key") + public Status ZenTaoKey(@RequestHeader String token){ + try{ + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + + ZenTaoKeyDO mZenTaoKeyDO = zenTaoService.getKey(); + return new Status(StateMessage.SUCCESS, mZenTaoKeyDO); + }catch (Exception e){ + return new Status(StateMessage.LOGIN_OTHER_DEVICE); + } + } + + /** + * 获取禅道用户列表 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取禅道用户列表") + @GetMapping(value = "/zentao/users") + public Status ZenTaoUsers(){ + try{ + List users = zenTaoService.getUsers(); + return new Status(StateMessage.SUCCESS, users); + }catch (Exception e){ + return new Status(StateMessage.UN_KNOW_REASON); + } + } + + + + + + /** + * token验证接口 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "token验证接口") + @PostMapping(value = "/check") + public Status checkToken(@RequestHeader String token) { + try { + String check = userService.check(token); + Status status = new Status(StateMessage.SUCCESS, check); + return status; + } catch (Exception e) { + return new Status(StateMessage.CAPTCHA_FAILURE); + } + } + + /** + * 获取操作记录 + */ + @OperationLogAnnotation(operModul = operModul,operDesc = "获取操作记录") + @GetMapping(value = "/log") + public Status getOperationsLog(@RequestHeader String token,@RequestBody LogRequest request){ + try { + if(checkToken && !userService.checkToken(token)){ + return new Status(StateMessage.TOKEN_ERROR); + } + List operationLog = userService.getOperationLog(request.getUser_id()); + Status status = new Status(StateMessage.SUCCESS, operationLog); + return status; + } catch (Exception e) { + return new Status(StateMessage.CAPTCHA_FAILURE); + } + } + + + + @GetMapping(value = "/test") + public String test() { + return "hello"; + } +} diff --git a/src/main/java/com/whn/hellospring/handler/MoneyTypeHandler.java b/src/main/java/com/whn/hellospring/handler/MoneyTypeHandler.java new file mode 100644 index 0000000..05c1a9d --- /dev/null +++ b/src/main/java/com/whn/hellospring/handler/MoneyTypeHandler.java @@ -0,0 +1,44 @@ +package com.whn.hellospring.handler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * 在Money与Long之间转换的TypeHandler,处理CNY和人民币 + */ +public class MoneyTypeHandler extends BaseTypeHandler { + @Override + public void setNonNullParameter(PreparedStatement preparedStatement, int i, Money money, JdbcType jdbcType) throws SQLException { + preparedStatement.setLong(i,money.getAmountMinorLong()); //存储为Long类型,精确到分 + } + + @Override + public Money getNullableResult(ResultSet resultSet, String s) throws SQLException { + return parseMoney(resultSet.getLong(s)); + } + + @Override + public Money getNullableResult(ResultSet resultSet, int i) throws SQLException { + return parseMoney(resultSet.getLong(i)); + } + + @Override + public Money getNullableResult(CallableStatement callableStatement, int i) throws SQLException { + return parseMoney(callableStatement.getLong(i)); + } + + /** + * 将Long值转换为Money + */ + private Money parseMoney(Long value){ + return Money.ofMinor(CurrencyUnit.of("CNY"),value); + } + +} diff --git a/src/main/java/com/whn/hellospring/log/OperationLogAnnotation.java b/src/main/java/com/whn/hellospring/log/OperationLogAnnotation.java new file mode 100644 index 0000000..25edcf8 --- /dev/null +++ b/src/main/java/com/whn/hellospring/log/OperationLogAnnotation.java @@ -0,0 +1,24 @@ +package com.whn.hellospring.log; + + +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; + +/** + * @title: OperationLog + * @projectName springcloud + * @description: 自定义操作日志注解 + */ +@Target(ElementType.METHOD)//注解放置的目标位置即方法级别 +@Retention(RetentionPolicy.RUNTIME)//注解在哪个阶段执行 +@Documented +public @interface OperationLogAnnotation { + String operModul() default ""; // 操作模块 + + String operDesc() default ""; // 操作说明 +} + + diff --git a/src/main/java/com/whn/hellospring/log/OperationLogAspect.java b/src/main/java/com/whn/hellospring/log/OperationLogAspect.java new file mode 100644 index 0000000..7d8726e --- /dev/null +++ b/src/main/java/com/whn/hellospring/log/OperationLogAspect.java @@ -0,0 +1,102 @@ +package com.whn.hellospring.log; + + +import com.whn.hellospring.common.Status; +import com.whn.hellospring.model.LogDO; +import com.whn.hellospring.model.UserDO; +import com.whn.hellospring.repository.LoggerRepository; +import com.whn.hellospring.service.UserService; +import com.whn.hellospring.utils.IpAddressUtil; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @projectName springcloud + * @description: 操作日志切面处理类 + */ +@Aspect +@Component +public class OperationLogAspect { + @Autowired + LoggerRepository logRepository; + + @Autowired + UserService userService; + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + /** + * 设置操作日志切入点 在注解的位置切入代码 + */ + @Pointcut("@annotation(com.whn.hellospring.log.OperationLogAnnotation)") + public void operLogPoinCut() { + } + + /** + * 记录操作日志 + * @param joinPoint 方法的执行点 + * @param result 方法返回值 + * @throws Throwable + */ + @AfterReturning(returning = "result", value = "operLogPoinCut()") + public void saveOperLog(JoinPoint joinPoint, Object result) throws Throwable { + // 获取RequestAttributes + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + // 从获取RequestAttributes中获取HttpServletRequest的信息 + HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST); + try { + //将返回值转换成map集合 + Status map = (Status) result; + LogDO operationLog = new LogDO(); + // 从切面织入点处通过反射机制获取织入点处的方法 + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + //获取切入点所在的方法 + Method method = signature.getMethod(); + //获取操作 + OperationLogAnnotation annotation = method.getAnnotation(OperationLogAnnotation.class); + if (annotation != null) { + operationLog.setModel(annotation.operModul()); + operationLog.setDescription(annotation.operDesc()); + } + //操作时间 + operationLog.setCreateTime(Timestamp.valueOf(sdf.format(new Date()))); + operationLog.setUpdateTime(Timestamp.valueOf(sdf.format(new Date()))); + + //操作用户 + try { + if(request.getHeader("token")!=null){ + UserDO user = userService.getUserWithToken(request.getHeader("token")); + operationLog.setUser_id(user.getId().toString()); + operationLog.setUser_name(user.getUserName()); + } + }catch (Exception e){ + System.out.println("e:"+e.toString()); + } + + + //操作IP + operationLog.setIp(IpAddressUtil.getIpAddr(request)); + //返回值信息 + operationLog.setResult(map.getMessage()); + //保存日志 + System.out.println("operationLog:"+operationLog); + logRepository.save(operationLog); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} + diff --git a/src/main/java/com/whn/hellospring/model/BaseEntity.java b/src/main/java/com/whn/hellospring/model/BaseEntity.java new file mode 100644 index 0000000..bf280b8 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/BaseEntity.java @@ -0,0 +1,31 @@ +package com.whn.hellospring.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.Sort; +import org.hibernate.annotations.UpdateTimestamp; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +@MappedSuperclass +@Data +@NoArgsConstructor +@AllArgsConstructor +public class BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(updatable = false) + @CreationTimestamp + private Date createTime; + + @UpdateTimestamp + private Date updateTime; + +} diff --git a/src/main/java/com/whn/hellospring/model/CustomerDO.java b/src/main/java/com/whn/hellospring/model/CustomerDO.java new file mode 100644 index 0000000..e16d1a3 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/CustomerDO.java @@ -0,0 +1,29 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_CUSTOMER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class CustomerDO extends BaseEntity implements Serializable { + + private String name; + + private int age; + + private String phone; + + private String pass_word; +} diff --git a/src/main/java/com/whn/hellospring/model/LogDO.java b/src/main/java/com/whn/hellospring/model/LogDO.java new file mode 100644 index 0000000..bf3beb4 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/LogDO.java @@ -0,0 +1,31 @@ +package com.whn.hellospring.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_LOGGER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class LogDO extends BaseEntity implements Serializable { + + private String user_id; + + private String user_name; + + private String ip; + + private String description; + + private String model; + + private String result; +} diff --git a/src/main/java/com/whn/hellospring/model/LoginResponse.java b/src/main/java/com/whn/hellospring/model/LoginResponse.java new file mode 100644 index 0000000..d954241 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/LoginResponse.java @@ -0,0 +1,11 @@ +package com.whn.hellospring.model; + +import lombok.Data; + +@Data +public class LoginResponse { + + private boolean loginSucceed = false; + private String token ; + private String errorMsg; +} diff --git a/src/main/java/com/whn/hellospring/model/MenuCoffeeDO.java b/src/main/java/com/whn/hellospring/model/MenuCoffeeDO.java new file mode 100644 index 0000000..5f1a839 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/MenuCoffeeDO.java @@ -0,0 +1,31 @@ +package com.whn.hellospring.model; + +import lombok.*; +import org.hibernate.annotations.Type; +import org.joda.money.Money; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_MENU_COFFEE") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +public class MenuCoffeeDO extends BaseEntity implements Serializable { + private Long menu_id_fk; + + private String name; + + @Column + @Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmount", + parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "CNY")}) + private Money price; + + +} + diff --git a/src/main/java/com/whn/hellospring/model/MenuDO.java b/src/main/java/com/whn/hellospring/model/MenuDO.java new file mode 100644 index 0000000..accdc47 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/MenuDO.java @@ -0,0 +1,26 @@ +package com.whn.hellospring.model; + +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +/** + * 菜单 + */ +@Entity +@Table(name = "T_MENU") +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class MenuDO extends BaseEntity implements Serializable { + + private String type; + private String coffee_name; + private String coffee_id; + private String price; + +} diff --git a/src/main/java/com/whn/hellospring/model/OrderState.java b/src/main/java/com/whn/hellospring/model/OrderState.java new file mode 100644 index 0000000..1e8c59d --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/OrderState.java @@ -0,0 +1,5 @@ +package com.whn.hellospring.model; + +public enum OrderState{ + INIT,PAID,BREWING,BREWED,TAKEN,CANCELLED +} \ No newline at end of file diff --git a/src/main/java/com/whn/hellospring/model/PermissionDO.java b/src/main/java/com/whn/hellospring/model/PermissionDO.java new file mode 100644 index 0000000..b6999d2 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/PermissionDO.java @@ -0,0 +1,22 @@ +package com.whn.hellospring.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_PERMISSION") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class PermissionDO extends BaseEntity implements Serializable { + private String name; + private String group_id; + private String group_name; +} diff --git a/src/main/java/com/whn/hellospring/model/ResultBean.java b/src/main/java/com/whn/hellospring/model/ResultBean.java new file mode 100644 index 0000000..bc4111f --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/ResultBean.java @@ -0,0 +1,21 @@ +package com.whn.hellospring.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResultBean { + + @JsonProperty("state") + private Boolean state; + @JsonProperty("errorCode") + private String errorCode; + @JsonProperty("message") + private String message; + @JsonProperty("data") + private Object data; +} diff --git a/src/main/java/com/whn/hellospring/model/RoleDO.java b/src/main/java/com/whn/hellospring/model/RoleDO.java new file mode 100644 index 0000000..c4b7dcf --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/RoleDO.java @@ -0,0 +1,30 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_ROLE") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class RoleDO extends BaseEntity implements Serializable { + + + private String name; + + + private String status; + + + private String p_id; + +} diff --git a/src/main/java/com/whn/hellospring/model/RoleDTO.java b/src/main/java/com/whn/hellospring/model/RoleDTO.java new file mode 100644 index 0000000..751c600 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/RoleDTO.java @@ -0,0 +1,32 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.List; + +@Table(name = "T_ROLE") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class RoleDTO extends BaseEntity implements Serializable { + + + private String name; + + + private String status; + + + private String p_id; + + private List PermissionDOList; + +} diff --git a/src/main/java/com/whn/hellospring/model/UserDO.java b/src/main/java/com/whn/hellospring/model/UserDO.java new file mode 100644 index 0000000..157992a --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/UserDO.java @@ -0,0 +1,33 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Entity +@Table(name = "T_USER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class UserDO extends BaseEntity implements Serializable { + + private String userPassword; + + private String userName; + + private String userAccount; + + private boolean isManager; + + private String session_name; + private String session_content; + private String role_id; + +} diff --git a/src/main/java/com/whn/hellospring/model/UserDTO.java b/src/main/java/com/whn/hellospring/model/UserDTO.java new file mode 100644 index 0000000..ce45907 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/UserDTO.java @@ -0,0 +1,38 @@ +package com.whn.hellospring.model; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.List; + +@Table(name = "T_USER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class UserDTO extends BaseEntity implements Serializable { + + + private String userName; + + private String userAccount; + + private boolean isManager; + + private String role_id; + private String session_name; + private String session_content; + + private List PermissionDOList; + private List roleList; + +// private String ZenTaoAccount; +// private String ZenTaoRealName; + +} diff --git a/src/main/java/com/whn/hellospring/model/VersionDO.java b/src/main/java/com/whn/hellospring/model/VersionDO.java new file mode 100644 index 0000000..e630abc --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/VersionDO.java @@ -0,0 +1,31 @@ +package com.whn.hellospring.model; + + +import com.whn.hellospring.model.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.stereotype.Service; + +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +@Data +@Table(name = "t_version") +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Entity +public class VersionDO extends BaseEntity implements Serializable { + + + private int equipment; + + private String version_code; + + private String version_name; + + +} diff --git a/src/main/java/com/whn/hellospring/model/ZenTaoKeyDO.java b/src/main/java/com/whn/hellospring/model/ZenTaoKeyDO.java new file mode 100644 index 0000000..7cd846a --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/ZenTaoKeyDO.java @@ -0,0 +1,12 @@ +package com.whn.hellospring.model; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Data +public class ZenTaoKeyDO { + private String code; + private String key; + private String account; +} diff --git a/src/main/java/com/whn/hellospring/model/dataSourceDB1.java b/src/main/java/com/whn/hellospring/model/dataSourceDB1.java new file mode 100644 index 0000000..e2b6e86 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/dataSourceDB1.java @@ -0,0 +1,4 @@ +package com.whn.hellospring.model; + +public class dataSourceDB1 { +} diff --git a/src/main/java/com/whn/hellospring/model/sqlSessionFactoryDB1.java b/src/main/java/com/whn/hellospring/model/sqlSessionFactoryDB1.java new file mode 100644 index 0000000..1cceecb --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/sqlSessionFactoryDB1.java @@ -0,0 +1,4 @@ +package com.whn.hellospring.model; + +public class sqlSessionFactoryDB1 { +} diff --git a/src/main/java/com/whn/hellospring/model/zentao/ZenTaoLoginDO.java b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoLoginDO.java new file mode 100644 index 0000000..9c8eb7f --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoLoginDO.java @@ -0,0 +1,175 @@ +package com.whn.hellospring.model.zentao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@NoArgsConstructor +@Data +public class ZenTaoLoginDO { + + @JsonProperty("status") + private String status; + @JsonProperty("user") + private UserDTO user; + + @NoArgsConstructor + @Data + public static class UserDTO { + @JsonProperty("id") + private String id; + @JsonProperty("company") + private String company; + @JsonProperty("type") + private String type; + @JsonProperty("dept") + private String dept; + @JsonProperty("account") + private String account; + @JsonProperty("role") + private String role; + @JsonProperty("realname") + private String realname; + @JsonProperty("pinyin") + private String pinyin; + @JsonProperty("nickname") + private String nickname; + @JsonProperty("commiter") + private String commiter; + @JsonProperty("avatar") + private String avatar; + @JsonProperty("birthday") + private String birthday; + @JsonProperty("gender") + private String gender; + @JsonProperty("email") + private String email; + @JsonProperty("skype") + private String skype; + @JsonProperty("qq") + private String qq; + @JsonProperty("mobile") + private String mobile; + @JsonProperty("phone") + private String phone; + @JsonProperty("weixin") + private String weixin; + @JsonProperty("dingding") + private String dingding; + @JsonProperty("slack") + private String slack; + @JsonProperty("whatsapp") + private String whatsapp; + @JsonProperty("address") + private String address; + @JsonProperty("zipcode") + private String zipcode; + @JsonProperty("nature") + private String nature; + @JsonProperty("analysis") + private String analysis; + @JsonProperty("strategy") + private String strategy; + @JsonProperty("join") + private String join; + @JsonProperty("visits") + private String visits; + @JsonProperty("visions") + private String visions; + @JsonProperty("ip") + private String ip; + @JsonProperty("last") + private String last; + @JsonProperty("fails") + private String fails; + @JsonProperty("locked") + private String locked; + @JsonProperty("feedback") + private String feedback; + @JsonProperty("ranzhi") + private String ranzhi; + @JsonProperty("ldap") + private String ldap; + @JsonProperty("score") + private String score; + @JsonProperty("scoreLevel") + private String scoreLevel; + @JsonProperty("resetToken") + private String resetToken; + @JsonProperty("clientStatus") + private String clientStatus; + @JsonProperty("clientLang") + private String clientLang; + @JsonProperty("lastTime") + private String lastTime; + @JsonProperty("admin") + private Boolean admin; + @JsonProperty("modifyPassword") + private Boolean modifyPassword; + @JsonProperty("rights") + private RightsDTO rights; + @JsonProperty("groups") + private List groups; + @JsonProperty("view") + private ViewDTO view; + @JsonProperty("token") + private String token; + + @NoArgsConstructor + @Data + public static class RightsDTO { + @JsonProperty("rights") + private RightsDTO rights; + @JsonProperty("acls") + private List acls; + @JsonProperty("projects") + private String projects; + @JsonProperty("programs") + private String programs; + @JsonProperty("products") + private String products; + @JsonProperty("executions") + private String executions; + +// @NoArgsConstructor +// @Data +// public static class RightsDTO { +// @JsonProperty("index") +// private IndexDTO index; +// @JsonProperty("my") +// private MyDTO my; +// +// @NoArgsConstructor +// @Data +// public static class IndexDTO { +// @JsonProperty("index") +// private Integer index; +// } +// +// @NoArgsConstructor +// @Data +// public static class MyDTO { +// @JsonProperty("index") +// private Integer index; +// } +// } + } + + @NoArgsConstructor + @Data + public static class ViewDTO { + @JsonProperty("account") + private String account; + @JsonProperty("programs") + private String programs; + @JsonProperty("products") + private String products; + @JsonProperty("projects") + private String projects; + @JsonProperty("sprints") + private String sprints; + } + } +} diff --git a/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDO.java b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDO.java new file mode 100644 index 0000000..da77ba8 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDO.java @@ -0,0 +1,17 @@ +package com.whn.hellospring.model.zentao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Data +public class ZenTaoSessionDO { + + @JsonProperty("data") + private String data; + @JsonProperty("status") + private String status; + @JsonProperty("md5") + private String md5; +} diff --git a/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDataDO.java b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDataDO.java new file mode 100644 index 0000000..e59c461 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoSessionDataDO.java @@ -0,0 +1,21 @@ +package com.whn.hellospring.model.zentao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Data +public class ZenTaoSessionDataDO { + + @JsonProperty("title") + private String title; + @JsonProperty("sessionName") + private String sessionName; + @JsonProperty("sessionID") + private String sessionID; + @JsonProperty("rand") + private Integer rand; + @JsonProperty("pager") + private Object pager; +} diff --git a/src/main/java/com/whn/hellospring/model/zentao/ZenTaoUserDO.java b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoUserDO.java new file mode 100644 index 0000000..be4ebd3 --- /dev/null +++ b/src/main/java/com/whn/hellospring/model/zentao/ZenTaoUserDO.java @@ -0,0 +1,93 @@ +package com.whn.hellospring.model.zentao; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +@Entity +@Table(name = "ZT_USER") +@Builder +@Data +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler"}) +public class ZenTaoUserDO implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Long company; + + private String type; + + private Long dept; + + private String account; + + private String password; + + private String role; + + private String realname; + private String pinyin; + private String nickname; + private String commiter; + private String avatar; + private Date birthday; + + private String gender; + private String email; + private String skype; + private String qq; + private String mobile; + + private String phone; + private String weixin; + private String dingding; + private String slack; + private String whatsapp; + private String address; + private String zipcode; + private String nature; + + + private String analysis; + private String strategy; + private Date join; + private Long visits; + private String visions; + private String ip; + private int last; + private int fails; + + + private Date locked; + private String feedback; + private String ranzhi; + private String ldap; + + private int score; + + + @Column( name="scorelevel" ) + private int scoreLevel; + + + @Column( name="resettoken" ) + private String resetToken; + private String deleted; + + @Column( name="clientstatus" ) + private String clientStatus; + + @Column( name="clientlang" ) + private String clientLang; + + private String user_id; + +} diff --git a/src/main/java/com/whn/hellospring/repository/AppRepository.java b/src/main/java/com/whn/hellospring/repository/AppRepository.java new file mode 100644 index 0000000..f89c6ed --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/AppRepository.java @@ -0,0 +1,12 @@ +package com.whn.hellospring.repository; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.model.VersionDO; + +import java.util.List; + +public interface AppRepository extends BaseRepository { + + List findByEquipment(int equipment); + +} diff --git a/src/main/java/com/whn/hellospring/repository/BaseRepository.java b/src/main/java/com/whn/hellospring/repository/BaseRepository.java new file mode 100644 index 0000000..d92e494 --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/BaseRepository.java @@ -0,0 +1,12 @@ +package com.whn.hellospring.repository; + +import org.springframework.data.repository.NoRepositoryBean; +import org.springframework.data.repository.PagingAndSortingRepository; + +import java.util.List; + +@NoRepositoryBean +public interface BaseRepository extends PagingAndSortingRepository { + List findTop3ByOrderByUpdateTimeDescIdAsc(); +} + diff --git a/src/main/java/com/whn/hellospring/repository/LoggerRepository.java b/src/main/java/com/whn/hellospring/repository/LoggerRepository.java new file mode 100644 index 0000000..e3dd393 --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/LoggerRepository.java @@ -0,0 +1,20 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.LogDO; +import com.whn.hellospring.model.RoleDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface LoggerRepository extends JpaRepository { + + + + @Query(value = " select * from t_logger where user_id in(?1)",nativeQuery = true) + List getLogWithId(Long id); //1,2 + + + + +} diff --git a/src/main/java/com/whn/hellospring/repository/MenuRepository.java b/src/main/java/com/whn/hellospring/repository/MenuRepository.java new file mode 100644 index 0000000..b5dbb38 --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/MenuRepository.java @@ -0,0 +1,22 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.MenuDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** + * 菜单类型 + */ +public interface MenuRepository extends JpaRepository { + + /** + * 获取菜单的类型列表 + */ + @Query(value = "select * from t_menu",nativeQuery = true) + List getMenuList(); + + + +} diff --git a/src/main/java/com/whn/hellospring/repository/PermissionRepository.java b/src/main/java/com/whn/hellospring/repository/PermissionRepository.java new file mode 100644 index 0000000..dde903a --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/PermissionRepository.java @@ -0,0 +1,18 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.PermissionDO; +import com.whn.hellospring.model.RoleDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface PermissionRepository extends JpaRepository { + + + + + @Query(value = " select * from t_permission where id in(?1)",nativeQuery = true) + List findPermissionWithId(List p_idList); //1,2 + +} diff --git a/src/main/java/com/whn/hellospring/repository/RoleRepository.java b/src/main/java/com/whn/hellospring/repository/RoleRepository.java new file mode 100644 index 0000000..8049384 --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/RoleRepository.java @@ -0,0 +1,30 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.RoleDO; +import com.whn.hellospring.model.UserDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface RoleRepository extends JpaRepository { + + @Query(value = "select * from t_role where status=1 && user_id=?1",nativeQuery = true) + List findRolesWithUserId(Long user_id); + + + @Query(value = " select * from t_role where id in(?1)",nativeQuery = true) + List findRolesWithRoleId(List role_id); //1,2 + + @Query(value = "select * from t_role where id=?1", nativeQuery = true) + RoleDO getDetail(Long id); + + /** + * 是否存在角色 + */ + @Query(value = "select * from t_role where name=?1", nativeQuery = true) + List isHaveThisName(String name); + + + +} diff --git a/src/main/java/com/whn/hellospring/repository/UserRepository.java b/src/main/java/com/whn/hellospring/repository/UserRepository.java new file mode 100644 index 0000000..b3f19e9 --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/UserRepository.java @@ -0,0 +1,29 @@ +package com.whn.hellospring.repository; + +import com.whn.hellospring.model.UserDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +import javax.transaction.Transactional; +import java.util.List; + +public interface UserRepository extends JpaRepository { + + + /** + * 是否存在该账号 + */ + @Query(value = "select * from t_user where user_account=?1", nativeQuery = true) + List isHaveThisAccount(String user_account); + + + @Query(value = "select * from t_user where id=?1", nativeQuery = true) + UserDO getDetail(Long id); + + @Modifying + @Transactional + @Query(value = "update t_user set role_id = ?1 where id = ?2",nativeQuery = true) + int updateRole(String role_id, String user_id); + +} diff --git a/src/main/java/com/whn/hellospring/repository/ZenTaoRepository.java b/src/main/java/com/whn/hellospring/repository/ZenTaoRepository.java new file mode 100644 index 0000000..c150a7d --- /dev/null +++ b/src/main/java/com/whn/hellospring/repository/ZenTaoRepository.java @@ -0,0 +1,27 @@ +package com.whn.hellospring.repository; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.model.UserDO; +import com.whn.hellospring.model.zentao.ZenTaoUserDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface ZenTaoRepository extends JpaRepository { + + + /** + * 是否存在该账号 + */ +// @Query(value = "select * from zt_user where user_id=?1", nativeQuery = true) +// List getZenTaoUserWithUserId(Long user_id); + +// public List findbyUser_id(Long user_id); + + + + @Query(value = "select * from zt_user where user_id=?1", nativeQuery = true) + ZenTaoUserDO getDetailByUserId(Long user_id); +} + diff --git a/src/main/java/com/whn/hellospring/request/BaseHeadRequest.java b/src/main/java/com/whn/hellospring/request/BaseHeadRequest.java new file mode 100644 index 0000000..991ed63 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/BaseHeadRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class BaseHeadRequest extends BaseRequest { + private String token; +} diff --git a/src/main/java/com/whn/hellospring/request/BaseRequest.java b/src/main/java/com/whn/hellospring/request/BaseRequest.java new file mode 100644 index 0000000..b6ad3da --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/BaseRequest.java @@ -0,0 +1,6 @@ +package com.whn.hellospring.request; + +import java.io.Serializable; + +public class BaseRequest implements Serializable { +} diff --git a/src/main/java/com/whn/hellospring/request/DeleteOrderRequest.java b/src/main/java/com/whn/hellospring/request/DeleteOrderRequest.java new file mode 100644 index 0000000..eddd7fc --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/DeleteOrderRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class DeleteOrderRequest extends BaseRequest { + private Long id; +} diff --git a/src/main/java/com/whn/hellospring/request/DeleteRequest.java b/src/main/java/com/whn/hellospring/request/DeleteRequest.java new file mode 100644 index 0000000..1fc6704 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/DeleteRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class DeleteRequest extends BaseRequest { + private Long id; +} diff --git a/src/main/java/com/whn/hellospring/request/GetLogRequest.java b/src/main/java/com/whn/hellospring/request/GetLogRequest.java new file mode 100644 index 0000000..39e99ab --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/GetLogRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class GetLogRequest extends BaseRequest { + private Long user_id; +} diff --git a/src/main/java/com/whn/hellospring/request/GetOrderRequest.java b/src/main/java/com/whn/hellospring/request/GetOrderRequest.java new file mode 100644 index 0000000..291adf9 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/GetOrderRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class GetOrderRequest extends BaseRequest { + private Long id; +} diff --git a/src/main/java/com/whn/hellospring/request/LogRequest.java b/src/main/java/com/whn/hellospring/request/LogRequest.java new file mode 100644 index 0000000..0465c57 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/LogRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class LogRequest extends BaseRequest { + private Long user_id; +} diff --git a/src/main/java/com/whn/hellospring/request/UpdateRoleRequest.java b/src/main/java/com/whn/hellospring/request/UpdateRoleRequest.java new file mode 100644 index 0000000..6af7c24 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/UpdateRoleRequest.java @@ -0,0 +1,9 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class UpdateRoleRequest extends BaseRequest { + private String UserId; + private String RoleId; +} diff --git a/src/main/java/com/whn/hellospring/request/UpdateUserRequest.java b/src/main/java/com/whn/hellospring/request/UpdateUserRequest.java new file mode 100644 index 0000000..db8a382 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/UpdateUserRequest.java @@ -0,0 +1,28 @@ +package com.whn.hellospring.request; + +import lombok.Data; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; + +import javax.persistence.Column; +import java.util.Date; + +@Data +public class UpdateUserRequest extends BaseRequest { + private Long id; + private String userPassword; + + private String userName; + + private String userAccount; + + private boolean isManager; + + private String session_name; + private String session_content; + private String role_id; + + private Date createTime; + + private Date updateTime; +} diff --git a/src/main/java/com/whn/hellospring/request/UserDetailRequest.java b/src/main/java/com/whn/hellospring/request/UserDetailRequest.java new file mode 100644 index 0000000..89b6943 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/UserDetailRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class UserDetailRequest extends BaseRequest { + private long id; +} diff --git a/src/main/java/com/whn/hellospring/request/UserLoginRequest.java b/src/main/java/com/whn/hellospring/request/UserLoginRequest.java new file mode 100644 index 0000000..14dda18 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/UserLoginRequest.java @@ -0,0 +1,9 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class UserLoginRequest extends BaseRequest { + private String userAccount; + private String userPassword; +} diff --git a/src/main/java/com/whn/hellospring/request/UserTokenRequest.java b/src/main/java/com/whn/hellospring/request/UserTokenRequest.java new file mode 100644 index 0000000..1c20641 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/UserTokenRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class UserTokenRequest extends BaseRequest { + private String token; +} diff --git a/src/main/java/com/whn/hellospring/request/VersionRequest.java b/src/main/java/com/whn/hellospring/request/VersionRequest.java new file mode 100644 index 0000000..c72efb6 --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/VersionRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class VersionRequest extends BaseRequest { + private int equipment; +} diff --git a/src/main/java/com/whn/hellospring/request/ZenTaoUserLoginRequest.java b/src/main/java/com/whn/hellospring/request/ZenTaoUserLoginRequest.java new file mode 100644 index 0000000..89d2f6d --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/ZenTaoUserLoginRequest.java @@ -0,0 +1,12 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class ZenTaoUserLoginRequest extends BaseRequest { + + private Long userId; + private String sessionName; + private String sessionContent; + +} diff --git a/src/main/java/com/whn/hellospring/request/getOrderListWithCustomerIdRequest.java b/src/main/java/com/whn/hellospring/request/getOrderListWithCustomerIdRequest.java new file mode 100644 index 0000000..ec611ca --- /dev/null +++ b/src/main/java/com/whn/hellospring/request/getOrderListWithCustomerIdRequest.java @@ -0,0 +1,8 @@ +package com.whn.hellospring.request; + +import lombok.Data; + +@Data +public class getOrderListWithCustomerIdRequest extends BaseRequest { + private String customerId; +} diff --git a/src/main/java/com/whn/hellospring/service/AppService.java b/src/main/java/com/whn/hellospring/service/AppService.java new file mode 100644 index 0000000..a875965 --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/AppService.java @@ -0,0 +1,28 @@ +package com.whn.hellospring.service; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.model.VersionDO; +import com.whn.hellospring.repository.AppRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@DS("zentao") +public class AppService { + + @Autowired + AppRepository repository; + + /** + * 获取版本列表 + */ + public List getVersion(int equipment) { + List versionDOList = repository.findByEquipment(equipment); + return versionDOList; + } + + +} diff --git a/src/main/java/com/whn/hellospring/service/JuheService.java b/src/main/java/com/whn/hellospring/service/JuheService.java new file mode 100644 index 0000000..b41246d --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/JuheService.java @@ -0,0 +1,99 @@ +package com.whn.hellospring.service; + + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.Map; + + +@Slf4j +@Service +public class JuheService { + + + public String getOilPrice() { + String url = "http://apis.juhe.cn/gnyj/query?key=212b6526c4f8a3899ca406a1173bafa8"; + + String result = ""; + BufferedReader in = null; + try { + String urlNameString = url; + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + Map> map = connection.getHeaderFields(); + for (String key : map.keySet()) { + System.out.println(key + "--->" + map.get(key)); + } + in = new BufferedReader(new InputStreamReader( + connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("异常" + e); + e.printStackTrace(); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + return result; + } + + + public static String sendPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + String result = ""; + try { + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setRequestProperty("charset", "utf-8"); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8")); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + System.out.println("sendPost" + result); + } catch (Exception e) { + System.out.println("异常" + e); + e.printStackTrace(); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return result; + } +} diff --git a/src/main/java/com/whn/hellospring/service/MenuService.java b/src/main/java/com/whn/hellospring/service/MenuService.java new file mode 100644 index 0000000..5bcf413 --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/MenuService.java @@ -0,0 +1,42 @@ +package com.whn.hellospring.service; + +import com.whn.hellospring.model.MenuDO; +import com.whn.hellospring.repository.MenuRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Slf4j +public class MenuService { + + @Autowired + private MenuRepository menuRepository; + + + + /** + * 获取菜单类型列表 + */ + public List getMenuTypeList() { + return menuRepository.getMenuList(); + +// List returnList = new ArrayList<>(); +// for (MenuDO menudo : menuRepository.getMenuList()) { +// Optional coffeeList = menuCoffeeRepository.findById(menudo.getId()); +// +// MenuDTO menuDTO = new MenuDTO(); +// if (coffeeList.isPresent()) menuDTO.setCoffee_list(MyOptional.toList(coffeeList)); +// menuDTO.setId(menudo.getId()); +// menuDTO.setCreateTime(menudo.getCreateTime()); +// menuDTO.setUpdateTime(menudo.getUpdateTime()); +// menuDTO.setType(menudo.getType()); +// +// returnList.add(menuDTO); +// } +// return returnList; + + } +} diff --git a/src/main/java/com/whn/hellospring/service/RoleService.java b/src/main/java/com/whn/hellospring/service/RoleService.java new file mode 100644 index 0000000..ca54455 --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/RoleService.java @@ -0,0 +1,77 @@ +package com.whn.hellospring.service; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.model.PermissionDO; +import com.whn.hellospring.model.RoleDO; +import com.whn.hellospring.model.UserDO; +import com.whn.hellospring.repository.PermissionRepository; +import com.whn.hellospring.repository.RoleRepository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +@Slf4j +@Service +@DS("master") +public class RoleService { + + @Autowired + RoleRepository roleRepository; + + @Autowired + PermissionRepository permissionRepository; + + + /** + * 保存,编辑 + */ + public RoleDO updateRole(RoleDO roleDO) { + roleRepository.save(roleDO); + return roleDO; + } + + + /** + * 删除 + */ + public int deleteRole(Long id) { + roleRepository.deleteById(id); + return 1; + } + + + /** + * 获取所有权限 + */ + public List findAllP(){ + return permissionRepository.findAll(); + } + + /** + * 获取所有角色 + */ + public List findRoleList(){ + return roleRepository.findAll(); + } + + /** + * 获取一个角色详情基本信息 + */ + public RoleDO getRoleWithId(long user_id){ + RoleDO roleDO = roleRepository.getDetail(user_id); + return roleDO; + } + + /** + * 判断用户是否存在 + */ + public boolean checkName(String name){ + List list = roleRepository.isHaveThisName(name); + return list == null || list.size() == 0; + } + + +} diff --git a/src/main/java/com/whn/hellospring/service/UserService.java b/src/main/java/com/whn/hellospring/service/UserService.java new file mode 100644 index 0000000..86d3b50 --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/UserService.java @@ -0,0 +1,294 @@ +package com.whn.hellospring.service; + + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.common.StateMessage; +import com.whn.hellospring.common.Status; +import com.whn.hellospring.model.*; +import com.whn.hellospring.repository.*; +import com.whn.hellospring.utils.DO2DTOUtil; +import com.whn.hellospring.utils.SHAUtils; +import io.jsonwebtoken.Claims; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static com.whn.hellospring.utils.JwtUtils.generateToken; +import static com.whn.hellospring.utils.JwtUtils.verifyJwt; + +@Slf4j +@Service +@DS("master") +public class UserService { + + @Autowired + UserRepository userRepository; + + @Autowired + ZenTaoRepository zenTaoRepository; + + @Autowired + RoleRepository roleRepository; + + @Autowired + PermissionRepository permissionRepository; + + @Autowired + LoggerRepository loggerRepository; + + + String ChanDaoHost = "http://101.37.147.15:21080"; + + /** + * 获取一个用户详情 + */ + @DS("master") + public UserDTO getUserDetail(long user_id){ + UserDO userDO = userRepository.getDetail(user_id); + if(userDO==null){ + return null; + } + UserDTO userDTO = (UserDTO) DO2DTOUtil.getInstance().doToDto(userDO, UserDTO.class); + //权限 + List permissionWithUserId = getPermissionWithUserId(user_id); + userDTO.setPermissionDOList(permissionWithUserId); + + + + return userDTO; + } + + + /** + * 获取一个用户详情基本信息 + */ + public UserDO getUserBasic(long user_id){ + UserDO userDO = userRepository.getDetail(user_id); + return userDO; + } + + /** + * 根据User_id,获取权限 + */ + public List getPermissionWithUserId(Long user_id){ + List roleDOS = getRoleWithUserId(user_id); + System.out.println("roleDOS:"+roleDOS); + + //获取权限idList + List roleDTOList = (List) DO2DTOUtil.getInstance().doListToDtoList(roleDOS, RoleDTO.class); + List pAll = new ArrayList<>(); + for(RoleDTO mRoleDTO :roleDTOList){ + String p_id = mRoleDTO.getP_id(); + if(!p_id.isEmpty()){ + String[] s_p_id = p_id.split(","); + List p_idList = Arrays.asList(s_p_id); + pAll.addAll(p_idList); + } + + } + + //获取权限详情 + List PermissionDOList = permissionRepository.findPermissionWithId(pAll); + return PermissionDOList; + } + + + /** + * 根据User_id,获取权限 + */ + public List getRoleWithUserId(Long user_id){ + UserDO userDO = userRepository.getDetail(user_id); + if(userDO==null ){ + return new ArrayList<>(); + } + String role_id = userDO.getRole_id(); + + //获取角色 + System.out.println("role_id:"+role_id); + if(role_id==null ||role_id.isEmpty()){ + return new ArrayList<>(); + } + String[] split = role_id.split(","); + List idList = Arrays.asList(split); + List roleDOS = roleRepository.findRolesWithRoleId(idList); + System.out.println("roleDOS:"+roleDOS); + return roleDOS; + } + + + + + + /** + * 删除一个用户 + */ + public int deleteUser(Long id) { + userRepository.deleteById(id); + return 1; + } + + /** + * 编辑客户 + */ + public UserDO updateUser(UserDO userDo) { + userDo.setUserPassword(SHAUtils.getSHA256StrJava(userDo.getUserPassword())); + userRepository.save(userDo); + return userDo; + } + + /** + * 编辑客户 + */ + public UserDO updateUserNoPassword(UserDO userDo) { + userRepository.save(userDo); + return userDo; + } + + /** + * 获取顾客列表 + */ + public List getUserList() { + return userRepository.findAll(); + } + + + /** + * 判断账号是否存在 + * @return true 不存在 + */ + public boolean checkAccount(String user_account){ + List list = userRepository.isHaveThisAccount(user_account); + return list == null || list.size() == 0; + } + + + /** + * 登录 + */ + public LoginResponse login(String user_account, String password) { + //判断是否存在 + LoginResponse response = new LoginResponse(); + + List list = userRepository.isHaveThisAccount(user_account); + if (list == null || list.size() == 0) { + response.setErrorMsg("该账号不存在"); + response.setLoginSucceed(false); + return response; + } else { + response.setErrorMsg("请检查密码"); + for (UserDO userDO : list) { + String sha256StrJava = SHAUtils.getSHA256StrJava(password); + if (sha256StrJava.equals(userDO.getUserPassword())) { + //生成token + String token = generateToken(userDO.getUserAccount(), userDO.getId()); + response.setToken(token); + response.setErrorMsg(""); + response.setLoginSucceed(true); + System.out.println(""+userDO.getUserAccount()+" token:"+ token ); + break; + } + } + return response; + } + } + + + /** + * 检测token + * return false 失敗 + */ + public boolean checkToken(String token){ + Claims claims = verifyJwt(token); + if(claims==null) return false; + String account = claims.get("account").toString(); + String id = claims.get("id").toString(); + //判断是否存在 + boolean b = false; + List list = userRepository.isHaveThisAccount(account); + if (list == null || list.size() == 0) { + b = false; + } else { + UserDTO userDetail = getUserDetail(Long.parseLong(id)); + if(userDetail!=null && account.equals(userDetail.getUserAccount())){ + b = true; + } + } + return b; + } + + + + /** + * 检测token + */ + public String check(String token){ + Claims claims = verifyJwt(token); + String account = claims.get("account").toString(); + String id = claims.get("id").toString(); + + //判断是否存在 + String msg = "验证失败"; + List list = userRepository.isHaveThisAccount(account); + if (list == null || list.size() == 0) { + msg="该账号不存在"; + } else { + UserDTO userDetail = getUserDetail(Long.parseLong(id)); + if(userDetail!=null && account.equals(userDetail.getUserAccount())){ + msg="验证成功"; + } + } + return msg; + } + + @DS("master") + public UserDO getUserWithToken(String token) throws Exception { + Claims claims = verifyJwt(token); + if(claims==null){ + throw new Exception("用户凭证失效"); + } + String id = claims.get("id").toString(); + UserDO one = userRepository.getOne(Long.parseLong(id)); + return one; + } + + @DS("master") + public Status getUserWithTokenStatus(String token) throws Exception { + Claims claims = verifyJwt(token); + if(claims==null){ + return new Status(StateMessage.TOKEN_ERROR); + } + String id = claims.get("id").toString(); + UserDO one = userRepository.getOne(Long.parseLong(id)); + return new Status(StateMessage.SUCCESS, one); + } + + + + /** + * 分配角色 + * + * @return + */ + + public int updateRole(String userId, String roleId){ + int i = userRepository.updateRole(roleId, userId); + return i; + } + + + /** + * 操作记录 + */ + public List getOperationLog(Long user_id){ + if(user_id!=null && user_id>0){ + return loggerRepository.getLogWithId(user_id); + }else{ + return loggerRepository.findAll(); + } + + } +} diff --git a/src/main/java/com/whn/hellospring/service/ZenTaoService.java b/src/main/java/com/whn/hellospring/service/ZenTaoService.java new file mode 100644 index 0000000..f795b1c --- /dev/null +++ b/src/main/java/com/whn/hellospring/service/ZenTaoService.java @@ -0,0 +1,244 @@ +package com.whn.hellospring.service; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.whn.hellospring.model.UserDTO; +import com.whn.hellospring.model.zentao.ZenTaoLoginDO; +import com.whn.hellospring.model.zentao.ZenTaoSessionDO; +import com.whn.hellospring.model.UserDO; +import com.whn.hellospring.model.ZenTaoKeyDO; +import com.whn.hellospring.model.zentao.ZenTaoSessionDataDO; +import com.whn.hellospring.model.zentao.ZenTaoUserDO; +import com.whn.hellospring.repository.ZenTaoRepository; +import com.whn.hellospring.utils.HttpUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpResponse; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +@DS("zentao") +public class ZenTaoService { + private String key = "cb2b16dfceb0e8fbf7817f96865b5d61"; + private String code = "631"; + + + @Autowired + UserService userService; + + @Autowired + ZenTaoRepository zenTaoRepository; + + + String ChanDaoHost = "http://101.37.147.15:21080"; + + + /** + * 获取禅道用户 + * + * @return + */ + @DS("zentao") + @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) + public List getUsers() { + return zenTaoRepository.findAll(); + } + + + /** + * 根据user_id获取禅道用户 + */ + @DS("zentao") + @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) + public ZenTaoUserDO getUserByParentUserId(Long user_id) { + return zenTaoRepository.getDetailByUserId(user_id); + } + + +// @Async("taskExecutor") +// @DS("zentao") +// public void getUserZenTaoMsg(Long user_id, UserDTO userDTO){ +// new Thread(){ +// @Override +// public void run() { +// super.run(); +// ZenTaoUserDO zenTaoUserDO = getUserByParentUserId(user_id); +// if(zenTaoUserDO==null) return; +// String account = zenTaoUserDO.getAccount(); +// System.out.println("zenTaoUserDO:"+zenTaoUserDO.toString()); +// System.out.println("account:"+account); +// userDTO.setZenTaoRealName(zenTaoUserDO.getRealname()); +// } +// }.start(); +// } + + /** + * 獲取禪道Key + */ + public ZenTaoKeyDO getKey() { + //TODO 從禪道數據庫獲取 + ZenTaoKeyDO mZenTaoKeyDO = new ZenTaoKeyDO(); + mZenTaoKeyDO.setKey("cb2b16dfceb0e8fbf7817f96865b5d61"); + mZenTaoKeyDO.setCode("631"); + return mZenTaoKeyDO; + } + + /** + * 获取禅道sessionId + */ + public ZenTaoSessionDO getSessionId(String token) { + + String path = "/api-getsessionid.json"; + + JSONObject requestObj = new JSONObject(); + String bodys = requestObj.toJSONString(); + JSONObject resObj = new JSONObject(); + try { + Map headers = new HashMap(); + Map querys = new HashMap(); + HttpResponse response = HttpUtils.doPost(ChanDaoHost, path, "POST", headers, querys, bodys); + int stat = response.getStatusLine().getStatusCode(); + if (stat != 200) { + System.out.println("Http code: " + stat); + System.out.println("http header error msg: " + response.getFirstHeader("X-Ca-Error-Message")); + String bodyErr = EntityUtils.toString(response.getEntity()); + System.out.println("Http body error msg:" + bodyErr); + resObj.put("errorMsg", bodyErr); + } else { + String res = EntityUtils.toString(response.getEntity()); + resObj.put("status", "SUCCESS"); + resObj.putAll(JSON.parseObject(res)); + } + + UserDO userWithToken = userService.getUserWithToken(token); + System.out.println("userWithToken:"+userWithToken); + ZenTaoSessionDO mChanDaoSessionDO = JSONObject.parseObject(String.valueOf(resObj), ZenTaoSessionDO.class); + ZenTaoSessionDataDO mZenTaoSessionDataDO = JSONObject.parseObject(String.valueOf(mChanDaoSessionDO.getData()), ZenTaoSessionDataDO.class); + System.out.println("mZenTaoSessionDataDO:" + mZenTaoSessionDataDO); + userWithToken.setSession_name(mZenTaoSessionDataDO.getSessionName()); + userWithToken.setSession_content(mZenTaoSessionDataDO.getSessionID()); + userService.updateUserNoPassword(userWithToken); + + } catch (Exception e) { + resObj.put("status", "FAIL"); + e.printStackTrace(); + } finally { + + log.info("resObj={}", JSONObject.toJSONString(resObj, true)); + ZenTaoSessionDO mChanDaoSessionDO = JSONObject.parseObject(String.valueOf(resObj), ZenTaoSessionDO.class); + log.info("bean" + mChanDaoSessionDO.toString()); + + + return mChanDaoSessionDO; + } + } + + + /** + * 禅道免密登录 + * + * @return + */ + public ZenTaoKeyDO chandaoLoginNoPassword(Long userId){ + //根据userID,从禅道数据库中读取 + List all = zenTaoRepository.findAll(); + + ZenTaoUserDO user = null; + for (ZenTaoUserDO zenTaoUserDO : all) { + if(zenTaoUserDO.getUser_id().equals(userId.toString())){ + user = zenTaoUserDO; + break; + } + } + String account = user.getAccount(); + ZenTaoKeyDO mZenTaoKeyDO = new ZenTaoKeyDO(); + mZenTaoKeyDO.setAccount(account); + mZenTaoKeyDO.setKey(key); + mZenTaoKeyDO.setCode(code); + return mZenTaoKeyDO; + } + + + /** + * 禅道登录 + * + * @return + */ + public ZenTaoLoginDO chandaoLogin(String token,Long userId, String sessionName,String sessionContent) throws Exception { +// http://101.37.147.15:21080/user-login.json?zentaosid=6a47nilf9p531ggtbkaf1t9ms7&account=root&password=Digiproto@123 + String path = "/user-login.json"; + + //根据userID,从禅道数据库中读取 + List all = zenTaoRepository.findAll(); + + + ZenTaoUserDO user = null; + for (ZenTaoUserDO zenTaoUserDO : all) { + if(zenTaoUserDO.getUser_id().equals(userId.toString())){ + user = zenTaoUserDO; + break; + } + } + + + + if (user==null) { + throw new Exception("token失效"); + } + + + String account = user.getAccount(); +// String password = user.getPassword(); + String password = "Digiproto@123"; + String name = sessionName; + String id = sessionContent; + + + JSONObject requestObj = new JSONObject(); + String bodys = requestObj.toJSONString(); + JSONObject resObj = new JSONObject(); + try { + Map headers = new HashMap(); + Map querys = new HashMap(); + querys.put("account", account); + querys.put("password", password); + querys.put(name, id); + + HttpResponse response = HttpUtils.doPost(ChanDaoHost, path, "POST", headers, querys, bodys); + int stat = response.getStatusLine().getStatusCode(); + if (stat != 200) { + System.out.println("Http code: " + stat); + System.out.println("http header error msg: " + response.getFirstHeader("X-Ca-Error-Message")); + String bodyErr = EntityUtils.toString(response.getEntity()); + System.out.println("Http body error msg:" + bodyErr); + resObj.put("errorMsg", bodyErr); + } else { + String res = EntityUtils.toString(response.getEntity()); + resObj.put("status", "SUCCESS"); + resObj.putAll(JSON.parseObject(res)); + } + } catch (Exception e) { + resObj.put("status", "FAIL"); + e.printStackTrace(); + } finally { + + log.info("resObj={}", JSONObject.toJSONString(resObj, true)); + ZenTaoLoginDO mChanDaoLoginDO = JSONObject.parseObject(String.valueOf(resObj), ZenTaoLoginDO.class); + log.info("bean" + mChanDaoLoginDO.toString()); + + return mChanDaoLoginDO; + } + } + +} diff --git a/src/main/java/com/whn/hellospring/top/topCheck.kt b/src/main/java/com/whn/hellospring/top/topCheck.kt new file mode 100644 index 0000000..67263e9 --- /dev/null +++ b/src/main/java/com/whn/hellospring/top/topCheck.kt @@ -0,0 +1,25 @@ +package com.whn.hellospring.utils + +/** + * 功能描述: + * 创建作者:尉浩楠 + * 创建时间:2018/10/9. + */ + +/** + * 判断字符串不为空 + */ +fun isNotNull(num: String?): Boolean { + return num != null && "" != num +} + +/** + * 判断字符串不为空 + */ +fun isNotNullAndZero(num: String?): Boolean { + return StringUtil.isNumber(num) && num?.toDouble() != 0.0 +} + + + + diff --git a/src/main/java/com/whn/hellospring/utils/DO2DTOUtil.java b/src/main/java/com/whn/hellospring/utils/DO2DTOUtil.java new file mode 100644 index 0000000..d90c33b --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/DO2DTOUtil.java @@ -0,0 +1,104 @@ +package com.whn.hellospring.utils; + +import org.springframework.beans.BeanUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * DO,DOT模型转换 + */ +public class DO2DTOUtil { + + private static DO2DTOUtil instance = new DO2DTOUtil(); + private DO2DTOUtil(){} + public static DO2DTOUtil getInstance(){ + return instance; + } + + /** + * DTO集合转换成DO集合 + * + * @param dtoList DTO 对象集合 + * @param doClass DO 类型 + * @return doClass类型的集合 + */ + public Object dtoListToDoList(Object dtoList, Class doClass) { + if (dtoList == null) { + return null; + } + List doList = new ArrayList<>(); + for (Object dto : (List) dtoList) { + Object i = dtoToDo(dto, doClass); + if (i != null) { + doList.add(i); + } + } + return doList; + } + + /** + * DTO模型转换成DO + * + * @param objectDto DTO 对象 + * @param doClass DO 类型 + * @return doClass类型的对象 + */ + public Object dtoToDo(Object objectDto, Class doClass) { + if (objectDto == null) { + return null; + } + Object objectDo = null; + try { + objectDo = doClass.newInstance(); + BeanUtils.copyProperties(objectDto, objectDo); + } catch (Exception ex) { + ex.printStackTrace(); + } + return objectDo; + } + + + /** + * DO集合转换成DTO集合 + * + * @param doList DO 对象集合 + * @param dtoClass DTO 类型 + * @return dtoClass类型的集合 + */ + public Object doListToDtoList(Object doList, Class dtoClass) { + if (doList == null) { + return null; + } + List dtoList = new ArrayList<>(); + for (Object i : (List) doList) { + Object dto = doToDto(i, dtoClass); + if (dto != null) { + dtoList.add(dto); + } + } + return dtoList; + } + + /** + * DO转换成DTO + * + * @param objectDo DO 对象 + * @param dtoClass DTO 类型 + * @return dtoClass类型的对象 + */ + public Object doToDto(Object objectDo, Class dtoClass) { + if (objectDo == null) { + return null; + } + Object objectDto = null; + try { + objectDto = dtoClass.newInstance(); + BeanUtils.copyProperties(objectDo, objectDto); + } catch (Exception ex) { + ex.printStackTrace(); + } + return objectDto; + } + +} diff --git a/src/main/java/com/whn/hellospring/utils/DateUtils.java b/src/main/java/com/whn/hellospring/utils/DateUtils.java new file mode 100644 index 0000000..eca9dd7 --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/DateUtils.java @@ -0,0 +1,32 @@ +package com.whn.hellospring.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class DateUtils { + + /** + * 计算两个日期之间相差的天数 + * + * @param smdate 较小的时间 + * @param bdate 较大的时间 + * @return 相差天数 + */ + public static int daysBetween(Date smdate, Date bdate) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + smdate = sdf.parse(sdf.format(smdate)); + bdate = sdf.parse(sdf.format(bdate)); + Calendar cal = Calendar.getInstance(); + cal.setTime(smdate); + long time1 = cal.getTimeInMillis(); + cal.setTime(bdate); + long time2 = cal.getTimeInMillis(); + long between_days = (time2 - time1) / (1000 * 3600 * 24); + return Integer.parseInt(String.valueOf(between_days)); + } catch (Exception e) { + return -1; + } + } +} diff --git a/src/main/java/com/whn/hellospring/utils/HttpUtils.java b/src/main/java/com/whn/hellospring/utils/HttpUtils.java new file mode 100644 index 0000000..3c8147d --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/HttpUtils.java @@ -0,0 +1,321 @@ +package com.whn.hellospring.utils; + + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 功能描述: + * + * @author Administrator + * @date 2021/7/23 + */ +public class HttpUtils { + + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + @Override + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + @Override + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/whn/hellospring/utils/IpAddressUtil.java b/src/main/java/com/whn/hellospring/utils/IpAddressUtil.java new file mode 100644 index 0000000..04fcea0 --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/IpAddressUtil.java @@ -0,0 +1,49 @@ +package com.whn.hellospring.utils; + + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * @ClassName IpAdrressUtil + * @Description 获取IP地址的工具类 + */ +public class IpAddressUtil { + + /** + * 获取IP地址 + */ + public static String getIpAddr(HttpServletRequest request){ + String ipAddress = request.getHeader("x-forwarded-for"); + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("Proxy-Client-IP"); + } + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("WL-Proxy-Client-IP"); + } + if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getRemoteAddr(); + if(ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")){ + //根据网卡取本机配置的IP + InetAddress inet=null; + try { + inet = InetAddress.getLocalHost(); + } catch (UnknownHostException e) { + } + if (inet.getHostAddress() != null) { + ipAddress= inet.getHostAddress(); + } + } + } + //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 + if(ipAddress!=null && ipAddress.length()>15){ //"***.***.***.***".length() = 15 + if(ipAddress.indexOf(",")>0){ + ipAddress = ipAddress.substring(0,ipAddress.indexOf(",")); + } + } + return ipAddress; + } + +} + diff --git a/src/main/java/com/whn/hellospring/utils/JsonUtils.java b/src/main/java/com/whn/hellospring/utils/JsonUtils.java new file mode 100644 index 0000000..fda80ef --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/JsonUtils.java @@ -0,0 +1,115 @@ +package com.whn.hellospring.utils; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; +import java.text.SimpleDateFormat; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +/** + * 基于Jackson的JSON转换工具类 + * + * @author ye17186 + * @version 2018/6/29 12:06 + */ +@Slf4j +public class JsonUtils { + + private static ObjectMapper om = new ObjectMapper(); + + static { + + // 对象的所有字段全部列入,还是其他的选项,可以忽略null等 + om.setSerializationInclusion(Include.ALWAYS); + // 设置Date类型的序列化及反序列化格式 + om.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); + + // 忽略空Bean转json的错误 + om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + // 忽略未知属性,防止json字符串中存在,java对象中不存在对应属性的情况出现错误 + om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + // 注册一个时间序列化及反序列化的处理模块,用于解决jdk8中localDateTime等的序列化问题 + om.registerModule(new JavaTimeModule()); + } + + /** + * 对象 => json字符串 + * + * @param obj 源对象 + */ + public static String toJson(T obj) { + + String json = null; + if (obj != null) { + try { + json = om.writeValueAsString(obj); + } catch (JsonProcessingException e) { + log.warn(e.getMessage(), e); + throw new IllegalArgumentException(e.getMessage()); + } + } + return json; + } + + /** + * json字符串 => 对象 + * + * @param json 源json串 + * @param clazz 对象类 + * @param 泛型 + */ + public static T parse(String json, Class clazz) { + + return parse(json, clazz, null); + } + + /** + * json字符串 => 对象 + * + * @param json 源json串 + * @param type 对象类型 + * @param 泛型 + */ + public static T parse(String json, TypeReference type) { + + return parse(json, null, type); + } + + + /** + * json => 对象处理方法 + *
+ * 参数clazz和type必须一个为null,另一个不为null + *
+ * 此方法不对外暴露,访问权限为private + * + * @param json 源json串 + * @param clazz 对象类 + * @param type 对象类型 + * @param 泛型 + */ + private static T parse(String json, Class clazz, TypeReference type) { + + T obj = null; + if (!StringUtils.isEmpty(json)) { + try { + if (clazz != null) { + obj = om.readValue(json, clazz); + } else { + obj = (T) om.readValue(json, type); + } + } catch (IOException e) { + log.warn(e.getMessage(), e); + throw new IllegalArgumentException(e.getMessage()); + } + } + return obj; + } +} \ No newline at end of file diff --git a/src/main/java/com/whn/hellospring/utils/JwtUtils.java b/src/main/java/com/whn/hellospring/utils/JwtUtils.java new file mode 100644 index 0000000..d97edcb --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/JwtUtils.java @@ -0,0 +1,114 @@ +package com.whn.hellospring.utils; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import com.google.common.io.BaseEncoding; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.apache.tomcat.util.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class JwtUtils { + /** + * token 过期时间, 单位: 秒. 这个值表示 30 天 + */ + private static final long TOKEN_EXPIRED_TIME = 30 * 24 * 60 * 60; + + public static final String jwtId = "tokenId"; + + /** + * jwt 加密解密密钥(可自行填写) + */ + private static final String JWT_SECRET = "1234567890"; + + /** + * 创建JWT + */ + public static String createJWT(Map claims, Long time) { + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; //指定签名的时候使用的签名算法,也就是header那部分,jjwt已经将这部分内容封装好了。 + Date now = new Date(System.currentTimeMillis()); + + SecretKey secretKey = generalKey(); + long nowMillis = System.currentTimeMillis();//生成JWT的时间 + //下面就是在为payload添加各种标准声明和私有声明了 + JwtBuilder builder = Jwts.builder() //这里其实就是new一个JwtBuilder,设置jwt的body + .setClaims(claims) //如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的 + .setId(jwtId) //设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。 + .setIssuedAt(now) //iat: jwt的签发时间 + .signWith(signatureAlgorithm, secretKey);//设置签名使用的签名算法和签名使用的秘钥 + if (time >= 0) { + long expMillis = nowMillis + time; + Date exp = new Date(expMillis); + builder.setExpiration(exp); //设置过期时间 + } + return builder.compact(); + } + + + /** + * 验证jwt + */ + public static Claims verifyJwt(String token) { + //签名秘钥,和生成的签名的秘钥一模一样 + SecretKey key = generalKey(); + Claims claims; + try { + claims = Jwts.parser() //得到DefaultJwtParser + .setSigningKey(key) //设置签名的秘钥 + .parseClaimsJws(token).getBody(); + } catch (Exception e) { + claims = null; + }//设置需要解析的jwt + return claims; + + } + + /** + * 由字符串生成加密key + * + * @return + */ + public static SecretKey generalKey() { + String stringKey = JWT_SECRET; + byte[] encodedKey = BaseEncoding.base64().decode(stringKey); +// byte[] encodedKey = Base64.decodeBase64(stringKey); + SecretKey key = new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); + return key; + } + + /** + * 根据userId和openid生成token + */ + public static String generateToken(String account, Long id) { + Map map = new HashMap<>(); + map.put("account", account); + map.put("id", id); + return createJWT(map, TOKEN_EXPIRED_TIME); + } + + public static void main(String[] args) { + // 生成token + String s = generateToken("111", 20L); + System.out.println(s); + + // 验证 + String token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMTEiLCJvcGVuSWQiOiIxMTEiLCJleHAiOjE2NjY1OTg4ODYsInVzZXJJZCI6MjAsImlhdCI6MTY2NjU5NjI5NCwianRpIjoidG9rZW5JZCJ9.fSDDJ0MdFjInzwDbkA90yw6SUF0ps9sc0E6WE8iadoE"; + Claims claims = verifyJwt(token); + String subject = claims.getSubject(); + String userId = claims.get("userId").toString(); + String openId = (String)claims.get("openId"); + String sub = (String)claims.get("sub"); + System.out.println("subject:" + subject); + System.out.println("userId:" + userId); + System.out.println("openId:" + openId); + System.out.println("sub:" + sub); + } +} \ No newline at end of file diff --git a/src/main/java/com/whn/hellospring/utils/MergeObjectsUtil.java b/src/main/java/com/whn/hellospring/utils/MergeObjectsUtil.java new file mode 100644 index 0000000..12fb111 --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/MergeObjectsUtil.java @@ -0,0 +1,41 @@ +package com.whn.hellospring.utils; + +import org.springframework.util.ObjectUtils; + +import java.lang.reflect.Field; + +/** + * @author SJT + * @Description: 合并两个对象的值,将第一个对象不为空的值赋值到目标对象 + * @date 2022-04-26 09:47 + */ +public class MergeObjectsUtil { + + //合并两个对象的值 + public static T mergeObjects(T sourceBean, T targetBean) { + + Class sourceBeanClass = sourceBean.getClass(); + Class targetBeanClass = targetBean.getClass(); + + Field[] sourceFields = sourceBeanClass.getDeclaredFields(); + Field[] targetFields = sourceBeanClass.getDeclaredFields(); + for (int i = 0; i < sourceFields.length; i++) { + Field sourceField = sourceFields[i]; + Field targetField = targetFields[i]; + sourceField.setAccessible(true); + targetField.setAccessible(true); + + Class type = sourceField.getType(); + + try { + if (!ObjectUtils.isEmpty(sourceField.get(sourceBean))) { + targetField.set(targetBean, sourceField.get(sourceBean)); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return targetBean; + } + +} diff --git a/src/main/java/com/whn/hellospring/utils/MyOptional.java b/src/main/java/com/whn/hellospring/utils/MyOptional.java new file mode 100644 index 0000000..84298ba --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/MyOptional.java @@ -0,0 +1,21 @@ +package com.whn.hellospring.utils; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collector; + +public class MyOptional { + + public static List toList(Optional option) { + return option. + map(Collections::singletonList). + orElse(Collections.emptyList()); + } + + public static R collect(Optional option, Collector collector) { + final A container = collector.supplier().get(); + option.ifPresent(v -> collector.accumulator().accept(container, v)); + return collector.finisher().apply(container); + } +} diff --git a/src/main/java/com/whn/hellospring/utils/SHAUtils.java b/src/main/java/com/whn/hellospring/utils/SHAUtils.java new file mode 100644 index 0000000..27e0429 --- /dev/null +++ b/src/main/java/com/whn/hellospring/utils/SHAUtils.java @@ -0,0 +1,46 @@ +package com.whn.hellospring.utils; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class SHAUtils{ + /** + * 利用java原生的摘要实现SHA256加密 + * @param str 加密后的报文 + * @return + */ + public static String getSHA256StrJava(String str){ + MessageDigest messageDigest; + String encodeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(str.getBytes("UTF-8")); + encodeStr = byte2Hex(messageDigest.digest()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return encodeStr; + } + + /** + * 将byte转为16进制 + * @param bytes + * @return + */ + private static String byte2Hex(byte[] bytes){ + StringBuffer stringBuffer = new StringBuffer(); + String temp = null; + for (int i=0;i AB3CD + */ + fun overlapCharacter(list: List): String { + //排序 +// java.util.Collections.sort(list) + + var j = 0 + var finalStr = "" + while (j < list.size) { + val str = list[j] //C + //如果已经存在当前要添加的字符 ABC + C AB2C +C + if (finalStr.contains(str)) { + if (j - 1 < 0) { //第一位 C+C + finalStr = "2" + finalStr + } else { + val index = finalStr.indexOf(str) + if (index > 0) { + val timesStr = finalStr.substring(index - 1, index) //倍数2 + if (isInteger(timesStr)) {// AB2C +C + val timesInt = timesStr.toInt() + 1 + finalStr = finalStr.substring(0, finalStr.length - 2) + finalStr += timesInt.toString() + finalStr += str + } else {// ABC + C + finalStr = finalStr.substring(0, finalStr.length - 1) + finalStr += "2" + finalStr += str + } + } else { //B2C4D + B + finalStr = "2" + finalStr + } + } + } else { + finalStr += str + } + j++ + } + return finalStr + } + + + /*方法二:推荐,速度最快 + * 判断是否为整数 + * @param str 传入的字符串 + * @return 是整数返回true,否则返回false + */ + fun isInteger(str: String): Boolean { + val pattern = Pattern.compile("^[-\\+]?[\\d]*$") + return pattern.matcher(str).matches() + } + + + /** + * 保留一位小数,四舍五入 + * 使用0.00不足位补0,#.##仅保留有效位 + */ + fun doubleToString1(num: Double?): String { +// if(!isNumber(num.toString()))return "0.0" +// return DecimalFormat("0.0").format(num) + if(!isNumber(num.toString()))return "0.0" + return String.format("%.1f", num!!.toDouble()) + } + + + /** + * 保留两位小数,四舍五入 + * 使用0.00不足位补0,#.##仅保留有效位 + */ + fun doubleToString2(num: Double?): String { +// if(!isNumber(num.toString()))return "0.00" +// return DecimalFormat("0.00").format(num) + if(!isNumber(num.toString()))return "0.00" + return String.format("%.2f", num!!.toDouble()) + } + + + /** + * 四舍五入 + * 1位小数 + */ + fun rounding1(num: String?): String { + if(!isNumber(num))return "0.0" + return String.format("%.1f", num!!.toDouble()) + } + + + /** + * 四舍五入 + * 2位小数 + */ + fun rounding2(num: String?): String { + if(!isNumber(num))return "0.00" + return String.format("%.2f", num!!.toDouble()) + } + + + /** + * 按长度截取中英文混合string + * + * @param text 字符串 + * @param length 长度 + * @param endWith 末尾追加 + * @return + */ + fun subStringIncludeChinese(text: String, length: Int, + endWith: String): String { + var text = text + text = text.trim { it <= ' ' } + val textLength = text.length + var byteLength = 0 + val returnStr = StringBuffer() + var i = 0 + while (i < textLength && byteLength < length * 2) { + val str_i = text.substring(i, i + 1) + if (str_i.toByteArray().size == 1) {// 英文 + byteLength++ + } else {// 中文 + byteLength += 2 + } + returnStr.append(str_i) + i++ + } + try { + if (byteLength < text.toByteArray(charset("GBK")).size) {// getBytes("GBK")每个汉字长2,getBytes("UTF-8")每个汉字长度为3 + returnStr.append(endWith) + } + } catch (e: UnsupportedEncodingException) { + e.printStackTrace() + } + + return returnStr.toString() + } + + /** + * 获取字符串的长度,如果有中文,则每个中文字符计为2位 + * + * @param text 指定的字符串 + * @return 字符串的长度 + */ + fun getStringLengthIncludeChinese(text: String): Int { + var text = text + text = text.trim { it <= ' ' } + var valueLength = 0 + val chinese = "[\u0391-\uFFE5]" + /* 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1 */ + for (i in 0..text.length - 1) { + /* 获取一个字符 */ + val temp = text.substring(i, i + 1) + /* 判断是否为中文字符 */ + if (temp.matches(chinese.toRegex())) { + /* 中文字符长度为2 */ + valueLength += 2 + } else { + /* 其他字符长度为1 */ + valueLength += 1 + } + } + return valueLength + } + + /** + * 验证邮箱地址是否正确 + * + * @param email + * @return + */ + fun checkEmail(email: String): Boolean { + var flag = false + try { + val check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$" + val regex = Pattern.compile(check) + val matcher = regex.matcher(email) + flag = matcher.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断字符串是否是数字 + * + * @param number + * @return + */ + fun isNumber(number: String?): Boolean { + + //如果为空,false + if (!isNotNull(number)) { + return false + } + + //只有. + if (number == ".") { + return false + } + + + //如果有多个点,false + val list = number!!.split(".") + if (list.size > 2) { + return false + } + + + //如果有其他字符 false + var flag = false + try { + val p = Pattern.compile("[0-9.-]+") + val m = p.matcher(number) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是英文字母组成(不区分大小写) + * + * @param letters + * @return + */ + fun isLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Za-z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是大写字母 + * + * @param letters + * @return + */ + fun isUppercaseLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 判断是否全是小写字母 + * + * @param letters + * @return + */ + fun isLowercaseLetters(letters: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[a-z]+$") + val m = p.matcher(letters) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 是否数字和字母组成 + * + * @param text + * @return + */ + fun isNumbersAndLetters(text: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^[A-Za-z0-9]+$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 包含数字,字母,下划线,不可以下划线开头 + * + * @param text + * @return + */ + fun isNumbersUnderlineLetters(text: String): Boolean { + var flag = false + try { + val p = Pattern.compile("^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + /** + * 是否是密码,(字母或数字开头,包含下划线) + * + * @param text + * @param lowest_median 最低位数 + * @param highest_median 最高位数 + * @return + */ + fun isPassword(text: String, lowest_median: Int, + highest_median: Int): Boolean { + var flag = false + try { + val p = Pattern + .compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{" + + lowest_median.toString() + "," + + highest_median.toString() + "}$") + val m = p.matcher(text) + flag = m.matches() + } catch (e: Exception) { + e.printStackTrace() + flag = false + } + + return flag + } + + // 过滤特殊字符 + @Throws(PatternSyntaxException::class) + fun StringFilter(str: String): String { + // 只允许字母和数字 + // String regEx = "[^a-zA-Z0-9]"; + // 清除掉所有特殊字符 + val regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]" + val p = Pattern.compile(regEx) + val m = p.matcher(str) + return m.replaceAll("").trim { it <= ' ' } + } + + // 中文识别 + fun hasChinese(source: String): Boolean { + val reg_charset = "([\\u4E00-\\u9FA5]*+)" + val p = Pattern.compile(reg_charset) + val m = p.matcher(source) + var hasChinese = false + while (m.find()) { + if ("" != m.group(1)) { + hasChinese = true + } + } + return hasChinese + } + + /** + * 判断是否有特殊字符 + */ + fun hasString(str: String): Boolean { + val regEx = "[`~!@#$%^&*()+=|{}':;',//[//].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"// 特殊字符 + val p = Pattern.compile(regEx) + val m = p.matcher(str) + return m.find() + } + + //获取当前时间 + fun refFormatNowDate(): String { + val nowTime = Date(System.currentTimeMillis()) + val sdFormatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + return sdFormatter.format(nowTime) + } + + + //时间格式 + fun Realtime(time: String): String { + val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + var str = "" + try { + val curDate = formatter.parse(time) + str = formatter.format(curDate) + } catch (e: ParseException) { + e.printStackTrace() + } + //获取当前时间 + return str + } + + /** + * 转换文件大小 + * + * @param fileS + * @return + */ + fun FormetFileSize(fileS: Long): String { + val df = DecimalFormat("#.00") + var fileSizeString = "" + val wrongSize = "0B" + if (fileS == 0L) { + return wrongSize + } + if (fileS < 1024) { + fileSizeString = df.format(fileS.toDouble()) + "B" + } else if (fileS < 1048576) { + fileSizeString = df.format(fileS.toDouble() / 1024) + "KB" + } else if (fileS < 1073741824) { + fileSizeString = df.format(fileS.toDouble() / 1048576) + "MB" + } else { + fileSizeString = df.format(fileS.toDouble() / 1073741824) + "GB" + } + return fileSizeString + } + + /** + * 检验数字的有效性 + * + * @param str + * @return + */ + fun isNumberTrue(str: String): Boolean { + val c = str.substring(str.length - 1, str.length) + if (c == ".") { + return false + } + val pattern = Pattern.compile("^[0-9]+(.[0-9]*)?$") + val match = pattern.matcher(str) + return match.matches() + } + + /** + * 大陆号码或香港号码均可 + */ + @Throws(PatternSyntaxException::class) + fun isPhoneLegal(str: String): Boolean { + return isChinaPhoneLegal(str) || isHKPhoneLegal(str) + } + + /** + * 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数 + * 此方法中前三位格式有: + * 13+任意数 + * 15+除4的任意数 + * 18+除1和4的任意数 + * 17+除9的任意数 + * 147 + */ + @Throws(PatternSyntaxException::class) + fun isChinaPhoneLegal(str: String): Boolean { + // String regExp = "^((13[0-9])|(15[^4])|(18[0-9])|(17[0-9])|(16[0-9])|(147))\\d{8}$"; + val regExp = "^\\d{11}$" + val p = Pattern.compile(regExp) + val m = p.matcher(str) + return m.matches() + } + + /** + * 香港手机号码8位数,5|6|8|9开头+7位任意数 + */ + @Throws(PatternSyntaxException::class) + fun isHKPhoneLegal(str: String): Boolean { + val regExp = "^(5|6|8|9)\\d{7}$" + val p = Pattern.compile(regExp) + val m = p.matcher(str) + return m.matches() + } + + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..e2ccbcc --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,59 @@ + + +spring: + datasource: + main: + allow-bean-definition-overriding: true + #配置hikari连接池 + hikari: + minimum-idle: 4 + maximum-pool-size: 16 + connection-timeout: 10000 + idle-timeout: 30000 + connection-init-sql: set names utf8mb4 + + #动态数据源配置 + dynamic: + #主数据源,默认启用 + primary: master + datasource: + #数据源1 + master: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://101.37.147.15:3306/AgileTools?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL + username: root + password: root + #数据源2 +# zentao: +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://101.37.147.15:23306/zentao?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL +# username: root +# password: 123456 + +# url: jdbc:mysql://101.37.147.15:3306/AgileTools?useUnicode=true&characterEncoding=UTF-8?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&failOverReadOnly=false&serverTimezone=UTC +# username: root +# password: root +# driver-class-name: com.mysql.cj.jdbc.Driver + tomcat: + max-active: 100 + max-idle: 200 + initial-size: 20 + jpa: + database: MYSQL + database-platform: org.hibernate.dialect.MySQL5Dialect + hibernate: + ddl-auto: none + properties: + hibernate: + format_sql: true + + +server: + port: 2223 + +mybatis: + configuration: + map-underscore-to-camel-case=true: + + + diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql new file mode 100644 index 0000000..2892dcc --- /dev/null +++ b/src/main/resources/schema.sql @@ -0,0 +1,32 @@ +drop table t_coffee if exists; +drop table t_order if exists; +drop table t_order_coffee if exists; + +create table t_coffee ( + id bigint auto_increment, + create_time timestamp, + update_time timestamp, + name varchar(255), + price bigint, + primary key (id) +); + +create table t_order ( + id bigint auto_increment, + create_time timestamp, + update_time timestamp, + customer varchar(255), + state integer not null, + primary key (id) +); + +create table t_order_coffee ( + coffee_order_id bigint not null, + items_id bigint not null +); + +insert into t_coffee (name, price, create_time, update_time) values ('espresso', 2000, now(), now()); +insert into t_coffee (name, price, create_time, update_time) values ('latte', 2500, now(), now()); +insert into t_coffee (name, price, create_time, update_time) values ('capuccino', 2500, now(), now()); +insert into t_coffee (name, price, create_time, update_time) values ('mocha', 3000, now(), now()); +insert into t_coffee (name, price, create_time, update_time) values ('macchiato', 3000, now(), now()); \ No newline at end of file diff --git a/src/test/java/com/whn/hellospring/HellospringApplicationTests.java b/src/test/java/com/whn/hellospring/HellospringApplicationTests.java new file mode 100644 index 0000000..9155fea --- /dev/null +++ b/src/test/java/com/whn/hellospring/HellospringApplicationTests.java @@ -0,0 +1,173 @@ +package com.whn.hellospring; + +import com.whn.hellospring.model.zentao.ZenTaoUserDO; +import com.whn.hellospring.repository.ZenTaoRepository; +import com.whn.hellospring.utils.SHAUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.List; + +@SpringBootTest +class ellospringApplicationTests { + + @Autowired + ZenTaoRepository zenTaoRepository; + + @Test + public void generatePassword(){ + String password = "12345"; + String sha256StrJava = SHAUtils.getSHA256StrJava(password); + System.out.println("sha256StrJava:"+sha256StrJava); + + + } + + + + + +// @Autowired +// private CoffeeRepository coffeeRepository; +// +// @Autowired +// private CoffeeOrderRepository orderRepository; +// +// +// /** +// * 查询一个订单信息,包含咖啡 +// */ +// @Test +// void queryOrder() { +// Long id = 8L; +// CoffeeOrderDO orderDO = orderRepository.queryOrderWithId(id); +// CoffeeOrderDTO orderDTO = (CoffeeOrderDTO) doToDto(orderDO, CoffeeOrderDTO.class); +// List coffeeDOList = coffeeRepository.selectCoffeeListWithOrder(id); +// List coffeeDTOList = (List) DO2DTOUtil.getInstance().doListToDtoList(coffeeDOList, CoffeeDTO.class); +// +// orderDTO.setItems(coffeeDTOList); +// System.out.println("顾客:" + orderDTO.getCustomer()); +// for (CoffeeDTO coffee : +// orderDTO.getItems()) { +// System.out.println("咖啡:" + coffee.getName()); +// } +// } +// +// +// /** +// * 创建一个订单,包含咖啡 +// */ +// @Test +// void createOrderWithCoffee() { +// //创建一个订单,包含一杯咖啡 +// CoffeeDO espresso = CoffeeDO.builder().name("订单下的咖啡3") +// .price(Money.of(CurrencyUnit.of("CNY"), 10.0)) +// .build(); +// coffeeRepository.save(espresso); +// CoffeeOrderDTO orderDTO = CoffeeOrderDTO.builder() +// .customer("me3") +// .state(OrderState.INIT) +// .build(); +// +// +// //保存订单,拆解DTO为DO +// CoffeeOrderDO order = (CoffeeOrderDO) dtoToDo(orderDTO, CoffeeOrderDO.class); +// orderRepository.save(order); +// +// //保存咖啡 +// List list = orderDTO.getItems(); +// for (CoffeeDTO coffee : list) { +// coffee.setOrder_id_fk(order.getId()); +//// coffeeRepository.save(coffee); +// } +// } +// +// /** +// * 创建一杯咖啡 +// */ +// @Test +// void createCoffee() { +// CoffeeDO espresso = CoffeeDO.builder().name("espresso") +// .price(Money.of(CurrencyUnit.of("CNY"), 20.0)) +// .build(); +// coffeeRepository.save(espresso); +// } +// +// /** +// * 获取一个订单下的咖啡列表 +// */ +// @Test +// void getCoffeeListWithOrder() { +// List list = coffeeRepository.selectCoffeeListWithOrder(1L); +// System.out.println("列表长度:" + list.size()); +// for (CoffeeDO item : list) { +// System.out.println("列表:" + item.getName()); +// } +// } +// +// +// /** +// * DTO模型转换成DO +// * +// * @param objectDto DTO 对象 +// * @param doClass DO 类型 +// * @return doClass类型的对象 +// */ +// public Object dtoToDo(Object objectDto, Class doClass) { +// if (objectDto == null) { +// return null; +// } +// Object objectDo = null; +// try { +// objectDo = doClass.newInstance(); +// BeanUtils.copyProperties(objectDto, objectDo); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return objectDo; +// } +// +// +// /** +// * DO集合转换成DTO集合 +// * +// * @param doList DO 对象集合 +// * @param dtoClass DTO 类型 +// * @return dtoClass类型的集合 +// */ +// public Object doListToDtoList(Object doList, Class dtoClass) { +// if (doList == null) { +// return null; +// } +// List dtoList = new ArrayList<>(); +// for (Object i : (List) doList) { +// Object dto = doToDto(i, dtoClass); +// if (dto != null) { +// dtoList.add(dto); +// } +// } +// return dtoList; +// } +// +// /** +// * DO转换成DTO +// * +// * @param objectDo DO 对象 +// * @param dtoClass DTO 类型 +// * @return dtoClass类型的对象 +// */ +// public Object doToDto(Object objectDo, Class dtoClass) { +// if (objectDo == null) { +// return null; +// } +// Object objectDto = null; +// try { +// objectDto = dtoClass.newInstance(); +// BeanUtils.copyProperties(objectDo, objectDto); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return objectDto; +// } +} diff --git a/temp.txt b/temp.txt new file mode 100644 index 0000000..e69de29