Compare commits

...

10 Commits

Author SHA1 Message Date
JIAL 1582ffb68d 业务查询系统 2024-01-11 08:30:14 +08:00
JIAL 16894fde8e 主页完成 2023-12-25 09:19:27 +08:00
JIAL 808854f60a 个人主页制作完成 2023-12-24 13:39:07 +08:00
JIAL 6aa998915f 新建界面V1 2023-12-12 15:23:28 +08:00
JIAL 79ed867fd4 新建案件界面布局 2023-12-10 00:04:13 +08:00
JIAL 88a66ba64e 新增界面 2023-12-08 15:13:59 +08:00
JIAL 8589322488 案件展示列表查询完成 2023-12-07 20:54:26 +08:00
JIAL 699f51f161 实现案件列表展示 2023-12-06 23:19:44 +08:00
JIAL 9b4e616da6 案件列表页面初步调整 2023-12-02 13:27:37 +08:00
JIAL 27ff2ff67d 完成管理账号,完善菜单 2023-11-29 21:17:35 +08:00
351 changed files with 38986 additions and 6945 deletions

View File

@ -2,18 +2,19 @@
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<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="reggie_take_out" />
<module name="FWManage" />
<module name="JIALDemo" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="FWManage" options="-parameters" />
<module name="JIALDemo" options="-parameters" />
<module name="reggie_take_out" options="-parameters" />
</option>
</component>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<component name="Encoding" defaultCharsetForPropertiesFiles="ISO-8859-1">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,15 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="@click" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="defaultUnitInitialized" value="true" />
<option name="renamerInitialized" value="true" />
</component>
</project>

View File

@ -8,7 +8,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="jbr-11" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
<component name="ProjectType">
<option name="id" value="jpab" />
</component>

View File

@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/bin" vcs="Git" />
</component>
</project>

1
bin

@ -1 +0,0 @@
Subproject commit 2329fea1f84e829d3a703c60cfd8da9014766e91

196
logs/JIAL-ss.log Normal file
View File

@ -0,0 +1,196 @@
2024-01-11 08:16:08.949 INFO 3284 --- [main] com.JIAL.JIALApplication : Starting JIALApplication using Java 1.8.0_341 on LAPTOP-JIAL with PID 3284 (D:\JIAL\JavaProject\JIALDemo\target\classes started by JIAL in D:\JIAL\JavaProject\JIALDemo)
2024-01-11 08:16:08.958 INFO 3284 --- [main] com.JIAL.JIALApplication : The following profiles are active: ss
2024-01-11 08:16:25.172 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:16:40.184 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:16:55.703 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:17:11.221 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:17:26.737 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:17:42.250 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:17:57.771 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:18:13.279 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:18:28.799 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:18:44.307 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:18:59.828 ERROR 3284 --- [Druid-ConnectionPool-Create-1510312933] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)
2024-01-11 08:19:13.647 INFO 15636 --- [main] com.JIAL.JIALApplication : Starting JIALApplication using Java 1.8.0_341 on LAPTOP-JIAL with PID 15636 (D:\JIAL\JavaProject\JIALDemo\target\classes started by JIAL in D:\JIAL\JavaProject\JIALDemo)
2024-01-11 08:19:13.648 INFO 15636 --- [main] com.JIAL.JIALApplication : The following profiles are active: ss
2024-01-11 08:19:29.653 ERROR 15636 --- [Druid-ConnectionPool-Create-277155095] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:sqlserver://192.168.9.230:1433;databaseName=ERP;Encrypt=false;TrustServerCertificate=true;, errorCode 0, state 08S01
com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 192.168.9.230 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774)

File diff suppressed because it is too large Load Diff

84
pom.xml
View File

@ -61,13 +61,47 @@
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- xml操作相关依赖 -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.11.1</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- 这个是编码解码的 -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
@ -80,6 +114,54 @@
<version>1.1.23</version>
</dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.4.7.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- SQL Server JDBC 驱动 -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.4.0.jre8</version> <!-- 使用最新版本 -->
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<!-- 数据库驱动,根据您使用的数据库选择合适的依赖 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,103 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.JIAL.FMSystem.common.BaseContext;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.AddressBook;
import com.JIAL.FMSystem.service.AddressBookService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 地址簿管理
*/
@Slf4j
@RestController
@RequestMapping("/addressBook")
public class AddressBookController {
@Autowired
private AddressBookService addressBookService;
/**
* 新增
*/
@PostMapping
public R<AddressBook> save(@RequestBody AddressBook addressBook) {
addressBook.setUserId(BaseContext.getCurrentId());
log.info("addressBook:{}", addressBook);
addressBookService.save(addressBook);
return R.success(addressBook);
}
/**
* 设置默认地址
*/
@PutMapping("default")
public R<AddressBook> setDefault(@RequestBody AddressBook addressBook) {
log.info("addressBook:{}", addressBook);
LambdaUpdateWrapper<AddressBook> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId());
wrapper.set(AddressBook::getIsDefault, 0);
//SQL:update address_book set is_default = 0 where user_id = ?
addressBookService.update(wrapper);
addressBook.setIsDefault(1);
//SQL:update address_book set is_default = 1 where id = ?
addressBookService.updateById(addressBook);
return R.success(addressBook);
}
/**
* 根据id查询地址
*/
@GetMapping("/{id}")
public R get(@PathVariable Long id) {
AddressBook addressBook = addressBookService.getById(id);
if (addressBook != null) {
return R.success(addressBook);
} else {
return R.error("没有找到该对象");
}
}
/**
* 查询默认地址
*/
@GetMapping("default")
public R<AddressBook> getDefault() {
LambdaQueryWrapper<AddressBook> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId());
queryWrapper.eq(AddressBook::getIsDefault, 1);
//SQL:select * from address_book where user_id = ? and is_default = 1
AddressBook addressBook = addressBookService.getOne(queryWrapper);
if (null == addressBook) {
return R.error("没有找到该对象");
} else {
return R.success(addressBook);
}
}
/**
* 查询指定用户的全部地址
*/
@GetMapping("/list")
public R<List<AddressBook>> list(AddressBook addressBook) {
addressBook.setUserId(BaseContext.getCurrentId());
log.info("addressBook:{}", addressBook);
//条件构造器
LambdaQueryWrapper<AddressBook> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(null != addressBook.getUserId(), AddressBook::getUserId, addressBook.getUserId());
queryWrapper.orderByDesc(AddressBook::getUpdateTime);
//SQL:select * from address_book where user_id = ? order by update_time desc
return R.success(addressBookService.list(queryWrapper));
}
}

View File

@ -1,102 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.Category;
import com.JIAL.FMSystem.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 分类管理
*/
@RestController
@RequestMapping("/category")
@Slf4j
public class CategoryController {
@Autowired
private CategoryService categoryService;
/**
* 新增分类
* @param category
* @return
*/
@PostMapping
public R<String> save(@RequestBody Category category){
log.info("category:{}",category);
categoryService.save(category);
return R.success("新增分类成功");
}
/**
* 分页查询
* @param page
* @param pageSize
* @return
*/
@GetMapping("/page")
public R<Page> page(int page,int pageSize){
//分页构造器
Page<Category> pageInfo = new Page<>(page,pageSize);
//条件构造器
LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>();
//添加排序条件根据sort进行排序
queryWrapper.orderByAsc(Category::getSort);
//分页查询
categoryService.page(pageInfo,queryWrapper);
return R.success(pageInfo);
}
/**
* 根据id删除分类
* @param id
* @return
*/
@DeleteMapping
public R<String> delete(Long id){
log.info("删除分类id为{}",id);
//categoryService.removeById(id);
categoryService.remove(id);
return R.success("分类信息删除成功");
}
/**
* 根据id修改分类信息
* @param category
* @return
*/
@PutMapping
public R<String> update(@RequestBody Category category){
log.info("修改分类信息:{}",category);
categoryService.updateById(category);
return R.success("修改分类信息成功");
}
/**
* 根据条件查询分类数据
* @param category
* @return
*/
@GetMapping("/list")
public R<List<Category>> list(Category category){
//条件构造器
LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>();
//添加条件
queryWrapper.eq(category.getType() != null,Category::getType,category.getType());
//添加排序条件
queryWrapper.orderByAsc(Category::getSort).orderByDesc(Category::getUpdateTime);
List<Category> list = categoryService.list(queryWrapper);
return R.success(list);
}
}

View File

@ -1,93 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.JIAL.FMSystem.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.UUID;
/**
* 文件上传和下载
*/
@RestController
@RequestMapping("/common")
@Slf4j
public class CommonController {
@Value("${reggie.path}")
private String basePath;
/**
* 文件上传
* @param file
* @return
*/
@PostMapping("/upload")
public R<String> upload(MultipartFile file){
//file是一个临时文件需要转存到指定位置否则本次请求完成后临时文件会删除
log.info(file.toString());
//原始文件名
String originalFilename = file.getOriginalFilename();//abc.jpg
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
//使用UUID重新生成文件名防止文件名称重复造成文件覆盖
String fileName = UUID.randomUUID().toString() + suffix;//dfsdfdfd.jpg
//创建一个目录对象
File dir = new File(basePath);
//判断当前目录是否存在
if(!dir.exists()){
//目录不存在需要创建
dir.mkdirs();
}
try {
//将临时文件转存到指定位置
file.transferTo(new File(basePath + fileName));
} catch (IOException e) {
e.printStackTrace();
}
return R.success(fileName);
}
/**
* 文件下载
* @param name
* @param response
*/
@GetMapping("/download")
public void download(String name, HttpServletResponse response){
try {
//输入流通过输入流读取文件内容
FileInputStream fileInputStream = new FileInputStream(new File(basePath + name));
//输出流通过输出流将文件写回浏览器
ServletOutputStream outputStream = response.getOutputStream();
response.setContentType("image/jpeg");
int len = 0;
byte[] bytes = new byte[1024];
while ((len = fileInputStream.read(bytes)) != -1){
outputStream.write(bytes,0,len);
outputStream.flush();
}
//关闭资源
outputStream.close();
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -1,189 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.dto.DishDto;
import com.JIAL.FMSystem.entity.Category;
import com.JIAL.FMSystem.entity.Dish;
import com.JIAL.FMSystem.entity.DishFlavor;
import com.JIAL.FMSystem.service.CategoryService;
import com.JIAL.FMSystem.service.DishFlavorService;
import com.JIAL.FMSystem.service.DishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 菜品管理
*/
@RestController
@RequestMapping("/dish")
@Slf4j
public class DishController {
@Autowired
private DishService dishService;
@Autowired
private DishFlavorService dishFlavorService;
@Autowired
private CategoryService categoryService;
/**
* 新增菜品
* @param dishDto
* @return
*/
@PostMapping
public R<String> save(@RequestBody DishDto dishDto){
log.info(dishDto.toString());
dishService.saveWithFlavor(dishDto);
return R.success("新增菜品成功");
}
/**
* 菜品信息分页查询
* @param page
* @param pageSize
* @param name
* @return
*/
@GetMapping("/page")
public R<Page> page(int page,int pageSize,String name){
//构造分页构造器对象
Page<Dish> pageInfo = new Page<>(page,pageSize);
Page<DishDto> dishDtoPage = new Page<>();
//条件构造器
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
//添加过滤条件
queryWrapper.like(name != null,Dish::getName,name);
//添加排序条件
queryWrapper.orderByDesc(Dish::getUpdateTime);
//执行分页查询
dishService.page(pageInfo,queryWrapper);
//对象拷贝
BeanUtils.copyProperties(pageInfo,dishDtoPage,"records");
List<Dish> records = pageInfo.getRecords();
List<DishDto> list = records.stream().map((item) -> {
DishDto dishDto = new DishDto();
BeanUtils.copyProperties(item,dishDto);
Long categoryId = item.getCategoryId();//分类id
//根据id查询分类对象
Category category = categoryService.getById(categoryId);
if(category != null){
String categoryName = category.getName();
dishDto.setCategoryName(categoryName);
}
return dishDto;
}).collect(Collectors.toList());
dishDtoPage.setRecords(list);
return R.success(dishDtoPage);
}
/**
* 根据id查询菜品信息和对应的口味信息
* @param id
* @return
*/
@GetMapping("/{id}")
public R<DishDto> get(@PathVariable Long id){
DishDto dishDto = dishService.getByIdWithFlavor(id);
return R.success(dishDto);
}
/**
* 修改菜品
* @param dishDto
* @return
*/
@PutMapping
public R<String> update(@RequestBody DishDto dishDto){
log.info(dishDto.toString());
dishService.updateWithFlavor(dishDto);
return R.success("修改菜品成功");
}
/**
* 根据条件查询对应的菜品数据
* @param dish
* @return
*/
/*@GetMapping("/list")
public R<List<Dish>> list(Dish dish){
//构造查询条件
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(dish.getCategoryId() != null ,Dish::getCategoryId,dish.getCategoryId());
//添加条件查询状态为1起售状态的菜品
queryWrapper.eq(Dish::getStatus,1);
//添加排序条件
queryWrapper.orderByAsc(Dish::getSort).orderByDesc(Dish::getUpdateTime);
List<Dish> list = dishService.list(queryWrapper);
return R.success(list);
}*/
@GetMapping("/list")
public R<List<DishDto>> list(Dish dish){
//构造查询条件
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(dish.getCategoryId() != null ,Dish::getCategoryId,dish.getCategoryId());
//添加条件查询状态为1起售状态的菜品
queryWrapper.eq(Dish::getStatus,1);
//添加排序条件
queryWrapper.orderByAsc(Dish::getSort).orderByDesc(Dish::getUpdateTime);
List<Dish> list = dishService.list(queryWrapper);
List<DishDto> dishDtoList = list.stream().map((item) -> {
DishDto dishDto = new DishDto();
BeanUtils.copyProperties(item,dishDto);
Long categoryId = item.getCategoryId();//分类id
//根据id查询分类对象
Category category = categoryService.getById(categoryId);
if(category != null){
String categoryName = category.getName();
dishDto.setCategoryName(categoryName);
}
//当前菜品的id
Long dishId = item.getId();
LambdaQueryWrapper<DishFlavor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DishFlavor::getDishId,dishId);
//SQL:select * from dish_flavor where dish_id = ?
List<DishFlavor> dishFlavorList = dishFlavorService.list(lambdaQueryWrapper);
dishDto.setFlavors(dishFlavorList);
return dishDto;
}).collect(Collectors.toList());
return R.success(dishDtoList);
}
}

View File

@ -1,159 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.Employee;
import com.JIAL.FMSystem.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@Slf4j
@RestController
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
/**
* 员工登录
* @param request
* @param employee
* @return
*/
@PostMapping("/login")
public R<Employee> login(HttpServletRequest request,@RequestBody Employee employee){
//1将页面提交的密码password进行md5加密处理
String password = employee.getPassword();
password = DigestUtils.md5DigestAsHex(password.getBytes());
//2根据页面提交的用户名username查询数据库
LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Employee::getUsername,employee.getUsername());
Employee emp = employeeService.getOne(queryWrapper);
//3如果没有查询到则返回登录失败结果
if(emp == null){
return R.error("登录失败");
}
//4密码比对如果不一致则返回登录失败结果
if(!emp.getPassword().equals(password)){
return R.error("登录失败");
}
//5查看员工状态如果为已禁用状态则返回员工已禁用结果
if(emp.getStatus() == 0){
return R.error("账号已禁用");
}
//6登录成功将员工id存入Session并返回登录成功结果
request.getSession().setAttribute("employee",emp.getId());
return R.success(emp);
}
/**
* 员工退出
* @param request
* @return
*/
@PostMapping("/logout")
public R<String> logout(HttpServletRequest request){
//清理Session中保存的当前登录员工的id
request.getSession().removeAttribute("employee");
return R.success("退出成功");
}
/**
* 新增员工
* @param employee
* @return
*/
@PostMapping
public R<String> save(HttpServletRequest request,@RequestBody Employee employee){
log.info("新增员工,员工信息:{}",employee.toString());
//设置初始密码123456需要进行md5加密处理
employee.setPassword(DigestUtils.md5DigestAsHex(employee.getPassword().getBytes()));
//employee.setCreateTime(LocalDateTime.now());
//employee.setUpdateTime(LocalDateTime.now());
//获得当前登录用户的id
//Long empId = (Long) request.getSession().getAttribute("employee");
//employee.setCreateUser(empId);
//employee.setUpdateUser(empId);
employeeService.save(employee);
return R.success("新增账号成功");
}
/**
* 员工信息分页查询
* @param page
* @param pageSize
* @param username
* @return
*/
@GetMapping("/page")
public R<Page> page(int page,int pageSize,String username){
log.info("page = {},pageSize = {},username = {}" ,page,pageSize,username);
//构造分页构造器
Page pageInfo = new Page(page,pageSize);
//构造条件构造器
LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper();
//添加过滤条件
queryWrapper.like(StringUtils.isNotEmpty(username),Employee::getUsername,username);
//添加排序条件
queryWrapper.orderByDesc(Employee::getUpdateTime);
//执行查询
employeeService.page(pageInfo,queryWrapper);
return R.success(pageInfo);
}
/**
* 根据id修改员工信息
* @param employee
* @return
*/
@PutMapping
public R<String> update(HttpServletRequest request,@RequestBody Employee employee){
log.info(employee.toString());
long id = Thread.currentThread().getId();
log.info("线程id为{}",id);
//Long empId = (Long)request.getSession().getAttribute("employee");
//employee.setUpdateTime(LocalDateTime.now());
//employee.setUpdateUser(empId);
employeeService.updateById(employee);
return R.success("员工信息修改成功");
}
/**
* 根据id查询员工信息
* @param id
* @return
*/
@GetMapping("/{id}")
public R<Employee> getById(@PathVariable Long id){
log.info("根据id查询员工信息...");
Employee employee = employeeService.getById(id);
if(employee != null){
return R.success(employee);
}
return R.error("没有查询到对应员工信息");
}
}

View File

@ -1,35 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.Orders;
import com.JIAL.FMSystem.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单
*/
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
@Autowired
private OrderService orderService;
/**
* 用户下单
* @param orders
* @return
*/
@PostMapping("/submit")
public R<String> submit(@RequestBody Orders orders){
log.info("订单数据:{}",orders);
orderService.submit(orders);
return R.success("下单成功");
}
}

View File

@ -1,19 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.JIAL.FMSystem.service.OrderDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 订单明细
*/
@Slf4j
@RestController
@RequestMapping("/orderDetail")
public class OrderDetailController {
@Autowired
private OrderDetailService orderDetailService;
}

View File

@ -1,127 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.dto.SetmealDto;
import com.JIAL.FMSystem.entity.Category;
import com.JIAL.FMSystem.entity.Setmeal;
import com.JIAL.FMSystem.service.CategoryService;
import com.JIAL.FMSystem.service.SetmealDishService;
import com.JIAL.FMSystem.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 套餐管理
*/
@RestController
@RequestMapping("/setmeal")
@Slf4j
public class SetmealController {
@Autowired
private SetmealService setmealService;
@Autowired
private CategoryService categoryService;
@Autowired
private SetmealDishService setmealDishService;
/**
* 新增套餐
* @param setmealDto
* @return
*/
@PostMapping
public R<String> save(@RequestBody SetmealDto setmealDto){
log.info("套餐信息:{}",setmealDto);
setmealService.saveWithDish(setmealDto);
return R.success("新增套餐成功");
}
/**
* 套餐分页查询
* @param page
* @param pageSize
* @param name
* @return
*/
@GetMapping("/page")
public R<Page> page(int page,int pageSize,String name){
//分页构造器对象
Page<Setmeal> pageInfo = new Page<>(page,pageSize);
Page<SetmealDto> dtoPage = new Page<>();
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper<>();
//添加查询条件根据name进行like模糊查询
queryWrapper.like(name != null,Setmeal::getName,name);
//添加排序条件根据更新时间降序排列
queryWrapper.orderByDesc(Setmeal::getUpdateTime);
setmealService.page(pageInfo,queryWrapper);
//对象拷贝
BeanUtils.copyProperties(pageInfo,dtoPage,"records");
List<Setmeal> records = pageInfo.getRecords();
List<SetmealDto> list = records.stream().map((item) -> {
SetmealDto setmealDto = new SetmealDto();
//对象拷贝
BeanUtils.copyProperties(item,setmealDto);
//分类id
Long categoryId = item.getCategoryId();
//根据分类id查询分类对象
Category category = categoryService.getById(categoryId);
if(category != null){
//分类名称
String categoryName = category.getName();
setmealDto.setCategoryName(categoryName);
}
return setmealDto;
}).collect(Collectors.toList());
dtoPage.setRecords(list);
return R.success(dtoPage);
}
/**
* 删除套餐
* @param ids
* @return
*/
@DeleteMapping
public R<String> delete(@RequestParam List<Long> ids){
log.info("ids:{}",ids);
setmealService.removeWithDish(ids);
return R.success("套餐数据删除成功");
}
/**
* 根据条件查询套餐数据
* @param setmeal
* @return
*/
@GetMapping("/list")
public R<List<Setmeal>> list(Setmeal setmeal){
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(setmeal.getCategoryId() != null,Setmeal::getCategoryId,setmeal.getCategoryId());
queryWrapper.eq(setmeal.getStatus() != null,Setmeal::getStatus,setmeal.getStatus());
queryWrapper.orderByDesc(Setmeal::getUpdateTime);
List<Setmeal> list = setmealService.list(queryWrapper);
return R.success(list);
}
}

View File

@ -1,105 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.JIAL.FMSystem.common.BaseContext;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.ShoppingCart;
import com.JIAL.FMSystem.service.ShoppingCartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* 购物车
*/
@Slf4j
@RestController
@RequestMapping("/shoppingCart")
public class ShoppingCartController {
@Autowired
private ShoppingCartService shoppingCartService;
/**
* 添加购物车
* @param shoppingCart
* @return
*/
@PostMapping("/add")
public R<ShoppingCart> add(@RequestBody ShoppingCart shoppingCart){
log.info("购物车数据:{}",shoppingCart);
//设置用户id指定当前是哪个用户的购物车数据
Long currentId = BaseContext.getCurrentId();
shoppingCart.setUserId(currentId);
Long dishId = shoppingCart.getDishId();
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShoppingCart::getUserId,currentId);
if(dishId != null){
//添加到购物车的是菜品
queryWrapper.eq(ShoppingCart::getDishId,dishId);
}else{
//添加到购物车的是套餐
queryWrapper.eq(ShoppingCart::getSetmealId,shoppingCart.getSetmealId());
}
//查询当前菜品或者套餐是否在购物车中
//SQL:select * from shopping_cart where user_id = ? and dish_id/setmeal_id = ?
ShoppingCart cartServiceOne = shoppingCartService.getOne(queryWrapper);
if(cartServiceOne != null){
//如果已经存在就在原来数量基础上加一
Integer number = cartServiceOne.getNumber();
cartServiceOne.setNumber(number + 1);
shoppingCartService.updateById(cartServiceOne);
}else{
//如果不存在则添加到购物车数量默认就是一
shoppingCart.setNumber(1);
shoppingCart.setCreateTime(LocalDateTime.now());
shoppingCartService.save(shoppingCart);
cartServiceOne = shoppingCart;
}
return R.success(cartServiceOne);
}
/**
* 查看购物车
* @return
*/
@GetMapping("/list")
public R<List<ShoppingCart>> list(){
log.info("查看购物车...");
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShoppingCart::getUserId,BaseContext.getCurrentId());
queryWrapper.orderByAsc(ShoppingCart::getCreateTime);
List<ShoppingCart> list = shoppingCartService.list(queryWrapper);
return R.success(list);
}
/**
* 清空购物车
* @return
*/
@DeleteMapping("/clean")
public R<String> clean(){
//SQL:delete from shopping_cart where user_id = ?
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShoppingCart::getUserId,BaseContext.getCurrentId());
shoppingCartService.remove(queryWrapper);
return R.success("清空购物车成功");
}
}

View File

@ -1,94 +0,0 @@
package com.JIAL.FMSystem.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.FMSystem.service.UserService;
import com.JIAL.FMSystem.utils.ValidateCodeUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.servlet.http.HttpSession;
import java.util.Map;
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
@Autowired
private UserService userService;
/**
* 发送手机短信验证码
* @param user
* @return
*/
@PostMapping("/sendMsg")
public R<String> sendMsg(@RequestBody User user, HttpSession session){
//获取手机号
String phone = user.getPhone();
if(StringUtils.isNotEmpty(phone)){
//生成随机的4位验证码
String code = ValidateCodeUtils.generateValidateCode(4).toString();
log.info("code={}",code);
//调用阿里云提供的短信服务API完成发送短信
//SMSUtils.sendMessage("瑞吉外卖","",phone,code);
//需要将生成的验证码保存到Session
session.setAttribute(phone,code);
return R.success("手机验证码短信发送成功");
}
return R.error("短信发送失败");
}
/**
* 移动端用户登录
* @param map
* @param session
* @return
*/
@PostMapping("/login")
public R<User> login(@RequestBody Map map, HttpSession session){
log.info(map.toString());
//获取手机号
String phone = map.get("phone").toString();
//获取验证码
String code = map.get("code").toString();
//从Session中获取保存的验证码
Object codeInSession = session.getAttribute(phone);
//进行验证码的比对页面提交的验证码和Session中保存的验证码比对
if(codeInSession != null && codeInSession.equals(code)){
//如果能够比对成功说明登录成功
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(User::getPhone,phone);
User user = userService.getOne(queryWrapper);
if(user == null){
//判断当前手机号对应的用户是否为新用户如果是新用户就自动完成注册
user = new User();
user.setPhone(phone);
user.setStatus(1);
userService.save(user);
}
session.setAttribute("user",user.getId());
return R.success(user);
}
return R.error("登录失败");
}
}

View File

@ -1,18 +0,0 @@
package com.JIAL.FMSystem.dto;
import com.JIAL.FMSystem.entity.Dish;
import com.JIAL.FMSystem.entity.DishFlavor;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class DishDto extends Dish {
//菜品对应的口味数据
private List<DishFlavor> flavors = new ArrayList<>();
private String categoryName;
private Integer copies;
}

View File

@ -1,14 +0,0 @@
package com.JIAL.FMSystem.dto;
import com.JIAL.FMSystem.entity.Setmeal;
import com.JIAL.FMSystem.entity.SetmealDish;
import lombok.Data;
import java.util.List;
@Data
public class SetmealDto extends Setmeal {
private List<SetmealDish> setmealDishes;
private String categoryName;
}

View File

@ -1,92 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 地址簿
*/
@Data
public class AddressBook implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//用户id
private Long userId;
//收货人
private String consignee;
//手机号
private String phone;
//性别 0 1
private String sex;
//省级区划编号
private String provinceCode;
//省级名称
private String provinceName;
//市级区划编号
private String cityCode;
//市级名称
private String cityName;
//区级区划编号
private String districtCode;
//区级名称
private String districtName;
//详细地址
private String detail;
//标签
private String label;
//是否默认 0 1是
private Integer isDefault;
//创建时间
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
//更新时间
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
//创建人
@TableField(fill = FieldFill.INSERT)
private Long createUser;
//修改人
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
//是否删除
private Integer isDeleted;
}

View File

@ -1,52 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 分类
*/
@Data
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//类型 1 菜品分类 2 套餐分类
private Integer type;
//分类名称
private String name;
//顺序
private Integer sort;
//创建时间
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
//更新时间
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
//创建人
@TableField(fill = FieldFill.INSERT)
private Long createUser;
//修改人
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
}

View File

@ -1,68 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
菜品
*/
@Data
public class Dish implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//菜品名称
private String name;
//菜品分类id
private Long categoryId;
//菜品价格
private BigDecimal price;
//商品码
private String code;
//图片
private String image;
//描述信息
private String description;
//0 停售 1 起售
private Integer status;
//顺序
private Integer sort;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT)
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
}

View File

@ -1,51 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
菜品口味
*/
@Data
public class DishFlavor implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//菜品id
private Long dishId;
//口味名称
private String name;
//口味数据list
private String value;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT)
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
//是否删除
private Integer isDeleted;
}

View File

@ -1,43 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 员工实体
*/
@Data
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String username;
private String name;
private String password;
private String phone;
private String admin;
private Integer status;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
}

View File

@ -1,44 +0,0 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 订单明细
*/
@Data
public class OrderDetail implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//名称
private String name;
//订单id
private Long orderId;
//菜品id
private Long dishId;
//套餐id
private Long setmealId;
//口味
private String dishFlavor;
//数量
private Integer number;
//金额
private BigDecimal amount;
//图片
private String image;
}

View File

@ -1,61 +0,0 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 订单
*/
@Data
public class Orders implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//订单号
private String number;
//订单状态 1待付款2待派送3已派送4已完成5已取消
private Integer status;
//下单用户id
private Long userId;
//地址id
private Long addressBookId;
//下单时间
private LocalDateTime orderTime;
//结账时间
private LocalDateTime checkoutTime;
//支付方式 1微信2支付宝
private Integer payMethod;
//实收金额
private BigDecimal amount;
//备注
private String remark;
//用户名
private String userName;
//手机号
private String phone;
//地址
private String address;
//收货人
private String consignee;
}

View File

@ -1,64 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 套餐
*/
@Data
public class Setmeal implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//分类id
private Long categoryId;
//套餐名称
private String name;
//套餐价格
private BigDecimal price;
//状态 0:停用 1:启用
private Integer status;
//编码
private String code;
//描述信息
private String description;
//图片
private String image;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT)
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
}

View File

@ -1,61 +0,0 @@
package com.JIAL.FMSystem.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 套餐菜品关系
*/
@Data
public class SetmealDish implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//套餐id
private Long setmealId;
//菜品id
private Long dishId;
//菜品名称 冗余字段
private String name;
//菜品原价
private BigDecimal price;
//份数
private Integer copies;
//排序
private Integer sort;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT)
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateUser;
//是否删除
private Integer isDeleted;
}

View File

@ -1,43 +0,0 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 购物车
*/
@Data
public class ShoppingCart implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//名称
private String name;
//用户id
private Long userId;
//菜品id
private Long dishId;
//套餐id
private Long setmealId;
//口味
private String dishFlavor;
//数量
private Integer number;
//金额
private BigDecimal amount;
//图片
private String image;
private LocalDateTime createTime;
}

View File

@ -1,40 +0,0 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 用户信息
*/
@Data
public class User implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
//姓名
private String name;
//手机号
private String phone;
//性别 0 1
private String sex;
//身份证号
private String idNumber;
//头像
private String avatar;
//状态 0:禁用1:正常
private Integer status;
}

View File

@ -1,10 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.AddressBook;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AddressBookMapper extends BaseMapper<AddressBook> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.Category;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CategoryMapper extends BaseMapper<Category> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.DishFlavor;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DishFlavorMapper extends BaseMapper<DishFlavor> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.Dish;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DishMapper extends BaseMapper<Dish> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EmployeeMapper extends BaseMapper<Employee>{
}

View File

@ -1,10 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
}

View File

@ -1,10 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderMapper extends BaseMapper<Orders> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SetmealDishMapper extends BaseMapper<SetmealDish> {
}

View File

@ -1,9 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.Setmeal;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SetmealMapper extends BaseMapper<Setmeal> {
}

View File

@ -1,10 +0,0 @@
package com.JIAL.FMSystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ShoppingCartMapper extends BaseMapper<ShoppingCart> {
}

View File

@ -1,8 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.AddressBook;
public interface AddressBookService extends IService<AddressBook> {
}

View File

@ -1,10 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.Category;
public interface CategoryService extends IService<Category> {
public void remove(Long id);
}

View File

@ -1,7 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.DishFlavor;
public interface DishFlavorService extends IService<DishFlavor> {
}

View File

@ -1,17 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.dto.DishDto;
import com.JIAL.FMSystem.entity.Dish;
public interface DishService extends IService<Dish> {
//新增菜品同时插入菜品对应的口味数据需要操作两张表dishdish_flavor
public void saveWithFlavor(DishDto dishDto);
//根据id查询菜品信息和对应的口味信息
public DishDto getByIdWithFlavor(Long id);
//更新菜品信息同时更新对应的口味信息
public void updateWithFlavor(DishDto dishDto);
}

View File

@ -1,7 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.Employee;
public interface EmployeeService extends IService<Employee> {
}

View File

@ -1,8 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.OrderDetail;
public interface OrderDetailService extends IService<OrderDetail> {
}

View File

@ -1,13 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.Orders;
public interface OrderService extends IService<Orders> {
/**
* 用户下单
* @param orders
*/
public void submit(Orders orders);
}

View File

@ -1,7 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.SetmealDish;
public interface SetmealDishService extends IService<SetmealDish> {
}

View File

@ -1,21 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.dto.SetmealDto;
import com.JIAL.FMSystem.entity.Setmeal;
import java.util.List;
public interface SetmealService extends IService<Setmeal> {
/**
* 新增套餐同时需要保存套餐和菜品的关联关系
* @param setmealDto
*/
public void saveWithDish(SetmealDto setmealDto);
/**
* 删除套餐同时需要删除套餐和菜品的关联数据
* @param ids
*/
public void removeWithDish(List<Long> ids);
}

View File

@ -1,8 +0,0 @@
package com.JIAL.FMSystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.ShoppingCart;
public interface ShoppingCartService extends IService<ShoppingCart> {
}

View File

@ -1,12 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.AddressBook;
import com.JIAL.FMSystem.mapper.AddressBookMapper;
import com.JIAL.FMSystem.service.AddressBookService;
import org.springframework.stereotype.Service;
@Service
public class AddressBookServiceImpl extends ServiceImpl<AddressBookMapper, AddressBook> implements AddressBookService {
}

View File

@ -1,55 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.common.CustomException;
import com.JIAL.FMSystem.entity.Category;
import com.JIAL.FMSystem.entity.Dish;
import com.JIAL.FMSystem.entity.Setmeal;
import com.JIAL.FMSystem.mapper.CategoryMapper;
import com.JIAL.FMSystem.service.CategoryService;
import com.JIAL.FMSystem.service.DishService;
import com.JIAL.FMSystem.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper,Category> implements CategoryService{
@Autowired
private DishService dishService;
@Autowired
private SetmealService setmealService;
/**
* 根据id删除分类删除之前需要进行判断
* @param id
*/
@Override
public void remove(Long id) {
LambdaQueryWrapper<Dish> dishLambdaQueryWrapper = new LambdaQueryWrapper<>();
//添加查询条件根据分类id进行查询
dishLambdaQueryWrapper.eq(Dish::getCategoryId,id);
int count1 = dishService.count(dishLambdaQueryWrapper);
//查询当前分类是否关联了菜品如果已经关联抛出一个业务异常
if(count1 > 0){
//已经关联菜品抛出一个业务异常
throw new CustomException("当前分类下关联了菜品,不能删除");
}
//查询当前分类是否关联了套餐如果已经关联抛出一个业务异常
LambdaQueryWrapper<Setmeal> setmealLambdaQueryWrapper = new LambdaQueryWrapper<>();
//添加查询条件根据分类id进行查询
setmealLambdaQueryWrapper.eq(Setmeal::getCategoryId,id);
int count2 = setmealService.count();
if(count2 > 0){
//已经关联套餐抛出一个业务异常
throw new CustomException("当前分类下关联了套餐,不能删除");
}
//正常删除分类
super.removeById(id);
}
}

View File

@ -1,11 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.DishFlavor;
import com.JIAL.FMSystem.mapper.DishFlavorMapper;
import com.JIAL.FMSystem.service.DishFlavorService;
import org.springframework.stereotype.Service;
@Service
public class DishFlavorServiceImpl extends ServiceImpl<DishFlavorMapper,DishFlavor> implements DishFlavorService {
}

View File

@ -1,93 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.dto.DishDto;
import com.JIAL.FMSystem.entity.Dish;
import com.JIAL.FMSystem.entity.DishFlavor;
import com.JIAL.FMSystem.mapper.DishMapper;
import com.JIAL.FMSystem.service.DishFlavorService;
import com.JIAL.FMSystem.service.DishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class DishServiceImpl extends ServiceImpl<DishMapper,Dish> implements DishService {
@Autowired
private DishFlavorService dishFlavorService;
/**
* 新增菜品同时保存对应的口味数据
* @param dishDto
*/
@Transactional
public void saveWithFlavor(DishDto dishDto) {
//保存菜品的基本信息到菜品表dish
this.save(dishDto);
Long dishId = dishDto.getId();//菜品id
//菜品口味
List<DishFlavor> flavors = dishDto.getFlavors();
flavors = flavors.stream().map((item) -> {
item.setDishId(dishId);
return item;
}).collect(Collectors.toList());
//保存菜品口味数据到菜品口味表dish_flavor
dishFlavorService.saveBatch(flavors);
}
/**
* 根据id查询菜品信息和对应的口味信息
* @param id
* @return
*/
public DishDto getByIdWithFlavor(Long id) {
//查询菜品基本信息从dish表查询
Dish dish = this.getById(id);
DishDto dishDto = new DishDto();
BeanUtils.copyProperties(dish,dishDto);
//查询当前菜品对应的口味信息从dish_flavor表查询
LambdaQueryWrapper<DishFlavor> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DishFlavor::getDishId,dish.getId());
List<DishFlavor> flavors = dishFlavorService.list(queryWrapper);
dishDto.setFlavors(flavors);
return dishDto;
}
@Override
@Transactional
public void updateWithFlavor(DishDto dishDto) {
//更新dish表基本信息
this.updateById(dishDto);
//清理当前菜品对应口味数据---dish_flavor表的delete操作
LambdaQueryWrapper<DishFlavor> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(DishFlavor::getDishId,dishDto.getId());
dishFlavorService.remove(queryWrapper);
//添加当前提交过来的口味数据---dish_flavor表的insert操作
List<DishFlavor> flavors = dishDto.getFlavors();
flavors = flavors.stream().map((item) -> {
item.setDishId(dishDto.getId());
return item;
}).collect(Collectors.toList());
dishFlavorService.saveBatch(flavors);
}
}

View File

@ -1,11 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.Employee;
import com.JIAL.FMSystem.mapper.EmployeeMapper;
import com.JIAL.FMSystem.service.EmployeeService;
import org.springframework.stereotype.Service;
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper,Employee> implements EmployeeService{
}

View File

@ -1,12 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.OrderDetail;
import com.JIAL.FMSystem.mapper.OrderDetailMapper;
import com.JIAL.FMSystem.service.OrderDetailService;
import org.springframework.stereotype.Service;
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {
}

View File

@ -1,108 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.common.BaseContext;
import com.JIAL.FMSystem.common.CustomException;
import com.JIAL.FMSystem.entity.*;
import com.JIAL.FMSystem.mapper.OrderMapper;
import com.JIAL.FMSystem.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Service
@Slf4j
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Orders> implements OrderService {
@Autowired
private ShoppingCartService shoppingCartService;
@Autowired
private UserService userService;
@Autowired
private AddressBookService addressBookService;
@Autowired
private OrderDetailService orderDetailService;
/**
* 用户下单
* @param orders
*/
@Transactional
public void submit(Orders orders) {
//获得当前用户id
Long userId = BaseContext.getCurrentId();
//查询当前用户的购物车数据
LambdaQueryWrapper<ShoppingCart> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShoppingCart::getUserId,userId);
List<ShoppingCart> shoppingCarts = shoppingCartService.list(wrapper);
if(shoppingCarts == null || shoppingCarts.size() == 0){
throw new CustomException("购物车为空,不能下单");
}
//查询用户数据
User user = userService.getById(userId);
//查询地址数据
Long addressBookId = orders.getAddressBookId();
AddressBook addressBook = addressBookService.getById(addressBookId);
if(addressBook == null){
throw new CustomException("用户地址信息有误,不能下单");
}
long orderId = IdWorker.getId();//订单号
AtomicInteger amount = new AtomicInteger(0);
List<OrderDetail> orderDetails = shoppingCarts.stream().map((item) -> {
OrderDetail orderDetail = new OrderDetail();
orderDetail.setOrderId(orderId);
orderDetail.setNumber(item.getNumber());
orderDetail.setDishFlavor(item.getDishFlavor());
orderDetail.setDishId(item.getDishId());
orderDetail.setSetmealId(item.getSetmealId());
orderDetail.setName(item.getName());
orderDetail.setImage(item.getImage());
orderDetail.setAmount(item.getAmount());
amount.addAndGet(item.getAmount().multiply(new BigDecimal(item.getNumber())).intValue());
return orderDetail;
}).collect(Collectors.toList());
orders.setId(orderId);
orders.setOrderTime(LocalDateTime.now());
orders.setCheckoutTime(LocalDateTime.now());
orders.setStatus(2);
orders.setAmount(new BigDecimal(amount.get()));//总金额
orders.setUserId(userId);
orders.setNumber(String.valueOf(orderId));
orders.setUserName(user.getName());
orders.setConsignee(addressBook.getConsignee());
orders.setPhone(addressBook.getPhone());
orders.setAddress((addressBook.getProvinceName() == null ? "" : addressBook.getProvinceName())
+ (addressBook.getCityName() == null ? "" : addressBook.getCityName())
+ (addressBook.getDistrictName() == null ? "" : addressBook.getDistrictName())
+ (addressBook.getDetail() == null ? "" : addressBook.getDetail()));
//向订单表插入数据一条数据
this.save(orders);
//向订单明细表插入数据多条数据
orderDetailService.saveBatch(orderDetails);
//清空购物车数据
shoppingCartService.remove(wrapper);
}
}

View File

@ -1,13 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.SetmealDish;
import com.JIAL.FMSystem.mapper.SetmealDishMapper;
import com.JIAL.FMSystem.service.SetmealDishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class SetmealDishServiceImpl extends ServiceImpl<SetmealDishMapper,SetmealDish> implements SetmealDishService {
}

View File

@ -1,73 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.common.CustomException;
import com.JIAL.FMSystem.dto.SetmealDto;
import com.JIAL.FMSystem.entity.Setmeal;
import com.JIAL.FMSystem.entity.SetmealDish;
import com.JIAL.FMSystem.mapper.SetmealMapper;
import com.JIAL.FMSystem.service.SetmealDishService;
import com.JIAL.FMSystem.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class SetmealServiceImpl extends ServiceImpl<SetmealMapper,Setmeal> implements SetmealService {
@Autowired
private SetmealDishService setmealDishService;
/**
* 新增套餐同时需要保存套餐和菜品的关联关系
* @param setmealDto
*/
@Transactional
public void saveWithDish(SetmealDto setmealDto) {
//保存套餐的基本信息操作setmeal执行insert操作
this.save(setmealDto);
List<SetmealDish> setmealDishes = setmealDto.getSetmealDishes();
setmealDishes.stream().map((item) -> {
item.setSetmealId(setmealDto.getId());
return item;
}).collect(Collectors.toList());
//保存套餐和菜品的关联信息操作setmeal_dish,执行insert操作
setmealDishService.saveBatch(setmealDishes);
}
/**
* 删除套餐同时需要删除套餐和菜品的关联数据
* @param ids
*/
@Transactional
public void removeWithDish(List<Long> ids) {
//select count(*) from setmeal where id in (1,2,3) and status = 1
//查询套餐状态确定是否可用删除
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(Setmeal::getId,ids);
queryWrapper.eq(Setmeal::getStatus,1);
int count = this.count(queryWrapper);
if(count > 0){
//如果不能删除抛出一个业务异常
throw new CustomException("套餐正在售卖中,不能删除");
}
//如果可以删除先删除套餐表中的数据---setmeal
this.removeByIds(ids);
//delete from setmeal_dish where setmeal_id in (1,2,3)
LambdaQueryWrapper<SetmealDish> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(SetmealDish::getSetmealId,ids);
//删除关系表中的数据----setmeal_dish
setmealDishService.remove(lambdaQueryWrapper);
}
}

View File

@ -1,12 +0,0 @@
package com.JIAL.FMSystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.ShoppingCart;
import com.JIAL.FMSystem.mapper.ShoppingCartMapper;
import com.JIAL.FMSystem.service.ShoppingCartService;
import org.springframework.stereotype.Service;
@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService {
}

View File

@ -1,6 +1,7 @@
package com.JIAL.FMSystem;
package com.JIAL;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@ -10,9 +11,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@ServletComponentScan
@EnableTransactionManagement
public class FWApplication {
public class JIALApplication {
public static void main(String[] args) {
SpringApplication.run(FWApplication.class,args);
SpringApplication.run(JIALApplication.class,args);
log.info("项目启动成功...");
}
}

View File

@ -0,0 +1,42 @@
package com.JIAL.backend.controller;
import com.JIAL.backend.service.FileService;
import com.JIAL.backend.vo.FileVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @ClassName FileController
* @Description 文件上传控制类
* @Author JIAL
* @Date 2023/12/15 13:15
* @Version 1.0
*/
@RestController
@RequestMapping("/file")
public class FileController {
@Autowired
FileService fileService;
@PostMapping("/upload")
public FileVO upload(MultipartFile file) throws IOException {
System.out.println("upload--file is"+file);
//调用service中的业务方法
return fileService.upload(file);
}
@GetMapping("/downloadFile")
public Object downloadFile(HttpServletResponse response, String filePath) throws IOException {
// 清空输出流
response.reset();
response.setContentType("application/x-download;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="+ new String(filePath.getBytes("utf-8"), "utf-8"));
fileService.download(response.getOutputStream(),filePath);
return null;
}
}

View File

@ -0,0 +1,61 @@
package com.JIAL.backend.controller;
import com.JIAL.backend.dto.HearCaseInMenuDto;
import com.JIAL.backend.entity.*;
import com.JIAL.backend.service.HearCaseService;
import com.JIAL.common.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName HeraCaseController
* @Description 审理案件控制类
* @Author JIAL
* @Date 2023/12/6 13:59
* @Version 1.0
*/
@RestController
@RequestMapping("/hearCase")
@Slf4j
public class HeraCaseController {
@Autowired
private HearCaseService hearCaseService;
/**
* @title page
* @description 分页查询案件列表
* @author JIAL
* @param: page
* @param: pageSize
* @param: caseNum
* @updateTime 2023/12/6 15:35
* @return: com.JIAL.FMSystem.common.R<com.baomidou.mybatisplus.extension.plugins.pagination.Page>
*/
@GetMapping("page")
public R<Page> page(int page, int pageSize, String caseNum) {
log.info("page = {}, pageSize = {}, username = {}", page, pageSize, caseNum);
//分页构造器
Page pageInfo = new Page(page, pageSize);
//条件构造器
MPJLambdaWrapper<HearCase> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(HearCase.class)//查询案件所有属性
.select("GROUP_CONCAT(DISTINCT d.unit_name ORDER BY d.id ASC SEPARATOR ', ') AS defendant_name")
.select("GROUP_CONCAT(DISTINCT p.unit_name ORDER BY p.id ASC SEPARATOR ', ') AS plaintiff_name")
.leftJoin(HearCaseDefendant.class, HearCaseDefendant::getHearCaseId, HearCase::getId)
.leftJoin(Defendant.class, "d",Defendant::getId, HearCaseDefendant::getDefendantId)
.leftJoin(HearCasePlaintiff.class, HearCasePlaintiff::getHearCaseId, HearCase::getId)
.leftJoin(Plaintiff.class, "p", Plaintiff::getId, HearCasePlaintiff::getPlaintiffId)
.groupBy(HearCase::getId);
hearCaseService.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
return R.success(pageInfo);
}
}

View File

@ -0,0 +1,28 @@
package com.JIAL.backend.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @ClassName HomeController
* @Description TODO
* @Author JIAL
* @Date 2023/12/25 8:18
* @Version 1.0
*/
@Controller
public class HomeController {
/**
* @title index
* @description 检测请求为/即只有域名不加路径的请求返回主页
* @author JIAL
* @updateTime 2023/12/25 8:18
* @return: java.lang.String
*/
@GetMapping("/")
public String index() {
// 返回 index.html 页面的逻辑视图名
return "index";
}
}

View File

@ -0,0 +1,164 @@
package com.JIAL.backend.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.JIAL.common.R;
import com.JIAL.backend.entity.User;
import com.JIAL.backend.service.UserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/user")
@Slf4j
/**
* @title
* @description
* @author JIAL
* @updateTime 2023/12/5 15:46
*/
public class UserController {
@Autowired
private UserService userService;
/**
* @title login
* @description 员工登陆
* @author JIAL
* @param: request
* @param: user
* @updateTime 2023/12/6 8:06
* @return: com.JIAL.FMSystem.common.R<com.JIAL.FMSystem.entity.User>
*/
@PostMapping("/login")
public R<User> login(HttpServletRequest request, @RequestBody User user) {
//将页面提交的密码进行md5加密
String password = user.getPassword();
password = DigestUtils.md5DigestAsHex(password.getBytes());
//根据页面提交的用户名username查询数据库
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(User::getUsername, user.getUsername());
User userResult = userService.getOne(queryWrapper);
//查询为空就返回登陆失败
if(userResult == null) {
return R.error("登陆失败");
}
if(!userResult.getPassword().equals(password)) {
return R.error("登陆失败");
}
if(userResult.getStatus() == 0) {
return R.error("账号已禁用");
}
request.getSession().setAttribute("user", userResult.getId());
return R.success(userResult);
}
@PostMapping("/logout")
public R<String> logout(HttpServletRequest request) {
//清理session中保存的当前登陆员工的id
request.getSession().removeAttribute("user");
return R.success("退出成功");
}
/**
* @title page
* @description 分页查询员工账号
* @author JIAL
* @param: page
* @param: pageSize
* @param: username
* @updateTime 2023/12/6 10:49
* @return: com.JIAL.FMSystem.common.R<com.baomidou.mybatisplus.extension.plugins.pagination.Page>
*/
@GetMapping("page")
public R<Page> page(int page, int pageSize, String username) {
log.info("page = {}, pageSize = {}, username = {}", page, pageSize, username);
//分页构造器
Page pageInfo = new Page(page, pageSize);
//条件构造器
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtils.isNotEmpty(username), User::getUsername, username);
queryWrapper.orderByDesc(User::getUpdateTime);
userService.page(pageInfo, queryWrapper);
return R.success(pageInfo);
}
/**
* @title getById
* @description 根据id查询用户信息
* @author JIAL
* @param: id
* @updateTime 2023/12/6 10:54
* @return: com.JIAL.FMSystem.common.R<com.JIAL.FMSystem.entity.User>
*/
@GetMapping("/{id}")
public R<User> getById(@PathVariable Long id) {
log.info("根据id查询员工信息...");
User user = userService.getById(id);
if(user != null) {
return R.success(user);
}
return R.error("没有查询到对应员工信息");
}
/**
* @title save
* @description 新建员工信息
* @author JIAL
* @param: request
* @param: user
* @updateTime 2023/12/6 12:45
* @return: com.JIAL.FMSystem.common.R<java.lang.String>
*/
@PostMapping
public R<String> save(HttpServletRequest request, @RequestBody User user) {
log.info("新增员工信息:{}", user.toString());
//初始密码用md5加密
user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
userService.save(user);
return R.success("新增账号成功");
}
/**
* @title update
* @description 根据id修改员工信息
* @author JIAL
* @param: request
* @param: user
* @updateTime 2023/12/6 13:12
* @return: com.JIAL.FMSystem.common.R<java.lang.String>
*/
@PutMapping
public R<String> update(HttpServletRequest request, @RequestBody User user) {
log.info(user.toString());
long id = Thread.currentThread().getId();
log.info("线程id为{}", id);
if(user.getPassword() != null) {
user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
}
userService.updateById(user);
return R.success("员工信息修改成功");
}
}

View File

@ -0,0 +1,67 @@
package com.JIAL.backend.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @ClassName HearCaseInMenu
* @Description 自建在菜单中显示案件详情的类用于分页
* @Author JIAL
* @Date 2023/12/6 22:58
* @Version 1.0
*/
@Data
public class HearCaseInMenuDto {
private static final long serialVersionUID = 1L;
private Integer id;
private String caseNum; //案件号
private String caseReason; //案件来由
private String plaintiffName; //原告单位名称
private String defendantName; //被告单位名称
private Integer caseType; //案件类型
private LocalDateTime trialTime; //开庭时间
private String court; //法院名称
private Integer caseStatus; //案件状态
private String judgeName; //法官姓名
private String judgePhone; //法官电话
private String salesmanName; //业务员姓名
private String salesmanPhone; //业务员电话
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,57 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName agent
* @Description 代理人实体类
* @Author JIAL
* @Date 2023/12/5 12:38
* @Version 1.0
*/
@Data
public class Agent implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Integer type; //代理人类型1-律师2-法律工作者3-单位推荐4-其他
private String name; //姓名
private Integer licenseType; //证件类型1-居民身份证
private String licenseNum; //证件号
private String phoneNum; //电话号码
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,61 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName Annex
* @Description 附件表实体类
* @Author JIAL
* @Date 2023/12/5 13:20
* @Version 1.0
*/
@Data
public class Annex implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long caseId; //案件号
private String indictment; //起诉状附件
private String partyPorve; //当事人身份证明
private String proxyProve; //委托人委托手续和身份材料
private String evidence; //证据材料
private String deliverConfirm; //送达地址确认书
private String otherMaterials; //其他材料
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,50 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName Defendant
* @Description 被告表实体类
* @Author JIAL
* @Date 2023/12/5 13:46
* @Version 1.0
*/
@Data
public class Defendant implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
private Integer type; //当事人类型1-法人
private String unitName; //单位名称
private String unitLocation; //单位所在地
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,65 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName HearCase
* @Description 审理案件表实体类
* @Author JIAL
* @Date 2023/12/5 14:20
* @Version 1.0
*/
@Data
public class HearCase implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String caseNum; //案件号
private String caseReason; //案件来由
private Integer caseType; //案件类型
private LocalDateTime trialTime; //开庭时间
private String court; //法院名称
private Integer caseStatus; //案件状态
private String judgeName; //法官姓名
private String judgePhone; //法官电话
private String salesmanName; //业务员姓名
private String salesmanPhone; //业务员电话
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,23 @@
package com.JIAL.backend.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName HearCaseDefendant
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:05
* @Version 1.0
*/
@Data
public class HearCaseDefendant implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long hearCaseId;
private Long defendantId;
}

View File

@ -0,0 +1,23 @@
package com.JIAL.backend.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName HearCasePlaintiff
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:05
* @Version 1.0
*/
@Data
public class HearCasePlaintiff implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long hearCaseId;
private Long plaintiffId;
}

View File

@ -0,0 +1,65 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName Money
* @Description 案件金额表对应实体类
* @Author JIAL
* @Date 2023/12/5 14:28
* @Version 1.0
*/
@Data
public class Money implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long caseId; //案件ID
private Long litigationAmount; //起诉金
private Long preservationAmount; //保全金额
private Long judicialActionFee; //诉讼费
private Long refund; //退费
private Long preservationFee; //保全费
private Long executeFee; //执行费
private Long estimateFee; //评估费
private Long resultAmount; //结果金额
private String resultAmountRemarks; //结果金额备注
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,57 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName Plaintiff
* @Description 原告表对应实体类
* @Author JIAL
* @Date 2023/12/5 14:45
* @Version 1.0
*/
@Data
public class Plaintiff implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Integer type; //原告类型1-法人
private String unitName; //单位名称
private Integer licenseType; //证照类型1-统一社会信用代码证
private String licenseNum; //证件号码
private String unitLocation; //单位所在地
private String phoneNum; //联系电话
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,58 @@
package com.JIAL.backend.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName User
* @Description 用户实体类
* @Author JIAL
* @Date 2023/12/5 12:38
* @Version 1.0
*/
@Data
public class User implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String name; //姓名
private String username; //账号工号
private String phone; //手机号
private Integer status; //状态 0:禁用1:正常
private String password; //密码
private Integer admin; //管理员等级0-超级用户1-管理员2-用户
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private LocalDateTime updateTime;
@TableField(fill = FieldFill.INSERT) //插入时填充字段
private Long createUser;
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
private Long updateUser;
private String reservedField1; //备用字段1
private String reservedField2; //备用字段2
private String reservedField3; //备用字段3
private String reservedField4; //备用字段4
private String reservedField5; //备用字段5
}

View File

@ -0,0 +1,16 @@
package com.JIAL.backend.mapper;
import com.JIAL.backend.entity.Defendant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName Defendant
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:30
* @Version 1.0
*/
@Mapper
public interface DefendantMapper extends BaseMapper<Defendant> {
}

View File

@ -0,0 +1,16 @@
package com.JIAL.backend.mapper;
import com.JIAL.backend.entity.HearCaseDefendant;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName HearCaseDefendantMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:09
* @Version 1.0
*/
@Mapper
public interface HearCaseDefendantMapper extends MPJBaseMapper<HearCaseDefendant> {
}

View File

@ -0,0 +1,16 @@
package com.JIAL.backend.mapper;
import com.JIAL.backend.entity.HearCase;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName HearCaseMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 14:01
* @Version 1.0
*/
@Mapper
public interface HearCaseMapper extends MPJBaseMapper<HearCase> {
}

View File

@ -0,0 +1,16 @@
package com.JIAL.backend.mapper;
import com.JIAL.backend.entity.HearCasePlaintiff;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName HearCasePlaintiffMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:09
* @Version 1.0
*/
@Mapper
public interface HearCasePlaintiffMapper extends MPJBaseMapper<HearCasePlaintiff> {
}

View File

@ -0,0 +1,17 @@
package com.JIAL.backend.mapper;
import com.JIAL.backend.entity.Plaintiff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName PlaintffMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:32
* @Version 1.0
*/
@Mapper
public interface PlaintiffMapper extends BaseMapper<Plaintiff> {
}

View File

@ -1,9 +1,15 @@
package com.JIAL.FMSystem.mapper;
package com.JIAL.backend.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.backend.entity.User;
import org.apache.ibatis.annotations.Mapper;
/**
* @title
* @description
* @author JIAL
* @updateTime 2023/12/6 14:01
*/
@Mapper
public interface UserMapper extends BaseMapper<User>{
}

View File

@ -0,0 +1,27 @@
package com.JIAL.backend.service;
import com.JIAL.backend.entity.Defendant;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @ClassName DefendantService
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:39
* @Version 1.0
*/
public interface DefendantService extends IService<Defendant> {
/**
* @title idAndNameUnitName
* @description 返回被告的id和单位名称组成的Map
* @author JIAL
* @updateTime 2023/12/6 20:28
* @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/
public List<Map<Long, Object>> idAndNameUnitName(List<Long> list);
}

View File

@ -0,0 +1,21 @@
package com.JIAL.backend.service;
import com.JIAL.backend.vo.FileVO;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.OutputStream;
/**
* @ClassName FileService
* @Description TODO
* @Author JIAL
* @Date 2023/12/18 9:20
* @Version 1.0
*/
public interface FileService {
//文件上传
public FileVO upload(MultipartFile file) throws IOException;
public Object download(OutputStream os, String filePath) throws IOException;
}

View File

@ -0,0 +1,20 @@
package com.JIAL.backend.service;
import com.JIAL.backend.dto.HearCaseInMenuDto;
import com.JIAL.backend.entity.HearCase;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
/**
* @ClassName HearCaseService
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 14:03
* @Version 1.0
*/
public interface HearCaseService extends MPJBaseService<HearCase> {
void selectJoinPage(Page pageInfo, Class<HearCaseInMenuDto> hearCaseInMenuDtoClass, MPJLambdaWrapper<HearCase> queryWrapper);
}

View File

@ -0,0 +1,14 @@
package com.JIAL.backend.service;
import com.JIAL.backend.entity.Plaintiff;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @ClassName PlaintffService
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:47
* @Version 1.0
*/
public interface PlaintiffService extends IService<Plaintiff> {
}

View File

@ -1,7 +1,7 @@
package com.JIAL.FMSystem.service;
package com.JIAL.backend.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.backend.entity.User;
public interface UserService extends IService<User> {
}

View File

@ -0,0 +1,42 @@
package com.JIAL.backend.service.impl;
import com.JIAL.backend.entity.Defendant;
import com.JIAL.backend.mapper.DefendantMapper;
import com.JIAL.backend.service.DefendantService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName DefendantServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:41
* @Version 1.0
*/
@Service
public class DefendantServiceImpl extends ServiceImpl<DefendantMapper, Defendant> implements DefendantService {
@Override
public List<Map<Long, Object>> idAndNameUnitName(List<Long> list) {
LambdaQueryWrapper<Defendant> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Defendant::getId, list);
List<Defendant> resultList = this.list(queryWrapper);
List<Map<Long, Object>> resultMapList = new ArrayList<>();
for(Defendant defendant : resultList) {
Map<Long, Object> columnMap = new HashMap<>();
columnMap.put(defendant.getId(), defendant.getUnitName());
resultMapList.add(columnMap);
}
return resultMapList;
}
}

View File

@ -0,0 +1,95 @@
package com.JIAL.backend.service.impl;
import com.JIAL.backend.service.FileService;
import com.JIAL.backend.vo.FileVO;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
* @ClassName FileServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2023/12/18 9:20
* @Version 1.0
*/
@Service
//加载指定的配置文件
@PropertySource("classpath:/file.properties")
public class FileServiceImpl implements FileService {
//获取配置文件中的配置 为属性动态赋值 注解@Value
@Value("${file.localPathDir}")
private String localPathDir; // Windows路径 例如 D:/files
@Override
public FileVO upload(MultipartFile file) throws IOException {
//1.1 获取文件名称
String fileName = file.getOriginalFilename();
//2. 目录结构
//2.1 实现分目录存储 可以以时间维度年月日进行分隔 /yyyy/MM/dd/
String datePath = new SimpleDateFormat("/yyyy/MM/dd/").format(new Date());
//2.2 最终本地图片存储路径
//进行目录的拼接 "D:/testFiles/2022/03/22";
String localDir = localPathDir + datePath;
//2.3 需要创建目录
File dirFile = new File(localDir);
if(!dirFile.exists()){
dirFile.mkdirs();
}
//3.文件名称重复 采用UUID防止文件重名 uuid.pdf
String uuid = UUID.randomUUID().toString().replace("-", "");
//3.1.获取文件类型
//fileName = abc.jpg fileType=.pdf
String fileType =
fileName.substring(fileName.lastIndexOf("."));
//3.2.重新拼接文件名 uuid.pdf
String realFileName = uuid + fileType;
//4.最终文件存储的路径+文件名 = /2021/11/11/uuid.pdf
//可以在这里将路径存储到数据库 实际保存文件地址 此处省略
String filePathAll = localDir + realFileName;
//5.实现文件上传
File realFile = new File(filePathAll);
file.transferTo(realFile);
//6.封装FileVO对象 //2021/11/11/uuid.pdf 图片路径 稍后给前台传递
//我们不可能将filePathAll告诉用户这样不安全容易被攻击
//virtualPath 半个路径没有具体盘符或根目录 /2021/11/11/uuid.pdf
String virtualPath = datePath + realFileName;
//7.将文件存储路径(半个路径没有具体盘符或根目录) 重命名后的文件名 封装到实体类中
return new FileVO(virtualPath,realFileName);
}
@Override
public Object download(OutputStream os, String filePath) throws IOException {
//下载文件的路径
String downPath = localPathDir+filePath;
//读取目标文件
File f = new File(downPath);
//创建输入流
InputStream is = new FileInputStream(f);
//做一些业务判断我这里简单点直接输出你也可以封装到实体类返回具体信息
if (is == null) {
System.out.println("文件不存在");
}
//利用IOUtils将输入流的内容 复制到输出流
//org.apache.tomcat.util.http.fileupload.IOUtils
//项目搭建是自动集成了这个类 直接使用即可
IOUtils.copy(is, os);
os.flush();
is.close();
os.close();
return null;
}
}

View File

@ -0,0 +1,39 @@
package com.JIAL.backend.service.impl;
import com.JIAL.backend.dto.HearCaseInMenuDto;
import com.JIAL.backend.entity.HearCase;
import com.JIAL.backend.mapper.HearCaseMapper;
import com.JIAL.backend.service.HearCaseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @ClassName HearCaseServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 14:02
* @Version 1.0
*/
@Service
public class HearCaseServiceImpl extends MPJBaseServiceImpl<HearCaseMapper, HearCase> implements HearCaseService {
@Autowired
private HearCaseMapper hearCaseMapper;
/**
* @title selectJoinPage
* @description 在Controller层需要调用到mapper层的方法将其封装在Service层中通过Service层进行调取
* @author JIAL
* @param: pageInfo
* @param: hearCaseInMenuDtoClass
* @param: queryWrapper
* @updateTime 2023/12/7 19:41
*/
public void selectJoinPage(Page pageInfo, Class<HearCaseInMenuDto> hearCaseInMenuDtoClass,
MPJLambdaWrapper<HearCase> queryWrapper) {
hearCaseMapper.selectJoinPage(pageInfo, hearCaseInMenuDtoClass, queryWrapper);
}
}

View File

@ -0,0 +1,18 @@
package com.JIAL.backend.service.impl;
import com.JIAL.backend.entity.Plaintiff;
import com.JIAL.backend.mapper.PlaintiffMapper;
import com.JIAL.backend.service.PlaintiffService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* @ClassName PlaintiffServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2023/12/6 16:49
* @Version 1.0
*/
@Service
public class PlaintiffServiceImpl extends ServiceImpl<PlaintiffMapper, Plaintiff> implements PlaintiffService {
}

View File

@ -1,9 +1,9 @@
package com.JIAL.FMSystem.service.impl;
package com.JIAL.backend.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.FMSystem.mapper.UserMapper;
import com.JIAL.FMSystem.service.UserService;
import com.JIAL.backend.entity.User;
import com.JIAL.backend.mapper.UserMapper;
import com.JIAL.backend.service.UserService;
import org.springframework.stereotype.Service;
@Service

View File

@ -0,0 +1,23 @@
package com.JIAL.backend.vo;
/**
* @ClassName FileVO
* @Description 文件上传的VO对象
* @Author JIAL
* @Date 2023/12/18 9:09
* @Version 1.0
*/
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class FileVO {
private String virtualPath; //动态变化的路径
private String fileName; //文件名称 uuid.pdf
}

View File

@ -1,4 +1,4 @@
package com.JIAL.FMSystem.common;
package com.JIAL.common;
/**
* 基于ThreadLocal封装工具类用户保存和获取当前登录用户id

View File

@ -1,4 +1,4 @@
package com.JIAL.FMSystem.common;
package com.JIAL.common;
/**
* 自定义业务异常类

View File

@ -1,4 +1,4 @@
package com.JIAL.FMSystem.common;
package com.JIAL.common;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;

View File

@ -1,4 +1,4 @@
package com.JIAL.FMSystem.common;
package com.JIAL.common;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

View File

@ -1,4 +1,4 @@
package com.JIAL.FMSystem.common;
package com.JIAL.common;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;

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