上传
This commit is contained in:
8
project/.idea/.gitignore
generated
vendored
Normal file
8
project/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
18
project/.idea/compiler.xml
generated
Normal file
18
project/.idea/compiler.xml
generated
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="jiaqingjiayi" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="jiaqingjiayi" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
17
project/.idea/dataSources.xml
generated
Normal file
17
project/.idea/dataSources.xml
generated
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="ba665c41-ba32-4a04-a2ed-68f44ab9dee6">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
6
project/.idea/encodings.xml
generated
Normal file
6
project/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/jiaqingjiayi/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
20
project/.idea/jarRepositories.xml
generated
Normal file
20
project/.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
15
project/.idea/misc.xml
generated
Normal file
15
project/.idea/misc.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/jiaqingjiayi/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
project/.idea/modules.xml
generated
Normal file
8
project/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/project.iml" filepath="$PROJECT_DIR$/.idea/project.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
9
project/.idea/project.iml
generated
Normal file
9
project/.idea/project.iml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
124
project/.idea/uiDesigner.xml
generated
Normal file
124
project/.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
project/.idea/vcs.xml
generated
Normal file
6
project/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
8
project/jiaqingjiayi/.idea/.gitignore
generated
vendored
Normal file
8
project/jiaqingjiayi/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
18
project/jiaqingjiayi/.idea/compiler.xml
generated
Normal file
18
project/jiaqingjiayi/.idea/compiler.xml
generated
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="jiaqingjiayi" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="jiaqingjiayi" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
29
project/jiaqingjiayi/.idea/dataSources.xml
generated
Normal file
29
project/jiaqingjiayi/.idea/dataSources.xml
generated
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="9f5fe676-083f-48f9-ba5c-a3b0a9964b4e">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="yunshujuku" uuid="c2730267-5c92-4f3f-8892-53d3c8744eeb">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://154.8.193.216:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
6
project/jiaqingjiayi/.idea/encodings.xml
generated
Normal file
6
project/jiaqingjiayi/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
20
project/jiaqingjiayi/.idea/jarRepositories.xml
generated
Normal file
20
project/jiaqingjiayi/.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
15
project/jiaqingjiayi/.idea/misc.xml
generated
Normal file
15
project/jiaqingjiayi/.idea/misc.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
87
project/jiaqingjiayi/.idea/mybatisx/templates.xml
generated
Normal file
87
project/jiaqingjiayi/.idea/mybatisx/templates.xml
generated
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="TemplatesSettings">
|
||||
<option name="templateConfigs">
|
||||
<TemplateContext>
|
||||
<option name="generateConfig">
|
||||
<GenerateConfig>
|
||||
<option name="annotationType" value="MYBATIS_PLUS3" />
|
||||
<option name="basePackage" value="generator" />
|
||||
<option name="basePath" value="src/main/java" />
|
||||
<option name="classNameStrategy" value="camel" />
|
||||
<option name="encoding" value="UTF-8" />
|
||||
<option name="extraClassSuffix" value="" />
|
||||
<option name="ignoreFieldPrefix" value="" />
|
||||
<option name="ignoreFieldSuffix" value="" />
|
||||
<option name="ignoreTablePrefix" value="" />
|
||||
<option name="ignoreTableSuffix" value="" />
|
||||
<option name="moduleName" value="jiaqingjiayi" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||
<option name="moduleUIInfoList">
|
||||
<list>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="serviceImpl.ftl" />
|
||||
<option name="configName" value="serviceImpl" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}ServiceImpl" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}ServiceImpl.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||
<option name="packageName" value="${domain.basePackage}.service.impl" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="mapperInterface.ftl" />
|
||||
<option name="configName" value="mapperInterface" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||
<option name="packageName" value="${domain.basePackage}.mapper" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="serviceInterface.ftl" />
|
||||
<option name="configName" value="serviceInterface" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Service" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Service.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||
<option name="packageName" value="${domain.basePackage}.service" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="src/main/resources" />
|
||||
<option name="configFileName" value="mapperXml.ftl" />
|
||||
<option name="configName" value="mapperXml" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.xml" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$" />
|
||||
<option name="packageName" value="mapper" />
|
||||
</ModuleInfoGo>
|
||||
</list>
|
||||
</option>
|
||||
<option name="needsComment" value="true" />
|
||||
<option name="needsModel" value="true" />
|
||||
<option name="relativePackage" value="domain" />
|
||||
<option name="superClass" value="" />
|
||||
<option name="tableUIInfoList">
|
||||
<list>
|
||||
<TableUIInfo>
|
||||
<option name="className" value="Recruitment" />
|
||||
<option name="tableName" value="recruitment" />
|
||||
</TableUIInfo>
|
||||
</list>
|
||||
</option>
|
||||
<option name="templatesName" value="mybatis-plus3" />
|
||||
<option name="useActualColumns" value="true" />
|
||||
<option name="useLombokPlugin" value="true" />
|
||||
</GenerateConfig>
|
||||
</option>
|
||||
<option name="moduleName" value="jiaqingjiayi" />
|
||||
<option name="projectPath" value="$PROJECT_DIR$" />
|
||||
<option name="templateName" value="mybatis-plus3" />
|
||||
</TemplateContext>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
124
project/jiaqingjiayi/.idea/uiDesigner.xml
generated
Normal file
124
project/jiaqingjiayi/.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
project/jiaqingjiayi/.idea/vcs.xml
generated
Normal file
6
project/jiaqingjiayi/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
133
project/jiaqingjiayi/pom.xml
Normal file
133
project/jiaqingjiayi/pom.xml
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.4</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.cj</groupId>
|
||||
<artifactId>jiaqingjiayi</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>jiaqingjiayi</name>
|
||||
<description>jiaqingjiayi</description>
|
||||
<url/>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.38.0.ALL</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- 阿里云oss依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.15.1</version>
|
||||
</dependency>
|
||||
<!--日期工具栏依赖-->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://doc.xiaominfo.com/knife4j/documentation/get_start.html-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>1.9.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
339
project/jiaqingjiayi/sql/sql.sql
Normal file
339
project/jiaqingjiayi/sql/sql.sql
Normal file
@ -0,0 +1,339 @@
|
||||
create database jqjy;
|
||||
|
||||
use jqjy;
|
||||
|
||||
show variables like 'lower_case_table_names';
|
||||
|
||||
create table user
|
||||
(
|
||||
username varchar(256) null comment '用户昵称',
|
||||
id bigint auto_increment comment 'id'
|
||||
primary key,
|
||||
unionId varchar(256) null comment '支付宝开放平台id',
|
||||
openId varchar(256) null comment 'openId',
|
||||
userAccount varchar(256) null comment '账号',
|
||||
avatarUrl varchar(256) null comment '用户头像',
|
||||
gender tinyint null comment '性别',
|
||||
userPassword varchar(512) not null comment '密码',
|
||||
phone varchar(128) null comment '电话',
|
||||
email varchar(512) null comment '邮箱',
|
||||
userStatus int default 0 not null comment '状态 0 -正常',
|
||||
createTime datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP,
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
userRole int default 0 not null comment '用户角色 0 - 普通用户 1 - 管理员 2 - 商家 3 - 美甲师',
|
||||
index idx_openId (openId)
|
||||
) comment '用户' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商品表
|
||||
create table if not exists commodities
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
businessId bigint not null comment '商家id',
|
||||
commoditiesGroupId bigint not null comment '商品分组id',
|
||||
commoditiesName varchar(128) not null comment '商品名称',
|
||||
commoditiesImage varchar(1024) null comment '商品图片',
|
||||
commoditiesPrice double not null comment '商品价格',
|
||||
inventoryStatus int not null comment '库存数量',
|
||||
status varchar(20) default '上架' not null comment '商品状态:上架,下架',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_businessId (businessId)
|
||||
) comment '商品表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商品分组表
|
||||
create table if not exists commodities_group
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
businessId bigint not null comment '商家id',
|
||||
groupName varchar(128) not null comment '商品分组名称',
|
||||
isTopping tinyint default 0 not null comment '是否置顶:0不置顶,1置顶',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_businessId (businessId)
|
||||
) comment '商品分组表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商家表
|
||||
create table if not exists business
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
userId bigint not null comment '用户id',
|
||||
businessName varchar(512) not null comment '门店名称',
|
||||
businessAvatar varchar(1024) not null comment '门店头像',
|
||||
businessPhone varchar(64) not null comment '门店手机号',
|
||||
address varchar(512) not null comment '店铺详细地址',
|
||||
businessProfile varchar(512) null comment '门店简介',
|
||||
businessImages varchar(1024) null comment '商家相册',
|
||||
categoryId bigint null comment '分类id',
|
||||
startBusiness varchar(64) not null comment '开始营业时间',
|
||||
endBusiness varchar(64) not null comment '结束营业时间',
|
||||
serviceMode tinyint not null comment '服务方式:服务方式:0 - 可到店可上门 1 - 不可上门',
|
||||
state tinyint default 0 not null comment '状态:0审核中,1启用,2禁用',
|
||||
storeStatus tinyint default 0 not null comment '店铺状态:0休业,1营业',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_businessId (id),
|
||||
index idx_userId (userId)
|
||||
) comment '商家' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商家认证表
|
||||
create table if not exists business_auth
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
businessId bigint not null comment '店铺id',
|
||||
shopkeeper varchar(64) not null comment '店主名',
|
||||
license varchar(1024) not null comment '营业执照',
|
||||
frontIdCard varchar(1024) not null comment '身份证正面',
|
||||
backIdCard varchar(1024) not null comment '身份证反面',
|
||||
bankCard varchar(64) not null comment '银行卡号',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_businessId (businessId)
|
||||
) comment '商家认证' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 商品和规格的中间表
|
||||
create table if not exists specifications_commodities
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
commoditiesId bigint not null comment '商品id',
|
||||
specificationsId bigint not null comment '规格id',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_dishesId (commoditiesId),
|
||||
index idx_specificationsId (specificationsId)
|
||||
) comment '商品和规格的中间表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 规格表
|
||||
create table if not exists specifications
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
businessId bigint not null comment '商家id',
|
||||
specificationsName varchar(128) not null comment '规格名称',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_businessId (businessId)
|
||||
) comment '规格表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 属性表
|
||||
create table if not exists attribute
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
businessId bigint not null comment '商家id',
|
||||
specificationsId bigint not null comment '规格id',
|
||||
attributeName varchar(128) not null comment '属性名称',
|
||||
attributeStatus tinyint default 0 not null comment '属性状态:0在售,1停售',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
index idx_businessId (businessId)
|
||||
) comment '属性表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
-- 购物车表
|
||||
create table if not exists cart
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
userId bigint not null comment '用户id',
|
||||
businessId bigint not null comment '商家id',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '加入购物车时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
commoditiesId bigint null comment '商品id',
|
||||
quantity int default 1 not null comment '商品数量',
|
||||
price decimal(10, 2) not null comment '当前选择规格的价格',
|
||||
subtotal decimal(10, 2) as ((`price` * `quantity`)) stored comment '小计(单价 * 数量)',
|
||||
selectedOptions varchar(512) default '' not null comment '已选规格属性列表',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
index idx_userId (userId),
|
||||
index idx_businessId (businessId)
|
||||
) comment '购物车表' collate = utf8mb4_unicode_ci;
|
||||
|
||||
create table if not exists manicurist
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT COMMENT '美甲师唯一标识(主键,自增)' PRIMARY KEY,
|
||||
userId BIGINT not null comment '用户ID(关联用户表)',
|
||||
businessId bigint null comment '商家id',
|
||||
manicuristName VARCHAR(100) not null comment '美甲师姓名',
|
||||
gender tinyint null comment '性别',
|
||||
manicuristAvatar VARCHAR(255) COMMENT '美甲师头像文件的存储路径或链接',
|
||||
phone VARCHAR(20) COMMENT '美甲师联系电话',
|
||||
email VARCHAR(100) COMMENT '美甲师电子邮件',
|
||||
employment_date DATE COMMENT '美甲师入职日期',
|
||||
specialties VARCHAR(255) comment '美甲师的专长(如法式美甲、彩绘等)',
|
||||
rating DECIMAL(3, 2) comment '美甲师的服务评分',
|
||||
salary DECIMAL(10, 2) comment '美甲师的基本薪资',
|
||||
manStatus int DEFAULT 0 comment '美甲师状态 0 表示正常 1 表示禁用',
|
||||
isDelete TINYINT DEFAULT 0 comment '逻辑删除标志,0 表示未删除,1 表示已删除',
|
||||
auditStatus TINYINT DEFAULT 0 comment '审核状态,0-待审核,1-审核通过,2-审核不通过',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP not null comment '记录创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '记录更新时间',
|
||||
INDEX idx_userId (userId)
|
||||
) comment ='美甲师表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS manicuristSign
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL COMMENT '姓名',
|
||||
manicuristId BIGINT NOT NULL COMMENT '美甲师ID(关联美甲师表)',
|
||||
businessId BIGINT NOT NULL COMMENT '商家id',
|
||||
businessName VARCHAR(512) NOT NULL COMMENT '门店名称',
|
||||
phone VARCHAR(20) COMMENT '联系电话',
|
||||
salary DECIMAL(10, 2) COMMENT '期望工资薪资',
|
||||
signTime VARCHAR(100) NOT NULL COMMENT '签约时长',
|
||||
tenure VARCHAR(100) NOT NULL COMMENT '工龄',
|
||||
manicuristLv VARCHAR(100) NOT NULL COMMENT '美甲师等级',
|
||||
auditStatus TINYINT DEFAULT 0 COMMENT '审核状态,0-待审核,1-审核通过,2-审核不通过',
|
||||
isDelete TINYINT DEFAULT 0 COMMENT '逻辑删除标志,0 表示未删除,1 表示已删除',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '记录创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间'
|
||||
) COMMENT ='美甲师签约表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS manicurist_auth
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT COMMENT '认证唯一标识(主键,自增)' PRIMARY KEY,
|
||||
artistId BIGINT NOT NULL COMMENT '美甲师ID(关联美甲师表)',
|
||||
name VARCHAR(100) COMMENT '美甲师名称',
|
||||
certification_number VARCHAR(100) COMMENT '认证编号',
|
||||
issuing_authority VARCHAR(100) COMMENT '发证机构',
|
||||
certificate_path VARCHAR(255) COMMENT '证书文件的存储路径或链接',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '记录创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间',
|
||||
isDelete TINYINT DEFAULT 0 COMMENT '逻辑删除标志,0 表示未删除,1 表示已删除',
|
||||
INDEX idx_artistId (artistId)
|
||||
) COMMENT ='美甲师认证表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
-- 预约表
|
||||
CREATE TABLE IF NOT EXISTS appointments
|
||||
(
|
||||
id bigint auto_increment comment '预约ID' primary key,
|
||||
userId bigint not null comment '用户ID(关联用户表)',
|
||||
userName varchar(100) not null comment '用户姓名',
|
||||
phone varchar(64) not null comment '手机号',
|
||||
businessId bigint not null comment '商家ID(关联商家表)',
|
||||
businessName varchar(512) null comment '商家名称',
|
||||
manicuristId bigint null comment '美甲师ID, 如果为空到店分配',
|
||||
manicuristName varchar(100) null comment '美甲师姓名',
|
||||
appointmentTime datetime not null comment '预约时间',
|
||||
serviceMode tinyint default 1 not null comment '服务方式(0 - 线上, 1 - 到店)',
|
||||
notes varchar(128) null comment '备注',
|
||||
status tinyint default 0 not null comment '预约状态(0 - 已确认, 1 - 已完成, 2 - 已取消)',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updateTime datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
isDelete tinyint default 0 not null comment '是否删除',
|
||||
orderId bigint null comment '订单ID(关联订单表)',
|
||||
appointmentAddress varchar(512) null comment '预约地址',
|
||||
INDEX idx_userId (userId),
|
||||
INDEX idx_businessId (businessId),
|
||||
INDEX idx_manicuristId (manicuristId),
|
||||
INDEX idx_orderId (orderId)
|
||||
) COMMENT '预约表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
-- 订单表
|
||||
CREATE TABLE IF NOT EXISTS orders
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT COMMENT '订单ID' PRIMARY KEY,
|
||||
orderNumber VARCHAR(50) NOT NULL UNIQUE COMMENT '订单号',
|
||||
userId BIGINT NOT NULL COMMENT '用户ID(关联用户表)',
|
||||
businessId bigint not null comment '商家id',
|
||||
manicuristId bigint null comment '美甲师ID',
|
||||
userName VARCHAR(100) NOT NULL COMMENT '用户姓名',
|
||||
phone varchar(64) not null comment '手机号',
|
||||
payMethod TINYINT NOT NULL COMMENT '支付方式:0微信支付',
|
||||
appointmentId BIGINT NULL COMMENT '预约ID(关联预约表)',
|
||||
totalPrice DECIMAL(10, 2) NOT NULL COMMENT '订单总金额',
|
||||
paymentStatus TINYINT DEFAULT 0 NOT NULL COMMENT '支付状态(0 - 未支付, 1 - 已支付, 2 - 退款中, 3 - 已退款)',
|
||||
claimStatus TINYINT DEFAULT 0 NOT NULL COMMENT '抢单状态(0 - 未抢单, 1 - 已抢单)',
|
||||
serviceMode tinyint default 1 not null comment '服务方式(0 - 到店, 1 - 上门)',
|
||||
notes varchar(128) null comment '备注',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
isDelete TINYINT DEFAULT 0 NOT NULL COMMENT '是否删除',
|
||||
INDEX idx_userId (userId),
|
||||
INDEX idx_appointmentId (appointmentId)
|
||||
) COMMENT '订单表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
-- 订单详情表
|
||||
CREATE TABLE IF NOT EXISTS order_items
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT COMMENT '详细订单ID' PRIMARY KEY,
|
||||
orderId BIGINT NOT NULL COMMENT '订单ID(关联订单表)',
|
||||
commoditiesId BIGINT NOT NULL COMMENT '商品ID(美甲款式)',
|
||||
quantity INT NOT NULL COMMENT '商品数量',
|
||||
price DECIMAL(10, 2) NOT NULL COMMENT '商品单价',
|
||||
subtotal decimal(10, 2) not null comment '小计(单价 * 数量)',
|
||||
attributeNames varchar(512) null comment '规格属性列表',
|
||||
createTime DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
updateTime DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
isDelete TINYINT DEFAULT 0 NOT NULL COMMENT '是否删除',
|
||||
INDEX idx_orderId (orderId),
|
||||
INDEX idx_commoditiesId (commoditiesId)
|
||||
) COMMENT '详细订单表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- 抢单记录表
|
||||
CREATE TABLE IF NOT EXISTS order_claim
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '抢单记录ID',
|
||||
orderId BIGINT NOT NULL COMMENT '订单ID(关联订单表)',
|
||||
manicuristId BIGINT NOT NULL COMMENT '美甲师ID(关联美甲师表)',
|
||||
claimStatus TINYINT DEFAULT 0 NOT NULL COMMENT '抢单状态(0 - 待抢单, 1 - 已抢单, 2 - 已分配, 3 - 放弃)',
|
||||
claimTime DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '抢单时间',
|
||||
isDelete TINYINT DEFAULT 0 NOT NULL COMMENT '是否删除',
|
||||
INDEX idx_orderId (orderId),
|
||||
INDEX idx_manicuristId (manicuristId)
|
||||
) COMMENT '抢单记录表' COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- 收藏表
|
||||
create table collect
|
||||
(
|
||||
id bigint auto_increment comment 'id' primary key,
|
||||
userId bigint not null comment '用户id',
|
||||
businessId bigint not null comment '商家id'
|
||||
) comment '收藏';
|
||||
|
||||
-- 用户评分表
|
||||
create table user_rating
|
||||
(
|
||||
id bigint auto_increment primary key comment 'id',
|
||||
businessId bigint not null comment '商家id',
|
||||
userId bigint not null comment '用户id',
|
||||
manicuristId bigint not null comment '美甲师id',
|
||||
orderId bigint not null comment '订单id',
|
||||
rating tinyint not null comment '评分',
|
||||
manicuristRating tinyint not null comment '美甲师评分',
|
||||
review varchar(512) null comment '评论',
|
||||
picture VARCHAR(512) COMMENT '评论图片',
|
||||
businessReview varchar(512) null comment '商家回复',
|
||||
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间'
|
||||
) comment '用户评分' collate = utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
-- 商家等级表
|
||||
create table business_level
|
||||
(
|
||||
id bigint auto_increment primary key comment 'id',
|
||||
businessId bigint not null comment '商家id',
|
||||
averageScore DECIMAL(3, 2) not null default 0 comment '综合评分',
|
||||
level tinyint not null comment '等级',
|
||||
createTime DATETIME default CURRENT_TIMESTAMP comment '创建时间',
|
||||
updateTime DATETIME default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
);
|
||||
|
||||
create table recruitment
|
||||
(
|
||||
id bigint auto_increment primary key comment '主键id',
|
||||
businessId bigint not null comment '商家id,关联business表',
|
||||
businessName varchar(512) not null comment '门店名称',
|
||||
requirements text not null comment '对美甲师的要求',
|
||||
salary varchar(50) not null comment '美甲师薪资,示例: 5k-10k/月',
|
||||
quantity int not null comment '招聘美甲师数量',
|
||||
createTime DATETIME default CURRENT_TIMESTAMP comment '创建时间',
|
||||
updateTime DATETIME default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
) comment ='美甲师招聘信息表';
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@MapperScan("com.cj.jiaqingjiayi.mapper")
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class JiaqingjiayiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JiaqingjiayiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.cj.jiaqingjiayi.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*通用返回类
|
||||
*/
|
||||
@Data
|
||||
public class BaseResponse<T> implements Serializable {
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private int code;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private T data;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
public BaseResponse(int code, T data, String message, String description) {
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.message = message;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public BaseResponse(int code, T data, String message) {
|
||||
this(code, data, message, "");
|
||||
}
|
||||
|
||||
public BaseResponse(int code, T data) {
|
||||
this(code, data, "", "");
|
||||
}
|
||||
|
||||
public BaseResponse(ErrorCode errorCode) {
|
||||
this(errorCode.getCode(), null , errorCode.getMessage(), errorCode.getDescription());
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.cj.jiaqingjiayi.common;
|
||||
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
public enum ErrorCode {
|
||||
|
||||
SUCCESS(0, "ok", ""),
|
||||
PARAMS_ERROR(40000, "请求参数错误", ""),
|
||||
NULL_ERROR(40001, "请求数据为空", ""),
|
||||
NOT_LOGIN(40100, "未登录", ""),
|
||||
NO_AUTH(40101, "无权限", ""),
|
||||
NOT_FOUND_ERROR(40400,"请求数据不存在",""),
|
||||
SYSTEM_ERROR(50000, "系统内部异常", ""),
|
||||
OPERATION_ERROR(50001, "操作失败", "");
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* 状态码信息
|
||||
*/
|
||||
private final String message;
|
||||
/**
|
||||
* 状态码的详细描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
ErrorCode(int code, String message, String description) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.cj.jiaqingjiayi.common;
|
||||
|
||||
/**
|
||||
* 返回工具类
|
||||
*/
|
||||
public class ResultUtils {
|
||||
/**
|
||||
* 成功
|
||||
*
|
||||
* @param data
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> BaseResponse<T> success(T data) {
|
||||
return new BaseResponse<>(0, data, "ok");
|
||||
}
|
||||
|
||||
public static <T> BaseResponse<T> success(T data, String message) {
|
||||
return new BaseResponse<>(0, data, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param errorCode
|
||||
* @return
|
||||
*/
|
||||
public static BaseResponse error(ErrorCode errorCode) {
|
||||
return new BaseResponse<>(errorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param code
|
||||
* @param message
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
public static BaseResponse error(int code, String message, String description) {
|
||||
return new BaseResponse(code, null, message, description);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param errorCode
|
||||
* @return
|
||||
*/
|
||||
public static BaseResponse error(ErrorCode errorCode, String message, String description) {
|
||||
return new BaseResponse(errorCode.getCode(), null, message, description);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param errorCode
|
||||
* @return
|
||||
*/
|
||||
public static BaseResponse error(ErrorCode errorCode, String description) {
|
||||
return new BaseResponse(errorCode.getCode(), errorCode.getMessage(), description);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.cj.jiaqingjiayi.config;
|
||||
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConstants;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
public class AlipayClients {
|
||||
//appid
|
||||
public String appId = "2021004144652242";
|
||||
//私钥
|
||||
//上:沙箱公钥 下:支付宝公钥
|
||||
public String PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo9gmNSz8l/eH4Uem6hqNoK1t91Gu5evoooJKzZraxPYW9AyJwH8Mxbag3qVaRSalz+OIHHVqszUxah98DbvaxJbpY9tB2zaLSvxhXM4U5iGFR3TqdqqvxsXsfiu+a0JHauuGYtuuNmUwR7ZFVub8Ma/YBCHfELPvl1TcX8MgMlHqw3NQqcEXZZO8Ziyxel7CqgHDx5dFn1meHDFWTajbWN/0TWSzvYAOKrlrS3LjjwbDzTr3BQzH84TLbLkBaMVGEUkJZUrVVkiN3XEVBpBUs5Cv5INN4L+UJ4kDy1u6LICzUVSSrQmHItuA+YiFHZ/WVJ18jISn0W7YZVyRqTo2sQIDAQAB";
|
||||
// public String PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjqGlEXMznr4XlQ3hvbZnQmfj0iJ2MAmPmpNyXMuQhuMK2xx8t9HozL+YzZ8l/4ksgtzGCHx0NiObsYe6Tt0EogfBqXjPTst21AjrT1TPKOxSfv6WuqNLNuY5o/i8ev0OLAGg8YUD2PL1GXSIrUMqjUuCFYQ7iFgEtcN54GVh4XG7Qj6wpN8CCTwmG4R4vHk4Al0ydE2yf0Efj49EgIi+Oq8EkXPSgdWpcS+UaEyuFVr3R5am36MHp+rXkOm6NluVJFBD/JHsOjB/Wt0EGd2HSyhR7n0hjFpNfVodughLL53/zG+nZ7+mM25s2S7Qh4iirxTedeqXlvBMXffxLSQrtQIDAQAB";
|
||||
//公钥appPrivateKey
|
||||
//上:沙箱私钥 下:支付宝私钥
|
||||
public String appPrivateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7rWG3si4XQlDEHjSe/ot98aCn/R25fCSiCBIUTTA6Wy3Gs5lk1XERw1N6loq8u9zR8vTQwzLnFmepwJx2sMLHGfJT3F6Y7Lx0z7gLYksMe+LIAfc+KYsfs0IyDvoKvwsm7XAzl8AYiqk1/p2dxc5etdvkLO7bXquyCDOclR3lL9NBgbJ6tH0fvcVd3RPmZk5Tb2hfn5JK1s/tAanbvFtKhLNCwX8qZp25+AfPakx2tRZkSgjh+fjA6ZElUnwq9ftHy16vfSmnX3C3LuDSKduo3EBkDhpGjTD5+zOs8tKGofW2gn347ouzXWnTz71ftzVwAgFUcOh4Ib0GVC9SKZBrAgMBAAECggEBAJEK8R8/tEFDfhnjYjWScYm3KLtLciJ8n+8dn6NS+DfRabJL8PutvUHGHAj8uWIdKg6T3sJMaVWQyjK16fYMq6umENLg17cGFquMMSeTIn8Wa3C5nDPNdXjdWAZJ7tJJTTwbeoBVAh+1YgqZqYRacCBgGf3hAARHyRfBIOodkEojc4oyzlbUGOz+Ee6/b+A9BZd84YWkbg/KlD9mlqSAYSGCKBM9nd8l1YIvr/4OgBn679x+A8pB8i5kGxP4fertZl2mkt75LigJ3Ab/vwoHDj1AuPjlUIce+PcTdxHqgNtIJSDWbop70BGPp0XQE9BRefPIPQfS9+2LO+eFeo4ESeECgYEA+DzH4cLoMYG9Hfq9IIbQyq6VJeip4/Lbv8h4RevGPHqyFIKB3fX7bHRlBB8hCnyX+zj4T/K50LEoZmo4tpVCv7YmRkyGRoF0QwaMgbo3bkaaCZeQnuPeZFaqyhszcJL1nhLghSNKcU75orStqf4H2mLL67VH1PkjelAWMrY1JVsCgYEAwYvMNzPkLG+p9MqGlkxgu2gQ6F4SdQp35XLHjygyTMG+qt/cPAbviyOILUhTLHP1s++kgw7z/qJPcNCQVVMWL6aBM40aRb+FiMajHouGe/q26zuDdtgsuqoN84/9phs7495Oa8ROxu6eZPuvU+OJNCgf/NMVkURbOpXtbe+yXjECgYBZwhiAQGqW5BOO0IgsR7MdZm0VrQApJTpiKUmb9rnSSocztVDiAjysJZYVHHBlC1IlC591wQ2BMV2rUoM5OdVN3r4OM0NmIQ754VdS3ROH801lZIFtgnV6kH/m3lkGPo1DYA4A9hbHy8emFnCpA+qxA4I6s2zKzF8Qrf6ozYt/+wKBgChyjrr6nTSsIViG+pluXMjNdrsY7cKH7YaF9i50uA5SbwZGwj/JM0ZgppTQCJHBqhdwfXDmLxeH1BI/g+pQ8tICef3L/zGUVNPAr1Yy0mgWfSOrzE2J388iuserz9Zm2p1EWB8tZ0krlO6Fqp5dbs73k7fCZT92iZo0uum+rggBAoGBAIO74oQpY3lY6OgvjZJAHcr9RiGPB7qQ+zmROxCqzFXdtNZ5sHb1Jdg+IsBcI7ZadFT28x/ENNpfO78mC+1j56mmN9BUpORBIcCaEzp2KYgP7e4FnWTluMvFV/2yBMlCfUEYHPfPK1TfD05oBJY4lTMD2qsT5RhS1ipFqagZgQ1X";
|
||||
// public String appPrivateKey ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCOoaURczOevheVDeG9tmdCZ+PSInYwCY+ak3Jcy5CG4wrbHHy30ejMv5jNnyX/iSyC3MYIfHQ2I5uxh7pO3QSiB8GpeM9Oy3bUCOtPVM8o7FJ+/pa6o0s25jmj+Lx6/Q4sAaDxhQPY8vUZdIitQyqNS4IVhDuIWAS1w3ngZWHhcbtCPrCk3wIJPCYbhHi8eTgCXTJ0TbJ/QR+Pj0SAiL46rwSRc9KB1alxL5RoTK4VWvdHlqbfowen6teQ6bo2W5UkUEP8kew6MH9a3QQZ3YdLKFHufSGMWk19Wh26CEsvnf/Mb6dnv6YzbmzZLtCHiKKvFN516peW8Exd9/EtJCu1AgMBAAECggEAPghReVhoL/cu3HXQIylsmXYDoIW6b0QJP8o25+Lk9bVTKF6oY24Y2MvPkkZQSWYIhNWuD0zJYi50bW7BecEoXawP7zwKtZNKGAfVB4i0HHFDo9XoCj4w3SyeDxGEL91VR5Bhxgj61mU8chi7xNc8b31SkzcSiUb2rXLZ091kB58/xtzQk2nZAhKhwms7gbX7qxm8+TWLRK9g4vWmsGVqbgFNj/sutqBURSeU/pHmW9PMqgcWvx6AwWWi+VgBUSoIgMnX7r7s6ZlgeDIgioii3JdCcr1nq39sVYPwFpwIe7a1DOCB58B+v2un1XoThC7ZNEcbwP5oYpUdFhSoxClrNQKBgQDJc/A1nz2yYiLUHUMJn2DhyTrOnCSclmowuzJVkyuo5gQPfZ3dTmjdPkM/fg09J3+zi3UCSwZd6dGMzJVHWooMniSiomZ/rY+o9SVTAJOjxt29N8jFN92b3fB43hbAWyBOuy4NMZMcr+4cADuqRHz2pKAeaALiZdpTbrTCzVXtqwKBgQC1QGS0sv8VU9fyBCyrYU4kQh8Fcvz0g6ObgUnHZi6UIL+Cy0/3JIGeIyvB/n47RF1wLUz4wykwW70e1qlMz7w21HM+DB8fVuzbO7SmQI3gDo024kQkWWGUhe3/w9ztzLF9ezleSN6wnrPeDbeMV+pURbsxIXA9xg7DYpZZ76ksHwKBgHQnF/oi7bTbpo88q/lxXq/wkaqtFuL+Sw378UKsD4Fb1j2ERTBj1Ey0aJvENyfqjVPddcKztWESvtL65pt0laI+0IrBLm4xiWJ2rmWUMIw+zn0aG/Wyh2Emb0+RZfbU0+TxQdUzn0nsGlMkw0IiKRcgxn2hpQAaj+6JJ0omkIPvAoGAZ2eGTKT17Cf6QgNprJiF6R+j7QruD11uoJABFHZSSoXoXGk7hMbZ/+sW0sUrJQrat93QVPeabxFXctmKmtzFBw7rdFGcC9gepvCIHnUju9jxbYdm0sn/ZqmF323RhAVMmUcMsqKmEWNpQFzZA4NAl7V0lxH5o/RzhbqgBk05WYcCgYEAny/umQs7+NYgwL/FztMJVljfQsGY81mhgrQyPhmg/7NiWmLodJtwQgSj3UitDVtUGhZRnuidO8P1XW0sUyDwc8xMLb+0qVxX4gMpM4J1B0UaIp+oPg7hCXeFGxkWQl8bPY0RFa3GOfT2/D63NpXqYw8Fe1lZWoIMz+PBdx0YN90=";
|
||||
//应用证书
|
||||
private String appCertPath;
|
||||
//支付宝证书
|
||||
private String alipayCertPath;
|
||||
//支付宝根证书
|
||||
private String alipayRootCertPath;
|
||||
//回调地址
|
||||
private String notify;
|
||||
//字符集 签名
|
||||
private String gateway = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
|
||||
|
||||
|
||||
// 公私钥模式
|
||||
@Bean
|
||||
public AlipayClient alipayClient() throws AlipayApiException {
|
||||
return new DefaultAlipayClient(this.gateway, this.appId, this.appPrivateKey, AlipayConstants.FORMAT_JSON, AlipayConstants.CHARSET_UTF8, this.PublicKey, AlipayConstants.SIGN_TYPE_RSA2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.cj.jiaqingjiayi.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 全局跨域配置
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
// 覆盖所有请求
|
||||
registry.addMapping("/**")
|
||||
// 允许发送 Cookie
|
||||
.allowCredentials(true)
|
||||
// 放行哪些域名(必须用 patterns,否则 * 会和 allowCredentials 冲突)
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowedHeaders("*")
|
||||
.exposedHeaders("*");
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.cj.jiaqingjiayi.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.boot.jackson.JsonComponent;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
/**
|
||||
* Spring MVC Json 配置
|
||||
*/
|
||||
@JsonComponent
|
||||
public class JsonConfig {
|
||||
|
||||
/**
|
||||
* 添加 Long 转 json 精度丢失的配置
|
||||
*/
|
||||
@Bean
|
||||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
||||
SimpleModule module = new SimpleModule();
|
||||
module.addSerializer(Long.class, ToStringSerializer.instance);
|
||||
module.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||
objectMapper.registerModule(module);
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.cj.jiaqingjiayi.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* @author bsz
|
||||
* Knife4j 接口文档配置
|
||||
*
|
||||
* http://localhost:8080/api/doc.html 接口文档地址
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@Profile({"dev", "test"}) //版本控制访问
|
||||
public class Knife4jConfig {
|
||||
@Bean
|
||||
public Docket defaultApi2() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
// 指定 Controller 扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("com.cj.jiaqingjiayi.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 自定义接口文档信息
|
||||
* @return 接口文档
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
// 接口文档的标题
|
||||
.title("甲情甲意")
|
||||
// 接口文档的描述信息
|
||||
.description("甲情甲意的接口文档,进行测试")
|
||||
// 提供服务的是谁?可以填写你自己的地址因为是你自己提供的服务
|
||||
.termsOfServiceUrl("https://www.bilibili.com/video/BV1W2421w78j/?spm_id_from=333.337.search-card.all.click")
|
||||
.contact(new Contact("gaomu", "https://account.bilibili.com/account/face/upload?spm_id_from=333.999.0.0", "1929829500@qq.com"))
|
||||
// 版本
|
||||
.version("1.0")
|
||||
// 构建
|
||||
.build();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.cj.jiaqingjiayi.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* MyBatis Plus 配置
|
||||
*/
|
||||
@Configuration
|
||||
public class MyBatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 拦截器配置
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 分页插件
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.contant;
|
||||
|
||||
/**
|
||||
* 通用常量
|
||||
*/
|
||||
public interface CommonConstant {
|
||||
|
||||
/**
|
||||
* 升序
|
||||
*/
|
||||
String SORT_ORDER_ASC = "ascend";
|
||||
|
||||
/**
|
||||
* 降序
|
||||
*/
|
||||
String SORT_ORDER_DESC = " descend";
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.cj.jiaqingjiayi.contant;
|
||||
|
||||
/**
|
||||
* 文件常量
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface FileConstant {
|
||||
|
||||
/**
|
||||
* COS 访问地址
|
||||
*/
|
||||
String COS_HOST = "xxxxxxxxxxxxxxxxxxxx";
|
||||
|
||||
/**
|
||||
* 服务器访问地址
|
||||
*/
|
||||
String SERVER_HOST = "39.101.78.35:9494";
|
||||
|
||||
/**
|
||||
* 服务器上传路径
|
||||
*/
|
||||
String SERVER_UPLOAD_DIR = "/www/wwwroot/images";
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.cj.jiaqingjiayi.contant;
|
||||
|
||||
public interface RedisKeyConstant {
|
||||
// IP 和 sessionId 的 key 前缀
|
||||
String USER_EXTRA_INFO = "user:extra:";
|
||||
// Spring Session 中 session 信息的后缀(sessionId 前面)
|
||||
String SESSION_KEY_POSTFIX = "sessions";
|
||||
// session 中保存的属性的前缀
|
||||
String SESSION_ATTRIBUTE_PREFIX = "sessionAttr";
|
||||
/**
|
||||
* 用户登录态键
|
||||
*/
|
||||
String USER_LOGIN_STATE = "jiaqingjiayi_user";
|
||||
String IP = "ip";
|
||||
String SESSION_ID = "sessionId";
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.cj.jiaqingjiayi.contant;
|
||||
|
||||
/**
|
||||
* 正则表达式常量
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface RegexConstant {
|
||||
/**
|
||||
* 手机号正则
|
||||
*/
|
||||
String PHONE_REGEX = "^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\\d{8}$";
|
||||
|
||||
/**
|
||||
* 邮箱正则
|
||||
*/
|
||||
String EMAIL_REGEX = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
|
||||
|
||||
/**
|
||||
* 18位身份证号正则
|
||||
*/
|
||||
String ID_CARD_REGEX = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9xX]$";
|
||||
|
||||
/**
|
||||
* 验证码正则, 6位数字或字母
|
||||
*/
|
||||
String VERIFY_CODE_REGEX = "^[a-zA-Z\\d]{6}$";
|
||||
|
||||
/**
|
||||
* 密码正则。4~32位的字母、数字、下划线
|
||||
*/
|
||||
String PASSWORD_REGEX = "^\\w{4,32}$";
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.cj.jiaqingjiayi.contant;
|
||||
|
||||
/**
|
||||
* 用户常量
|
||||
*/
|
||||
public interface UserConstant {
|
||||
|
||||
/**
|
||||
* 用户登录态键
|
||||
*/
|
||||
String USER_LOGIN_STATE = "userLoginState";
|
||||
|
||||
/**
|
||||
* 盐值
|
||||
*/
|
||||
String USER_SALT = "yctf";
|
||||
|
||||
// ------- 权限 --------
|
||||
|
||||
/**
|
||||
* 默认权限
|
||||
*/
|
||||
int DEFAULT_ROLE = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 管理员权限
|
||||
*/
|
||||
int ADMIN_ROLE = 1;
|
||||
|
||||
/**
|
||||
* 商家权限
|
||||
*/
|
||||
int BUSINESS_ROLE = 2;
|
||||
|
||||
}
|
@ -0,0 +1,372 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
import com.alipay.api.*;
|
||||
import com.alipay.api.domain.AlipayTradeCloseModel;
|
||||
import com.alipay.api.domain.AlipayTradeCreateModel;
|
||||
import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||
import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.alipay.api.request.*;
|
||||
import com.alipay.api.response.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.config.AlipayClients;
|
||||
import com.cj.jiaqingjiayi.contant.RedisKeyConstant;
|
||||
import com.cj.jiaqingjiayi.contant.UserConstant;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.mapper.UserMapper;
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicurist;
|
||||
import com.cj.jiaqingjiayi.model.domain.OrderItems;
|
||||
import com.cj.jiaqingjiayi.model.domain.Orders;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.AlipayTradeCreateRequest1;
|
||||
import com.cj.jiaqingjiayi.model.request.CreateAlipayRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.UserDTO;
|
||||
import com.cj.jiaqingjiayi.model.vo.UserVO;
|
||||
import com.cj.jiaqingjiayi.service.*;
|
||||
import com.cj.jiaqingjiayi.utils.RandomNumberGenerator;
|
||||
import com.cj.jiaqingjiayi.utils.UniqueNumberGenerator;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cj.jiaqingjiayi.contant.UserConstant.USER_LOGIN_STATE;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "支付宝接口")
|
||||
@RestController
|
||||
@RequestMapping("/Alipay")
|
||||
public class AlipayController {
|
||||
|
||||
|
||||
@Value("${alipay.appId}")
|
||||
public String appId;
|
||||
|
||||
@Value("${alipay.appPrivateKey}")
|
||||
public String appPrivateKey;
|
||||
|
||||
@Value("${alipay.alipayPublicKey}")
|
||||
public String PublicKey;
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Resource
|
||||
private AliPayService aliPayService;
|
||||
|
||||
@Resource
|
||||
private OrderItemsService orderItemsService;
|
||||
|
||||
@Resource
|
||||
private ManicuristService manicuristService;
|
||||
|
||||
@Resource
|
||||
private RandomNumberGenerator randomNumberGenerator;
|
||||
|
||||
private static String authToken;
|
||||
|
||||
public static final String NOURL = "http://39.101.78.35:1107/api/Alipay/notifyUrl";
|
||||
|
||||
|
||||
/**
|
||||
* 解析code获取open_id和token
|
||||
* @return aaa
|
||||
* @throws AlipayApiException 支付宝api异常
|
||||
*/
|
||||
@GetMapping("/parseCode")
|
||||
public BaseResponse<UserDTO> login(@RequestParam String authcode, @RequestParam long severId, HttpServletRequest req) throws AlipayApiException {
|
||||
AlipayConfig alipayConfig = choiceServer(severId);
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||
AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
|
||||
request.setCode(authcode);
|
||||
request.setGrantType("authorization_code");
|
||||
AlipaySystemOauthTokenResponse response = alipayClient.execute(request);
|
||||
// System.out.println(response.getBody());//打印所有响应
|
||||
authToken = response.getAccessToken();
|
||||
if (!response.isSuccess()) {
|
||||
return ResultUtils.error(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
AlipayUserInfoShareRequest request1 = new AlipayUserInfoShareRequest();
|
||||
AlipayUserInfoShareResponse response1 = alipayClient.execute(request1, authToken);
|
||||
|
||||
User oid = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, response.getOpenId()));
|
||||
UserVO userVO = new UserVO();
|
||||
UserDTO userDTO = new UserDTO();
|
||||
if (response1.isSuccess()) {
|
||||
if (oid == null) {
|
||||
User user = new User();
|
||||
user.setOpenId(response.getOpenId());
|
||||
user.setUsername(StringUtils.isAnyBlank(response1.getNickName()) ? "随机名字" + randomNumberGenerator.generateRandomNumber() : response1.getNickName());
|
||||
user.setUserPassword("123456");
|
||||
user.setUserAccount("用户" + randomNumberGenerator.generateRandomNumber());
|
||||
user.setAvatarUrl(StringUtils.isAnyBlank(response1.getAvatar()) ? "https://tfs.alipayobjects.com/images/partner/ATuihpR50zu7UAAAAAAAAAAAAADtl2AA" : response1.getAvatar());
|
||||
userMapper.insert(user);
|
||||
req.getSession().setAttribute(RedisKeyConstant.USER_LOGIN_STATE,user);
|
||||
BeanUtils.copyProperties(user, userVO);
|
||||
userVO.setSessionId(req.getSession().getId());
|
||||
userDTO.setUserVO(userVO);
|
||||
return ResultUtils.success(userDTO,"注册成功");
|
||||
}
|
||||
//如果用户权限为美甲师则返回美甲师内容
|
||||
if (oid.getUserRole().equals(3)){
|
||||
QueryWrapper<Manicurist> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userId", oid.getId());
|
||||
Manicurist manicurist = manicuristService.getOne(queryWrapper);
|
||||
userDTO.setManicurist(manicurist);
|
||||
}
|
||||
req.getSession().setAttribute(RedisKeyConstant.USER_LOGIN_STATE, oid);
|
||||
BeanUtils.copyProperties(oid, userVO);
|
||||
userVO.setSessionId(req.getSession().getId());
|
||||
userDTO.setUserVO(userVO);
|
||||
return ResultUtils.success(userDTO,"登录成功");
|
||||
}
|
||||
//如果用户权限为美甲师则返回美甲师内容
|
||||
if (oid.getUserRole().equals(3)){
|
||||
QueryWrapper<Manicurist> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userId", oid.getId());
|
||||
Manicurist manicurist = manicuristService.getOne(queryWrapper);
|
||||
userDTO.setManicurist(manicurist);
|
||||
}
|
||||
req.getSession().setAttribute(RedisKeyConstant.USER_LOGIN_STATE,oid);
|
||||
BeanUtils.copyProperties(oid, userVO);
|
||||
userVO.setSessionId(req.getSession().getId());
|
||||
userDTO.setUserVO(userVO);
|
||||
return ResultUtils.success(userDTO,"登录成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建支付
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@PostMapping("/create/alipay")
|
||||
public BaseResponse<String> AlipayTradeCreate(@RequestBody AlipayTradeCreateRequest1 pay, HttpServletRequest request) throws AlipayApiException {
|
||||
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// String miniOpenId = loginUser.getOpenId();
|
||||
|
||||
// 初始化SDK
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||
User byId = userService.getById(pay.getUserId());
|
||||
ThrowUtils.throwIf(byId.getOpenId() == null, ErrorCode.NOT_FOUND_ERROR, "不是小程序用户");
|
||||
|
||||
Orders order = ordersService.getById(pay.getId());
|
||||
|
||||
ThrowUtils.throwIf(order == null, ErrorCode.NOT_FOUND_ERROR, "订单不存在");
|
||||
ThrowUtils.throwIf(order.getPayMethod() != 0, ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||
|
||||
if (!byId.getId().equals(order.getUserId())) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH, "你不是该订单用户!");
|
||||
}
|
||||
|
||||
String tradeNo = aliPayService.createPayment(String.valueOf(order.getId()), byId.getOpenId(), order.getTotalPrice(), alipayClient);
|
||||
log.info("tradeNo:" + tradeNo);
|
||||
return ResultUtils.success(tradeNo);
|
||||
}
|
||||
|
||||
@GetMapping("/test/close")
|
||||
public String closeOrder(String out_trade_no,Long orderId) throws AlipayApiException {
|
||||
|
||||
log.info("out_trade_no:" + out_trade_no);
|
||||
AlipayClients clients = new AlipayClients();
|
||||
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
|
||||
AlipayTradeCloseModel model = new AlipayTradeCloseModel();
|
||||
|
||||
//model.setTradeNo(); 这是订单项
|
||||
//订单项可能会有多个支付单
|
||||
model.setTradeNo(out_trade_no);
|
||||
|
||||
request.setBizModel(model);
|
||||
// request.setNotifyUrl(NOURL + "/close");
|
||||
LambdaQueryWrapper<Orders> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Orders::getId, orderId);
|
||||
Orders orders = ordersService.getOne(queryWrapper);
|
||||
log.info("orders:" + orders);
|
||||
ThrowUtils.throwIf(!orders.getPaymentStatus().equals(0),ErrorCode.SYSTEM_ERROR,"当前订单已支付或已退款");
|
||||
orders.setPaymentStatus(3);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "修改订单状态失败");
|
||||
AlipayTradeCloseResponse response = clients.alipayClient().execute(request);
|
||||
|
||||
//这里应该写进日志
|
||||
log.info("订单已取消");
|
||||
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
@GetMapping("/test/refund")
|
||||
public String test_refund(String out_trade_no) throws AlipayApiException {
|
||||
AlipayClients clients = new AlipayClients();
|
||||
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
|
||||
|
||||
|
||||
QueryWrapper<Orders> ordersQueryWrapper = new QueryWrapper<>();
|
||||
ordersQueryWrapper.eq("orderNumber", out_trade_no);
|
||||
Orders orders = ordersService.getOne(ordersQueryWrapper);
|
||||
model.setOutTradeNo(out_trade_no);
|
||||
model.setRefundAmount(String.valueOf(orders.getTotalPrice()));
|
||||
//退款请求单号 要求唯一 需改
|
||||
String number = UniqueNumberGenerator.generateNumber();
|
||||
model.setOutRequestNo(number);
|
||||
log.info("outRequestNo:" + number);
|
||||
request.setBizModel(model);
|
||||
ThrowUtils.throwIf(!orders.getPaymentStatus().equals(1),ErrorCode.SYSTEM_ERROR,"当前订单未支付");
|
||||
orders.setPaymentStatus(2);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "修改订单状态失败");
|
||||
log.info("paymentStatus:" + orders.getPaymentStatus());
|
||||
AlipayTradeRefundResponse response = clients.alipayClient().execute(request);
|
||||
log.info("退款成功");
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
@GetMapping("/test/query")
|
||||
public String test_query (String orderNo) throws AlipayApiException {
|
||||
AlipayClients clients = new AlipayClients();
|
||||
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
|
||||
|
||||
model.setOutTradeNo(orderNo);
|
||||
|
||||
request.setBizModel(model);
|
||||
request.setNotifyUrl(NOURL);
|
||||
|
||||
AlipayTradeQueryResponse response = clients.alipayClient().execute(request);
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/notifyUrl")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public synchronized void aliPayNotifyUrl(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
System.out.println(log);
|
||||
|
||||
// 将 HttpServletRequest 的参数转换为 Map<String, String>
|
||||
Map<String,String> params = new HashMap<>();Map<String, String[]> requestParams = request.getParameterMap();
|
||||
for(String name : requestParams.keySet()) {
|
||||
params.put(name, request.getParameter(name));
|
||||
}
|
||||
//修改订单信息
|
||||
String out_trade_no = params.get("out_trade_no");
|
||||
|
||||
log.info( "23333333333333" + out_trade_no);
|
||||
|
||||
QueryWrapper<Orders> ordersQueryWrapper = new QueryWrapper<>();
|
||||
ordersQueryWrapper.eq("orderNumber", out_trade_no);
|
||||
Orders orders = ordersService.getOne(ordersQueryWrapper);
|
||||
orders.setPaymentStatus(1);
|
||||
Date date = new Date();
|
||||
orders.setUpdateTime(date);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
log.info("orders:" + orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "修改订单状态失败");
|
||||
//TODO 商家通知
|
||||
// websocketService.sendOrderMessage(orders);
|
||||
|
||||
String resultInfo = "buyer_id=208****24&total_amount=0.01&body=***试&trade_no=20190329**941025940236¬ify_time=2019-03-29 19:42:04&subject=**电脑网站支付&sign_type=RSA2&charset=UTF-8&auth_app_id=201****222¬ify_type=trade_status_sync&invoice_amount=0.01&out_trade_no=20190329ygyg45484544100003&trade_status=TRADE_SUCCESS&gmt_payment=2019-03-29 19:42:03&version=1.0&point_amount=0.00&sign=LDDUIGQmc+1qNtk3oyoAKVeMUKTngdX3ZjVeZOK0EjiPDJ/+Nk+0WSqcE6J7/5xb96Z/vP0yY3pVhZUiFVJ1G45/ys/HAleHh+EERZ1lkCkule1sSyaGFTKQGKx4uHpTyqIgRB1bouf19RPbSx1EkA0VkCarSy9G/OEG5Qmg8UdL2dRulMhlbOHS7tdMJJycDA8vOspOUMeQmk/H6IK9R2Kou5hN2T3KR1GWLYFK+z1jeZhQB3q52lZynO0OFjSzU4aQUBMW5QskQppBYd/ghtY/2YP+2H6YVGNgVmaheZMQ3PVTBALEV+8rZa91salH9DkKN2UCYGvNSNDT1VGCTQ==&gmt_create=2019-03-29 19:42:00&buyer_pay_amount=0.01&receipt_amount=0.01&fund_bill_list=[{\"amount\":\"0.01\",\"fundChannel\":\"PCREDIT\"}]&seller_id=208****0&app_id=2014100***22¬ify_id=20190329002221942040**8";
|
||||
//编码格式
|
||||
String charset="utf-8";
|
||||
//签名方式
|
||||
String sign_type="RSA2";
|
||||
//对待签名字符串数据通过&进行拆分
|
||||
String [] temp = resultInfo.split("&");
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
||||
//把拆分数据放在map集合内
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
String[] arr = temp[i].split("=", 2); //通过"="号分割成2个数据
|
||||
String[] tempAagin = new String[arr.length]; //再开辟一个数组用来接收分割后的数据
|
||||
for (int j = 0; j < arr.length; j++) {
|
||||
tempAagin[j] = arr[j];
|
||||
}
|
||||
map.put(tempAagin[0], tempAagin[1]);
|
||||
}
|
||||
System.out.println(map);
|
||||
|
||||
|
||||
try {
|
||||
//验签方法
|
||||
boolean signVerified = AlipaySignature.rsaCheckV1(params,PublicKey,charset,sign_type);
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
PrintWriter writer = response.getWriter();
|
||||
if (signVerified && "TRADE_SUCCESS".equals(params.get("trade_status"))) {
|
||||
// 业务处理
|
||||
writer.println("success");
|
||||
} else {
|
||||
writer.println("fail");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private AlipayConfig choiceServer(long serverId) {
|
||||
String testPrivateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7rWG3si4XQlDEHjSe/ot98aCn/R25fCSiCBIUTTA6Wy3Gs5lk1XERw1N6loq8u9zR8vTQwzLnFmepwJx2sMLHGfJT3F6Y7Lx0z7gLYksMe+LIAfc+KYsfs0IyDvoKvwsm7XAzl8AYiqk1/p2dxc5etdvkLO7bXquyCDOclR3lL9NBgbJ6tH0fvcVd3RPmZk5Tb2hfn5JK1s/tAanbvFtKhLNCwX8qZp25+AfPakx2tRZkSgjh+fjA6ZElUnwq9ftHy16vfSmnX3C3LuDSKduo3EBkDhpGjTD5+zOs8tKGofW2gn347ouzXWnTz71ftzVwAgFUcOh4Ib0GVC9SKZBrAgMBAAECggEBAJEK8R8/tEFDfhnjYjWScYm3KLtLciJ8n+8dn6NS+DfRabJL8PutvUHGHAj8uWIdKg6T3sJMaVWQyjK16fYMq6umENLg17cGFquMMSeTIn8Wa3C5nDPNdXjdWAZJ7tJJTTwbeoBVAh+1YgqZqYRacCBgGf3hAARHyRfBIOodkEojc4oyzlbUGOz+Ee6/b+A9BZd84YWkbg/KlD9mlqSAYSGCKBM9nd8l1YIvr/4OgBn679x+A8pB8i5kGxP4fertZl2mkt75LigJ3Ab/vwoHDj1AuPjlUIce+PcTdxHqgNtIJSDWbop70BGPp0XQE9BRefPIPQfS9+2LO+eFeo4ESeECgYEA+DzH4cLoMYG9Hfq9IIbQyq6VJeip4/Lbv8h4RevGPHqyFIKB3fX7bHRlBB8hCnyX+zj4T/K50LEoZmo4tpVCv7YmRkyGRoF0QwaMgbo3bkaaCZeQnuPeZFaqyhszcJL1nhLghSNKcU75orStqf4H2mLL67VH1PkjelAWMrY1JVsCgYEAwYvMNzPkLG+p9MqGlkxgu2gQ6F4SdQp35XLHjygyTMG+qt/cPAbviyOILUhTLHP1s++kgw7z/qJPcNCQVVMWL6aBM40aRb+FiMajHouGe/q26zuDdtgsuqoN84/9phs7495Oa8ROxu6eZPuvU+OJNCgf/NMVkURbOpXtbe+yXjECgYBZwhiAQGqW5BOO0IgsR7MdZm0VrQApJTpiKUmb9rnSSocztVDiAjysJZYVHHBlC1IlC591wQ2BMV2rUoM5OdVN3r4OM0NmIQ754VdS3ROH801lZIFtgnV6kH/m3lkGPo1DYA4A9hbHy8emFnCpA+qxA4I6s2zKzF8Qrf6ozYt/+wKBgChyjrr6nTSsIViG+pluXMjNdrsY7cKH7YaF9i50uA5SbwZGwj/JM0ZgppTQCJHBqhdwfXDmLxeH1BI/g+pQ8tICef3L/zGUVNPAr1Yy0mgWfSOrzE2J388iuserz9Zm2p1EWB8tZ0krlO6Fqp5dbs73k7fCZT92iZo0uum+rggBAoGBAIO74oQpY3lY6OgvjZJAHcr9RiGPB7qQ+zmROxCqzFXdtNZ5sHb1Jdg+IsBcI7ZadFT28x/ENNpfO78mC+1j56mmN9BUpORBIcCaEzp2KYgP7e4FnWTluMvFV/2yBMlCfUEYHPfPK1TfD05oBJY4lTMD2qsT5RhS1ipFqagZgQ1X";
|
||||
String testAlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo9gmNSz8l/eH4Uem6hqNoK1t91Gu5evoooJKzZraxPYW9AyJwH8Mxbag3qVaRSalz+OIHHVqszUxah98DbvaxJbpY9tB2zaLSvxhXM4U5iGFR3TqdqqvxsXsfiu+a0JHauuGYtuuNmUwR7ZFVub8Ma/YBCHfELPvl1TcX8MgMlHqw3NQqcEXZZO8Ziyxel7CqgHDx5dFn1meHDFWTajbWN/0TWSzvYAOKrlrS3LjjwbDzTr3BQzH84TLbLkBaMVGEUkJZUrVVkiN3XEVBpBUs5Cv5INN4L+UJ4kDy1u6LICzUVSSrQmHItuA+YiFHZ/WVJ18jISn0W7YZVyRqTo2sQIDAQAB";
|
||||
String privateKey = appPrivateKey;
|
||||
String alipayPublicKey = PublicKey;
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
if (serverId == 0) {
|
||||
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
alipayConfig.setAppId(appId);
|
||||
alipayConfig.setPrivateKey(privateKey);
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setAlipayPublicKey(alipayPublicKey);
|
||||
alipayConfig.setCharset("utf-8");
|
||||
alipayConfig.setSignType("RSA2");
|
||||
}
|
||||
else if (serverId == 1) {
|
||||
alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
|
||||
alipayConfig.setAppId(appId);
|
||||
alipayConfig.setPrivateKey(testPrivateKey);
|
||||
alipayConfig.setAlipayPublicKey(testAlipayPublicKey);
|
||||
alipayConfig.setConnectTimeout(15000);
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setCharset("utf-8");
|
||||
alipayConfig.setSignType("RSA2");
|
||||
// log.info("应用网关:" + "https://openapi-sandbox.dl.alipaydev.com/gateway.do");
|
||||
}
|
||||
else {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"网关选择错误");
|
||||
}
|
||||
return alipayConfig;
|
||||
}
|
||||
|
||||
private static AlipayConfig getAlipayConfig() {
|
||||
String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7rWG3si4XQlDEHjSe/ot98aCn/R25fCSiCBIUTTA6Wy3Gs5lk1XERw1N6loq8u9zR8vTQwzLnFmepwJx2sMLHGfJT3F6Y7Lx0z7gLYksMe+LIAfc+KYsfs0IyDvoKvwsm7XAzl8AYiqk1/p2dxc5etdvkLO7bXquyCDOclR3lL9NBgbJ6tH0fvcVd3RPmZk5Tb2hfn5JK1s/tAanbvFtKhLNCwX8qZp25+AfPakx2tRZkSgjh+fjA6ZElUnwq9ftHy16vfSmnX3C3LuDSKduo3EBkDhpGjTD5+zOs8tKGofW2gn347ouzXWnTz71ftzVwAgFUcOh4Ib0GVC9SKZBrAgMBAAECggEBAJEK8R8/tEFDfhnjYjWScYm3KLtLciJ8n+8dn6NS+DfRabJL8PutvUHGHAj8uWIdKg6T3sJMaVWQyjK16fYMq6umENLg17cGFquMMSeTIn8Wa3C5nDPNdXjdWAZJ7tJJTTwbeoBVAh+1YgqZqYRacCBgGf3hAARHyRfBIOodkEojc4oyzlbUGOz+Ee6/b+A9BZd84YWkbg/KlD9mlqSAYSGCKBM9nd8l1YIvr/4OgBn679x+A8pB8i5kGxP4fertZl2mkt75LigJ3Ab/vwoHDj1AuPjlUIce+PcTdxHqgNtIJSDWbop70BGPp0XQE9BRefPIPQfS9+2LO+eFeo4ESeECgYEA+DzH4cLoMYG9Hfq9IIbQyq6VJeip4/Lbv8h4RevGPHqyFIKB3fX7bHRlBB8hCnyX+zj4T/K50LEoZmo4tpVCv7YmRkyGRoF0QwaMgbo3bkaaCZeQnuPeZFaqyhszcJL1nhLghSNKcU75orStqf4H2mLL67VH1PkjelAWMrY1JVsCgYEAwYvMNzPkLG+p9MqGlkxgu2gQ6F4SdQp35XLHjygyTMG+qt/cPAbviyOILUhTLHP1s++kgw7z/qJPcNCQVVMWL6aBM40aRb+FiMajHouGe/q26zuDdtgsuqoN84/9phs7495Oa8ROxu6eZPuvU+OJNCgf/NMVkURbOpXtbe+yXjECgYBZwhiAQGqW5BOO0IgsR7MdZm0VrQApJTpiKUmb9rnSSocztVDiAjysJZYVHHBlC1IlC591wQ2BMV2rUoM5OdVN3r4OM0NmIQ754VdS3ROH801lZIFtgnV6kH/m3lkGPo1DYA4A9hbHy8emFnCpA+qxA4I6s2zKzF8Qrf6ozYt/+wKBgChyjrr6nTSsIViG+pluXMjNdrsY7cKH7YaF9i50uA5SbwZGwj/JM0ZgppTQCJHBqhdwfXDmLxeH1BI/g+pQ8tICef3L/zGUVNPAr1Yy0mgWfSOrzE2J388iuserz9Zm2p1EWB8tZ0krlO6Fqp5dbs73k7fCZT92iZo0uum+rggBAoGBAIO74oQpY3lY6OgvjZJAHcr9RiGPB7qQ+zmROxCqzFXdtNZ5sHb1Jdg+IsBcI7ZadFT28x/ENNpfO78mC+1j56mmN9BUpORBIcCaEzp2KYgP7e4FnWTluMvFV/2yBMlCfUEYHPfPK1TfD05oBJY4lTMD2qsT5RhS1ipFqagZgQ1X";
|
||||
String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo9gmNSz8l/eH4Uem6hqNoK1t91Gu5evoooJKzZraxPYW9AyJwH8Mxbag3qVaRSalz+OIHHVqszUxah98DbvaxJbpY9tB2zaLSvxhXM4U5iGFR3TqdqqvxsXsfiu+a0JHauuGYtuuNmUwR7ZFVub8Ma/YBCHfELPvl1TcX8MgMlHqw3NQqcEXZZO8Ziyxel7CqgHDx5dFn1meHDFWTajbWN/0TWSzvYAOKrlrS3LjjwbDzTr3BQzH84TLbLkBaMVGEUkJZUrVVkiN3XEVBpBUs5Cv5INN4L+UJ4kDy1u6LICzUVSSrQmHItuA+YiFHZ/WVJ18jISn0W7YZVyRqTo2sQIDAQAB";
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
|
||||
alipayConfig.setAppId("2021004144652242");
|
||||
alipayConfig.setPrivateKey(privateKey);
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setAlipayPublicKey(alipayPublicKey);
|
||||
alipayConfig.setCharset("UTF-8");
|
||||
alipayConfig.setSignType("RSA2");
|
||||
return alipayConfig;
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.Appointments;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.appointments.AppointmentsAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.appointments.AppointmentsUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.AppointmentsVO;
|
||||
import com.cj.jiaqingjiayi.service.AppointmentsService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "预约接口")
|
||||
@RestController
|
||||
@RequestMapping("/appointments")
|
||||
public class AppointmentsController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private AppointmentsService appointmentsService;
|
||||
|
||||
@ApiOperation(value = "添加预约")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addAppointments(@RequestBody AppointmentsAddRequest appointmentsAddRequest, HttpServletRequest request){
|
||||
//校验是否登录
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
ThrowUtils.throwIf(appointmentsAddRequest== null, ErrorCode.NULL_ERROR);
|
||||
|
||||
String appointmentTime = appointmentsAddRequest.getAppointmentTime();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM-dd HH:mm");
|
||||
// 提取当前年份
|
||||
int year = LocalDate.now().getYear();
|
||||
// 解析成 LocalDate 和 LocalTime
|
||||
LocalDate date = LocalDate.parse(year + "-" + appointmentTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
|
||||
LocalTime time = LocalTime.parse(appointmentTime, formatter);
|
||||
// 合并为 LocalDateTime
|
||||
LocalDateTime dateTime = LocalDateTime.of(date, time);
|
||||
// LocalDateTime 转为 Date
|
||||
Date date1 = Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
|
||||
Appointments appointments = new Appointments();
|
||||
appointments.setAppointmentTime(date1);
|
||||
//不传入默认用户昵称
|
||||
// if (appointmentsAddRequest.getUsername() == null) {
|
||||
// appointmentsAddRequest.setUsername(loginUser.getUsername());
|
||||
// }
|
||||
BeanUtils.copyProperties(appointmentsAddRequest, appointments);
|
||||
appointments.setUserId(appointments.getUserId());
|
||||
//校验是否输入必要的数据
|
||||
appointmentsService.valid(appointments);
|
||||
|
||||
//返回预约号
|
||||
Long id = appointmentsService.addAppointments(appointments);
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.PARAMS_ERROR, "预约失败");
|
||||
|
||||
return ResultUtils.success(id, "预约成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询我的预约")
|
||||
@PostMapping("/query")
|
||||
public BaseResponse<List<AppointmentsVO>> queryMyAppointments(@RequestBody CommonRequest commonRequest, HttpServletRequest request){
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
Long userid = commonRequest.getId();
|
||||
QueryWrapper<Appointments> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("userId", userid);
|
||||
List<Appointments> appointmentsList = appointmentsService.list(wrapper);
|
||||
|
||||
List<AppointmentsVO> appointmentsVOList = appointmentsService.queryAppointmentsVO(appointmentsList);
|
||||
return ResultUtils.success(appointmentsVOList);
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperation(value = "取消预约")
|
||||
public BaseResponse<Boolean> removeAppointments(@RequestBody CommonRequest commonRequest) {
|
||||
|
||||
boolean flag = appointmentsService.removeId(commonRequest.getId());
|
||||
|
||||
return ResultUtils.success(flag);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改预约信息")
|
||||
public BaseResponse<Boolean> updateAppointments(@RequestBody AppointmentsUpdateRequest updateRequest) {
|
||||
ThrowUtils.throwIf(updateRequest == null, ErrorCode.NULL_ERROR);
|
||||
|
||||
|
||||
Long id = updateRequest.getId();
|
||||
Appointments appointments = appointmentsService.getById(id);
|
||||
BeanCopyUtils.copyPropertiesIgnoreEmpty(updateRequest,appointments);
|
||||
boolean flag = appointmentsService.updateById(appointments);
|
||||
|
||||
return ResultUtils.success(flag);
|
||||
}
|
||||
|
||||
@GetMapping("/list/select")
|
||||
@ApiOperation(value = "查询当前店铺预约信息")
|
||||
public BaseResponse<List<Appointments>> queryBuAppointments(@RequestParam Long id) {
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.NULL_ERROR);
|
||||
|
||||
QueryWrapper<Appointments> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("businessId", id);
|
||||
List<Appointments> appointmentsList = appointmentsService.list(queryWrapper);
|
||||
|
||||
return ResultUtils.success(appointmentsList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据Id查询预约信息")
|
||||
@GetMapping("/getAppointments")
|
||||
public BaseResponse<Appointments> queryByIdAppointments(@RequestParam Long appointmentsId){
|
||||
ThrowUtils.throwIf(appointmentsId < 0, ErrorCode.PARAMS_ERROR);
|
||||
Appointments appointments = appointmentsService.getById(appointmentsId);
|
||||
return ResultUtils.success(appointments);
|
||||
}
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessAuth;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.BusinessDTO;
|
||||
import com.cj.jiaqingjiayi.model.request.business.BusinessAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.business.BusinessQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.business.BusinessUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.BusinessAdminVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.BusinessVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.CartDTO;
|
||||
import com.cj.jiaqingjiayi.model.vo.CartVO;
|
||||
import com.cj.jiaqingjiayi.service.BusinessAuthService;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cj.jiaqingjiayi.contant.UserConstant.USER_SALT;
|
||||
|
||||
/**
|
||||
* 商家接口
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "商家接口")
|
||||
@RestController
|
||||
@RequestMapping("/business")
|
||||
public class BusinessController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Resource
|
||||
private BusinessAuthService businessAuthService;
|
||||
|
||||
@ApiOperation(value = "添加商家")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addBusiness(@RequestBody BusinessAddRequest businessAddRequest) {
|
||||
ThrowUtils.throwIf(businessAddRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
User user = new User();
|
||||
BeanUtils.copyProperties(businessAddRequest, user);
|
||||
Business business = new Business();
|
||||
BeanUtils.copyProperties(businessAddRequest, business);
|
||||
BusinessAuth businessAuth = new BusinessAuth();
|
||||
BeanUtils.copyProperties(businessAddRequest, businessAuth);
|
||||
|
||||
//对每个应该校验的业务进行校验
|
||||
businessService.validUser(user, true);
|
||||
businessService.validBusiness(business, true);
|
||||
businessService.validBusinessAuth(businessAuth, true);
|
||||
|
||||
//加密
|
||||
String encryptPassword = DigestUtils.md5DigestAsHex((USER_SALT + user.getUserPassword()).getBytes());
|
||||
user.setUserPassword(encryptPassword);
|
||||
|
||||
business.setState(0);
|
||||
|
||||
//更改用户权限为商家
|
||||
user.setUserRole(2);
|
||||
|
||||
//往user表中补充商家信息
|
||||
user.setUsername(business.getBusinessName());
|
||||
// user.setAvatarUrl(business.getBusinessAvatar());
|
||||
user.setPhone(business.getBusinessPhone());
|
||||
|
||||
//插入到表中
|
||||
businessService.addBusiness(user, business, businessAuth);
|
||||
|
||||
return ResultUtils.success(business.getId(),"添加商家成功");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商家
|
||||
*/
|
||||
@ApiOperation(value = "更新商家")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> updateBusiness (@RequestBody BusinessUpdateRequest businessUpdateRequest, HttpServletRequest request) {
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
|
||||
if (businessUpdateRequest == null || businessUpdateRequest.getId() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "传入参数为空");
|
||||
}
|
||||
|
||||
Business business = new Business();
|
||||
|
||||
BeanCopyUtils.copyPropertiesIgnoreEmpty(businessUpdateRequest, business);
|
||||
//更新不添加 只需要判断修改符不符合逻辑
|
||||
businessService.validBusiness(business, false);
|
||||
|
||||
boolean updateById = businessService.updateBusiness(business);
|
||||
|
||||
ThrowUtils.throwIf(!updateById, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*/
|
||||
@ApiOperation(value = "管理员根据id查询商家")
|
||||
@GetMapping("/getById")
|
||||
public BaseResponse<BusinessAdminVO> getBusinessById(@RequestParam Long id, HttpServletRequest request) {
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.NULL_ERROR);
|
||||
|
||||
//获取商家视图
|
||||
Business business = businessService.getById(id);
|
||||
ThrowUtils.throwIf(business == null , ErrorCode.PARAMS_ERROR, "id不符合规范");
|
||||
BusinessAdminVO businessAdminVO = businessAuthService.getBusinessAdminVO(business);
|
||||
|
||||
return ResultUtils.success(businessAdminVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "根据id查询商家")
|
||||
@GetMapping("/userGetById")
|
||||
public BaseResponse<BusinessVO> userGetBusinessById(@RequestParam Long id, HttpServletRequest request) {
|
||||
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.NULL_ERROR);
|
||||
|
||||
//获取商家视图
|
||||
Business business = businessService.getById(id);
|
||||
ThrowUtils.throwIf(business == null , ErrorCode.PARAMS_ERROR, "id不符合规范");
|
||||
BusinessVO businessVO = businessService.getBusinessVO(business);
|
||||
|
||||
return ResultUtils.success(businessVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有商家
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询所有商家")
|
||||
@PostMapping("/list")
|
||||
public BaseResponse<List<BusinessDTO>> listBusinessAll(){
|
||||
List<Business> businessList = businessService.list();
|
||||
|
||||
List<BusinessDTO> businessDTOS = new ArrayList<>();
|
||||
for (Business business : businessList) {
|
||||
QueryWrapper<BusinessAuth> queryWrapper = new QueryWrapper<BusinessAuth>();
|
||||
queryWrapper.eq("businessId", business.getId());
|
||||
BusinessAuth one = businessAuthService.getOne(queryWrapper);
|
||||
BusinessDTO businessDTO = new BusinessDTO();
|
||||
businessDTO.setBusinessAuth(one);
|
||||
businessDTO.setBusiness(business);
|
||||
businessDTOS.add(businessDTO);
|
||||
}
|
||||
return new BaseResponse<>(0,businessDTOS,"查询成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有商家
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询所有商家等级版")
|
||||
@PostMapping("/listLv")
|
||||
public BaseResponse<List<BusinessVO>> listBusinessAllLv(){
|
||||
List<BusinessVO> businessList = businessService.findAllBusiness();
|
||||
return new BaseResponse<>(0,businessList,"查询成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param businessQueryRequest
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询商家")
|
||||
@PostMapping("/list/page")
|
||||
//@AuthCheck(mustRole = 1)
|
||||
public BaseResponse<Page<Business>> listBusinessByPage (@RequestBody BusinessQueryRequest businessQueryRequest) {
|
||||
long current = businessQueryRequest.getCurrent();
|
||||
long size = businessQueryRequest.getPageSize();
|
||||
Page<Business> businessPage = businessService.page(new Page<>(current, size),
|
||||
businessService.getQueryWrapper(businessQueryRequest));
|
||||
return ResultUtils.success(businessPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取商家列表(用户视图)
|
||||
*/
|
||||
@ApiOperation(value = "用户分页获取商家")
|
||||
@PostMapping("/list/page/vo")
|
||||
public BaseResponse<Page<BusinessVO>> listBusinessVOByPage(@RequestBody BusinessQueryRequest businessQueryRequest) {
|
||||
long current = businessQueryRequest.getCurrent();
|
||||
long size = businessQueryRequest.getPageSize();
|
||||
|
||||
ThrowUtils.throwIf(size > 20, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
QueryWrapper<Business> queryWrapper = businessService.getQueryWrapper(businessQueryRequest);
|
||||
queryWrapper.eq("state", 1); // 只显示正常营业商家
|
||||
|
||||
Page<Business> businessPage = businessService.page(new Page<>(current, size), queryWrapper);
|
||||
Page<BusinessVO> businessVOPage = new Page<>(current, size, businessPage.getTotal());
|
||||
|
||||
List<BusinessVO> businessVOList = businessService.getBusinessVO(businessPage.getRecords());
|
||||
businessVOPage.setRecords(businessVOList);
|
||||
|
||||
return ResultUtils.success(businessVOPage);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取当前登录商家")
|
||||
@GetMapping("/current")
|
||||
public BaseResponse<BusinessVO> getLoginBusiness(@RequestParam Long businessId, HttpServletRequest request){
|
||||
//获取登录态
|
||||
// Business business = businessService.getLoginBusiness(request);
|
||||
Business business = businessService.getById(businessId);
|
||||
return ResultUtils.success(businessService.getBusinessVO(business));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,252 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.*;
|
||||
import com.cj.jiaqingjiayi.model.request.cart.CartAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.cart.CartDeleteRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.cart.CartQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.cart.CartUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.*;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.CartService;
|
||||
import com.cj.jiaqingjiayi.service.CommoditiesService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "购物车接口")
|
||||
@RequestMapping("/cart")
|
||||
public class CartController {
|
||||
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Resource
|
||||
private CommoditiesService commoditiesService;
|
||||
|
||||
/**
|
||||
* 添加进购物车
|
||||
* @param cartAddRequest 添加请求
|
||||
* @param request 网络请求
|
||||
* @return 购物车id
|
||||
*/
|
||||
@ApiOperation(value = "添加购物车")
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<CartVO> addCart (@RequestBody CartAddRequest cartAddRequest, HttpServletRequest request) {
|
||||
if (cartAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
//校验
|
||||
cartService.validCart(cartAddRequest);
|
||||
//添加商品到购物车
|
||||
Cart cart = cartService.addCart(cartAddRequest, request);
|
||||
CartVO cartVO = new CartVO();
|
||||
BeanUtils.copyProperties(cart, cartVO);
|
||||
Long commoditiesId = cartVO.getCommoditiesId();
|
||||
Commodities commodities = commoditiesService.getById(commoditiesId);
|
||||
List<CommoditiesVO> commoditiesList = new ArrayList<>();
|
||||
CommoditiesVO commoditiesVO = commoditiesService.getCommoditiesVO(commodities);
|
||||
commoditiesList.add(commoditiesVO);
|
||||
cartVO.setCommoditiesVO(commoditiesList);
|
||||
return ResultUtils.success(cartVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新购物车
|
||||
* @param cartUpdateRequest 更新请求
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
// @ApiOperation(value = "更新购物车")
|
||||
// @PostMapping("/update")
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public BaseResponse<Boolean> updateCart (@RequestBody CartUpdateRequest cartUpdateRequest, HttpServletRequest request){
|
||||
// if (cartUpdateRequest == null) {
|
||||
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
// }
|
||||
// //校验
|
||||
// CartAddRequest cartAddRequest = new CartAddRequest();
|
||||
// BeanUtils.copyProperties(cartUpdateRequest,cartAddRequest);
|
||||
// cartService.validCart(cartAddRequest);
|
||||
//
|
||||
// Boolean cart = cartService.updateCart(cartUpdateRequest, request);
|
||||
// return ResultUtils.success(cart);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除购物车
|
||||
* @param cartDeleteRequest 删除请求
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "删除购物车")
|
||||
@PostMapping("/delete")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> deleteCart (@RequestBody CartDeleteRequest cartDeleteRequest, HttpServletRequest request) {
|
||||
if (cartDeleteRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
Boolean cart = cartService.deleteCart(cartDeleteRequest, request);
|
||||
ThrowUtils.throwIf(!cart, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户id获取购物车脱敏列表
|
||||
* @param cartQueryRequest 商户id
|
||||
* @param request 网络请求
|
||||
* @return 脱敏列表
|
||||
*/
|
||||
@ApiOperation(value = "根据商户id获取购物车脱敏列表")
|
||||
@PostMapping("/selectByBusinessId")
|
||||
public BaseResponse<CartResponseVO> selectByBusinessId(@RequestBody CartQueryRequest cartQueryRequest, HttpServletRequest request) {
|
||||
if (cartQueryRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
Long businessId = cartQueryRequest.getId();
|
||||
Long userId = cartQueryRequest.getUserId();
|
||||
|
||||
// 查询购物车列表
|
||||
LambdaQueryWrapper<Cart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Cart::getBusinessId, businessId);
|
||||
List<Cart> cartList = cartService.list(queryWrapper);
|
||||
|
||||
// 查询对应的 Business 信息
|
||||
Business business = businessService.getById(businessId);
|
||||
if (business == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商家不存在");
|
||||
}
|
||||
|
||||
// 转换 Cart 数据为 CartVO
|
||||
List<CartVO> cartVOList = this.getCartVOList(cartList);
|
||||
|
||||
// 封装返回对象
|
||||
CartResponseVO responseVO = new CartResponseVO();
|
||||
responseVO.setBusiness(business);
|
||||
responseVO.setCartList(cartVOList);
|
||||
|
||||
return ResultUtils.success(responseVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户查找购物车列表
|
||||
* @param request 网络请求
|
||||
* @return 脱敏列表
|
||||
*/
|
||||
@ApiOperation(value = "根据用户查找购物车列表")
|
||||
@PostMapping("/selectByUserId")
|
||||
public BaseResponse<List<CartDTO>> selectByUserId (@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// Long userId = loginUser.getId();
|
||||
Long userId = commonRequest.getId();
|
||||
LambdaQueryWrapper<Cart> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Cart::getUserId, userId);
|
||||
|
||||
List<CartDTO> cartDTOList = new ArrayList<>();
|
||||
|
||||
List<Cart> cartList = cartService.list(wrapper);
|
||||
List<CartVO> cartVOList = this.getCartVOList(cartList);
|
||||
|
||||
|
||||
for (CartVO cartVO : cartVOList) {
|
||||
Business business = businessService.getById(cartVO.getBusinessId());
|
||||
CartDTO cartDTO = new CartDTO();
|
||||
cartDTO.setCartVO(cartVO);
|
||||
cartDTO.setBusiness(business);
|
||||
cartDTOList.add(cartDTO);
|
||||
}
|
||||
|
||||
return ResultUtils.success(cartDTOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空商家内的购物车
|
||||
* @param cartQueryRequest 商家id
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "清空商家内的购物车")
|
||||
@PostMapping("/empty/business")
|
||||
public BaseResponse<Boolean> emptyBusinessCart(@RequestBody CartQueryRequest cartQueryRequest, HttpServletRequest request) {
|
||||
if (cartQueryRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
Long businessId = cartQueryRequest.getId();
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// Long userId = loginUser.getId();
|
||||
Long userId = cartQueryRequest.getUserId();
|
||||
LambdaQueryWrapper<Cart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Cart::getBusinessId, businessId);
|
||||
queryWrapper.eq(Cart::getUserId, userId);
|
||||
boolean remove = cartService.remove(queryWrapper);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空用户购物车
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "清空用户购物车")
|
||||
@PostMapping("/empty/user")
|
||||
public BaseResponse<Boolean> emptyUserCart(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// Long userId = loginUser.getId();
|
||||
Long userId = commonRequest.getId();
|
||||
LambdaQueryWrapper<Cart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Cart::getUserId, userId);
|
||||
boolean remove = cartService.remove(queryWrapper);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
private List<CartVO> getCartVOList(List<Cart> cartList) {
|
||||
if (CollectionUtils.isEmpty(cartList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return cartList.stream().map(item ->{
|
||||
CartVO cartVO = new CartVO();
|
||||
BeanUtils.copyProperties(item, cartVO);
|
||||
return cartVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.alipay.api.domain.CPBillModifySet;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.Collect;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.collect.CollectAddRequest;
|
||||
import com.cj.jiaqingjiayi.service.CollectService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/collect")
|
||||
@Api(tags = "收藏接口")
|
||||
public class CollectController {
|
||||
|
||||
@Resource
|
||||
private CollectService collectService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "添加收藏")
|
||||
public BaseResponse<Boolean> addCollect(@RequestBody CollectAddRequest collectAddRequest, HttpServletRequest request) {
|
||||
if (collectAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
collectService.validCollect(collectAddRequest);
|
||||
Collect collect = new Collect();
|
||||
collect.setUserId(collectAddRequest.getUserId());
|
||||
BeanUtils.copyProperties(collectAddRequest, collect);
|
||||
Boolean result = collectService.addCollect(collect, request);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一条收藏
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除一条收藏")
|
||||
public BaseResponse<Boolean> deleteCollect(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = commonRequest.getId();
|
||||
LambdaQueryWrapper<Collect> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Collect::getId, id);
|
||||
boolean remove = collectService.remove(wrapper);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.SYSTEM_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所有收藏
|
||||
*/
|
||||
@PostMapping("/delete/all")
|
||||
@ApiOperation(value = "删除所有收藏")
|
||||
public BaseResponse<Boolean> deleteCollectAll(@RequestBody CommonRequest commonRequest,HttpServletRequest request) {
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// Long loginUserId = loginUser.getId();
|
||||
Long userId = commonRequest.getId();
|
||||
LambdaQueryWrapper<Collect> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Collect::getUserId, userId);
|
||||
boolean remove = collectService.remove(wrapper);
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.SYSTEM_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有收藏
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ApiOperation(value = "查询所有收藏")
|
||||
public BaseResponse<List<Collect>> listCollect(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
// Long loginUserId = loginUser.getId();
|
||||
Long userId = commonRequest.getId();
|
||||
LambdaQueryWrapper<Collect> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Collect::getUserId, userId);
|
||||
List<Collect> list = collectService.list(wrapper);
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,222 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Commodities;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.Commodities.CommoditiesAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.Commodities.CommoditiesDeleteRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.Commodities.CommoditiesQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.Commodities.CommoditiesUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.BusinessVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.CommoditiesVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.LoginUserVO;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.CommoditiesService;
|
||||
import com.cj.jiaqingjiayi.service.SpecificationsCommoditiesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "商品接口")
|
||||
@RestController
|
||||
@RequestMapping("/commodities")
|
||||
public class CommoditiesController {
|
||||
|
||||
@Resource
|
||||
private CommoditiesService commoditiesService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Resource
|
||||
private SpecificationsCommoditiesService specificationsCommoditiesService;
|
||||
|
||||
|
||||
/**
|
||||
*添加商品
|
||||
* @param commoditiesAddRequest 添加商品请求体
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "添加商品")
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> addCommodities (@RequestBody CommoditiesAddRequest commoditiesAddRequest, HttpServletRequest request) {
|
||||
if (commoditiesAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Commodities commodities = new Commodities();
|
||||
BeanUtils.copyProperties(commoditiesAddRequest,commodities);
|
||||
//校验
|
||||
commoditiesService.validCommodities(commodities,false);
|
||||
//添加商家id
|
||||
// Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
commodities.setBusinessId(commoditiesAddRequest.getBusinessId());
|
||||
//保存商品信息
|
||||
Long commoditiesId = commoditiesService.addCommodities(commodities);
|
||||
//中间表中添加数据
|
||||
List<Long> specificationsIds = commoditiesAddRequest.getSpecificationsIds();
|
||||
specificationsCommoditiesService.add(commoditiesId,specificationsIds);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param commoditiesDeleteRequest 删除请求
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "删除商品")
|
||||
@PostMapping("/delete")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> deleteCommodities(@RequestBody CommoditiesDeleteRequest commoditiesDeleteRequest, HttpServletRequest request) {
|
||||
if (commoditiesDeleteRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long commoditiesId = commoditiesDeleteRequest.getId();
|
||||
//获取商家id
|
||||
// Business business = businessService.getLoginBusiness(request);
|
||||
Long businessId = commoditiesDeleteRequest.getBusinessId();
|
||||
//校验商品是不是当前登录商家的
|
||||
LambdaQueryWrapper<Commodities> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Commodities::getId, commoditiesId);
|
||||
wrapper.eq(Commodities::getBusinessId, businessId);
|
||||
Commodities commodities = commoditiesService.getOne(wrapper);
|
||||
ThrowUtils.throwIf(commodities == null, ErrorCode.OPERATION_ERROR, "当前商家无权限删除该商品");
|
||||
//删除商品
|
||||
boolean commoditiesRemove = commoditiesService.removeById(commoditiesId);
|
||||
ThrowUtils.throwIf(!commoditiesRemove, ErrorCode.OPERATION_ERROR);
|
||||
//删除中间表信息
|
||||
specificationsCommoditiesService.deleteByCommoditiesId(commoditiesId);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
* @param commoditiesUpdateRequest 更新请求
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "更新商品")
|
||||
@PostMapping("/update")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> updateCommodities (@RequestBody CommoditiesUpdateRequest commoditiesUpdateRequest, HttpServletRequest request) {
|
||||
if (commoditiesUpdateRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Commodities commodities = new Commodities();
|
||||
BeanUtils.copyProperties(commoditiesUpdateRequest, commodities);
|
||||
//校验
|
||||
commoditiesService.validCommodities(commodities, true);
|
||||
//添加商家id
|
||||
// Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
Long businessId = commoditiesUpdateRequest.getBusinessId();
|
||||
commodities.setBusinessId(businessId);
|
||||
//更新商品
|
||||
Boolean updateDishes = commoditiesService.updateCommodities(commodities);
|
||||
ThrowUtils.throwIf(!updateDishes, ErrorCode.OPERATION_ERROR);
|
||||
//更新中间表的信息
|
||||
Long commoditiesId = commodities.getId();
|
||||
List<Long> specificationsIds = commoditiesUpdateRequest.getSpecificationsIds();
|
||||
return ResultUtils.success(specificationsCommoditiesService.updateByCommoditiesId(commoditiesId, specificationsIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品状态
|
||||
* @param commoditiesUpdateRequest 商品请求体
|
||||
* @param request 前端请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "更新商品状态")
|
||||
@PostMapping("/update/status")
|
||||
public BaseResponse<Boolean> updateCommoditiesStatus (@RequestBody CommoditiesUpdateRequest commoditiesUpdateRequest, HttpServletRequest request) {
|
||||
Long id = commoditiesUpdateRequest.getId();
|
||||
String status = commoditiesUpdateRequest.getStatus();
|
||||
if (id == null || StringUtils.isBlank(status)) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR);
|
||||
}
|
||||
|
||||
//获取商家id
|
||||
// Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
Long businessId = commoditiesUpdateRequest.getBusinessId();
|
||||
//更新状态
|
||||
UpdateWrapper<Commodities> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id",id);
|
||||
updateWrapper.eq("businessId",businessId);
|
||||
updateWrapper.set("status",status);
|
||||
return ResultUtils.success(commoditiesService.update(updateWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
*获取商品列表
|
||||
* @param commoditiesQueryRequest 查询请求体
|
||||
* @return 分页列表
|
||||
*/
|
||||
@ApiOperation(value = "获取商品列表")
|
||||
@PostMapping("/list/page/commodities")
|
||||
public BaseResponse<Page<Commodities>> commoditiesPage(@RequestBody CommoditiesQueryRequest commoditiesQueryRequest) {
|
||||
long current = commoditiesQueryRequest.getCurrent();
|
||||
long pageSize = commoditiesQueryRequest.getPageSize();
|
||||
//获取查询条件
|
||||
QueryWrapper<Commodities> wrapper = commoditiesService.getWrapper(commoditiesQueryRequest);
|
||||
//获取商家有的商品
|
||||
Page<Commodities> commoditiesPage = commoditiesService.page(new Page<>(current, pageSize), wrapper);
|
||||
return ResultUtils.success(commoditiesPage);
|
||||
}
|
||||
|
||||
// /**
|
||||
// *获取商品脱敏列表
|
||||
// * @param commoditiesQueryRequest 查询请求体
|
||||
// * @return 分页列表
|
||||
// */
|
||||
// @ApiOperation(value = "获取商品脱敏列表")
|
||||
// @PostMapping("/list/page/commoditiesVO")
|
||||
// public BaseResponse<Page<CommoditiesVO>> commoditiesVOPage(@RequestBody CommoditiesQueryRequest commoditiesQueryRequest) {
|
||||
// long current = commoditiesQueryRequest.getCurrent();
|
||||
// long pageSize = commoditiesQueryRequest.getPageSize();
|
||||
// //获取查询条件
|
||||
// QueryWrapper<Commodities> wrapper = commoditiesService.getWrapper(commoditiesQueryRequest);
|
||||
// //获取商家有的商品
|
||||
// Page<Commodities> commoditiesPage = commoditiesService.page(new Page<>(current, pageSize), wrapper);
|
||||
// //获取脱敏信息列表
|
||||
// List<Commodities> commoditiesList = commoditiesPage.getRecords();
|
||||
// long total = commoditiesPage.getTotal();
|
||||
// List<CommoditiesVO> commoditiesVOList = commoditiesService.getCommoditiesVOList(commoditiesList);
|
||||
// Page<CommoditiesVO> commoditiesVOPage = new Page<>(current, pageSize, total);
|
||||
// commoditiesVOPage.setRecords(commoditiesVOList);
|
||||
// return ResultUtils.success(commoditiesVOPage);
|
||||
// }
|
||||
|
||||
/**
|
||||
*根据id获取商品
|
||||
*/
|
||||
@ApiOperation(value = "根据商品id获取商品信息")
|
||||
@GetMapping("/getById/commodities")
|
||||
public BaseResponse<CommoditiesVO> getCommoditiesById(@RequestParam Long id) {
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.NULL_ERROR);
|
||||
Commodities byId = commoditiesService.getById(id);
|
||||
CommoditiesVO commoditiesVO = commoditiesService.getCommoditiesVO(byId);
|
||||
ThrowUtils.throwIf(commoditiesVO == null, ErrorCode.NULL_ERROR, "不存在该商品");
|
||||
return ResultUtils.success(commoditiesVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.contant.FileConstant;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.UploadFileRequest;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.cj.jiaqingjiayi.model.enums.FileUploadBizEnum;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class FileController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@PostMapping("/upload/server/not_login")
|
||||
public BaseResponse<String> uploadServerNotLogin (@RequestPart("file")MultipartFile multipartFile, UploadFileRequest uploadFileRequest) {
|
||||
//获取业务名称
|
||||
String biz = uploadFileRequest.getBiz();
|
||||
FileUploadBizEnum fileUploadBizEnum = FileUploadBizEnum.getEnumByValue(biz);
|
||||
if (fileUploadBizEnum == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
//校验文件
|
||||
validfile(multipartFile, fileUploadBizEnum);
|
||||
//文件目录:根据业务,用户来划分
|
||||
String uuid = RandomStringUtils.randomAlphabetic(8);
|
||||
String fileName = uuid + "-" + multipartFile.getOriginalFilename();
|
||||
String filePath = String.format("/%s/%s/%s", fileUploadBizEnum.getValue(), 0, fileName);
|
||||
try {
|
||||
//判断目录是否存在
|
||||
File file = new File(FileConstant.SERVER_UPLOAD_DIR, filePath);
|
||||
log.info("filepath:{}",file);
|
||||
if (!file.exists()) {
|
||||
boolean mkdirs = file.mkdirs();
|
||||
if (!mkdirs) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR,"创建目录失败");
|
||||
}
|
||||
}
|
||||
multipartFile.transferTo(new File(FileConstant.SERVER_UPLOAD_DIR, filePath));
|
||||
// 返回可访问地址
|
||||
return ResultUtils.success(FileConstant.SERVER_HOST + filePath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error("file upload error, filePath = " + filePath, e);
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR,"上传失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/upload/server")
|
||||
public BaseResponse<String> uploadServerFile(@RequestPart("file") MultipartFile multipartFile, UploadFileRequest uploadFileRequest, HttpServletRequest request) {
|
||||
// 获取业务名称
|
||||
String biz = uploadFileRequest.getBiz();
|
||||
FileUploadBizEnum fileUploadBizEnum = FileUploadBizEnum.getEnumByValue(biz);
|
||||
if (fileUploadBizEnum == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "业务名称错误");
|
||||
}
|
||||
//校验文件
|
||||
validfile(multipartFile,fileUploadBizEnum);
|
||||
//校验用户是否登录
|
||||
User loginUser = userService.getLoginUser(request);
|
||||
if (loginUser == null) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "未登录");
|
||||
}
|
||||
// 文件目录:根据业务、用户来划分
|
||||
String uuid = RandomStringUtils.randomAlphabetic(8);
|
||||
String fileName = uuid + "-" + multipartFile.getOriginalFilename();
|
||||
String filePath = String.format("/%s/%s/%s", fileUploadBizEnum.getValue(), loginUser.getId(), fileName);
|
||||
try {
|
||||
File file = new File(FileConstant.SERVER_UPLOAD_DIR, filePath);
|
||||
if (!file.exists()) {
|
||||
//创建目录
|
||||
boolean mkdirs = file.mkdirs();
|
||||
|
||||
if (!mkdirs) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "创建目录失败");
|
||||
}
|
||||
}
|
||||
multipartFile.transferTo(new File(FileConstant.SERVER_UPLOAD_DIR,filePath));
|
||||
//返回可访问的地址
|
||||
return ResultUtils.success(FileConstant.SERVER_HOST + filePath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error("file upload error, filepath = " + filePath, e);
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验文件
|
||||
*/
|
||||
private void validfile(MultipartFile multipartFile, FileUploadBizEnum fileUploadBizEnum) {
|
||||
//文件大小
|
||||
long fileSize = multipartFile.getSize();
|
||||
//文件后缀
|
||||
String fileSuffix = FileUtil.getSuffix(multipartFile.getOriginalFilename());
|
||||
final long TWO_M = 2*1024*1024L;
|
||||
if (FileUploadBizEnum.USER_AVATAR.equals(fileUploadBizEnum)) {
|
||||
if (fileSize > TWO_M) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "文件大小不能超过 2M");
|
||||
}
|
||||
if (!Arrays.asList("jpeg", "jpg", "svg", "png", "webp").contains(fileSuffix)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "文件类型错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.CommoditiesGroup;
|
||||
import com.cj.jiaqingjiayi.model.request.group.AddGroupRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.GroupVO;
|
||||
import com.cj.jiaqingjiayi.service.CommoditiesGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "分组接口")
|
||||
@RestController
|
||||
@RequestMapping("/group")
|
||||
public class GroupController {
|
||||
|
||||
@Resource
|
||||
private CommoditiesGroupService groupService;
|
||||
|
||||
/**
|
||||
*添加分组
|
||||
*/
|
||||
@ApiOperation(value = "添加分组")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addGroup(@RequestBody AddGroupRequest addGroupRequest){
|
||||
ThrowUtils.throwIf(addGroupRequest == null, ErrorCode.NULL_ERROR);
|
||||
|
||||
CommoditiesGroup group = new CommoditiesGroup();
|
||||
BeanUtils.copyProperties(addGroupRequest, group);
|
||||
|
||||
groupService.validGroup(group, true);
|
||||
|
||||
Long added = groupService.addGroup(group);
|
||||
ThrowUtils.throwIf(added < 0, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(added);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除分组
|
||||
*/
|
||||
@ApiOperation(value = "删除分组")
|
||||
@GetMapping("/delete")
|
||||
public BaseResponse<Boolean> deleteGroup(@RequestParam String groupName){
|
||||
ThrowUtils.throwIf(groupName == null, ErrorCode.NULL_ERROR);
|
||||
|
||||
|
||||
CommoditiesGroup group = new CommoditiesGroup();
|
||||
group.setGroupName(groupName);
|
||||
|
||||
groupService.validGroup(group, false);
|
||||
|
||||
Boolean deleted = groupService.deleteGroup(groupName);
|
||||
ThrowUtils.throwIf(!deleted, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
*查询分组视图
|
||||
*/
|
||||
@ApiOperation(value = "查询分组")
|
||||
@GetMapping("/queryGroupVO")
|
||||
public BaseResponse<List<GroupVO>> queryGroup(){
|
||||
|
||||
List<CommoditiesGroup> list = groupService.list();
|
||||
|
||||
List<GroupVO> groupVO = groupService.getGroupVO(list);
|
||||
|
||||
return ResultUtils.success(groupVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.*;
|
||||
import com.cj.jiaqingjiayi.model.request.manicurist.*;
|
||||
import com.cj.jiaqingjiayi.model.vo.ManicuristVO;
|
||||
import com.cj.jiaqingjiayi.service.ManicuristService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cj.jiaqingjiayi.contant.UserConstant.USER_SALT;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "美甲师接口")
|
||||
@RequestMapping("/manicurist")
|
||||
public class ManicuristController {
|
||||
|
||||
@Resource
|
||||
private ManicuristService manicuristService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加美甲师(管理员)
|
||||
* @param adminManicuristAddRequest
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "管理员添加美甲师")
|
||||
@PostMapping("/adminAdd")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Long> AdminAddManicurist(@RequestBody AdminManicuristAddRequest adminManicuristAddRequest, HttpServletRequest request) {
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
|
||||
ThrowUtils.throwIf(adminManicuristAddRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
User user = new User();
|
||||
BeanUtils.copyProperties(adminManicuristAddRequest, user);
|
||||
Manicurist manicurist = new Manicurist();
|
||||
BeanUtils.copyProperties(adminManicuristAddRequest, manicurist);
|
||||
ManicuristAuth manicuristAuth = new ManicuristAuth();
|
||||
BeanUtils.copyProperties(adminManicuristAddRequest, manicuristAuth);
|
||||
|
||||
//对每个应该校验的业务进行校验
|
||||
manicuristService.validUser(user, true);
|
||||
manicuristService.validManicurist(manicurist, true);
|
||||
manicuristService.validManicuristAuth(manicuristAuth, true);
|
||||
|
||||
//插入到表中
|
||||
manicuristService.adminAddManicurist(user, manicurist, manicuristAuth);
|
||||
|
||||
return ResultUtils.success(manicurist.getId(),"添加美甲师成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证成为美甲师
|
||||
* @param manicuristAddRequest
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "认证美甲师")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addManicurist(@RequestBody ManicuristAddRequest manicuristAddRequest, HttpServletRequest request) {
|
||||
ThrowUtils.throwIf(manicuristAddRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
//获取登录的用户
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
|
||||
Manicurist manicurist = new Manicurist();
|
||||
//如果不给美甲师名字默认为用户名字
|
||||
// if (manicuristAddRequest.getManicuristName() == null) {
|
||||
// manicuristAddRequest.setManicuristName(loginUser.getUsername());
|
||||
// }
|
||||
BeanUtils.copyProperties(manicuristAddRequest, manicurist);
|
||||
ManicuristAuth manicuristAuth = new ManicuristAuth();
|
||||
BeanUtils.copyProperties(manicuristAddRequest, manicuristAuth);
|
||||
manicuristService.validManicurist(manicurist, true);
|
||||
manicuristService.validManicuristAuth(manicuristAuth, true);
|
||||
|
||||
//插入到表中
|
||||
manicuristService.addManicurist(manicuristAddRequest.getUserId(), manicurist, manicuristAuth);
|
||||
|
||||
return ResultUtils.success(manicurist.getId(),"添加美甲师成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除美甲师
|
||||
*/
|
||||
@ApiOperation(value = "删除美甲师")
|
||||
@PostMapping("/deleteMan")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> DeleteManicurist(long id, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
|
||||
manicuristService.deleteMan(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员修改美甲师信息
|
||||
* 确认一定会传入美甲师的id?
|
||||
*/
|
||||
@ApiOperation(value = "管理修改美甲师信息")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> UpdateManicurist(@RequestBody ManicuristUpdateRequest manicuristUpdateRequest, HttpServletRequest request){
|
||||
|
||||
|
||||
if (manicuristUpdateRequest == null || manicuristUpdateRequest.getId() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "传入参数为空");
|
||||
}
|
||||
|
||||
Manicurist manicurist = new Manicurist();
|
||||
|
||||
if(manicuristUpdateRequest.getBusinessId() != null){
|
||||
//检验美甲师绑定的商家是否存在
|
||||
manicuristService.validManBus(manicuristUpdateRequest.getBusinessId());
|
||||
}
|
||||
|
||||
BeanCopyUtils.copyPropertiesIgnoreEmpty(manicuristUpdateRequest, manicurist);
|
||||
//校验一下
|
||||
manicuristService.validManicurist(manicurist, false);
|
||||
|
||||
if (manicuristUpdateRequest.getAuditStatus() == 1){
|
||||
Manicurist serviceById = manicuristService.getById(manicurist);
|
||||
User user = userService.getById(serviceById.getUserId());
|
||||
user.setUserRole(3);
|
||||
}
|
||||
|
||||
boolean result = manicuristService.updateById(manicurist);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true, "修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
*美甲师修改个人信息
|
||||
*/
|
||||
//TODO:后续可能会改
|
||||
@ApiOperation(value = "美甲师修改个人信息")
|
||||
@PostMapping("/myUpdate")
|
||||
public BaseResponse<Boolean> MyUpdateManicurist(@RequestBody MyManicuristUpdateRequest myUpdateRequest, HttpServletRequest request){
|
||||
ThrowUtils.throwIf(myUpdateRequest == null, ErrorCode.NULL_ERROR);
|
||||
|
||||
// User logingUser = userService.getLoginUser(request);
|
||||
Long userId = myUpdateRequest.getUserId();
|
||||
QueryWrapper<Manicurist> manicuristQueryWrapper = new QueryWrapper<Manicurist>().eq("userId", userId);
|
||||
|
||||
Manicurist manicuristLog = manicuristService.getOne(manicuristQueryWrapper);
|
||||
ThrowUtils.throwIf(manicuristLog == null , ErrorCode.NULL_ERROR);
|
||||
Long manId = manicuristLog.getId();
|
||||
|
||||
Manicurist manicurist = new Manicurist();
|
||||
manicurist.setId(manId);
|
||||
BeanUtils.copyProperties(myUpdateRequest, manicurist);
|
||||
manicuristService.validManicurist(manicurist, false);
|
||||
|
||||
|
||||
boolean result = manicuristService.updateById(manicurist);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "修改失败");
|
||||
return ResultUtils.success(true, "修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询美甲师
|
||||
*/
|
||||
@ApiOperation(value = "根据id获取美甲师")
|
||||
@GetMapping("/queryById")
|
||||
public BaseResponse<Manicurist> QueryByIdManicurist(@RequestParam Integer manicuristId, HttpServletRequest request){
|
||||
|
||||
ThrowUtils.throwIf(manicuristId < 0, ErrorCode.NULL_ERROR, "id不符合规范");
|
||||
Manicurist manicurist = manicuristService.getById(manicuristId);
|
||||
ThrowUtils.throwIf(manicurist == null, ErrorCode.PARAMS_ERROR, "美甲师不存在");
|
||||
return ResultUtils.success(manicurist);
|
||||
}
|
||||
/**
|
||||
* 查询全部美甲师
|
||||
*/
|
||||
@ApiOperation(value = "查询全部美甲师")
|
||||
@PostMapping("/queryAll")
|
||||
public BaseResponse<List<Manicurist>> QueryAllManicurist(@RequestBody CommonRequest commonRequest, HttpServletRequest request){
|
||||
// userService.isAdmin(request);
|
||||
|
||||
Long businessId = commonRequest.getId();
|
||||
QueryWrapper<Manicurist> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(ObjectUtils.isNotEmpty(businessId),"businessId", businessId);
|
||||
|
||||
|
||||
List<Manicurist> manicuristList = manicuristService.list(queryWrapper);
|
||||
return ResultUtils.success(manicuristList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部美甲师(用户)
|
||||
* 用于展示店铺信息
|
||||
*/
|
||||
@ApiOperation(value = "用户查询全部美甲师")
|
||||
@GetMapping("/userQueryAll")
|
||||
public BaseResponse<List<ManicuristVO>> UserQueryAllManicurist(@RequestParam Long businessId){
|
||||
|
||||
QueryWrapper<Manicurist> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("businessId", businessId);
|
||||
List<Manicurist> manicuristList = manicuristService.list(queryWrapper);
|
||||
List<ManicuristVO> manicuristVOList = manicuristService.getManicuristVO(manicuristList);
|
||||
return ResultUtils.success(manicuristVOList);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 搜索美甲师
|
||||
// */
|
||||
// @ApiOperation(value = "用户查询美甲师")
|
||||
// @PostMapping("/userQuery")
|
||||
// public BaseResponse<List<ManicuristVO>> UserQueryManicurist(@RequestBody ManicuristQueryRequest manicuristQueryRequest){
|
||||
// ThrowUtils.throwIf(manicuristQueryRequest == null, ErrorCode.NULL_ERROR);
|
||||
//
|
||||
// QueryWrapper<Manicurist> queryWrapper = manicuristService.getQueryWrapper(manicuristQueryRequest);
|
||||
//
|
||||
// List<Manicurist> manicuristList = manicuristService.list(queryWrapper);
|
||||
//
|
||||
// List<ManicuristVO> manicuristVO = manicuristService.getManicuristVO(manicuristList);
|
||||
//
|
||||
// return ResultUtils.success(manicuristVO);
|
||||
// }
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicurist;
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicuristsign;
|
||||
import com.cj.jiaqingjiayi.model.request.manicuristSign.ManicuristSignAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.ManicuristsignVO;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.ManicuristService;
|
||||
import com.cj.jiaqingjiayi.service.ManicuristsignService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "美甲师签约接口")
|
||||
@RestController
|
||||
@RequestMapping("/manicuristSign")
|
||||
public class ManicuristSignController {
|
||||
|
||||
@Resource
|
||||
private ManicuristsignService manicuristsignService;
|
||||
|
||||
@Resource
|
||||
private ManicuristService manicuristService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
/**
|
||||
* 添加签约
|
||||
*/
|
||||
@ApiOperation(value = "添加美甲师签约")
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Long> addManicuristSign(@RequestBody ManicuristSignAddRequest addRequest){
|
||||
|
||||
ThrowUtils.throwIf(addRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
Manicuristsign manicuristsign = new Manicuristsign();
|
||||
|
||||
BeanUtils.copyProperties(addRequest, manicuristsign);
|
||||
|
||||
boolean save = manicuristsignService.save(manicuristsign);
|
||||
|
||||
if (!save) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "添加失败");
|
||||
}
|
||||
return ResultUtils.success(manicuristsign.getId(), "添加成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过签约
|
||||
*/
|
||||
@ApiOperation(value = "同意美甲师签约")
|
||||
@GetMapping("/success")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> succManicuristSign(@RequestParam Long signId){
|
||||
|
||||
ThrowUtils.throwIf(signId < 0 , ErrorCode.PARAMS_ERROR);
|
||||
//拿到签约数据
|
||||
Manicuristsign manicuristsign = manicuristsignService.getById(signId);
|
||||
//拿到签约的美甲师数据
|
||||
Manicurist manicurist = manicuristService.getById(manicuristsign.getManicuristId());
|
||||
ThrowUtils.throwIf(manicurist == null, ErrorCode.SYSTEM_ERROR);
|
||||
Manicurist manicuristNew = new Manicurist();
|
||||
|
||||
QueryWrapper<Business> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("businessName", manicuristsign.getBusinessName());
|
||||
Business business = businessService.getOne(queryWrapper);
|
||||
manicurist.setBusinessId(business.getId());
|
||||
//更新美甲师所属的美甲店铺
|
||||
BeanUtils.copyProperties(manicurist, manicuristNew);
|
||||
manicuristsign.setAuditStatus(1);
|
||||
|
||||
boolean flag = manicuristService.updateById(manicuristNew);
|
||||
ThrowUtils.throwIf(!flag , ErrorCode.OPERATION_ERROR);
|
||||
|
||||
boolean updateById = manicuristsignService.updateById(manicuristsign);
|
||||
ThrowUtils.throwIf(!updateById, ErrorCode.SYSTEM_ERROR);
|
||||
|
||||
return ResultUtils.success(true, "审核通过");
|
||||
}
|
||||
|
||||
/**
|
||||
* 不同意美甲师签约
|
||||
*/
|
||||
@ApiOperation(value = "不同意美甲师签约")
|
||||
@GetMapping("/refuse")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> refuseManicuristSign(@RequestParam Long signId){
|
||||
|
||||
ThrowUtils.throwIf(signId < 0 , ErrorCode.PARAMS_ERROR);
|
||||
//拿到签约数据
|
||||
Manicuristsign manicuristsign = manicuristsignService.getById(signId);
|
||||
|
||||
manicuristsign.setAuditStatus(2);
|
||||
|
||||
boolean updateById = manicuristsignService.updateById(manicuristsign);
|
||||
ThrowUtils.throwIf(!updateById, ErrorCode.SYSTEM_ERROR);
|
||||
|
||||
return ResultUtils.success(true, "审核不通过");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除签约
|
||||
*/
|
||||
@ApiOperation(value = "根据id删除签约")
|
||||
@GetMapping("/delete")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> deleteManicuristSign(@RequestParam Long signId){
|
||||
|
||||
ThrowUtils.throwIf(signId < 0 , ErrorCode.PARAMS_ERROR);
|
||||
|
||||
boolean b = manicuristsignService.removeById(signId);
|
||||
ThrowUtils.throwIf(!b, ErrorCode.SYSTEM_ERROR);
|
||||
|
||||
return ResultUtils.success(true, "删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前店铺签约列表
|
||||
*/
|
||||
@ApiOperation(value = "查询签约列表")
|
||||
@GetMapping("/select")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<List<ManicuristsignVO>> selectManicuristSign(@RequestParam Long businessId){
|
||||
|
||||
ThrowUtils.throwIf(businessId < 0 , ErrorCode.PARAMS_ERROR);
|
||||
|
||||
QueryWrapper<Manicuristsign> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("businessId", businessId);
|
||||
|
||||
List<Manicuristsign> manicuristsignList = manicuristsignService.list(queryWrapper);
|
||||
List<ManicuristsignVO> manicuristsignVOList = manicuristsignService.getManicuristsignVO(manicuristsignList);
|
||||
return ResultUtils.success(manicuristsignVOList);
|
||||
}
|
||||
}
|
@ -0,0 +1,505 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.contant.CommonConstant;
|
||||
import com.cj.jiaqingjiayi.contant.UserConstant;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.*;
|
||||
import com.cj.jiaqingjiayi.model.request.order.*;
|
||||
import com.cj.jiaqingjiayi.model.vo.OrdersExcelVO;
|
||||
import com.cj.jiaqingjiayi.model.vo.OrdersVO;
|
||||
import com.cj.jiaqingjiayi.service.*;
|
||||
import com.cj.jiaqingjiayi.utils.ExcelUtils;
|
||||
import com.cj.jiaqingjiayi.utils.SqlUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 订单相关接口
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "订单接口")
|
||||
@RequestMapping("/orders")
|
||||
public class OrdersController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Resource
|
||||
private AppointmentsService appointmentsService;
|
||||
|
||||
@Resource
|
||||
private OrderItemsService orderItemsService;
|
||||
|
||||
@Resource
|
||||
private CommoditiesService commoditiesService;
|
||||
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*
|
||||
* @return 订单id
|
||||
*/
|
||||
@ApiOperation(value = "订单创建接口")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addOrders(@RequestBody OrderAddRequest orderAddRequest, HttpServletRequest request) {
|
||||
if (orderAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
//校验是否登录
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
|
||||
String appointmentTime = orderAddRequest.getAppointmentTime();
|
||||
Long id = null;
|
||||
if (ObjectUtils.isNotEmpty(appointmentTime)) {
|
||||
LocalDateTime dateTime;
|
||||
|
||||
// 判断 appointmentTime 是否是 HH:mm 格式
|
||||
if (appointmentTime.matches("\\d{2}:\\d{2}")) {
|
||||
// 只有时间,没有日期,补上当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
LocalTime time = LocalTime.parse(appointmentTime, timeFormatter);
|
||||
dateTime = LocalDateTime.of(today, time);
|
||||
} else {
|
||||
// 传入的是完整格式 yyyy-MM-dd HH:mm,直接解析
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
dateTime = LocalDateTime.parse(appointmentTime, formatter);
|
||||
}
|
||||
|
||||
// 转换成 Date 类型
|
||||
Date date1 = Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
Appointments appointments = new Appointments();
|
||||
appointments.setAppointmentTime(date1);
|
||||
|
||||
BeanUtils.copyProperties(orderAddRequest, appointments);
|
||||
appointments.setUserId(appointments.getUserId());
|
||||
|
||||
appointmentsService.valid(appointments);
|
||||
|
||||
// 返回预约号
|
||||
id = appointmentsService.addAppointments(appointments);
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.PARAMS_ERROR, "预约失败");
|
||||
}
|
||||
|
||||
// 提取订单
|
||||
Orders orders = new Orders();
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
BeanUtils.copyProperties(orderAddRequest, orders);
|
||||
orders.setUserId(orders.getUserId());
|
||||
ordersService.validOrder(orders);
|
||||
// 提取订单详情
|
||||
List<OrderItemsAddRequest> detailAddRequest = orderAddRequest.getOrderItemsAddRequest();
|
||||
List<OrderItems> orderItemsList = detailAddRequest.stream().map(item -> {
|
||||
OrderItems orderItems = new OrderItems();
|
||||
BeanUtils.copyProperties(item, orderItems);
|
||||
orderItemsService.validOrderItems(orderItems);
|
||||
Long commoditiesId = orderItems.getCommoditiesId();
|
||||
// 根据商品设置价格
|
||||
Commodities commodities = commoditiesService.getById(commoditiesId);
|
||||
BigDecimal commoditiesPrice = BigDecimal.valueOf(commodities.getCommoditiesPrice());
|
||||
orderItems.setPrice(commoditiesPrice);
|
||||
double subtotal = commodities.getCommoditiesPrice() * orderItems.getQuantity();
|
||||
orderItems.setSubtotal(BigDecimal.valueOf(subtotal));
|
||||
return orderItems;
|
||||
}).toList();
|
||||
// 创建订单
|
||||
orders.setAppointmentId(id);
|
||||
long orderId = ordersService.addOrder(orders, orderItemsList);
|
||||
return ResultUtils.success(orderId, "订单创建成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@ApiOperation(value = "订单取消接口")
|
||||
@PostMapping("/cancel")
|
||||
public BaseResponse<Boolean> cancelOrder(@RequestBody OrderCancelRequest orderCancelRequest, HttpServletRequest request) {
|
||||
Long orderId = orderCancelRequest.getId();
|
||||
if (orderId == null || orderId <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
//
|
||||
Orders orders = ordersService.getById(orderId);
|
||||
ThrowUtils.throwIf(orders == null, ErrorCode.NOT_FOUND_ERROR);
|
||||
ThrowUtils.throwIf(orders.getPaymentStatus() != 0, ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||
// 判断是否为自己的订单
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
if (!orders.getUserId().equals(orderCancelRequest.getUserId())) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH);
|
||||
}
|
||||
// 修改订单状态
|
||||
orders.setPaymentStatus(3);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.SYSTEM_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成订单
|
||||
*/
|
||||
@ApiOperation(value = "订单完成接口")
|
||||
@PostMapping("/success")
|
||||
public BaseResponse<Boolean> successOrder(@RequestBody OrderCancelRequest orderCancelRequest, HttpServletRequest request) {
|
||||
Long orderId = orderCancelRequest.getId();
|
||||
if (orderId == null || orderId <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
//
|
||||
Orders orders = ordersService.getById(orderId);
|
||||
ThrowUtils.throwIf(orders == null, ErrorCode.NOT_FOUND_ERROR);
|
||||
ThrowUtils.throwIf(orders.getPaymentStatus() != 0, ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||
// 判断是否为自己的订单
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
if (!orders.getUserId().equals(orderCancelRequest.getUserId())) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH);
|
||||
}
|
||||
// 修改订单状态
|
||||
orders.setPaymentStatus(4);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.SYSTEM_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 id 获取订单信息
|
||||
*/
|
||||
@ApiOperation(value = "根据 id 获取订单信息")
|
||||
@GetMapping("/get")
|
||||
public BaseResponse<OrdersVO> getOrderVOById(@RequestParam Long id) {
|
||||
if (id <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Orders orders = ordersService.getById(id);
|
||||
ThrowUtils.throwIf(orders == null, ErrorCode.NOT_FOUND_ERROR);
|
||||
return ResultUtils.success(ordersService.getOrdersVO(orders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取订单列表
|
||||
*/
|
||||
@PostMapping("/list/page")
|
||||
@ApiOperation(value = "分页获取订单列表")
|
||||
public BaseResponse<Page<Orders>> listOrdersByPage(@RequestBody OrderQueryRequest orderQueryRequest, HttpServletRequest request) {
|
||||
// userService.isAdmin(request);
|
||||
long current = orderQueryRequest.getCurrent();
|
||||
long size = orderQueryRequest.getPageSize();
|
||||
Page<Orders> ordersPage = ordersService.page(new Page<>(current, size),
|
||||
ordersService.getQueryWrapper(orderQueryRequest));
|
||||
return ResultUtils.success(ordersPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的订单
|
||||
*/
|
||||
@ApiOperation(value = "获取自己的订单")
|
||||
@PostMapping("/my/page")
|
||||
public BaseResponse<Page<OrdersVO>> getMyOrders(@RequestBody MyOrderQueryRequest myOrderQueryRequest, HttpServletRequest request) {
|
||||
if (myOrderQueryRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
long current = myOrderQueryRequest.getCurrent();
|
||||
long size = myOrderQueryRequest.getPageSize();
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
Integer userRole = myOrderQueryRequest.getUserRole();
|
||||
OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
|
||||
BeanUtils.copyProperties(myOrderQueryRequest, orderQueryRequest);
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
// if (userRole.equals(UserConstant.BUSINESS_ROLE)) {
|
||||
// // 商家获取订单
|
||||
// Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
// queryWrapper.eq("businessId", loginBusiness.getId());
|
||||
// } else {
|
||||
// // 用户获取订单
|
||||
// queryWrapper.eq("userId", myOrderQueryRequest.getUserId());
|
||||
// }
|
||||
Page<Orders> ordersPage = ordersService.page(new Page<>(current, size),
|
||||
queryWrapper);
|
||||
Page<OrdersVO> ordersVOPage = new Page<>(current, size, ordersPage.getTotal());
|
||||
List<OrdersVO> ordersVOList = ordersService.getOrdersVO(ordersPage.getRecords());
|
||||
ordersVOPage.setRecords(ordersVOList);
|
||||
return ResultUtils.success(ordersVOPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计
|
||||
*/
|
||||
@ApiOperation(value = "订单统计")
|
||||
@PostMapping("/count")
|
||||
public BaseResponse<String> ordersCount(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
String type = orderCountRequest.getType();
|
||||
Integer state = orderCountRequest.getPaymentStatus();
|
||||
Long businessId = orderCountRequest.getBusinessId();
|
||||
String startTime = orderCountRequest.getStartTime();
|
||||
String endTime = orderCountRequest.getEndTime();
|
||||
|
||||
// 参数校验
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR, "Type不能为空");
|
||||
ThrowUtils.throwIf(businessId == null, ErrorCode.PARAMS_ERROR, "BusinessId不能为空");
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(state != null, "paymentStatus", state);
|
||||
queryWrapper.eq("businessId", businessId);
|
||||
return getStringBaseResponse(type, startTime, endTime, queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单金额统计(商家)
|
||||
*/
|
||||
@ApiOperation(value = "订单金额统计")
|
||||
@PostMapping("/count/money")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<List<BigDecimal>> ordersCountMoney(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
// 获取查询类型
|
||||
String type = orderCountRequest.getType();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
|
||||
BeanUtils.copyProperties(orderCountRequest, orderQueryRequest);
|
||||
List<BigDecimal> moneyCountList = new ArrayList<>();
|
||||
if (type.equals("week")) {
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter startFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
|
||||
DateTimeFormatter endFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59");
|
||||
// 遍历查询7天数据,放入数组
|
||||
for (int i = 0; i <= 6; i++) {
|
||||
LocalDate date = today.minusDays(i);
|
||||
orderQueryRequest.setStartTime(date.format(startFormatter));
|
||||
orderQueryRequest.setEndTime(date.format(endFormatter));
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
moneyCountList.add(money);
|
||||
}
|
||||
} else {
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
moneyCountList.add(money);
|
||||
}
|
||||
return ResultUtils.success(moneyCountList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单数量统计(商家)
|
||||
*/
|
||||
@ApiOperation(value = "订单数量统计")
|
||||
@PostMapping("/count/number")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<List<Long>> ordersCountNumber(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
// 获取查询类型
|
||||
String type = orderCountRequest.getType();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
OrderQueryRequest orderQueryRequest = new OrderQueryRequest();
|
||||
BeanUtils.copyProperties(orderCountRequest, orderQueryRequest);
|
||||
List<Long> numberCountList = new ArrayList<>();
|
||||
if (type.equals("week")) {
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter startFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
|
||||
DateTimeFormatter endFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59");
|
||||
// 遍历查询7天数据,放入数组
|
||||
for (int i = 0; i <= 6; i++) {
|
||||
LocalDate date = today.minusDays(i);
|
||||
orderQueryRequest.setStartTime(date.format(startFormatter));
|
||||
orderQueryRequest.setEndTime(date.format(endFormatter));
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
long count = ordersService.count(queryWrapper );
|
||||
numberCountList.add(count);
|
||||
}
|
||||
} else {
|
||||
QueryWrapper<Orders> queryWrapper = ordersService.getQueryWrapper(orderQueryRequest);
|
||||
long count = ordersService.count(queryWrapper);
|
||||
numberCountList.add(count);
|
||||
}
|
||||
return ResultUtils.success(numberCountList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计(web端)
|
||||
*/
|
||||
@ApiOperation(value = "订单统计(web端)")
|
||||
@PostMapping("/count/web")
|
||||
//@AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<String> ordersCountByWeb(@RequestBody OrderCountRequest orderCountRequest) {
|
||||
String type = orderCountRequest.getType();
|
||||
Integer state = orderCountRequest.getPaymentStatus();
|
||||
String businessName = orderCountRequest.getBusinessName();
|
||||
Long businessState = orderCountRequest.getBusinessState();
|
||||
String startTime = orderCountRequest.getStartTime();
|
||||
String endTime = orderCountRequest.getEndTime();
|
||||
List<Long> businessIdList = new ArrayList<>();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(type), ErrorCode.PARAMS_ERROR);
|
||||
if (businessName != null || businessState != null) {
|
||||
QueryWrapper<Business> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StringUtils.isNotBlank(businessName), "businessName", businessName);
|
||||
wrapper.eq(businessState != null, "state", businessState);
|
||||
List<Business> businessList = businessService.list(wrapper);
|
||||
if (CollectionUtils.isEmpty(businessList)) {
|
||||
return ResultUtils.success("0");
|
||||
}
|
||||
businessIdList = businessList.stream().map(Business::getId).collect(Collectors.toList());
|
||||
}
|
||||
QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(state != null, "paymentStatus", state);
|
||||
queryWrapper.in(!CollectionUtils.isEmpty(businessIdList), "businessId", businessIdList);
|
||||
return getStringBaseResponse(type, startTime, endTime, queryWrapper);
|
||||
}
|
||||
|
||||
private BaseResponse<String> getStringBaseResponse(String type, String startTime, String endTime, QueryWrapper<Orders> queryWrapper) {
|
||||
queryWrapper.ge(StringUtils.isNotBlank(startTime), "createTime", startTime);
|
||||
queryWrapper.le(StringUtils.isNotBlank(endTime), "createTime", endTime);
|
||||
if (type.equals("money")) {
|
||||
List<Orders> ordertList = ordersService.list(queryWrapper);
|
||||
BigDecimal money = new BigDecimal("0");
|
||||
for (Orders order : ordertList) {
|
||||
money = money.add(order.getTotalPrice());
|
||||
}
|
||||
String strMoney = String.valueOf(money);
|
||||
return ResultUtils.success(strMoney);
|
||||
} else if (type.equals("number")) {
|
||||
long count = ordersService.count(queryWrapper);
|
||||
String strNumber = String.valueOf(count);
|
||||
return ResultUtils.success(strNumber);
|
||||
} else {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "type不正确");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 抢单
|
||||
* @param commonRequest 订单id
|
||||
* @param request 当前登录用户
|
||||
* @return 是否抢单成功
|
||||
*/
|
||||
@ApiOperation(value = "抢单")
|
||||
@PostMapping("/get/order")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> getOrder(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
if (commonRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long ordersId = commonRequest.getId();
|
||||
// Errand loginErrand = errandService.getLoginErrand(request);
|
||||
// Long loginErrandId = loginErrand.getId();
|
||||
// ErrandOrder errandOrder = errandOrderService.getOne(Wrappers.<ErrandOrder>lambdaQuery()
|
||||
// .eq(ErrandOrder::getOrderId, ordersId));
|
||||
// Integer state = loginErrand.getState();
|
||||
// if (state != 1) {
|
||||
// throw new BusinessException(ErrorCode.FORBIDDEN_ERROR, "当前跑腿不可抢单");
|
||||
// }
|
||||
|
||||
// errandService.updateTotal(loginErrand, true);
|
||||
|
||||
// 开始事务
|
||||
Orders orders = ordersService.getOrderWithPessimisticLock(ordersId);
|
||||
|
||||
// 判断订单是否已被抢
|
||||
if (orders == null || orders.getManicuristId() != null) {
|
||||
return ResultUtils.success(false, "该订单已被抢"); // 订单已经被抢或不存在
|
||||
}
|
||||
|
||||
// 更新订单的状态
|
||||
orders.setManicuristId(commonRequest.getManicuristId());
|
||||
orders.setClaimStatus(1);
|
||||
boolean update = ordersService.updateById(orders);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR, "抢单失败");
|
||||
|
||||
|
||||
|
||||
// errandOrder.setErrandState(2); // 2待取货
|
||||
// boolean update1 = errandOrderService.updateById(errandOrder);
|
||||
// ThrowUtils.throwIf(!update1, ErrorCode.OPERATION_ERROR, "更新跑腿订单关联失败");
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/download")
|
||||
public void download(@RequestBody OrderQueryRequest orderQueryRequest, HttpServletResponse response) throws IOException {
|
||||
String startTime = orderQueryRequest.getStartTime();
|
||||
String endTime = orderQueryRequest.getEndTime();
|
||||
Long businessId = orderQueryRequest.getBusinessId();
|
||||
String sortOrder = orderQueryRequest.getSortOrder();
|
||||
String sortField = orderQueryRequest.getSortField();
|
||||
// 获取数据
|
||||
QueryWrapper<Orders> wrapper = new QueryWrapper<>();
|
||||
wrapper.ge(StringUtils.isNotBlank(startTime), "createTime", startTime);
|
||||
wrapper.le(StringUtils.isNotBlank(endTime), "createTime", endTime);
|
||||
wrapper.eq("businessId", businessId).and(item -> item.eq("paymentStatus", 1).or().eq("paymentStatus", 2));
|
||||
wrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC),
|
||||
sortField);
|
||||
List<Orders> ordersList = ordersService.list(wrapper);
|
||||
List<OrdersExcelVO> ordersExcelVOList = ordersList.stream().map(item -> {
|
||||
OrdersExcelVO ordersExcelVO = new OrdersExcelVO();
|
||||
BeanUtils.copyProperties(item, ordersExcelVO);
|
||||
//改变订单支付状态
|
||||
if (item.getPaymentStatus() == 1) {
|
||||
ordersExcelVO.setState("已完成");
|
||||
} else if (item.getPaymentStatus() == 2) {
|
||||
ordersExcelVO.setState("已退款");
|
||||
}
|
||||
// Date转字符串
|
||||
ordersExcelVO.setCreateTime(ExcelUtils.dateToString(item.getCreateTime()));
|
||||
return ordersExcelVO;
|
||||
}).collect(Collectors.toList());
|
||||
// 设置导出名称
|
||||
ExcelUtils.setExcelResponseProp(response, "订单信息");
|
||||
// 获取输出流名称
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
EasyExcel.write(outputStream, OrdersExcelVO.class) // 对应实体类
|
||||
.sheet("订单数据") // sheet页名称
|
||||
.doWrite(ordersExcelVOList); // 导出的数据集合
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,99 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Recruitment;
|
||||
import com.cj.jiaqingjiayi.model.request.recruitment.RecruitmentAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.recruitment.RecruitmentUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.RecruitmentService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "招聘接口")
|
||||
@RequestMapping("/recruitment")
|
||||
public class RecruitmentController {
|
||||
|
||||
|
||||
@Resource
|
||||
private RecruitmentService recruitmentService;
|
||||
|
||||
/**
|
||||
*发布招聘信息
|
||||
*/
|
||||
@ApiOperation(value = "发布招聘信息")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addRecruitment(@RequestBody RecruitmentAddRequest addRequest){
|
||||
ThrowUtils.throwIf(addRequest == null, ErrorCode.NULL_ERROR);
|
||||
|
||||
Long id = recruitmentService.addRecruitment(addRequest);
|
||||
|
||||
return ResultUtils.success(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除招聘信息
|
||||
*/
|
||||
@ApiOperation(value = "删除招聘信息")
|
||||
@GetMapping("/delete")
|
||||
public BaseResponse<Boolean> deleteRecruitmentById(@RequestParam Long id){
|
||||
ThrowUtils.throwIf(id < 0, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
boolean flag = recruitmentService.deleteRecruitment(id);
|
||||
ThrowUtils.throwIf(!flag, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改招聘信息
|
||||
*/
|
||||
@ApiOperation(value = "更改招聘信息")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> updateRecruitment(@RequestBody RecruitmentUpdateRequest updateRequest){
|
||||
ThrowUtils.throwIf(updateRequest == null, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
boolean flag = recruitmentService.updateRecruitment(updateRequest);
|
||||
ThrowUtils.throwIf(!flag, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
*查询招聘信息
|
||||
*/
|
||||
@ApiOperation(value = "查询招聘信息(商家)")
|
||||
@GetMapping("/list/select")
|
||||
public BaseResponse<List<Recruitment>> selectRecruitment(@RequestParam Long businessId){
|
||||
ThrowUtils.throwIf(businessId < 0, ErrorCode.PARAMS_ERROR);
|
||||
|
||||
List<Recruitment> recruitmentList = recruitmentService.selectRecruitment(businessId);
|
||||
|
||||
return ResultUtils.success(recruitmentList);
|
||||
}
|
||||
|
||||
/**
|
||||
*查询招聘信息
|
||||
*/
|
||||
@ApiOperation(value = "查询招聘信息")
|
||||
@GetMapping("/list/selectMy")
|
||||
public BaseResponse<List<Recruitment>> selectRecruitmentMy(){
|
||||
|
||||
List<Recruitment> recruitmentList = recruitmentService.list();
|
||||
|
||||
return ResultUtils.success(recruitmentList);
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.Specifications;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.SpecificationsCommodities;
|
||||
import com.cj.jiaqingjiayi.model.request.attribute.AttributeAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.attribute.AttributeUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.specifications.SpecificationsAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.specifications.SpecificationsMyQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.specifications.SpecificationsQueryRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.specifications.SpecificationsUpdateRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.SpecificationsVO;
|
||||
import com.cj.jiaqingjiayi.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "规格接口")
|
||||
@RestController
|
||||
@RequestMapping("/specifications")
|
||||
public class SpecificationsController {
|
||||
|
||||
@Resource
|
||||
private SpecificationsService specificationsService;
|
||||
|
||||
@Resource
|
||||
private SpecificationsCommoditiesService specificationsCommoditiesService;
|
||||
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
@Resource
|
||||
private AttributeService attributeService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 添加规格
|
||||
* @param specificationsAddRequest 添加请求体
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "添加规格")
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> addSpecifications(@RequestBody SpecificationsAddRequest specificationsAddRequest, HttpServletRequest request){
|
||||
//判断是否为商家
|
||||
userService.isBusiness(request);
|
||||
|
||||
if (specificationsAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
Specifications specifications = new Specifications();
|
||||
BeanUtils.copyProperties(specificationsAddRequest,specifications);
|
||||
//校验请求体
|
||||
specificationsService.validSpecifications(specifications, false);
|
||||
//添加规格和属性
|
||||
List<AttributeAddRequest> attributeAddRequests = specificationsAddRequest.getAttributeAddRequests();
|
||||
Boolean aBoolean = specificationsService.addSpecifications(specifications, attributeAddRequests, request);
|
||||
ThrowUtils.throwIf(!aBoolean, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**·
|
||||
* 更新规格
|
||||
* @param specificationsUpdateRequest 更新请求体
|
||||
* @param request 网络请求
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "更新规格")
|
||||
@PostMapping("/update")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse<Boolean> updateSpecifications(@RequestBody SpecificationsUpdateRequest specificationsUpdateRequest, HttpServletRequest request) {
|
||||
//判断是否为商家
|
||||
userService.isBusiness(request);
|
||||
|
||||
if (specificationsUpdateRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
Specifications specifications = new Specifications();
|
||||
BeanUtils.copyProperties(specificationsUpdateRequest,specifications);
|
||||
//校验
|
||||
specificationsService.validSpecifications(specifications,true);
|
||||
|
||||
//更新规格和属性
|
||||
List<AttributeUpdateRequest> attributeUpdateRequests = specificationsUpdateRequest.getAttributeUpdateRequests();
|
||||
Boolean aBoolean = specificationsService.updateSpecifications(specifications, attributeUpdateRequests, request);
|
||||
ThrowUtils.throwIf(!aBoolean, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜品id获取规格脱敏信息
|
||||
* @param specificationsMyQueryRequest 请求体
|
||||
* @return 脱敏列表
|
||||
*/
|
||||
@ApiOperation(value = "根据id获取规格")
|
||||
@PostMapping("/list/specificationsVOByComId")
|
||||
public BaseResponse<List<SpecificationsVO>> specificationsVOByComId(@RequestBody SpecificationsMyQueryRequest specificationsMyQueryRequest) {
|
||||
if (specificationsMyQueryRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long commoditiesId = specificationsMyQueryRequest.getId();
|
||||
//根据id获取中间表数据
|
||||
QueryWrapper<SpecificationsCommodities> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("commoditiesId",commoditiesId);
|
||||
List<SpecificationsCommodities> list = specificationsCommoditiesService.list(queryWrapper);
|
||||
//根据中间表数据中的规格获取规格信息和属性
|
||||
return ResultUtils.success(specificationsCommoditiesService.getSpecificationsAddAttribute(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取脱敏列表
|
||||
* @param specificationsQueryRequest 前端请求
|
||||
* @param request 网络请求
|
||||
* @return 脱敏列表
|
||||
*/
|
||||
@ApiOperation(value = "获取规格列表")
|
||||
@PostMapping("/list/specificationsVO")
|
||||
public BaseResponse<List<SpecificationsVO>> specificationsVOList(@RequestBody SpecificationsQueryRequest specificationsQueryRequest, HttpServletRequest request) {
|
||||
//获取商家id
|
||||
Business loginBusiness = businessService.getLoginBusiness(request);
|
||||
Long businessId = loginBusiness.getId();
|
||||
//获取商家的规格表
|
||||
String specificationsName = specificationsQueryRequest.getSpecificationsName();
|
||||
QueryWrapper<Specifications> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(specificationsName), "specificationsName", specificationsName);
|
||||
queryWrapper.eq("businessId",businessId);
|
||||
List<Specifications> list = specificationsService.list(queryWrapper);
|
||||
//对规格信息脱敏
|
||||
List<SpecificationsVO> specificationsVO = specificationsService.getSpecificationsVO(list);
|
||||
//获取各规格的属性脱敏信息
|
||||
return ResultUtils.success(attributeService.getBySpecificationsVoId(specificationsVO));
|
||||
}
|
||||
}
|
@ -0,0 +1,295 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.mapper.UserMapper;
|
||||
import com.cj.jiaqingjiayi.model.LoginUserDTO;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import com.cj.jiaqingjiayi.model.request.user.*;
|
||||
import com.cj.jiaqingjiayi.model.vo.LoginUserVO;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import com.cj.jiaqingjiayi.utils.BeanCopyUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.jdbc.Null;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cj.jiaqingjiayi.contant.UserConstant.*;
|
||||
|
||||
@Api(tags = "用户接口")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 用户注册请求接口
|
||||
*
|
||||
*/
|
||||
@ApiOperation(value = "用户注册")
|
||||
@PostMapping("/register")
|
||||
public BaseResponse<Long> userRegister(@RequestBody UserRegisterRequest userRegisterRequest) {
|
||||
if (userRegisterRequest == null){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数为空");
|
||||
}
|
||||
|
||||
String userAccount = userRegisterRequest.getUserAccount();
|
||||
String userPassword = userRegisterRequest.getUserPassword();
|
||||
String checkPassword = userRegisterRequest.getCheckPassword();
|
||||
|
||||
if (StringUtils.isAllBlank(userAccount, userPassword, checkPassword)) {
|
||||
return ResultUtils.error(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
long result = userService.userRegister(userAccount, userPassword, checkPassword);
|
||||
return ResultUtils.success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户登录请求接口
|
||||
*
|
||||
* @param request 前端请求对象
|
||||
*/
|
||||
@ApiOperation(value = "用户登录")
|
||||
@PostMapping("/login")
|
||||
public BaseResponse<LoginUserDTO> userLogin(@RequestBody UserLoginRequest userLoginRequest, HttpServletRequest request) {
|
||||
if (userLoginRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数为空");
|
||||
}
|
||||
|
||||
String userAccount = userLoginRequest.getUserAccount();
|
||||
String userPassword = userLoginRequest.getUserPassword();
|
||||
|
||||
if (StringUtils.isAllBlank(userAccount, userPassword)){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数为空");
|
||||
}
|
||||
|
||||
LoginUserDTO loginUserDTO = userService.userLogin(userAccount, userPassword, request);
|
||||
return ResultUtils.success(loginUserDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注销接口
|
||||
*/
|
||||
@ApiOperation(value = "用户注销")
|
||||
@PostMapping("/logout")
|
||||
public BaseResponse<Integer> userLogout(HttpServletRequest request) {
|
||||
if (request == null) {
|
||||
throw new BusinessException(ErrorCode.NULL_ERROR, "传入参数为空");
|
||||
}
|
||||
int result = userService.userLogout(request);
|
||||
return ResultUtils.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户(管理员)
|
||||
*/
|
||||
@ApiOperation(value = "查询用户")
|
||||
@GetMapping("/search")
|
||||
public BaseResponse<List<User>> searchUsers(UserSearchRequest searchRequest, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
userService.isAdmin(request);
|
||||
|
||||
QueryWrapper<User> queryWrapper = userService.getQueryWrapper(searchRequest);
|
||||
List<User> userList = userService.list(queryWrapper);
|
||||
List<User> users = userList.stream().map(userService::getSafetyUser).collect(Collectors.toList());
|
||||
|
||||
//用户脱敏
|
||||
return ResultUtils.success(users);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取用户列表
|
||||
* @return 用户列表
|
||||
*/
|
||||
@ApiOperation(value = "分页查询用户")
|
||||
@PostMapping("/list/page")
|
||||
public BaseResponse<Page<User>> listUserByPage(@RequestBody UserSearchRequest userSearchRequest, HttpServletRequest request) {
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
long current = userSearchRequest.getCurrent();
|
||||
long size = userSearchRequest.getPageSize();
|
||||
Page<User> userPage = userService.page(new Page<>(current, size),
|
||||
userService.getQueryWrapper(userSearchRequest));
|
||||
return ResultUtils.success(userPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户(管理员)
|
||||
*/
|
||||
@ApiOperation(value = "删除用户")
|
||||
@PostMapping("/delete")
|
||||
public BaseResponse<Boolean> deleteUser(@RequestBody UserDeleteRequest deleteRequest, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
userService.isAdmin(request);
|
||||
if(deleteRequest == null || deleteRequest.getId() <= 0){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "id不合法");
|
||||
}
|
||||
boolean removeUser = userService.removeById(deleteRequest.getId());
|
||||
return ResultUtils.success(removeUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录的用户信息
|
||||
*/
|
||||
@ApiOperation(value = "获取当前登录用户")
|
||||
@GetMapping("/current")
|
||||
public BaseResponse<LoginUserVO> getLoginUser(HttpServletRequest request){
|
||||
//获取登录态
|
||||
User user = userService.getLoginUser(request);
|
||||
return ResultUtils.success(userService.getLoginUserVO(user));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取用户(管理员)
|
||||
*/
|
||||
@ApiOperation(value = "根据id获取用户")
|
||||
@GetMapping("/getById")
|
||||
public BaseResponse<User> getUserById(@RequestParam Long id, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
userService.isAdmin(request);
|
||||
if(id < 0){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "id不符合规范");
|
||||
}
|
||||
User user = userService.getById(id);
|
||||
if(user == null){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户不存在");
|
||||
}
|
||||
return ResultUtils.success(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改密码
|
||||
*/
|
||||
@ApiOperation(value = "用户修改密码")
|
||||
@PostMapping("/password/update")
|
||||
public BaseResponse<Boolean> updateUserPassword(@RequestBody UserUpdatePasswordRequest updatePasswordRequest,
|
||||
HttpServletRequest request){
|
||||
boolean update = userService.updateUserPassword(updatePasswordRequest, request);
|
||||
if(update){
|
||||
return ResultUtils.success(true);
|
||||
} else {
|
||||
return ResultUtils.error(ErrorCode.OPERATION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户(管理员)
|
||||
* @param userAddRequest
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "管理员添加用户")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Long> addUser(@RequestBody UserAddRequest userAddRequest, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
userService.isAdmin(request);
|
||||
if(userAddRequest == null){
|
||||
throw new BusinessException(ErrorCode.NULL_ERROR,"传入数据为空");
|
||||
}
|
||||
User user = new User();
|
||||
String userAccount = userAddRequest.getUserAccount();
|
||||
String userPassword = userAddRequest.getUserPassword();
|
||||
if(StringUtils.isAnyBlank(userAccount, userPassword)){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "未输入账号密码");
|
||||
}
|
||||
|
||||
if(userAccount.length() < 4){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户账号过短");
|
||||
}
|
||||
|
||||
//判断密码是否小于8
|
||||
if(userPassword.length() < 8){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "密码过短");
|
||||
}
|
||||
//判断是否有特殊字符
|
||||
String validPattern = "[`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
|
||||
|
||||
Matcher matcher = Pattern.compile(validPattern).matcher(userAccount);
|
||||
|
||||
if (matcher.find()) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "包含特殊字符");
|
||||
}
|
||||
|
||||
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userAccount", userAccount);
|
||||
long count = userService.count(queryWrapper);
|
||||
if(count > 0){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户已存在");
|
||||
}
|
||||
BeanUtils.copyProperties(userAddRequest, user);
|
||||
String password = DigestUtils.md5DigestAsHex((USER_SALT + userPassword).getBytes());
|
||||
user.setUserPassword(password);
|
||||
boolean save = userService.save(user);
|
||||
if(!save){
|
||||
throw new BusinessException(ErrorCode.OPERATION_ERROR);
|
||||
}
|
||||
return ResultUtils.success(user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户信息(管理员)
|
||||
* @param userUpdateRequest
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "管理员更新用户信息")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> updateUser(@RequestBody UserUpdateRequest userUpdateRequest, HttpServletRequest request){
|
||||
//判断是否为管理员
|
||||
// userService.isAdmin(request);
|
||||
User user = new User();
|
||||
BeanCopyUtils.copyPropertiesIgnoreEmpty(userUpdateRequest, user);
|
||||
boolean res = userService.updateById(user);
|
||||
if(!res){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "该用户不存在");
|
||||
}
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新个人信息
|
||||
* @param userUpdateMyRequest
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "用户更新个人信息")
|
||||
@PostMapping("/user/update")
|
||||
public BaseResponse<Boolean> updateMyUser(@RequestBody UserUpdateMyRequest userUpdateMyRequest, HttpServletRequest request){
|
||||
|
||||
if(userUpdateMyRequest == null){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
// User logingUser = userService.getLoginUser(request);
|
||||
User user = new User();
|
||||
BeanCopyUtils.copyPropertiesIgnoreEmpty(userUpdateMyRequest,user);
|
||||
|
||||
boolean result = userService.updateById(user);
|
||||
if(!result){
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "操作失败");
|
||||
}
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package com.cj.jiaqingjiayi.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import com.cj.jiaqingjiayi.exception.BusinessException;
|
||||
import com.cj.jiaqingjiayi.exception.ThrowUtils;
|
||||
import com.cj.jiaqingjiayi.model.CommonRequest;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.UserRating;
|
||||
import com.cj.jiaqingjiayi.model.request.userRating.UserRatingAddRequest;
|
||||
import com.cj.jiaqingjiayi.model.request.userRating.UserRatingReviewRequest;
|
||||
import com.cj.jiaqingjiayi.model.vo.UserRatingDTO;
|
||||
import com.cj.jiaqingjiayi.service.BusinessService;
|
||||
import com.cj.jiaqingjiayi.service.UserRatingService;
|
||||
import com.cj.jiaqingjiayi.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "用户评分接口")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/level")
|
||||
public class UserRatingController {
|
||||
|
||||
@Resource
|
||||
private UserRatingService userRatingService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 添加用户评分
|
||||
* @param userRatingAddRequest 用户评分请求
|
||||
* @param request 当期那登录用户
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@ApiOperation(value = "添加用户评分")
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<Boolean> addRating (@RequestBody UserRatingAddRequest userRatingAddRequest, HttpServletRequest request) {
|
||||
if (userRatingAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
||||
UserRating userRating = new UserRating();
|
||||
BeanUtils.copyProperties(userRatingAddRequest, userRating);
|
||||
userRatingService.validUserRating(userRating, request);
|
||||
boolean save = userRatingService.save(userRating);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.SYSTEM_ERROR, "添加失败");
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户评分
|
||||
* @param commonRequest 用户评分id
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@ApiOperation(value = "删除用户评分")
|
||||
@PostMapping("/delete")
|
||||
public BaseResponse<Boolean> deleteUserRating (@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
boolean remove = userRatingService.removeById(commonRequest.getId());
|
||||
ThrowUtils.throwIf(!remove, ErrorCode.SYSTEM_ERROR, "删除失败");
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前用户评论
|
||||
* @param request 当前用户
|
||||
* @return 评分列表
|
||||
*/
|
||||
@ApiOperation(value = "展示用户评分")
|
||||
@PostMapping("/list")
|
||||
public BaseResponse<List<UserRating>> listUserRating (@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
// User loginUser = userService.getLoginUser(request);
|
||||
Long userId = commonRequest.getId();
|
||||
List<UserRating> list = userRatingService.list(Wrappers.<UserRating>lambdaQuery().eq(UserRating::getUserId, userId));
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前店铺评分
|
||||
*/
|
||||
@ApiOperation(value = "展示商家评论")
|
||||
@GetMapping("/listBusinessRating")
|
||||
public BaseResponse<List<UserRatingDTO>> listUserRatingBusiness (@RequestParam Long businessId) {
|
||||
// 查询 UserRating 列表
|
||||
List<UserRating> userRatings = userRatingService.list(
|
||||
Wrappers.<UserRating>lambdaQuery().eq(UserRating::getBusinessId, businessId)
|
||||
);
|
||||
|
||||
// 创建返回的 DTO 列表
|
||||
List<UserRatingDTO> userRatingDTOList = new ArrayList<>();
|
||||
|
||||
// 遍历 UserRating 列表,根据 userId 查询 User 信息
|
||||
for (UserRating userRating : userRatings) {
|
||||
User user = userService.getById(userRating.getUserId());
|
||||
UserRatingDTO userRatingDTO = new UserRatingDTO();
|
||||
userRatingDTO.setUserRating(userRating);
|
||||
userRatingDTO.setUser(user);
|
||||
userRatingDTOList.add(userRatingDTO);
|
||||
}
|
||||
|
||||
// 返回 DTO 列表
|
||||
return ResultUtils.success(userRatingDTOList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*商家回复
|
||||
*/
|
||||
@ApiOperation(value = "商家回复")
|
||||
@PostMapping("/business/reply")
|
||||
// @AuthCheck(mustRole = UserConstant.BUSINESS_ROLE)
|
||||
public BaseResponse<Boolean> businessReply (@RequestBody UserRatingReviewRequest userRatingReviewRequest, HttpServletRequest request) {
|
||||
if (userRatingReviewRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
Long id = userRatingReviewRequest.getId();
|
||||
String businessReview = userRatingReviewRequest.getBusinessReview();
|
||||
userRatingService.validUserRatingByBusiness(id, request);
|
||||
LambdaQueryWrapper<UserRating> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserRating::getId, id);
|
||||
UserRating userRating = userRatingService.getOne(wrapper);
|
||||
userRating.setBusinessReview(businessReview);
|
||||
boolean update = userRatingService.updateById(userRating);
|
||||
ThrowUtils.throwIf(!update, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.cj.jiaqingjiayi.exception;
|
||||
|
||||
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
|
||||
/**
|
||||
* 自定义异常类
|
||||
*
|
||||
*/
|
||||
public class BusinessException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* 异常码
|
||||
*/
|
||||
private final int code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public BusinessException(String message, int code, String description) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public BusinessException(ErrorCode errorCode) {
|
||||
super(errorCode.getMessage());
|
||||
this.code = errorCode.getCode();
|
||||
this.description = errorCode.getDescription();
|
||||
}
|
||||
|
||||
public BusinessException(ErrorCode errorCode, String description) {
|
||||
super(errorCode.getMessage());
|
||||
this.code = errorCode.getCode();
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.cj.jiaqingjiayi.exception;
|
||||
|
||||
|
||||
|
||||
import com.cj.jiaqingjiayi.common.BaseResponse;
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
import com.cj.jiaqingjiayi.common.ResultUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public BaseResponse<?> businessExceptionHandler(BusinessException e) {
|
||||
log.error("businessException: " + e.getMessage(), e);
|
||||
return ResultUtils.error(e.getCode(), e.getMessage(), e.getDescription());
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public BaseResponse<?> runtimeExceptionHandler(RuntimeException e) {
|
||||
log.error("runtimeException", e);
|
||||
return ResultUtils.error(ErrorCode.SYSTEM_ERROR, e.getMessage(), "");
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.cj.jiaqingjiayi.exception;
|
||||
|
||||
|
||||
import com.cj.jiaqingjiayi.common.ErrorCode;
|
||||
|
||||
/**
|
||||
* 抛异常工具类
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class ThrowUtils {
|
||||
|
||||
/**
|
||||
* 条件成立则抛异常
|
||||
*
|
||||
* @param condition 条件
|
||||
* @param runtimeException 运行时异常
|
||||
*/
|
||||
public static void throwIf(boolean condition, RuntimeException runtimeException) {
|
||||
if (condition) {
|
||||
throw runtimeException;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件成立则抛异常
|
||||
*
|
||||
* @param condition 条件
|
||||
* @param errorCode 自定义异常
|
||||
*/
|
||||
public static void throwIf(boolean condition, ErrorCode errorCode) {
|
||||
throwIf(condition, new BusinessException(errorCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件成立则抛异常
|
||||
*
|
||||
* @param condition 条件
|
||||
* @param errorCode 自定义异常
|
||||
* @param message 报错信息
|
||||
*/
|
||||
public static void throwIf(boolean condition, ErrorCode errorCode, String message) {
|
||||
throwIf(condition, new BusinessException(errorCode, message));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Appointments;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【appointments(预约表)】的数据库操作Mapper
|
||||
* @createDate 2024-11-05 19:07:40
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Appointments
|
||||
*/
|
||||
public interface AppointmentsMapper extends BaseMapper<Appointments> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Attribute;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【attribute(属性表)】的数据库操作Mapper
|
||||
* @createDate 2024-08-21 16:29:45
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Attribute
|
||||
*/
|
||||
public interface AttributeMapper extends BaseMapper<Attribute> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessAuth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【business_auth(商家认证)】的数据库操作Mapper
|
||||
* @createDate 2024-07-28 17:18:28
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.BusinessAuth
|
||||
*/
|
||||
public interface BusinessAuthMapper extends BaseMapper<BusinessAuth> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessLevel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【business_level】的数据库操作Mapper
|
||||
* @createDate 2024-12-02 14:13:25
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.BusinessLevel
|
||||
*/
|
||||
public interface BusinessLevelMapper extends BaseMapper<BusinessLevel> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【business(商家)】的数据库操作Mapper
|
||||
* @createDate 2024-07-28 17:16:33
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Business
|
||||
*/
|
||||
public interface BusinessMapper extends BaseMapper<Business> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Cart;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【cart(购物车表)】的数据库操作Mapper
|
||||
* @createDate 2024-09-05 15:15:56
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Cart
|
||||
*/
|
||||
public interface CartMapper extends BaseMapper<Cart> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Collect;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【collect(收藏)】的数据库操作Mapper
|
||||
* @createDate 2024-12-02 14:11:46
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Collect
|
||||
*/
|
||||
public interface CollectMapper extends BaseMapper<Collect> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cj.jiaqingjiayi.model.domain.CommoditiesGroup;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【commodities_group(商品分组表)】的数据库操作Mapper
|
||||
* @createDate 2024-12-17 08:52:35
|
||||
* @Entity generator.domain.CommoditiesGroup
|
||||
*/
|
||||
public interface CommoditiesGroupMapper extends BaseMapper<CommoditiesGroup> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Commodities;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【commodities(商品表)】的数据库操作Mapper
|
||||
* @createDate 2024-08-20 19:55:49
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Commodities
|
||||
*/
|
||||
public interface CommoditiesMapper extends BaseMapper<Commodities> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.ManicuristAuth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【manicurist_auth(美甲师认证表)】的数据库操作Mapper
|
||||
* @createDate 2024-09-23 18:46:06
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.ManicuristAuth
|
||||
*/
|
||||
public interface ManicuristAuthMapper extends BaseMapper<ManicuristAuth> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicurist;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【manicurist(美甲师表)】的数据库操作Mapper
|
||||
* @createDate 2024-09-23 19:23:08
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Manicurist
|
||||
*/
|
||||
public interface ManicuristMapper extends BaseMapper<Manicurist> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Manicuristsign;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【manicuristsign(美甲师表)】的数据库操作Mapper
|
||||
* @createDate 2025-02-26 19:29:22
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Manicuristsign
|
||||
*/
|
||||
public interface ManicuristsignMapper extends BaseMapper<Manicuristsign> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.OrderItems;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【order_items(详细订单表)】的数据库操作Mapper
|
||||
* @createDate 2024-11-10 14:25:15
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.OrderItems
|
||||
*/
|
||||
public interface OrderItemsMapper extends BaseMapper<OrderItems> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Orders;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【orders(订单表)】的数据库操作Mapper
|
||||
* @createDate 2024-11-10 14:22:10
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Orders
|
||||
*/
|
||||
public interface OrdersMapper extends BaseMapper<Orders> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Recruitment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【recruitment(美甲师招聘信息表)】的数据库操作Mapper
|
||||
* @createDate 2025-03-12 18:51:44
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.RecruitmentController
|
||||
*/
|
||||
public interface RecruitmentMapper extends BaseMapper<Recruitment> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.SpecificationsCommodities;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【specifications_commodities(商品和规格的中间表)】的数据库操作Mapper
|
||||
* @createDate 2024-08-21 16:21:41
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.SpecificationsCommodities
|
||||
*/
|
||||
public interface SpecificationsCommoditiesMapper extends BaseMapper<SpecificationsCommodities> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Specifications;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【specifications(规格表)】的数据库操作Mapper
|
||||
* @createDate 2024-08-21 16:20:48
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.Specifications
|
||||
*/
|
||||
public interface SpecificationsMapper extends BaseMapper<Specifications> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cj.jiaqingjiayi.model.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author ly
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.cj.jiaqingjiayi.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cj.jiaqingjiayi.model.domain.UserRating;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author 高木
|
||||
* @description 针对表【user_rating(用户评分)】的数据库操作Mapper
|
||||
* @createDate 2024-12-02 14:14:23
|
||||
* @Entity com.cj.jiaqingjiayi.model.domain.UserRating
|
||||
*/
|
||||
public interface UserRatingMapper extends BaseMapper<UserRating> {
|
||||
|
||||
@Select("select avg(rating) from jqjy.user_rating where businessId = #{businessId}")
|
||||
Double findAvgByBusinessId(@Param("businessId") Long businessId);
|
||||
|
||||
@Select("select avg(manicuristRating) from jqjy.user_rating where manicuristId = #{manicuristId}")
|
||||
Double findAvgByManicuristId(@Param("manicuristId") Long manicuristId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.cj.jiaqingjiayi.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用请求
|
||||
*/
|
||||
@Data
|
||||
@SuppressWarnings("all")
|
||||
public class CommonRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 美甲师Id
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.cj.jiaqingjiayi.model;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.vo.LoginUserVO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginUserDTO {
|
||||
|
||||
LoginUserVO loginUserVO;
|
||||
|
||||
Business business;
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 预约表
|
||||
* @TableName appointments
|
||||
*/
|
||||
@TableName(value ="appointments")
|
||||
@Data
|
||||
public class Appointments implements Serializable {
|
||||
/**
|
||||
* 预约ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID(关联用户表)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 商家ID(关联商家表)
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商家名
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 美甲师ID, 如果为空到店分配
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 美甲师名
|
||||
*/
|
||||
private String manicuristName;
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private Date appointmentTime;
|
||||
|
||||
/**
|
||||
* 预约详细地址
|
||||
*/
|
||||
private String appointmentAddress;
|
||||
|
||||
/**
|
||||
* 服务方式(0 - 线上, 1 - 到店)
|
||||
*/
|
||||
private Integer serviceMode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* 预约状态(0 - 已确认, 1 - 已完成, 2 - 已取消)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
*订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 属性表
|
||||
* @TableName attribute
|
||||
*/
|
||||
@TableName(value ="attribute")
|
||||
@Data
|
||||
public class Attribute implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
private Long specificationsId;
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String attributeName;
|
||||
|
||||
/**
|
||||
* 属性状态:0在售,1停售
|
||||
*/
|
||||
private Integer attributeStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 商家
|
||||
*/
|
||||
@TableName(value ="business")
|
||||
@Data
|
||||
public class Business implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 门店头像
|
||||
*/
|
||||
private String businessAvatar;
|
||||
|
||||
/**
|
||||
* 门店手机号
|
||||
*/
|
||||
private String businessPhone;
|
||||
|
||||
/**
|
||||
* 店铺详细地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 门店简介
|
||||
*/
|
||||
private String businessProfile;
|
||||
|
||||
/**
|
||||
* 商家相册
|
||||
*/
|
||||
private String businessImages;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 开始营业时间
|
||||
*/
|
||||
private String startBusiness;
|
||||
|
||||
/**
|
||||
* 结束营业时间
|
||||
*/
|
||||
private String endBusiness;
|
||||
|
||||
/**
|
||||
* 状态:0审核中,1启用,2禁用
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 店铺状态:0休业,1营业
|
||||
*/
|
||||
private Integer storeStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 服务方式
|
||||
*/
|
||||
private Integer serviceMode;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 商家认证
|
||||
* @TableName business_auth
|
||||
*/
|
||||
@TableName(value ="business_auth")
|
||||
@Data
|
||||
public class BusinessAuth implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 店主名
|
||||
*/
|
||||
private String shopkeeper;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String license;
|
||||
|
||||
/**
|
||||
* 身份证正面
|
||||
*/
|
||||
private String frontIdCard;
|
||||
|
||||
/**
|
||||
* 身份证反面
|
||||
*/
|
||||
private String backIdCard;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName business_level
|
||||
*/
|
||||
@TableName(value ="business_level")
|
||||
@Data
|
||||
public class BusinessLevel implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 综合评分
|
||||
*/
|
||||
private BigDecimal averageScore;
|
||||
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 购物车表
|
||||
* @TableName cart
|
||||
*/
|
||||
@TableName(value ="cart")
|
||||
@Data
|
||||
public class Cart implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 加入购物车时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long commoditiesId;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 当前选择规格的价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 小计(单价 * 数量)
|
||||
*/
|
||||
private BigDecimal subtotal;
|
||||
|
||||
/**
|
||||
* 已选规格属性列表
|
||||
*/
|
||||
private String selectedOptions;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 收藏
|
||||
* @TableName collect
|
||||
*/
|
||||
@TableName(value ="collect")
|
||||
@Data
|
||||
public class Collect implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 商品表
|
||||
* @TableName commodities
|
||||
*/
|
||||
@TableName(value ="commodities")
|
||||
@Data
|
||||
public class Commodities implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商品分组id
|
||||
*/
|
||||
private Long commoditiesGroupId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String commoditiesName;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String commoditiesImage;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private Double commoditiesPrice;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer inventoryStatus;
|
||||
|
||||
/**
|
||||
* 商品状态:上架,下架
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品分组表
|
||||
* @TableName commodities_group
|
||||
*/
|
||||
@TableName(value ="commodities_group")
|
||||
@Data
|
||||
public class CommoditiesGroup implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商品分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 是否置顶:0不置顶,1置顶
|
||||
*/
|
||||
private Integer isTopping;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 美甲师表
|
||||
* @TableName manicurist
|
||||
*/
|
||||
@TableName(value ="manicurist")
|
||||
@Data
|
||||
public class Manicurist implements Serializable {
|
||||
/**
|
||||
* 美甲师唯一标识(主键,自增)
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID(关联用户表)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家ID(关联商家表)
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
|
||||
/**
|
||||
* 美甲师姓名
|
||||
*/
|
||||
private String manicuristName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 美甲师联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 美甲师电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 美甲师入职日期
|
||||
*/
|
||||
private Date employment_date;
|
||||
|
||||
/**
|
||||
* 美甲师的专长(如法式美甲、彩绘等)
|
||||
*/
|
||||
private String specialties;
|
||||
|
||||
/**
|
||||
* 美甲师的服务评分
|
||||
*/
|
||||
private BigDecimal rating;
|
||||
|
||||
/**
|
||||
* 美甲师的基本薪资
|
||||
*/
|
||||
private BigDecimal salary;
|
||||
|
||||
/**
|
||||
* 审核状态,0-待审核,1-审核通过,2-审核不通过
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 逻辑删除标志,0 表示未删除,1 表示已删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 记录更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 美甲师头像的存储路径或链接
|
||||
*/
|
||||
private String manicuristAvatar;
|
||||
|
||||
/**
|
||||
* 美甲师状态
|
||||
*/
|
||||
private Integer manStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 美甲师认证表
|
||||
* @TableName manicurist_auth
|
||||
*/
|
||||
@TableName(value ="manicurist_auth")
|
||||
@Data
|
||||
public class ManicuristAuth implements Serializable {
|
||||
/**
|
||||
* 认证唯一标识(主键,自增)
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 美甲师ID(关联美甲师表)
|
||||
*/
|
||||
private Long artistId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String nameUser;
|
||||
|
||||
/**
|
||||
* 认证编号
|
||||
*/
|
||||
private String certification_number;
|
||||
|
||||
/**
|
||||
* 发证机构
|
||||
*/
|
||||
private String issuing_authority;
|
||||
|
||||
/**
|
||||
* 证书文件的存储路径或链接
|
||||
*/
|
||||
private String certificate_path;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 记录更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标志,0 表示未删除,1 表示已删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 美甲师签约表
|
||||
* @TableName manicuristsign
|
||||
*/
|
||||
@TableName(value ="manicuristsign")
|
||||
@Data
|
||||
public class Manicuristsign implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 美甲师ID(关联美甲师表)
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 期望工资薪资
|
||||
*/
|
||||
private BigDecimal salary;
|
||||
|
||||
/**
|
||||
* 签约时长
|
||||
*/
|
||||
private String signTime;
|
||||
|
||||
/**
|
||||
* 工龄
|
||||
*/
|
||||
private String tenure;
|
||||
|
||||
/**
|
||||
* 美甲师等级
|
||||
*/
|
||||
private String manicuristLv;
|
||||
|
||||
/**
|
||||
* 审核状态,0-待审核,1-审核通过,2-审核不通过
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 逻辑删除标志,0 表示未删除,1 表示已删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 记录更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 详细订单表
|
||||
* @TableName order_items
|
||||
*/
|
||||
@TableName(value ="order_items")
|
||||
@Data
|
||||
public class OrderItems implements Serializable {
|
||||
/**
|
||||
* 详细订单ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单ID(关联订单表)
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long commoditiesId;
|
||||
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 商品单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 小计(单价 * 数量)
|
||||
*/
|
||||
private BigDecimal subtotal;
|
||||
|
||||
/**
|
||||
* 规格属性列表
|
||||
*/
|
||||
private String attributeNames;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 订单表
|
||||
* @TableName orders
|
||||
*/
|
||||
@TableName(value ="orders")
|
||||
@Data
|
||||
public class Orders implements Serializable {
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 用户ID(关联用户表)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 美甲师id
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 预约ID(关联预约表)
|
||||
*/
|
||||
private Long appointmentId;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 服务方式(0 - 线上, 1 - 到店)
|
||||
*/
|
||||
private Integer serviceMode;
|
||||
|
||||
/**
|
||||
* 支付方式:0微信支付
|
||||
*/
|
||||
private Integer payMethod;
|
||||
|
||||
/**
|
||||
* 支付状态(0 - 未支付, 1 - 已支付, 2 - 退款中, 3 - 已退款)
|
||||
*/
|
||||
private Integer paymentStatus;
|
||||
|
||||
/**
|
||||
* 抢单状态(0 - 未抢单, 1 - 已抢单)
|
||||
*/
|
||||
private Integer claimStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 美甲师招聘信息表
|
||||
* @TableName recruitment
|
||||
*/
|
||||
@TableName(value ="recruitment")
|
||||
@Data
|
||||
public class Recruitment implements Serializable {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id,关联business表
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 对美甲师的要求
|
||||
*/
|
||||
private String requirements;
|
||||
|
||||
/**
|
||||
* 美甲师薪资,示例: 5k-10k/月
|
||||
*/
|
||||
private String salary;
|
||||
|
||||
/**
|
||||
* 招聘美甲师数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 规格表
|
||||
* @TableName specifications
|
||||
*/
|
||||
@TableName(value ="specifications")
|
||||
@Data
|
||||
public class Specifications implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
private String specificationsName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 商品和规格的中间表
|
||||
* @TableName specifications_commodities
|
||||
*/
|
||||
@TableName(value ="specifications_commodities")
|
||||
@Data
|
||||
public class SpecificationsCommodities implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long commoditiesId;
|
||||
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
private Long specificationsId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
* @TableName user
|
||||
*/
|
||||
@TableName(value ="user")
|
||||
@Data
|
||||
public class User implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝开放平台id
|
||||
*/
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* openId
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatarUrl;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 状态 0 -正常
|
||||
*/
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 用户角色 0 - 普通用户 1 - 管理员
|
||||
*/
|
||||
private Integer userRole;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.cj.jiaqingjiayi.model.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户评分
|
||||
* @TableName user_rating
|
||||
*/
|
||||
@TableName(value ="user_rating")
|
||||
@Data
|
||||
public class UserRating implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 美甲师ID(关联美甲师表)
|
||||
*/
|
||||
private Long manicuristId;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 评分
|
||||
*/
|
||||
private Integer rating;
|
||||
|
||||
/**
|
||||
* 美甲师评分
|
||||
*/
|
||||
private Integer manicuristRating;
|
||||
|
||||
/**
|
||||
* 评论
|
||||
*/
|
||||
private String review;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String picture;
|
||||
|
||||
/**
|
||||
* 商家回复
|
||||
*/
|
||||
private String businessReview;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.cj.jiaqingjiayi.model.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public enum FileUploadBizEnum {
|
||||
USER_AVATAR("头像", "user_avatar"),
|
||||
|
||||
DISHES_IMAGE("商品", "commodities"),
|
||||
|
||||
CARD_IMAGE("证件", "card"),
|
||||
|
||||
SYSTEM_IMAGE("系统", "system");
|
||||
|
||||
|
||||
private final String text;
|
||||
|
||||
private final String value;
|
||||
|
||||
FileUploadBizEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取值列表
|
||||
*/
|
||||
public static List<String> getValues() {
|
||||
return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 value获取枚举
|
||||
*/
|
||||
public static FileUploadBizEnum getEnumByValue(String value) {
|
||||
if (ObjectUtils.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (FileUploadBizEnum fileEnum : FileUploadBizEnum.values()) {
|
||||
if (fileEnum.value.equals(value)) {
|
||||
return fileEnum;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.cj.jiaqingjiayi.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlipayTradeCreateRequest1 {
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.cj.jiaqingjiayi.model.request;
|
||||
|
||||
import com.cj.jiaqingjiayi.model.domain.Business;
|
||||
import com.cj.jiaqingjiayi.model.domain.BusinessAuth;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusinessDTO {
|
||||
|
||||
private Business business;
|
||||
|
||||
private BusinessAuth businessAuth;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.cj.jiaqingjiayi.model.request.Commodities;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommoditiesAddRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8094188745265544921L;
|
||||
/**
|
||||
* 该商品的规格id列表
|
||||
*/
|
||||
private List<Long> specificationsIds;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商品分组id
|
||||
*/
|
||||
private Long commoditiesGroupId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String commoditiesName;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String commoditiesImage;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private Double commoditiesPrice;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer inventoryStatus;
|
||||
|
||||
/**
|
||||
* 商品状态:上架,下架
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.cj.jiaqingjiayi.model.request.Commodities;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CommoditiesDeleteRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8880136450188924209L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private Long businessId;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.cj.jiaqingjiayi.model.request.Commodities;
|
||||
|
||||
|
||||
import com.cj.jiaqingjiayi.model.request.PageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CommoditiesQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -483140126402634506L;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商品分组id
|
||||
*/
|
||||
private Long commoditiesGroupId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String commoditiesName;
|
||||
|
||||
/**
|
||||
* 商品状态:上架,下架
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.cj.jiaqingjiayi.model.request.Commodities;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommoditiesUpdateRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7891617409382838083L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 该商品的规格id列表
|
||||
*/
|
||||
private List<Long> specificationsIds;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 商品分组id
|
||||
*/
|
||||
private Long commoditiesGroupId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String commoditiesName;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String commoditiesImage;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private Double commoditiesPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer inventoryStatus;
|
||||
|
||||
/**
|
||||
* 商品状态:上架,下架
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user