├── Park-PC ├── .classpath ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── bin │ ├── .gitignore │ ├── carlogal.png │ ├── image │ │ ├── carlogal.png │ │ ├── park++圆角7.png │ │ ├── thecar1.png │ │ ├── 车位灰.png │ │ ├── 车位黄黑.png │ │ └── 车位黑白.png │ ├── park++圆角7.png │ ├── thecar1.png │ ├── 车位灰.png │ ├── 车位黄黑.png │ └── 车位黑白.png ├── image │ ├── carlogal.png │ ├── park++圆角7.png │ ├── thecar1.png │ ├── 车位灰.png │ ├── 车位黄黑.png │ └── 车位黑白.png ├── mysql-connector-java-5.1.7-bin.jar └── src │ ├── com │ └── park │ │ ├── coclient │ │ ├── ConClient.java │ │ └── ConClientThread.java │ │ ├── conserver │ │ ├── ConServer.java │ │ └── ConServerThread.java │ │ ├── data │ │ ├── Data.java │ │ └── ParkData.java │ │ ├── db │ │ ├── DBControlCommand.java │ │ ├── DeleteThreadInParkInfo.java │ │ ├── DeleteThreadInParkStatus.java │ │ ├── InsertThreadInParkInfo.java │ │ ├── InsertThreadInParkStatus.java │ │ ├── QueryInParkInfo.java │ │ ├── QueryInParkStatus.java │ │ ├── QueryTimestampOnly.java │ │ ├── UpdateInParkStatusLockedOnly.java │ │ ├── UpdateThreadInParkInfo.java │ │ ├── UpdateThreadInParkStatus.java │ │ ├── UpdateThreadParkStatusBlank.java │ │ ├── UpdateThreadParkStatusLock.java │ │ └── UpdateThreadParkStatusOrder.java │ │ ├── dto │ │ └── Message.java │ │ ├── enity │ │ ├── DBelements.java │ │ ├── ParkInfo.java │ │ └── ParkStatus.java │ │ ├── tools │ │ └── ThreadManage.java │ │ ├── util │ │ ├── DButil.java │ │ ├── ParkControlUtil.java │ │ ├── ParkUtil.java │ │ └── TimeMinus.java │ │ └── view │ │ ├── DailyRecordView.java │ │ ├── EndPark.java │ │ ├── Login.java │ │ ├── Park.java │ │ ├── ParkForm.java │ │ ├── ParkStatuView.java │ │ ├── RegistrationView.java │ │ └── listener │ │ ├── EndParkListener.java │ │ ├── LoginListener.java │ │ ├── ParkActionListener.java │ │ ├── ParkFormListener.java │ │ ├── ParkStatusListener.java │ │ └── RegistrationListener.java │ └── image │ ├── carlogal.png │ ├── park++圆角7.png │ ├── thecar1.png │ ├── 车位灰.png │ ├── 车位黄黑.png │ └── 车位黑白.png └── park-server ├── .directory ├── .idea ├── .name ├── artifacts │ ├── park_war.xml │ └── park_war_exploded.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── libraries │ ├── Maven__aopalliance_aopalliance_1_0.xml │ ├── Maven__ch_qos_logback_logback_classic_1_1_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_1_3.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_6_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_6_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_6_0.xml │ ├── Maven__com_google_guava_guava_19_0.xml │ ├── Maven__com_mchange_c3p0_0_9_2_1.xml │ ├── Maven__com_mchange_mchange_commons_java_0_2_3_4.xml │ ├── Maven__com_squareup_okhttp3_okhttp_3_3_1.xml │ ├── Maven__com_squareup_okio_okio_1_8_0.xml │ ├── Maven__commons_logging_commons_logging_1_2.xml │ ├── Maven__javax_servlet_javax_servlet_api_3_1_0.xml │ ├── Maven__javax_servlet_jsp_jsp_api_2_1.xml │ ├── Maven__jstl_jstl_1_2.xml │ ├── Maven__junit_junit_4_11.xml │ ├── Maven__mysql_mysql_connector_java_5_1_6.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_mybatis_mybatis_3_3_0.xml │ ├── Maven__org_mybatis_mybatis_spring_1_2_3.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_3.xml │ ├── Maven__org_springframework_spring_aop_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_1_7_RELEASE.xml │ ├── Maven__org_springframework_spring_webmvc_4_1_7_RELEASE.xml │ └── Maven__taglibs_standard_1_1_2.xml ├── misc.xml ├── modules.xml └── workspace.xml ├── .settings ├── org.eclipse.jdt.core.prefs ├── org.eclipse.m2e.core.prefs └── org.eclipse.wst.validation.prefs ├── park-server.iml ├── park.iml ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── park │ │ │ ├── controller │ │ │ ├── PhoneController.java │ │ │ └── WebController.java │ │ │ ├── dao │ │ │ ├── OrderInfoDAO.java │ │ │ ├── ParkInfoDAO.java │ │ │ └── UserDAO.java │ │ │ ├── data │ │ │ └── Data.java │ │ │ ├── dto │ │ │ ├── Message.java │ │ │ └── Result.java │ │ │ ├── enity │ │ │ ├── OrderInfo.java │ │ │ ├── ParkInfo.java │ │ │ ├── ParkStatus.java │ │ │ └── User.java │ │ │ ├── exception │ │ │ ├── ParkException.java │ │ │ └── StatusEnum.java │ │ │ ├── listener │ │ │ └── SocketServiceLoader.java │ │ │ ├── service │ │ │ ├── ParkService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── ParkServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── socket │ │ │ ├── ServerSocketThread.java │ │ │ └── SocketThread.java │ │ │ ├── socketmanage │ │ │ └── SocketThreadManage.java │ │ │ └── vo │ │ │ ├── CommonVo.java │ │ │ ├── EndParkVo.java │ │ │ ├── GetAllParkInfoVo.java │ │ │ ├── GetLotInfoVo.java │ │ │ ├── GetOrderInfoVo.java │ │ │ ├── LockRelayVo.java │ │ │ ├── LoginVo.java │ │ │ ├── OrderParkVo.java │ │ │ ├── RegisterVo.java │ │ │ ├── RequestVo.java │ │ │ └── UnlockRelayVo.java │ ├── resources │ │ ├── jdbc.properties │ │ ├── mapper │ │ │ ├── orderinfo-dao.xml │ │ │ ├── parkinfo-dao.xml │ │ │ └── user-dao.xml │ │ ├── mybatis │ │ │ └── mybatis_setting.xml │ │ ├── schema │ │ │ └── stallserver.sql │ │ └── spring │ │ │ ├── spring-dao.xml │ │ │ ├── spring-mvc.xml │ │ │ ├── spring-service.xml │ │ │ └── spring.xml │ └── webapp │ │ ├── WEB-INF │ │ ├── jsp │ │ │ └── login.jsp │ │ └── web.xml │ │ └── index.jsp └── test │ └── java │ └── com │ └── park │ ├── dao │ ├── ParkInfoDAOTest.java │ └── UserDaoTest.java │ └── service │ └── ParkServiceTest.java └── target ├── classes ├── com │ └── park │ │ ├── controller │ │ └── PhoneController.class │ │ ├── dao │ │ ├── OrderInfoDAO.class │ │ ├── ParkInfoDAO.class │ │ └── UserDAO.class │ │ ├── data │ │ └── Data.class │ │ ├── dto │ │ ├── Message.class │ │ └── Result.class │ │ ├── enity │ │ ├── OrderInfo.class │ │ ├── ParkInfo.class │ │ ├── ParkStatus.class │ │ └── User.class │ │ ├── exception │ │ ├── ParkException.class │ │ └── StatusEnum.class │ │ ├── listener │ │ └── SocketServiceLoader.class │ │ ├── service │ │ ├── ParkService.class │ │ ├── UserService.class │ │ └── impl │ │ │ ├── ParkServiceImpl.class │ │ │ └── UserServiceImpl.class │ │ ├── socket │ │ ├── ServerSocketThread.class │ │ └── SocketThread.class │ │ ├── socketmanage │ │ └── SocketThreadManage.class │ │ └── vo │ │ ├── CommonVo.class │ │ ├── EndParkVo.class │ │ ├── GetAllParkInfoVo.class │ │ ├── GetLotInfoVo.class │ │ ├── GetOrderInfoVo.class │ │ ├── LockRelayVo.class │ │ ├── LoginVo.class │ │ ├── OrderParkVo.class │ │ ├── RegisterVo.class │ │ ├── RequestVo.class │ │ └── UnlockRelayVo.class ├── jdbc.properties ├── mapper │ ├── orderinfo-dao.xml │ ├── parkinfo-dao.xml │ └── user-dao.xml ├── mybatis │ └── mybatis_setting.xml └── spring │ ├── spring-dao.xml │ ├── spring-mvc.xml │ ├── spring-service.xml │ └── spring.xml ├── maven-status └── maven-compiler-plugin │ ├── compile │ └── default-compile │ │ ├── createdFiles.lst │ │ └── inputFiles.lst │ └── testCompile │ └── default-testCompile │ ├── createdFiles.lst │ └── inputFiles.lst ├── park.war └── park ├── WEB-INF ├── classes │ ├── com │ │ └── park │ │ │ ├── controller │ │ │ └── PhoneController.class │ │ │ ├── dao │ │ │ ├── OrderInfoDAO.class │ │ │ ├── ParkInfoDAO.class │ │ │ └── UserDAO.class │ │ │ ├── data │ │ │ └── Data.class │ │ │ ├── dto │ │ │ ├── Message.class │ │ │ └── Result.class │ │ │ ├── enity │ │ │ ├── OrderInfo.class │ │ │ ├── ParkInfo.class │ │ │ ├── ParkStatus.class │ │ │ └── User.class │ │ │ ├── exception │ │ │ ├── ParkException.class │ │ │ └── StatusEnum.class │ │ │ ├── listener │ │ │ └── SocketServiceLoader.class │ │ │ ├── service │ │ │ ├── ParkService.class │ │ │ ├── UserService.class │ │ │ └── impl │ │ │ │ ├── ParkServiceImpl.class │ │ │ │ └── UserServiceImpl.class │ │ │ ├── socket │ │ │ ├── ServerSocketThread.class │ │ │ └── SocketThread.class │ │ │ ├── socketmanage │ │ │ └── SocketThreadManage.class │ │ │ └── vo │ │ │ ├── CommonVo.class │ │ │ ├── EndParkVo.class │ │ │ ├── GetAllParkInfoVo.class │ │ │ ├── GetLotInfoVo.class │ │ │ ├── GetOrderInfoVo.class │ │ │ ├── LockRelayVo.class │ │ │ ├── LoginVo.class │ │ │ ├── OrderParkVo.class │ │ │ ├── RegisterVo.class │ │ │ ├── RequestVo.class │ │ │ └── UnlockRelayVo.class │ ├── jdbc.properties │ ├── mapper │ │ ├── orderinfo-dao.xml │ │ ├── parkinfo-dao.xml │ │ └── user-dao.xml │ ├── mybatis │ │ └── mybatis_setting.xml │ └── spring │ │ ├── spring-dao.xml │ │ ├── spring-mvc.xml │ │ ├── spring-service.xml │ │ └── spring.xml ├── jsp │ └── index.jsp ├── lib │ ├── aopalliance-1.0.jar │ ├── c3p0-0.9.2.1.jar │ ├── commons-logging-1.2.jar │ ├── guava-19.0.jar │ ├── hamcrest-core-1.3.jar │ ├── jackson-annotations-2.6.0.jar │ ├── jackson-core-2.6.0.jar │ ├── jackson-databind-2.6.0.jar │ ├── jstl-1.2.jar │ ├── junit-4.11.jar │ ├── logback-classic-1.1.3.jar │ ├── logback-core-1.1.3.jar │ ├── mchange-commons-java-0.2.3.4.jar │ ├── mybatis-3.3.0.jar │ ├── mybatis-spring-1.2.3.jar │ ├── mysql-connector-java-5.1.6.jar │ ├── okhttp-3.3.1.jar │ ├── okio-1.8.0.jar │ ├── slf4j-api-1.7.3.jar │ ├── spring-aop-4.1.7.RELEASE.jar │ ├── spring-beans-4.1.7.RELEASE.jar │ ├── spring-context-4.1.7.RELEASE.jar │ ├── spring-context-support-4.1.7.RELEASE.jar │ ├── spring-core-4.1.7.RELEASE.jar │ ├── spring-expression-4.1.7.RELEASE.jar │ ├── spring-jdbc-4.1.7.RELEASE.jar │ ├── spring-tx-4.1.7.RELEASE.jar │ ├── spring-web-4.1.7.RELEASE.jar │ ├── spring-webmvc-4.1.7.RELEASE.jar │ └── standard-1.1.2.jar └── web.xml └── index.jsp /Park-PC/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Park-PC/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Park-PC 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Park-PC/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /Park-PC/bin/.gitignore: -------------------------------------------------------------------------------- 1 | /com/ 2 | -------------------------------------------------------------------------------- /Park-PC/bin/carlogal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/carlogal.png -------------------------------------------------------------------------------- /Park-PC/bin/image/carlogal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/carlogal.png -------------------------------------------------------------------------------- /Park-PC/bin/image/park++圆角7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/park++圆角7.png -------------------------------------------------------------------------------- /Park-PC/bin/image/thecar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/thecar1.png -------------------------------------------------------------------------------- /Park-PC/bin/image/车位灰.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/车位灰.png -------------------------------------------------------------------------------- /Park-PC/bin/image/车位黄黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/车位黄黑.png -------------------------------------------------------------------------------- /Park-PC/bin/image/车位黑白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/image/车位黑白.png -------------------------------------------------------------------------------- /Park-PC/bin/park++圆角7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/park++圆角7.png -------------------------------------------------------------------------------- /Park-PC/bin/thecar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/thecar1.png -------------------------------------------------------------------------------- /Park-PC/bin/车位灰.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/车位灰.png -------------------------------------------------------------------------------- /Park-PC/bin/车位黄黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/车位黄黑.png -------------------------------------------------------------------------------- /Park-PC/bin/车位黑白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/bin/车位黑白.png -------------------------------------------------------------------------------- /Park-PC/image/carlogal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/carlogal.png -------------------------------------------------------------------------------- /Park-PC/image/park++圆角7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/park++圆角7.png -------------------------------------------------------------------------------- /Park-PC/image/thecar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/thecar1.png -------------------------------------------------------------------------------- /Park-PC/image/车位灰.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/车位灰.png -------------------------------------------------------------------------------- /Park-PC/image/车位黄黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/车位黄黑.png -------------------------------------------------------------------------------- /Park-PC/image/车位黑白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/image/车位黑白.png -------------------------------------------------------------------------------- /Park-PC/mysql-connector-java-5.1.7-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/mysql-connector-java-5.1.7-bin.jar -------------------------------------------------------------------------------- /Park-PC/src/com/park/coclient/ConClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 服务器连接客户端线程 3 | */ 4 | package com.park.coclient; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.IOException; 8 | import java.io.InputStreamReader; 9 | import java.net.ServerSocket; 10 | import java.net.Socket; 11 | import java.util.Date; 12 | 13 | import com.park.data.ParkData; 14 | import com.park.tools.ThreadManage; 15 | import com.park.view.Park; 16 | 17 | /** 18 | * 链接硬件 19 | * @author ansore 20 | * 21 | */ 22 | 23 | public class ConClient extends Thread{ 24 | ServerSocket serverSocket; 25 | public ConClient(){ 26 | try { 27 | serverSocket=new ServerSocket(10000); 28 | } catch (IOException e) { 29 | e.printStackTrace(); 30 | } 31 | } 32 | public void run(){ 33 | while(true){ 34 | try { 35 | Park.park.getDailyPanel().getText().append(new Date().toLocaleString()+": 等待设备链接\n"); 36 | Socket socket=serverSocket.accept(); 37 | System.out.println("有链接"); 38 | 39 | BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream())); 40 | String name = br.readLine().trim(); 41 | System.out.println("第一次收到数据为:"+name); 42 | Park.park.getDailyPanel().getText().append(new Date()+":设备 "+name+" 已经链接\n"); 43 | ConClientThread clientThread=new ConClientThread(socket,name); 44 | //TODO 45 | ParkData.HardWare = name; 46 | 47 | ThreadManage.ClientThread.put(name, clientThread); 48 | clientThread.start(); 49 | 50 | 51 | } catch (IOException e) { 52 | e.printStackTrace(); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | } 56 | } 57 | } 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/conserver/ConServer.java: -------------------------------------------------------------------------------- 1 | package com.park.conserver; 2 | 3 | import java.io.IOException; 4 | import java.io.ObjectInputStream; 5 | import java.io.ObjectOutputStream; 6 | import java.net.Socket; 7 | import java.util.Date; 8 | 9 | import com.park.data.Data; 10 | import com.park.data.ParkData; 11 | import com.park.dto.Message; 12 | import com.park.tools.ThreadManage; 13 | import com.park.view.Park; 14 | 15 | public class ConServer { 16 | 17 | private Socket socket; 18 | 19 | //首次链接服务器 20 | //传入登录/注册信息 21 | /** 22 | * 注册 true 注册成功 false 注册失败 断开链接 23 | * 登录 true 登录成功 false 登录失败 保持链接 24 | * @param message 25 | * @return 26 | */ 27 | public boolean conToServer(Message message) { 28 | 29 | boolean result = false; 30 | 31 | try { 32 | socket = new Socket("115.29.55.106", 10000); 33 | ObjectOutputStream oos = new ObjectOutputStream(this.socket.getOutputStream()); 34 | ObjectInputStream ois = new ObjectInputStream(this.socket.getInputStream()); 35 | //注册处理 36 | if(message.getMessageType()==Data.RegInfo){ 37 | oos.writeObject(message); 38 | //接收返回消息 39 | message = (Message) ois.readObject(); 40 | if(message.getStatu()==true) { 41 | result = true; 42 | } 43 | else { 44 | result = false; 45 | } 46 | //断开链接 47 | if(oos!=null) oos.close(); 48 | if(ois!=null) ois.close(); 49 | if(socket!=null) socket.close(); 50 | } 51 | else 52 | //登录处理 53 | if(message.getMessageType()==Data.Login) { 54 | oos.writeObject(message); 55 | message = (Message) ois.readObject(); 56 | if(message.getStatu()==true) { 57 | //登录成功保持链接 58 | result = true; 59 | System.out.println("登录成功"); 60 | Park.park.getDailyPanel().getText().append(new Date().getTime()+" 登陆成功\n"); 61 | ParkData.ParkName = message.getParkName(); 62 | ParkData.parkAddress = message.getAddress(); 63 | ParkData.parkRemark = message.getRemark(); 64 | ConServerThread conServerThread = new ConServerThread(socket); 65 | conServerThread.start(); 66 | ThreadManage.ServerThread.put("server", conServerThread); 67 | } 68 | else { 69 | System.out.println("登录失败"); 70 | Park.park.getDailyPanel().getText().append(new Date().getTime()+" 登陆失败\n"); 71 | result = false; 72 | //断开链接 73 | if(oos!=null) oos.close(); 74 | if(ois!=null) ois.close(); 75 | if(socket!=null) socket.close(); 76 | } 77 | } 78 | 79 | } catch (Exception e) { 80 | result = false; 81 | e.printStackTrace(); 82 | } 83 | return result; 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/data/Data.java: -------------------------------------------------------------------------------- 1 | package com.park.data; 2 | 3 | /** 4 | * TODO 静态常量 !!!!!不规范 后面要改 5 | * 接口常量 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public interface Data { 9 | 10 | /** 11 | * PC&服务器交互常量 12 | * 13 | */ 14 | //登录 15 | public int Login = 1; 16 | 17 | //注册 18 | public int RegInfo = 2; 19 | 20 | //服务器向客户端请求车位信息 21 | public int GetParkInfo = 4; 22 | 23 | //服务器向客户段发送控制信息 24 | public int ControlInfo = 5; 25 | 26 | //锁定 27 | public int Lock = 10; 28 | 29 | //解锁 30 | public int Unlock = 11; 31 | 32 | //服务器向客户端发送预约信息 33 | public int OrderInfo = 6; 34 | 35 | //双向,结束停车 36 | public int EndParkInfo = 7; 37 | //响应 38 | public int Answer = 20; 39 | //获取预定信息 40 | public int GetOrderInfoPC = 8; 41 | 42 | //服务器 -> PC 43 | //车位指示灯亮 44 | public int LEDOn = 12; 45 | //车位指示灯灭 46 | public int LEDOff = 13; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/data/ParkData.java: -------------------------------------------------------------------------------- 1 | package com.park.data; 2 | 3 | public class ParkData { 4 | 5 | public static int ParkId = 0; 6 | public static String ParkName = ""; 7 | public static String Phone = ""; 8 | public static double ParkNum = 4; 9 | public static String HardWare = ""; 10 | public static String parkAddress = ""; 11 | public static String parkRemark = ""; 12 | } 13 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/DeleteThreadInParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | 9 | public class DeleteThreadInParkInfo extends Thread { 10 | 11 | int parkId; 12 | public DeleteThreadInParkInfo(int ParkId){ 13 | this.parkId=ParkId; 14 | } 15 | //车位预定信息 16 | public void run(){ 17 | Connection conn=DButil.open(); 18 | try{ 19 | String sql = "delete from parkinfo where parkid=?"; 20 | PreparedStatement pstmt = conn.prepareStatement(sql); 21 | pstmt.setInt(1, parkId); 22 | int num =pstmt.executeUpdate(); 23 | if(num>0){ 24 | System.out.println("删除停车信息成功"); 25 | } 26 | }catch (Exception e) { 27 | e.printStackTrace(); 28 | }finally{ 29 | DButil.close(conn); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/DeleteThreadInParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | 9 | public class DeleteThreadInParkStatus extends Thread{ 10 | 11 | int id; 12 | 13 | public DeleteThreadInParkStatus(int Id){ 14 | this.id=Id; 15 | } 16 | 17 | public void run(){ 18 | Connection conn=DButil.open(); 19 | try{ 20 | 21 | String sql = "delete from parkstatus where id=?"; 22 | PreparedStatement pstmt = conn.prepareStatement(sql); 23 | pstmt.setInt(1, id); 24 | int num =pstmt.executeUpdate(); 25 | 26 | if(num>0){ 27 | System.out.println("删除车位信息成功!"); 28 | } 29 | }catch (Exception e) { 30 | e.printStackTrace(); 31 | }finally{ 32 | DButil.close(conn); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/InsertThreadInParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | 7 | import com.park.util.DButil; 8 | 9 | 10 | public class InsertThreadInParkInfo extends Thread{ 11 | int parkId; 12 | String palte; 13 | String telephone; 14 | int statu; 15 | public InsertThreadInParkInfo(int ParkId,String Palte,String Telephone,int Statu){ 16 | this.parkId=ParkId; 17 | this.palte=Palte; 18 | this.telephone=Telephone; 19 | this.statu=Statu; 20 | } 21 | 22 | public void run(){ 23 | String sql="insert into parkinfo(parkid,palte,telephone,statu) values(?,?,?,?)"; 24 | Connection conn=DButil.open(); 25 | try { 26 | PreparedStatement pstmt=conn.prepareStatement(sql); 27 | pstmt.setInt(1,parkId); 28 | pstmt.setString(2,palte); 29 | pstmt.setString(3,telephone); 30 | pstmt.setInt(4,statu); 31 | int num=pstmt.executeUpdate(); 32 | if(num>0){ 33 | System.out.println("预约成功!!"); 34 | } 35 | } catch (SQLException e) { 36 | e.printStackTrace(); 37 | }finally{ 38 | DButil.close(conn); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/InsertThreadInParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | 7 | import com.park.util.DButil; 8 | 9 | public class InsertThreadInParkStatus extends Thread { 10 | 11 | int id; 12 | int locked; 13 | int ordered; 14 | int blank; 15 | public InsertThreadInParkStatus(int Id,int Locked,int Ordered,int Blank){ 16 | this.id=Id; 17 | this.locked=Locked; 18 | this.ordered=Ordered; 19 | this.blank=Blank; 20 | } 21 | 22 | public void run(){ 23 | 24 | String sql="insert into parkstatus(id,locked,ordered,blank) values(?,?,?,?)"; 25 | 26 | Connection conn=DButil.open(); 27 | try { 28 | PreparedStatement pstmt=conn.prepareStatement(sql); 29 | pstmt.setInt(1,id); 30 | pstmt.setInt(2,locked); 31 | pstmt.setInt(3,ordered); 32 | pstmt.setInt(4,blank); 33 | int num=pstmt.executeUpdate(); 34 | if(num>0){ 35 | System.out.println("添加车位状态成功"); 36 | } 37 | } catch (SQLException e) { 38 | e.printStackTrace(); 39 | }finally{ 40 | DButil.close(conn); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/QueryInParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.concurrent.Callable; 8 | 9 | import com.park.enity.ParkInfo; 10 | import com.park.util.DButil; 11 | 12 | 13 | public class QueryInParkInfo implements Callable{ 14 | 15 | int parkId; 16 | public QueryInParkInfo(int ParkId){ 17 | this.parkId=ParkId; 18 | } 19 | 20 | public QueryInParkInfo() { 21 | 22 | } 23 | 24 | public String call(){ 25 | Connection conn=DButil.open(); 26 | String sql="select * from parkinfo where parkid=?"; 27 | try { 28 | PreparedStatement pstmt=conn.prepareStatement(sql); 29 | pstmt.setInt(1,parkId); 30 | ResultSet rs=pstmt.executeQuery(); 31 | if(rs.next()){ 32 | return "1"; 33 | }else{ 34 | return "0"; 35 | } 36 | } catch (SQLException e) { 37 | // TODO Auto-generated catch block 38 | e.printStackTrace(); 39 | }finally{ 40 | DButil.close(conn); 41 | } 42 | return "null"; 43 | } 44 | 45 | public int getParkIdCall(String phone) { 46 | int result = 0; 47 | Connection conn=DButil.open(); 48 | String sql="select * from parkinfo where telephone=?"; 49 | try { 50 | PreparedStatement pstmt=conn.prepareStatement(sql); 51 | pstmt.setString(1,phone); 52 | ResultSet rs=pstmt.executeQuery(); 53 | while(rs.next()) { 54 | result = rs.getInt("parkid"); 55 | } 56 | } catch (SQLException e) { 57 | // TODO Auto-generated catch block 58 | e.printStackTrace(); 59 | }finally{ 60 | DButil.close(conn); 61 | } 62 | return result; 63 | } 64 | 65 | 66 | public ParkInfo getParkInfo(int parkid) { 67 | ParkInfo parkInfo = new ParkInfo(); 68 | Connection conn=DButil.open(); 69 | String sql="select *from parkinfo where parkid=?"; 70 | try { 71 | PreparedStatement pstmt=conn.prepareStatement(sql); 72 | pstmt.setInt(1,parkid); 73 | ResultSet rs=pstmt.executeQuery(); 74 | if(rs.next()){ 75 | parkInfo.setStarttime(rs.getTimestamp("starttime")); 76 | parkInfo.setTelephone(rs.getString("telephone")); 77 | parkInfo.setParkid(rs.getInt("parkid")); 78 | parkInfo.setPlate(rs.getString("palte")); 79 | return parkInfo; 80 | }else{ 81 | System.out.println("获取失败"); 82 | return null; 83 | } 84 | } catch (SQLException e) { 85 | // TODO Auto-generated catch block 86 | e.printStackTrace(); 87 | }finally{ 88 | 89 | DButil.close(conn); 90 | } 91 | return parkInfo; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/QueryInParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.concurrent.Callable; 10 | 11 | import com.park.enity.ParkInfo; 12 | import com.park.enity.ParkStatus; 13 | import com.park.util.DButil; 14 | 15 | 16 | public class QueryInParkStatus implements Callable{ 17 | int ID; 18 | public QueryInParkStatus(int Id){ 19 | this.ID=Id; 20 | } 21 | 22 | //空构造函数 23 | public QueryInParkStatus() { 24 | 25 | } 26 | 27 | public String call(){ 28 | Connection conn=DButil.open(); 29 | String sql="select * from parkstatus where id=?"; 30 | try { 31 | PreparedStatement pstmt=conn.prepareStatement(sql); 32 | pstmt.setInt(1, ID); 33 | ResultSet rs=pstmt.executeQuery(); 34 | 35 | if(rs.next()){ 36 | return "1"; 37 | }else{ 38 | return "0"; 39 | } 40 | } catch (SQLException e) { 41 | // TODO Auto-generated catch block 42 | e.printStackTrace(); 43 | }finally{ 44 | DButil.close(conn); 45 | } 46 | return "null"; 47 | } 48 | 49 | public List callAll() { 50 | List l = new ArrayList<>(); 51 | Connection conn=DButil.open(); 52 | String sql="select * from parkstatus"; 53 | try { 54 | PreparedStatement pstmt=conn.prepareStatement(sql); 55 | ResultSet rs=pstmt.executeQuery(); 56 | while(rs.next()) { 57 | ParkStatus parkStatus = new ParkStatus(); 58 | parkStatus.setId(rs.getInt("id")); 59 | parkStatus.setBlank(rs.getInt("blank")); 60 | parkStatus.setLocked(rs.getInt("locked")); 61 | parkStatus.setOrdered(rs.getInt("ordered")); 62 | l.add(parkStatus); 63 | } 64 | } catch (SQLException e) { 65 | // TODO Auto-generated catch block 66 | e.printStackTrace(); 67 | }finally{ 68 | DButil.close(conn); 69 | } 70 | return l; 71 | } 72 | 73 | public ParkStatus callParkStatus() { 74 | ParkStatus parkStatus = null; 75 | Connection conn=DButil.open(); 76 | String sql="select * from parkstatus where id=?"; 77 | try { 78 | PreparedStatement pstmt=conn.prepareStatement(sql); 79 | pstmt.setInt(1, ID); 80 | ResultSet rs=pstmt.executeQuery(); 81 | parkStatus = new ParkStatus(); 82 | while(rs.next()) { 83 | parkStatus.setId(rs.getInt("id")); 84 | parkStatus.setBlank(rs.getInt("blank")); 85 | parkStatus.setLocked(rs.getInt("locked")); 86 | parkStatus.setOrdered(rs.getInt("ordered")); 87 | } 88 | } catch (SQLException e) { 89 | // TODO Auto-generated catch block 90 | e.printStackTrace(); 91 | }finally{ 92 | DButil.close(conn); 93 | } 94 | return parkStatus; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/QueryTimestampOnly.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Timestamp; 8 | import java.util.concurrent.Callable; 9 | 10 | import com.park.util.DButil; 11 | 12 | 13 | public class QueryTimestampOnly implements Callable{ 14 | int parkId; 15 | Timestamp tms; 16 | public QueryTimestampOnly(int ParkId){ 17 | this.parkId=ParkId; 18 | } 19 | 20 | public Timestamp call(){ 21 | Connection conn=DButil.open(); 22 | String sql="select * from parkinfo where parkid=?"; 23 | try { 24 | PreparedStatement pstmt=conn.prepareStatement(sql); 25 | pstmt.setInt(1,parkId); 26 | ResultSet rs=pstmt.executeQuery(); 27 | if(rs.next()){ 28 | tms=rs.getTimestamp("starttime"); 29 | return tms; 30 | }else{ 31 | System.out.println("获取失败"); 32 | return null; 33 | } 34 | } catch (SQLException e) { 35 | // TODO Auto-generated catch block 36 | e.printStackTrace(); 37 | }finally{ 38 | 39 | DButil.close(conn); 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateInParkStatusLockedOnly.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | 9 | public class UpdateInParkStatusLockedOnly extends Thread { 10 | 11 | int id; 12 | int locked; 13 | public UpdateInParkStatusLockedOnly(int Id,int Locked){ 14 | this.id=Id; 15 | this.locked=Locked; 16 | } 17 | 18 | public void run(){ 19 | Connection conn=null; 20 | try{ 21 | 22 | conn = DButil.open(); 23 | String sql = "update parkstatus set locked=? where id=?"; 24 | PreparedStatement pstmt = conn.prepareStatement(sql); 25 | ; 26 | pstmt.setInt(1, locked); 27 | pstmt.setInt(2, id); 28 | int num = pstmt.executeUpdate(); 29 | if(num>0){ 30 | System.out.println("更新成功!!!"); 31 | } 32 | }catch (Exception e) { 33 | e.printStackTrace(); 34 | 35 | }finally{ 36 | DButil.close(conn); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateThreadInParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | 9 | public class UpdateThreadInParkInfo extends Thread{ 10 | 11 | int parkid; 12 | int statu; 13 | public UpdateThreadInParkInfo(int ParkId,int Statu){ 14 | this.parkid=ParkId; 15 | this.statu=Statu; 16 | } 17 | 18 | public UpdateThreadInParkInfo() { 19 | 20 | } 21 | 22 | public void UpdateThreadInParkStatus(int id,int sta) { 23 | Connection conn=null; 24 | try{ 25 | conn = DButil.open(); 26 | String sql = "update parkinfo set statu=? where parkid=?"; 27 | PreparedStatement pstmt = conn.prepareStatement(sql); 28 | 29 | pstmt.setInt(1,sta); 30 | pstmt.setInt(2,id); 31 | int num = pstmt.executeUpdate(); 32 | 33 | if(num>0){ 34 | System.out.println("更新停车信息成功!!!"); 35 | } 36 | }catch (Exception e) { 37 | e.printStackTrace(); 38 | 39 | }finally{ 40 | DButil.close(conn); 41 | } 42 | } 43 | 44 | public void run(){ 45 | Connection conn=null; 46 | try{ 47 | 48 | conn = DButil.open(); 49 | String sql = "update parkinfo set statu=? where parkid=?"; 50 | PreparedStatement pstmt = conn.prepareStatement(sql); 51 | 52 | pstmt.setInt(1,statu); 53 | pstmt.setInt(2,parkid); 54 | int num = pstmt.executeUpdate(); 55 | if(num>0){ 56 | System.out.println("更新停车信息成功!!!"); 57 | } 58 | }catch (Exception e) { 59 | e.printStackTrace(); 60 | 61 | }finally{ 62 | DButil.close(conn); 63 | } 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateThreadInParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | public class UpdateThreadInParkStatus extends Thread { 9 | 10 | int id; 11 | int locked; 12 | int ordered; 13 | int blank; 14 | public UpdateThreadInParkStatus(int Id,int Locked,int Ordered,int Blank){ 15 | this.id=Id; 16 | this.locked=Locked; 17 | this.ordered=Ordered; 18 | this.blank=Blank; 19 | } 20 | 21 | public void run(){ 22 | Connection conn=null; 23 | try{ 24 | conn = DButil.open(); 25 | String sql = "update parkstatus set locked=?,ordered=?,blank=? where id=?"; 26 | PreparedStatement pstmt = conn.prepareStatement(sql); 27 | ; 28 | pstmt.setInt(1, locked); 29 | pstmt.setInt(2, ordered); 30 | pstmt.setInt(3, blank); 31 | pstmt.setInt(4, id); 32 | int num = pstmt.executeUpdate(); 33 | if(num>0){ 34 | System.out.println("更新车位状态成功!!!"); 35 | } 36 | }catch (Exception e) { 37 | e.printStackTrace(); 38 | 39 | }finally{ 40 | DButil.close(conn); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateThreadParkStatusBlank.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | public class UpdateThreadParkStatusBlank extends Thread { 9 | int id; 10 | int blank; 11 | public UpdateThreadParkStatusBlank(int Id,int Blank){ 12 | this.id=Id; 13 | this.blank=Blank; 14 | } 15 | 16 | public void run(){ 17 | Connection conn=null; 18 | try{ 19 | conn = DButil.open(); 20 | String sql = "update parkstatus set blank=? where id=?"; 21 | PreparedStatement pstmt = conn.prepareStatement(sql); 22 | pstmt.setInt(1, blank); 23 | pstmt.setInt(2, id); 24 | int num = pstmt.executeUpdate(); 25 | if(num>0){ 26 | System.out.println("更新车位状态成功!!!"); 27 | } 28 | }catch (Exception e) { 29 | e.printStackTrace(); 30 | 31 | }finally{ 32 | DButil.close(conn); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateThreadParkStatusLock.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | /** 9 | * 更新 锁状态的线程 10 | * @author ansore 11 | * 12 | */ 13 | 14 | public class UpdateThreadParkStatusLock extends Thread { 15 | int id; 16 | int locked; 17 | public UpdateThreadParkStatusLock(int Id,int Locked){ 18 | this.id=Id; 19 | this.locked=Locked; 20 | } 21 | 22 | public void run(){ 23 | Connection conn=null; 24 | try{ 25 | conn = DButil.open(); 26 | String sql = "update parkstatus set locked=? where id=?"; 27 | PreparedStatement pstmt = conn.prepareStatement(sql); 28 | ; 29 | pstmt.setInt(1, locked); 30 | pstmt.setInt(2, id); 31 | int num = pstmt.executeUpdate(); 32 | if(num>0){ 33 | System.out.println("更新车位状态成功!!!"); 34 | } 35 | }catch (Exception e) { 36 | e.printStackTrace(); 37 | 38 | }finally{ 39 | DButil.close(conn); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/db/UpdateThreadParkStatusOrder.java: -------------------------------------------------------------------------------- 1 | package com.park.db; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | 6 | import com.park.util.DButil; 7 | 8 | public class UpdateThreadParkStatusOrder extends Thread { 9 | 10 | int id; 11 | int ordered; 12 | public UpdateThreadParkStatusOrder(int Id,int ordered){ 13 | this.id=Id; 14 | this.ordered=ordered; 15 | } 16 | 17 | public void run(){ 18 | 19 | Connection conn=null; 20 | try{ 21 | conn = DButil.open(); 22 | String sql = "update parkstatus set ordered=? where id=?"; 23 | PreparedStatement pstmt = conn.prepareStatement(sql); 24 | ; 25 | pstmt.setInt(1, ordered); 26 | pstmt.setInt(2, id); 27 | int num = pstmt.executeUpdate(); 28 | if(num>0){ 29 | System.out.println("更新车位预约状态成功!!!"); 30 | } 31 | }catch (Exception e) { 32 | e.printStackTrace(); 33 | 34 | }finally{ 35 | DButil.close(conn); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.park.dto; 2 | 3 | import com.park.enity.ParkStatus; 4 | import java.util.List; 5 | 6 | /** 7 | * Message DTO 8 | * 与PC客户端通信实体 9 | * Created by ansore on 16-9-12. 10 | */ 11 | public class Message implements java.io.Serializable { 12 | 13 | //消息类型 14 | private int messageType; 15 | 16 | //状态 17 | private boolean statu; 18 | 19 | //注册 20 | private String telephone; 21 | private String userName; 22 | private String password; 23 | private String parkName; 24 | private String address; 25 | private String remark; 26 | 27 | //控制信息 28 | private String controlInfo; 29 | 30 | //停车场车位状态 31 | private List parkList; 32 | 33 | //预约信息 34 | //车牌 35 | private String palte; 36 | //车位编号 37 | private int parkId; 38 | //用户手机号 private String telephone; 39 | 40 | //结束停车 车位编号 private int parkId; 41 | 42 | //费用 43 | private double payNum; 44 | 45 | 46 | public String getAddress() { 47 | return address; 48 | } 49 | 50 | public void setAddress(String address) { 51 | this.address = address; 52 | } 53 | 54 | public String getRemark() { 55 | return remark; 56 | } 57 | 58 | public void setRemark(String remark) { 59 | this.remark = remark; 60 | } 61 | 62 | public String getControlInfo() { 63 | return controlInfo; 64 | } 65 | 66 | public void setControlInfo(String controlInfo) { 67 | this.controlInfo = controlInfo; 68 | } 69 | 70 | public int getMessageType() { 71 | return messageType; 72 | } 73 | 74 | public void setMessageType(int messageType) { 75 | this.messageType = messageType; 76 | } 77 | 78 | public boolean getStatu() { 79 | return statu; 80 | } 81 | 82 | public void setStatu(boolean statu) { 83 | this.statu = statu; 84 | } 85 | 86 | public String getTelephone() { 87 | return telephone; 88 | } 89 | 90 | public void setTelephone(String telephone) { 91 | this.telephone = telephone; 92 | } 93 | 94 | public String getUserName() { 95 | return userName; 96 | } 97 | 98 | public void setUserName(String userName) { 99 | this.userName = userName; 100 | } 101 | 102 | public String getPassword() { 103 | return password; 104 | } 105 | 106 | public void setPassword(String password) { 107 | this.password = password; 108 | } 109 | 110 | public String getParkName() { 111 | return parkName; 112 | } 113 | 114 | public void setParkName(String parkName) { 115 | this.parkName = parkName; 116 | } 117 | 118 | public List getParkList() { 119 | return parkList; 120 | } 121 | 122 | public void setParkList(List parkList) { 123 | this.parkList = parkList; 124 | } 125 | 126 | public String getPalte() { 127 | return palte; 128 | } 129 | 130 | public void setPalte(String palte) { 131 | this.palte = palte; 132 | } 133 | 134 | public int getParkId() { 135 | return parkId; 136 | } 137 | 138 | public void setParkId(int parkId) { 139 | this.parkId = parkId; 140 | } 141 | 142 | public double getPayNum() { 143 | return payNum; 144 | } 145 | 146 | public void setPayNum(double payNum) { 147 | this.payNum = payNum; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/enity/DBelements.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | import java.sql.Date; 4 | 5 | public class DBelements { 6 | private int id;//parkstatus表的id 7 | private int locked; 8 | private int ordered; 9 | public int getOrdered() { 10 | return ordered; 11 | } 12 | public void setOrdered(int ordered) { 13 | this.ordered = ordered; 14 | } 15 | private int blank; 16 | private int parkId; //parkinfo表的ID 17 | private String palte; 18 | public String getPalte() { 19 | return palte; 20 | } 21 | public void setPalte(String palte) { 22 | this.palte = palte; 23 | } 24 | private String telephone; 25 | private int statu; 26 | private Date starttime; 27 | 28 | 29 | public int getParkId() { 30 | return parkId; 31 | } 32 | public void setParkId(int parkId) { 33 | this.parkId = parkId; 34 | } 35 | 36 | public String getTelephone() { 37 | return telephone; 38 | } 39 | public void setTelephone(String telephone) { 40 | this.telephone = telephone; 41 | } 42 | public int getStatu() { 43 | return statu; 44 | } 45 | public void setStatu(int statu) { 46 | this.statu = statu; 47 | } 48 | public Date getStarttime() { 49 | return starttime; 50 | } 51 | public void setStarttime(Date starttime) { 52 | this.starttime = starttime; 53 | } 54 | public int getId() { 55 | return id; 56 | } 57 | public void setId(int id) { 58 | this.id = id; 59 | } 60 | public int getLocked() { 61 | return locked; 62 | } 63 | public void setLocked(int locked) { 64 | this.locked = locked; 65 | } 66 | public int getBlank() { 67 | return blank; 68 | } 69 | public void setBlank(int blank) { 70 | this.blank = blank; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/enity/ParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | import java.sql.Timestamp; 4 | 5 | public class ParkInfo { 6 | 7 | private int parkid; 8 | private String plate; 9 | private Timestamp starttime; 10 | private String telephone; 11 | 12 | public int getParkid() { 13 | return parkid; 14 | } 15 | public void setParkid(int parkid) { 16 | this.parkid = parkid; 17 | } 18 | public String getPlate() { 19 | return plate; 20 | } 21 | public void setPlate(String plate) { 22 | this.plate = plate; 23 | } 24 | public String getTelephone() { 25 | return telephone; 26 | } 27 | public void setTelephone(String telephone) { 28 | this.telephone = telephone; 29 | } 30 | public Timestamp getStarttime() { 31 | return starttime; 32 | } 33 | public void setStarttime(Timestamp starttime) { 34 | this.starttime = starttime; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/enity/ParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | /** 4 | * 与PC交互实体类 5 | * 停车场车位状态实体类 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public class ParkStatus implements java.io.Serializable{ 9 | 10 | private int id; 11 | private int locked; 12 | private int ordered; 13 | private int blank; 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | 19 | public void setId(int id) { 20 | this.id = id; 21 | } 22 | 23 | public int getLocked() { 24 | return locked; 25 | } 26 | 27 | public void setLocked(int locked) { 28 | this.locked = locked; 29 | } 30 | 31 | public int getOrdered() { 32 | return ordered; 33 | } 34 | 35 | public void setOrdered(int ordered) { 36 | this.ordered = ordered; 37 | } 38 | 39 | public int getBlank() { 40 | return blank; 41 | } 42 | 43 | public void setBlank(int blank) { 44 | this.blank = blank; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/tools/ThreadManage.java: -------------------------------------------------------------------------------- 1 | package com.park.tools; 2 | 3 | import java.util.HashMap; 4 | 5 | import com.park.coclient.ConClientThread; 6 | import com.park.conserver.ConServerThread; 7 | 8 | public class ThreadManage { 9 | 10 | public static HashMap ServerThread = new HashMap<>(); 11 | 12 | public static HashMap ClientThread = new HashMap<>(); 13 | } 14 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/util/DButil.java: -------------------------------------------------------------------------------- 1 | package com.park.util; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | 7 | public class DButil { 8 | private static String driver; 9 | private static String url; 10 | private static String username; 11 | private static String password; 12 | 13 | static{ 14 | driver="com.mysql.jdbc.Driver"; 15 | url="jdbc:mysql://localhost:3306/stallpc"; 16 | username="ansore"; 17 | password="ansore"; 18 | } 19 | 20 | public static Connection open() 21 | { 22 | try { 23 | Class.forName(driver); 24 | } catch (ClassNotFoundException e) { 25 | // TODO Auto-generated catch block 26 | e.printStackTrace(); 27 | } 28 | try { 29 | return DriverManager.getConnection(url, username, password); 30 | } catch (SQLException e) { 31 | // TODO Auto-generated catch block 32 | }return null; 33 | } 34 | public static Connection getConnection() throws SQLException{ 35 | return DriverManager.getConnection(url, username,password); 36 | } 37 | 38 | public static void close(Connection conn){ 39 | if(conn!=null){ 40 | try { 41 | conn.close(); 42 | } catch (SQLException e) { 43 | // TODO Auto-generated catch block 44 | e.printStackTrace(); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/util/ParkControlUtil.java: -------------------------------------------------------------------------------- 1 | package com.park.util; 2 | 3 | import com.park.data.ParkData; 4 | import com.park.tools.ThreadManage; 5 | 6 | /** 7 | * 车位控制类 8 | * @author ansore 9 | * 10 | */ 11 | public class ParkControlUtil { 12 | public static boolean lockSpace(int id) { 13 | if(ThreadManage.ClientThread.size()!=0) { 14 | ThreadManage.ClientThread.get(ParkData.HardWare).SenderMessages("control relay "+id+" 1"); 15 | return true; 16 | } 17 | return false; 18 | } 19 | 20 | public static boolean unlockSpace(int id) { 21 | if(ThreadManage.ClientThread.size()!=0) { 22 | ThreadManage.ClientThread.get(ParkData.HardWare).SenderMessages("control relay "+id+" 0"); 23 | return true; 24 | } 25 | return false; 26 | } 27 | 28 | public static boolean onLED(int id) { 29 | if(ThreadManage.ClientThread.size()!=0) { 30 | ThreadManage.ClientThread.get(ParkData.HardWare).SenderMessages("control led "+id+" 1"); 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | public static boolean offLED(int id) { 37 | if(ThreadManage.ClientThread.size()!=0) { 38 | ThreadManage.ClientThread.get(ParkData.HardWare).SenderMessages("control led "+id+" 0"); 39 | return true; 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/util/ParkUtil.java: -------------------------------------------------------------------------------- 1 | package com.park.util; 2 | 3 | import java.math.BigDecimal; 4 | import java.sql.Timestamp; 5 | import java.util.Date; 6 | 7 | import javax.swing.JOptionPane; 8 | 9 | import com.park.data.Data; 10 | import com.park.data.ParkData; 11 | import com.park.db.DeleteThreadInParkInfo; 12 | import com.park.db.InsertThreadInParkInfo; 13 | import com.park.db.QueryInParkStatus; 14 | import com.park.db.QueryTimestampOnly; 15 | import com.park.db.UpdateInParkStatusLockedOnly; 16 | import com.park.db.UpdateThreadParkStatusOrder; 17 | import com.park.enity.ParkStatus; 18 | import com.park.tools.ThreadManage; 19 | import com.park.view.Park; 20 | 21 | public class ParkUtil { 22 | //结束停车 返回费用 23 | public static double endPark(int id) { 24 | QueryTimestampOnly queryThread1=new QueryTimestampOnly(id); 25 | Timestamp timestamp=queryThread1.call(); 26 | if(timestamp!=null){ 27 | System.out.println(timestamp); 28 | } 29 | //更改车位状态 30 | new UpdateInParkStatusLockedOnly(id, 0).start(); 31 | new UpdateThreadParkStatusOrder(id,0).start(); 32 | //删除停车信息表信息 33 | new DeleteThreadInParkInfo(id).start(); 34 | //计算时间 35 | long minutes=new TimeMinus().minus(timestamp); 36 | 37 | //保留两位小数 38 | BigDecimal bg = new BigDecimal((double)(minutes*1.0/60)*ParkData.ParkNum); 39 | double payNum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 40 | 41 | System.out.println("停车时间为:"+minutes); 42 | 43 | System.out.println("结束停车,费用为:"+payNum); 44 | JOptionPane.showMessageDialog(null,"车位号:"+id+" 已结束停车 停车费用为:"+payNum+"元\n", "停车结束", JOptionPane.YES_OPTION); 45 | Park.park.getDailyPanel().getText().append(new Date().toLocaleString()+":车位号:"+id+" 已结束停车 停车费用为:"+payNum+"元\n"); 46 | 47 | if(ThreadManage.ClientThread.size()!=0) 48 | ThreadManage.ClientThread.get(ParkData.HardWare).SenderMessages("control relay "+id+" 0"); 49 | 50 | return payNum; 51 | } 52 | 53 | public static boolean orderSpace(String palte,int id,String phone) { 54 | ParkStatus parkStatus = new QueryInParkStatus().callParkStatus(); 55 | if(parkStatus==null || parkStatus.getBlank() == 1 || parkStatus.getOrdered() == 1) { 56 | return false; 57 | } 58 | Park.park.getDailyPanel().getText().append(new Date().toLocaleString()+":车牌号: "+palte+" 预约了"+id+"号车位\n"); 59 | //添加预约信息 60 | new InsertThreadInParkInfo(id, palte, phone, 0).start(); 61 | //更改车位状态 62 | new UpdateInParkStatusLockedOnly(id, 1).start(); 63 | new UpdateThreadParkStatusOrder(id,1).start(); 64 | ParkControlUtil.lockSpace(id); 65 | return true; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/util/TimeMinus.java: -------------------------------------------------------------------------------- 1 | package com.park.util; 2 | 3 | import java.sql.Timestamp; 4 | import java.text.DateFormat; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | 8 | 9 | 10 | public class TimeMinus { 11 | 12 | public long minus(Timestamp tms){ 13 | 14 | long minutes=0; 15 | Timestamp ts=new Timestamp(System.currentTimeMillis()); 16 | DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 17 | try 18 | 19 | { 20 | 21 | Date d1 = df.parse(TimestampToString(ts)); 22 | 23 | Date d2 = df.parse(TimestampToString(tms)); 24 | long diff = d1.getTime() - d2.getTime(); 25 | minutes = diff / (1000*60); 26 | 27 | return minutes; 28 | 29 | } 30 | catch (Exception e) 31 | { 32 | }return minutes; 33 | } 34 | 35 | public String TimestampToString(Timestamp tms){ 36 | 37 | Timestamp ts = tms; 38 | String tsStr = ""; 39 | try { 40 | 41 | tsStr = ts.toString(); 42 | return tsStr; 43 | } catch (Exception e) { 44 | e.printStackTrace(); 45 | } return null; 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/EndPark.java: -------------------------------------------------------------------------------- 1 | package com.park.view; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import java.awt.Font; 6 | import java.awt.Image; 7 | import java.awt.Toolkit; 8 | 9 | import javax.swing.JButton; 10 | import javax.swing.JFrame; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JTextField; 14 | 15 | import com.park.view.listener.EndParkListener; 16 | 17 | public class EndPark extends JFrame { 18 | 19 | private JLabel label1=new JLabel("结束停车"); 20 | private JLabel spaceLabel=new JLabel("结束车位:"); 21 | private JLabel[]a={spaceLabel}; 22 | private JTextField spaceText=new JTextField(); 23 | private JTextField[]b={spaceText}; 24 | private JButton sure=new JButton("确认"); 25 | private JButton canel=new JButton("取消"); 26 | private JButton[]c={sure,canel}; 27 | 28 | private EndParkListener endParkListener; 29 | 30 | private JPanel mainPanel; 31 | 32 | public EndPark() { 33 | endParkListener = new EndParkListener(this); 34 | Toolkit kt=Toolkit.getDefaultToolkit(); 35 | Dimension screenSize=kt.getScreenSize(); 36 | int screenW=screenSize.width; //获取当前屏幕的宽 37 | int screenH=screenSize.height; //获取当前屏幕的高 38 | //设置logal,占时显示绝对路径 TODO 39 | Image kt1=Toolkit.getDefaultToolkit().createImage(getClass().getResource("/image/carlogal.png")); 40 | 41 | mainPanel = new JPanel(); 42 | mainPanel.setBackground(Color.black); 43 | mainPanel.setLayout(null);//布局为空 44 | 45 | int i; 46 | label1.setBounds(125, 20, 150, 30);//JLabel1布局 设置大小 47 | label1.setForeground(Color.white); 48 | label1.setFont(new Font("Monospaced",Font.BOLD,15)); 49 | mainPanel.add(label1);//在面板添加Jlabel1 50 | for(i=0;i<1;i++)//依次对Jlabel[]a布局 设置大小并添加到面板 51 | { 52 | a[i].setForeground(Color.white); 53 | a[i].setBounds(40,80+50*i, 150, 30); 54 | a[i].setFont(new Font("Monospaced",Font.CENTER_BASELINE,15)); 55 | this.add(a[i]); 56 | } 57 | for(i=0;i<1;i++)//依次对JTextField[]b布局 设置大小并添加到面板 58 | { b[i].setBounds(140,80+50*i, 150, 30); 59 | this.add(b[i]); 60 | } 61 | c[0].setBounds(40, 145, 100, 30);//对“确认”按钮布局并设置大小 62 | c[0].setBackground(Color.white); 63 | c[0].setFocusPainted(false); 64 | c[0].setActionCommand("sure"); 65 | c[0].addActionListener(endParkListener); 66 | mainPanel.add(c[0]);//“确认”按钮添加到面板 67 | c[1].setBounds(180, 145, 100, 30);//对“重置”按钮布局并设置大小 68 | c[1].setBackground(Color.white); 69 | c[1].setFocusPainted(false); 70 | c[1].setActionCommand("canel"); 71 | c[1].addActionListener(endParkListener); 72 | mainPanel.add(c[1]); //“重置”按钮添加到面板 73 | 74 | this.setTitle("结束停车"); 75 | this.setIconImage(kt1); 76 | this.setBounds(screenW/3,screenH/4,350,250); 77 | this.getContentPane().add(mainPanel); 78 | this.setVisible(true); 79 | } 80 | 81 | public JTextField getSpaceText() { 82 | return spaceText; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/Login.java: -------------------------------------------------------------------------------- 1 | package com.park.view; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Container; 6 | import java.awt.FlowLayout; 7 | import java.awt.Image; 8 | import java.awt.Toolkit; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | import javax.swing.JPasswordField; 15 | import javax.swing.JTextField; 16 | 17 | import com.park.view.listener.LoginListener; 18 | 19 | /** 20 | * 登陆窗口 21 | * @author ansore 22 | * 23 | */ 24 | 25 | public class Login extends JFrame { 26 | 27 | private Container c; 28 | //用户名 29 | private JTextField username; 30 | //密码 31 | private JPasswordField password; 32 | //登录按钮 33 | private JButton okButton; 34 | //注册按钮 35 | private JButton enrollButton; 36 | //按钮监听 37 | private LoginListener loginListener; 38 | 39 | public Login(){ 40 | 41 | this.setTitle("登录"); 42 | 43 | 44 | //初始化组建 45 | loginListener = new LoginListener(this); 46 | username = new JTextField(); 47 | password = new JPasswordField(); 48 | okButton = new JButton("登陆"); 49 | okButton.setActionCommand("okButton"); 50 | okButton.addActionListener(loginListener); 51 | enrollButton = new JButton("注册"); 52 | enrollButton.setActionCommand("enrollButton"); 53 | enrollButton.addActionListener(loginListener); 54 | 55 | 56 | c = this.getContentPane(); 57 | 58 | c.setLayout(new BorderLayout()); 59 | 60 | initFrame(); 61 | 62 | c.setBackground(Color.red); 63 | 64 | Image kt1=Toolkit.getDefaultToolkit().createImage("image//carlogal.png"); 65 | 66 | this.setIconImage(kt1); 67 | this.setBounds(Toolkit.getDefaultToolkit().getScreenSize().width/3,Toolkit.getDefaultToolkit().getScreenSize().height/3,300,200); 68 | this.setVisible(true); 69 | this.setResizable(true); 70 | } 71 | 72 | /** 73 | * 初始化组建布局 74 | */ 75 | private void initFrame() { 76 | 77 | //顶部 78 | JPanel titlePanel = new JPanel(); 79 | titlePanel.setLayout(new FlowLayout()); 80 | titlePanel.add(new JLabel("服务器登陆")); 81 | c.add(titlePanel,"North"); 82 | titlePanel.setBackground(Color.white); 83 | 84 | //中部表单 85 | JPanel fieldPanel = new JPanel(); 86 | fieldPanel.setLayout(null); 87 | fieldPanel.setBackground(Color.black); 88 | JLabel l1 = new JLabel("用户名:"); 89 | l1.setBounds(50, 20, 50, 20); 90 | l1.setForeground(Color.white); 91 | JLabel l2 = new JLabel("密 码:"); 92 | l2.setForeground(Color.white); 93 | l2.setBounds(50, 60, 50, 20); 94 | fieldPanel.add(l1); 95 | fieldPanel.add(l2); 96 | username.setBounds(110,20,120,20); 97 | password.setBounds(110,60,120,20); 98 | fieldPanel.add(username); 99 | fieldPanel.add(password); 100 | c.add(fieldPanel,"Center"); 101 | 102 | //底部按钮 103 | JPanel buttonPanel = new JPanel(); 104 | buttonPanel.setLayout(new FlowLayout()); 105 | 106 | enrollButton.setBackground(Color.black); 107 | enrollButton.setForeground(Color.white); 108 | enrollButton.setFocusPainted(false); 109 | 110 | okButton.setBackground(Color.black); 111 | okButton.setForeground(Color.white); 112 | okButton.setFocusPainted(false); 113 | 114 | buttonPanel.add(okButton); 115 | buttonPanel.add(enrollButton); 116 | c.add(buttonPanel,"South"); 117 | } 118 | 119 | public JTextField getUsername() { 120 | return username; 121 | } 122 | 123 | public JPasswordField getPasswordN() { 124 | return password; 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/EndParkListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.sql.Timestamp; 6 | import java.util.Date; 7 | 8 | import javax.swing.JOptionPane; 9 | 10 | import com.park.data.ParkData; 11 | import com.park.db.DeleteThreadInParkInfo; 12 | import com.park.db.QueryInParkStatus; 13 | import com.park.db.QueryTimestampOnly; 14 | import com.park.db.UpdateInParkStatusLockedOnly; 15 | import com.park.db.UpdateThreadParkStatusOrder; 16 | import com.park.enity.ParkStatus; 17 | import com.park.tools.ThreadManage; 18 | import com.park.util.TimeMinus; 19 | import com.park.view.EndPark; 20 | import com.park.view.Park; 21 | 22 | public class EndParkListener implements ActionListener { 23 | 24 | private EndPark endPark; 25 | 26 | public EndParkListener(EndPark endPark) { 27 | this.endPark = endPark; 28 | } 29 | 30 | @Override 31 | public void actionPerformed(ActionEvent e) { 32 | 33 | 34 | //取消按钮响应 35 | if(e.getActionCommand().equals("canel")) { 36 | System.out.println("取消"); 37 | this.endPark.dispose(); 38 | } 39 | else 40 | if(ThreadManage.ClientThread.get(ParkData.HardWare)==null) { 41 | JOptionPane.showMessageDialog(null,"设备未链接", "ERROR", JOptionPane.ERROR_MESSAGE); 42 | return; 43 | } 44 | else 45 | //确认按钮响应 46 | if(e.getActionCommand().equals("sure")) { 47 | String space = this.endPark.getSpaceText().getText(); 48 | 49 | if(!space.matches("^[0-9]*$")||space.trim().equals("")){ 50 | JOptionPane.showMessageDialog(null,"请输入正确的车位号", "ERROR", JOptionPane.ERROR_MESSAGE); 51 | return; 52 | } 53 | 54 | ParkStatus parkStatus = new QueryInParkStatus(Integer.valueOf(space)).callParkStatus(); 55 | if(parkStatus==null) { 56 | JOptionPane.showMessageDialog(null,"请输入正确的车位号", "ERROR", JOptionPane.ERROR_MESSAGE); 57 | return; 58 | } else { 59 | if(parkStatus.getBlank()!=0&&parkStatus.getOrdered()==1) { 60 | JOptionPane.showMessageDialog(null,"请开走您的车", "ERROR", JOptionPane.ERROR_MESSAGE); 61 | return; 62 | } 63 | else { 64 | QueryTimestampOnly queryThread1=new QueryTimestampOnly(Integer.valueOf(space)); 65 | Timestamp timestamp=queryThread1.call(); 66 | if(timestamp!=null){ 67 | System.out.println(timestamp); 68 | } 69 | //更改车位状态 70 | new UpdateInParkStatusLockedOnly(Integer.valueOf(space), 0).start(); 71 | new UpdateThreadParkStatusOrder(Integer.valueOf(space),0).start(); 72 | //删除停车信息表信息 73 | new DeleteThreadInParkInfo(Integer.valueOf(space)).start(); 74 | //计算时间 75 | long minutes=new TimeMinus().minus(timestamp); 76 | Park.park.getDailyPanel().getText().append(new Date()+":车位号:"+Integer.valueOf(space)+" 已结束停车 停车费用为:"+(double)(minutes*1.0/60)*ParkData.ParkNum+"元\n"); 77 | JOptionPane.showMessageDialog(null,new Date()+":车位号:"+Integer.valueOf(space)+" 已结束停车 停车费用为:"+(double)(minutes*1.0/60)*ParkData.ParkNum+"元\n", "ERROR", JOptionPane.OK_OPTION); 78 | this.endPark.dispose(); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/LoginListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JOptionPane; 7 | 8 | import com.park.conserver.ConServer; 9 | import com.park.data.Data; 10 | import com.park.data.ParkData; 11 | import com.park.dto.Message; 12 | import com.park.tools.ThreadManage; 13 | import com.park.view.Login; 14 | import com.park.view.Park; 15 | import com.park.view.RegistrationView; 16 | 17 | public class LoginListener implements ActionListener { 18 | 19 | //传入Login对象 20 | private Login login; 21 | 22 | public LoginListener(Login login) { 23 | this.login = login; 24 | } 25 | 26 | @Override 27 | public void actionPerformed(ActionEvent e) { 28 | 29 | //注册按钮响应 30 | if(e.getActionCommand().equals("enrollButton")) { 31 | new RegistrationView(); 32 | this.login.dispose(); 33 | } 34 | 35 | //登陆按钮响应 36 | if(e.getActionCommand().equals("okButton")) { 37 | if(login.getUsername().getText().trim().equals("")||String.valueOf(login.getPasswordN().getPassword()).trim().equals("")){ 38 | JOptionPane.showMessageDialog(null,"请输入完整信息", "ERROR", JOptionPane.ERROR_MESSAGE); 39 | } 40 | else { 41 | int userName = Integer.valueOf(this.login.getUsername().getText().trim()); 42 | String password = new String(this.login.getPasswordN().getPassword()).trim(); 43 | 44 | Message message = new Message(); 45 | message.setMessageType(Data.Login); 46 | message.setParkId(userName); 47 | message.setPassword(password); 48 | Boolean boolean1 = new ConServer().conToServer(message); 49 | if(boolean1==true) { 50 | Park.park.getDisplayLabel().setText("已链接上服务器"); 51 | ParkData.ParkId = userName; 52 | this.login.dispose(); 53 | } 54 | else { 55 | JOptionPane.showMessageDialog(null,"用户名或密码错误", "ERROR", JOptionPane.ERROR_MESSAGE); 56 | } 57 | 58 | System.out.println(userName + "---" + password); 59 | } 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/ParkActionListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.CardLayout; 4 | import java.awt.event.ActionEvent; 5 | 6 | import javax.swing.JOptionPane; 7 | import javax.swing.JPanel; 8 | 9 | import com.park.data.Data; 10 | import com.park.dto.Message; 11 | import com.park.tools.ThreadManage; 12 | import com.park.view.EndPark; 13 | import com.park.view.Login; 14 | import com.park.view.ParkForm; 15 | 16 | 17 | 18 | 19 | /** 20 | * 按钮监听事件 21 | * @author silver 22 | * 23 | */ 24 | 25 | 26 | public class ParkActionListener implements java.awt.event.ActionListener { 27 | 28 | JPanel cardLayout; 29 | 30 | public ParkActionListener(JPanel jPanel) { 31 | this.cardLayout = jPanel; 32 | } 33 | 34 | @Override 35 | public void actionPerformed(ActionEvent e) { 36 | 37 | if(e.getActionCommand().equals("carStateButton")){ 38 | ((CardLayout) cardLayout.getLayout()).show(cardLayout, "statePanel"); 39 | } 40 | 41 | if(e.getActionCommand().equals("parkNewsButton")) { 42 | ((CardLayout) cardLayout.getLayout()).show(cardLayout, "newsPanel"); 43 | } 44 | if(e.getActionCommand().equals("parkDailyButton")){ 45 | ((CardLayout) cardLayout.getLayout()).show(cardLayout, "dailyPanel"); 46 | } 47 | //登录服务器按钮监听事件响应 48 | if(e.getActionCommand().equals("enterButton")) { 49 | System.out.println(ThreadManage.ServerThread.size()); 50 | if(ThreadManage.ServerThread.size()==0) { 51 | new Login(); 52 | } 53 | else { 54 | JOptionPane.showMessageDialog(null,"已链接服务器", "ERROR", JOptionPane.ERROR_MESSAGE); 55 | return; 56 | } 57 | } 58 | //停车表单填写 59 | if(e.getActionCommand().equals("noBookkingButton")) { 60 | new ParkForm(); 61 | } 62 | 63 | //结束停车 64 | if(e.getActionCommand().equals("endPark")) { 65 | new EndPark(); 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/ParkFormListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JFrame; 7 | import javax.swing.JOptionPane; 8 | 9 | import com.park.data.Data; 10 | import com.park.data.ParkData; 11 | import com.park.db.InsertThreadInParkInfo; 12 | import com.park.db.QueryInParkStatus; 13 | import com.park.db.UpdateThreadParkStatusOrder; 14 | import com.park.enity.ParkStatus; 15 | import com.park.tools.ThreadManage; 16 | import com.park.view.ParkForm; 17 | 18 | public class ParkFormListener implements ActionListener { 19 | 20 | private ParkForm parkForm; 21 | 22 | public ParkFormListener(ParkForm parkForm) { 23 | this.parkForm = parkForm; 24 | } 25 | 26 | @Override 27 | public void actionPerformed(ActionEvent e) { 28 | 29 | 30 | //取消按钮响应 31 | if(e.getActionCommand().equals("canel")) { 32 | System.out.println("取消"); 33 | this.parkForm.dispose(); 34 | } 35 | else 36 | if(ThreadManage.ClientThread.get(ParkData.HardWare)==null) { 37 | JOptionPane.showMessageDialog(null,"设备未链接", "ERROR", JOptionPane.ERROR_MESSAGE); 38 | return; 39 | } 40 | else 41 | //确认按钮响应 42 | if(e.getActionCommand().equals("sure")) { 43 | String name = this.parkForm.getNameText().getText(); 44 | String phone = this.parkForm.getPhoneText().getText(); 45 | String palte = this.parkForm.getPlateText().getText(); 46 | String space = this.parkForm.getSpaceText().getText(); 47 | /** 48 | * 检测输入字段 49 | */ 50 | if(!phone.matches("^[0-9]*$")||phone.trim().equals("")) { 51 | JOptionPane.showMessageDialog(null,"请输入正确的手机号", "ERROR", JOptionPane.ERROR_MESSAGE); 52 | return; 53 | } 54 | if(!space.matches("^[0-9]*$")||space.trim().equals("")){ 55 | JOptionPane.showMessageDialog(null,"请输入正确的车位号", "ERROR", JOptionPane.ERROR_MESSAGE); 56 | return; 57 | } 58 | if(name.trim().equals("")) { 59 | JOptionPane.showMessageDialog(null,"请输入正确的用户姓名", "ERROR", JOptionPane.ERROR_MESSAGE); 60 | return; 61 | } 62 | if(palte.trim().equals("")) { 63 | JOptionPane.showMessageDialog(null,"请输入正确的车牌号", "ERROR", JOptionPane.ERROR_MESSAGE); 64 | return; 65 | } 66 | 67 | ParkStatus parkStatus = new QueryInParkStatus(Integer.valueOf(space)).callParkStatus(); 68 | if(parkStatus==null) { 69 | JOptionPane.showMessageDialog(null,"请输入正确的车位号", "ERROR", JOptionPane.ERROR_MESSAGE); 70 | return; 71 | } 72 | else { 73 | if(parkStatus.getBlank()!=0||parkStatus.getLocked()!=0||parkStatus.getOrdered()!=0) { 74 | JOptionPane.showMessageDialog(null,"该车位被预定或者被锁定", "ERROR", JOptionPane.ERROR_MESSAGE); 75 | return; 76 | } 77 | else { 78 | new UpdateThreadParkStatusOrder(Integer.valueOf(space), 1).start(); 79 | new InsertThreadInParkInfo(Integer.valueOf(space), palte, phone, 0).start();; 80 | JOptionPane.showMessageDialog(null,"预定成功", "SUCESS", JOptionPane.OK_OPTION); 81 | this.parkForm.dispose(); 82 | } 83 | } 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/ParkStatusListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | 6 | import javax.swing.JOptionPane; 7 | 8 | import com.park.data.ParkData; 9 | import com.park.enity.ParkStatus; 10 | import com.park.tools.ThreadManage; 11 | import com.park.util.ParkControlUtil; 12 | import com.park.util.ParkUtil; 13 | import com.park.view.ParkForm; 14 | 15 | public class ParkStatusListener implements ActionListener { 16 | 17 | private ParkStatus parkStatus; 18 | 19 | public ParkStatusListener(ParkStatus parkStatus) { 20 | this.parkStatus = parkStatus; 21 | } 22 | 23 | @Override 24 | public void actionPerformed(ActionEvent e) { 25 | if(e.getActionCommand().equals("lock")) { 26 | if(ParkControlUtil.lockSpace(parkStatus.getId())==false) { 27 | JOptionPane.showMessageDialog(null,"失败,可能该设备没有链接", "ERROR", JOptionPane.ERROR_MESSAGE); 28 | } 29 | } 30 | if(e.getActionCommand().equals("unlock")) { 31 | if(ParkControlUtil.unlockSpace(parkStatus.getId())==false) { 32 | JOptionPane.showMessageDialog(null,"失败,可能该设备没有链接", "ERROR", JOptionPane.ERROR_MESSAGE); 33 | } 34 | } 35 | if(e.getActionCommand().equals("order")) { 36 | ParkForm parkForm = new ParkForm(); 37 | parkForm.getSpaceText().setEnabled(false); 38 | parkForm.getSpaceText().setText(this.parkStatus.getId()+""); 39 | } 40 | if(e.getActionCommand().equals("end")) { 41 | 42 | if(ThreadManage.ClientThread.get(ParkData.HardWare)==null) { 43 | JOptionPane.showMessageDialog(null,"设备未链接", "ERROR", JOptionPane.ERROR_MESSAGE); 44 | return; 45 | } 46 | int n = JOptionPane.showConfirmDialog(null, "确认结束吗?", "确认对话框", JOptionPane.YES_NO_OPTION); 47 | if (n == JOptionPane.YES_OPTION) { 48 | 49 | ParkUtil.endPark(parkStatus.getId()); 50 | 51 | } else if (n == JOptionPane.NO_OPTION) { 52 | } 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Park-PC/src/com/park/view/listener/RegistrationListener.java: -------------------------------------------------------------------------------- 1 | package com.park.view.listener; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.util.regex.Pattern; 6 | 7 | import javax.swing.JOptionPane; 8 | 9 | import com.park.conserver.ConServer; 10 | import com.park.data.Data; 11 | import com.park.dto.Message; 12 | import com.park.view.RegistrationView; 13 | 14 | public class RegistrationListener implements ActionListener { 15 | 16 | private RegistrationView registrationView; 17 | 18 | public RegistrationListener(RegistrationView registrationView) { 19 | this.registrationView = registrationView; 20 | } 21 | 22 | @Override 23 | public void actionPerformed(ActionEvent e) { 24 | 25 | //注册处理 26 | if(e.getActionCommand().equals("reg")){ 27 | 28 | int parkId; 29 | 30 | try { 31 | parkId = Integer.valueOf(this.registrationView.getTextfield1().getText().trim()); 32 | } catch (Exception e2) { 33 | JOptionPane.showMessageDialog(null,"请输入正确ID", "ERROR", JOptionPane.ERROR_MESSAGE); 34 | return; 35 | } 36 | 37 | String parkName = this.registrationView.getTextfield2().getText().trim(); 38 | String phone = this.registrationView.getTextfield3().getText().trim(); 39 | String passwd1 = new String(this.registrationView.getPassword1().getPassword()).trim(); 40 | String passwd2 = new String(this.registrationView.getPassword2().getPassword()).trim(); 41 | String address = this.registrationView.getTextfield4().getText().trim(); 42 | String remark = this.registrationView.getTextfield5().getText().trim(); 43 | 44 | if(parkName.equals("")||phone.equals("")||passwd1.equals("")||passwd2.equals("")||address.equals("")||remark.equals("")) { 45 | JOptionPane.showMessageDialog(null,"请输入完整信息", "ERROR", JOptionPane.ERROR_MESSAGE); 46 | return; 47 | } 48 | 49 | if(!Pattern.compile("[0-9]*").matcher(phone).matches()) { 50 | JOptionPane.showMessageDialog(null,"请输入正确手机号", "ERROR", JOptionPane.ERROR_MESSAGE); 51 | return; 52 | } 53 | 54 | if(!passwd1.equals(passwd2)) { 55 | JOptionPane.showMessageDialog(null,"两次密码不一致", "ERROR", JOptionPane.ERROR_MESSAGE); 56 | return; 57 | } 58 | 59 | //注册 60 | Message message = new Message(); 61 | message.setMessageType(Data.RegInfo); 62 | message.setParkId(parkId); 63 | message.setParkName(parkName); 64 | message.setPassword(passwd1); 65 | message.setTelephone(phone); 66 | message.setAddress(address); 67 | message.setRemark(remark); 68 | 69 | boolean result = new ConServer().conToServer(message); 70 | if(result == true) { 71 | JOptionPane.showMessageDialog(null,"注册成功,请返回登陆", "SUCESS", JOptionPane.INFORMATION_MESSAGE); 72 | } 73 | else { 74 | JOptionPane.showMessageDialog(null,"注册失败,未知错误", "ERROR", JOptionPane.ERROR_MESSAGE); 75 | } 76 | 77 | System.out.println(parkId+ "-----"+parkName + "---" + phone+ "---"+passwd1 + "---" + passwd2 + "----" + address + "---" + remark); 78 | 79 | } 80 | 81 | //取消处理 82 | if(e.getActionCommand().equals("dispose")) { 83 | this.registrationView.dispose(); 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /Park-PC/src/image/carlogal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/carlogal.png -------------------------------------------------------------------------------- /Park-PC/src/image/park++圆角7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/park++圆角7.png -------------------------------------------------------------------------------- /Park-PC/src/image/thecar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/thecar1.png -------------------------------------------------------------------------------- /Park-PC/src/image/车位灰.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/车位灰.png -------------------------------------------------------------------------------- /Park-PC/src/image/车位黄黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/车位黄黑.png -------------------------------------------------------------------------------- /Park-PC/src/image/车位黑白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/Park-PC/src/image/车位黑白.png -------------------------------------------------------------------------------- /park-server/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2016,10,8,22,10,44 3 | Version=3 4 | 5 | [Settings] 6 | HiddenFilesShown=true 7 | -------------------------------------------------------------------------------- /park-server/.idea/.name: -------------------------------------------------------------------------------- 1 | park -------------------------------------------------------------------------------- /park-server/.idea/artifacts/park_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/target 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /park-server/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /park-server/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /park-server/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_google_guava_guava_19_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_mchange_c3p0_0_9_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_mchange_mchange_commons_java_0_2_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_squareup_okhttp3_okhttp_3_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__com_squareup_okio_okio_1_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__javax_servlet_jsp_jsp_api_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__jstl_jstl_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__junit_junit_4_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_mybatis_mybatis_3_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_mybatis_mybatis_spring_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_aop_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_beans_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_context_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_context_support_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_core_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_expression_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_jdbc_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_test_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_tx_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_web_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__org_springframework_spring_webmvc_4_1_7_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/libraries/Maven__taglibs_standard_1_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | Android API 23 Platform 45 | 46 | 51 | 52 | 53 | 54 | 55 | 56 | 1.8 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /park-server/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /park-server/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 3 | org.eclipse.jdt.core.compiler.compliance=1.5 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.5 6 | -------------------------------------------------------------------------------- /park-server/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /park-server/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/controller/WebController.java: -------------------------------------------------------------------------------- 1 | package com.park.controller; 2 | 3 | import com.park.dto.Result; 4 | import com.park.enity.ParkInfo; 5 | import com.park.enity.User; 6 | import com.park.exception.StatusEnum; 7 | import com.park.service.ParkService; 8 | import com.park.service.UserService; 9 | import com.park.socketmanage.SocketThreadManage; 10 | import com.park.vo.RegisterVo; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.ui.Model; 13 | import org.springframework.util.StringUtils; 14 | import org.springframework.web.bind.annotation.RequestBody; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.ResponseBody; 17 | 18 | import javax.annotation.Resource; 19 | import javax.servlet.http.HttpSession; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by ansore on 17-5-28. 24 | */ 25 | @Controller 26 | @RequestMapping ("/web") 27 | public class WebController { 28 | 29 | @Resource 30 | UserService userService; 31 | 32 | @Resource 33 | ParkService parkService; 34 | 35 | @RequestMapping("/") 36 | public String indexPage() { 37 | return "index"; 38 | } 39 | @RequestMapping("/login") 40 | public String loginPage(HttpSession httpSession){ 41 | httpSession.removeAttribute("user"); 42 | return "login"; 43 | } 44 | 45 | @RequestMapping ("/check") 46 | public String login(HttpSession httpSession, Model model, String phone , String password) { 47 | 48 | //验证用户信息 49 | User user = userService.getUser(phone); 50 | if(user == null || !user.getPassword().equals(password)) { 51 | return "loginError"; 52 | } 53 | else { 54 | httpSession.setAttribute("user",user); 55 | 56 | List l = parkService.getParksInfoList(); 57 | if(l!=null&&l.size()!=0) { 58 | for (ParkInfo parkInfo : l) { 59 | if (SocketThreadManage.socketThread.get(parkInfo.getParkid()) != null) { 60 | parkInfo.setAlive(true); 61 | } else { 62 | parkInfo.setAlive(false); 63 | } 64 | } 65 | } 66 | model.addAttribute("parksList",l); 67 | return "index"; 68 | } 69 | } 70 | 71 | @RequestMapping("/reg") 72 | @ResponseBody 73 | public Result register(@RequestBody RegisterVo registerVo) { 74 | Result result = new Result(false,StatusEnum.getStatusCode(-1).getStatusInfo()); 75 | if(StringUtils.isEmpty(registerVo.getPalte())||StringUtils.isEmpty(registerVo.getUsername())||StringUtils.isEmpty(registerVo.getPassword())||StringUtils.isEmpty(registerVo.getTelephone())){ 76 | return new Result(false,StatusEnum.getStatusCode(102).getStatusInfo()); 77 | } 78 | int i = userService.userRegister(registerVo); 79 | if(i == 1) { 80 | result.setStatus(true); 81 | result.setStatusInfo(StatusEnum.getStatusCode(201).getStatusInfo()); 82 | } 83 | return result; 84 | } 85 | 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/dao/OrderInfoDAO.java: -------------------------------------------------------------------------------- 1 | package com.park.dao; 2 | 3 | import com.park.enity.OrderInfo; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | /** 7 | * Created by ansore on 16-10-6. 8 | */ 9 | public interface OrderInfoDAO { 10 | /** 11 | * 查看用户是否已经预约 12 | * 0 否 1 是 13 | * @param phone 14 | * @return 15 | */ 16 | int orderIsExist(@Param("phone") String phone); 17 | 18 | /** 19 | * 添加预约信息 20 | * @return 21 | */ 22 | int addOrderInfo(OrderInfo orderInfo); 23 | 24 | /** 25 | * 删除预约记录 26 | * @param phone 27 | * @return 28 | */ 29 | int delOrderInfo(@Param("phone") String phone); 30 | 31 | /** 32 | * 获取预定信息 33 | * @param phone 34 | * @return 35 | */ 36 | OrderInfo getOrderInfo(@Param("phone") String phone); 37 | } 38 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/dao/ParkInfoDAO.java: -------------------------------------------------------------------------------- 1 | package com.park.dao; 2 | 3 | import com.park.enity.ParkInfo; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by ansore on 16-9-12. 10 | */ 11 | public interface ParkInfoDAO { 12 | 13 | /** 14 | * 检测停车场是否已经注册 15 | * @param parkid 16 | * @return 17 | */ 18 | int parkIsExist(@Param("parkid") int parkid); 19 | 20 | /** 21 | * 添加停车场 22 | * @param parkInfo 23 | * @return 24 | */ 25 | int addPark(ParkInfo parkInfo); 26 | 27 | /** 28 | * 停车场管理登录 29 | * @param parkid 30 | * @param password 31 | * @return 32 | */ 33 | int parkLogin(@Param("parkid") int parkid,@Param("password") String password); 34 | 35 | /** 36 | * 获取所有停车场列表 37 | * @return 38 | */ 39 | List getParksList(); 40 | } 41 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/dao/UserDAO.java: -------------------------------------------------------------------------------- 1 | package com.park.dao; 2 | 3 | import com.park.enity.User; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | /** 7 | * Created by ansore on 16-9-11. 8 | */ 9 | public interface UserDAO { 10 | 11 | /** 12 | * 检测用户是否存在 13 | * @return 14 | */ 15 | int userIsExist(@Param("telephone") String telephone); 16 | 17 | /** 18 | * Add Phone User 19 | * 添加手机用户 20 | * @param u 21 | * @return 22 | */ 23 | int addUser(User u); 24 | 25 | /** 26 | * 验证用户登录 27 | * @param telephone 28 | * @param password 29 | * @return 0用户名或密码错误 30 | * 1 正常登录 31 | */ 32 | int userLogin(@Param("telephone") String telephone,@Param("password") String password); 33 | 34 | User getUser(@Param("telephone") String telephone); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/data/Data.java: -------------------------------------------------------------------------------- 1 | package com.park.data; 2 | 3 | /** 4 | * TODO 静态常量 !!!!!不规范 后面要改 5 | * 接口常量 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public interface Data { 9 | 10 | /** 11 | * PC交互常量 12 | * 13 | */ 14 | //登录 15 | public int Login = 1; 16 | 17 | //注册 18 | public int RegInfo = 2; 19 | 20 | //服务器向客户端请求车位信息 21 | public int GetParkInfo = 4; 22 | 23 | //服务器向客户段发送控制信息 24 | public int ControlInfo = 5; 25 | 26 | //锁定 27 | public int Lock = 10; 28 | 29 | //解锁 30 | public int Unlock = 11; 31 | 32 | //服务器向客户端发送预约信息 33 | public int OrderInfo = 6; 34 | 35 | //双向,结束停车 36 | public int EndParkInfo = 7; 37 | 38 | //响应 39 | public int Answer = 20; 40 | 41 | //获取预定信息 42 | public int GetOrderInfoPC = 8; 43 | 44 | //服务器 -> PC 45 | //车位指示灯亮 46 | public int LEDOn = 12; 47 | //车位指示灯灭 48 | public int LEDOff = 13; 49 | 50 | 51 | 52 | /** 53 | * 手机交互静态常量 54 | * action常量 55 | */ 56 | //注册 57 | public String Reg = "reg"; 58 | //登录 59 | public String LoginPhone = "login"; 60 | //获取停车场信息 61 | public String GetParksInfo = "getParksInfo"; 62 | //获取车位信息 63 | public String GetLotInfo = "getLotInfo"; 64 | //预订车位 65 | public String OrderPark = "orderPark"; 66 | //获取预订信息 67 | public String GetOrderInfo = "getOrderInfo"; 68 | //开闸(主) 69 | public String OpenMainRelay = "openMainRelay"; 70 | //解锁车位 71 | public String UnlockRelay = "unlockRelay"; 72 | //锁定车位 73 | public String LockRelay = "lockRelay"; 74 | //结束停车 75 | public String EndPark = "endPark"; 76 | //模拟支付 77 | public String PayMoney = "payMoney"; 78 | //LED 79 | //LED关闭 80 | public String offLED = "offLED"; 81 | //LED开启 82 | public String onLED = "onLED"; 83 | } 84 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.park.dto; 2 | 3 | import com.park.enity.ParkStatus; 4 | import java.util.List; 5 | 6 | /** 7 | * Message DTO 8 | * 与PC客户端通信实体 9 | * Created by ansore on 16-9-12. 10 | */ 11 | public class Message implements java.io.Serializable { 12 | 13 | //消息类型 14 | private int messageType; 15 | 16 | //状态 17 | private boolean statu; 18 | 19 | //注册 20 | //预约时复用telephone 21 | private String telephone; 22 | private String userName; 23 | private String password; 24 | private String parkName; 25 | private String address; 26 | private String remark; 27 | 28 | //控制信息 29 | private String controlInfo; 30 | 31 | //停车场车位状态 32 | private List parkList; 33 | 34 | //预约信息 35 | //车牌 36 | private String palte; 37 | //车位编号 / 注册时停车场ID 38 | private int parkId; 39 | //用户手机号 private String telephone; 40 | 41 | //结束停车 车位编号 private int parkId; 42 | 43 | //费用 44 | private double payNum; 45 | 46 | 47 | public String getAddress() { 48 | return address; 49 | } 50 | 51 | public void setAddress(String address) { 52 | this.address = address; 53 | } 54 | 55 | public String getRemark() { 56 | return remark; 57 | } 58 | 59 | public void setRemark(String remark) { 60 | this.remark = remark; 61 | } 62 | 63 | public String getControlInfo() { 64 | return controlInfo; 65 | } 66 | 67 | public void setControlInfo(String controlInfo) { 68 | this.controlInfo = controlInfo; 69 | } 70 | 71 | public int getMessageType() { 72 | return messageType; 73 | } 74 | 75 | public void setMessageType(int messageType) { 76 | this.messageType = messageType; 77 | } 78 | 79 | public boolean getStatu() { 80 | return statu; 81 | } 82 | 83 | public void setStatu(boolean statu) { 84 | this.statu = statu; 85 | } 86 | 87 | public String getTelephone() { 88 | return telephone; 89 | } 90 | 91 | public void setTelephone(String telephone) { 92 | this.telephone = telephone; 93 | } 94 | 95 | public String getUserName() { 96 | return userName; 97 | } 98 | 99 | public void setUserName(String userName) { 100 | this.userName = userName; 101 | } 102 | 103 | public String getPassword() { 104 | return password; 105 | } 106 | 107 | public void setPassword(String password) { 108 | this.password = password; 109 | } 110 | 111 | public String getParkName() { 112 | return parkName; 113 | } 114 | 115 | public void setParkName(String parkName) { 116 | this.parkName = parkName; 117 | } 118 | 119 | public List getParkList() { 120 | return parkList; 121 | } 122 | 123 | public void setParkList(List parkList) { 124 | this.parkList = parkList; 125 | } 126 | 127 | public String getPalte() { 128 | return palte; 129 | } 130 | 131 | public void setPalte(String palte) { 132 | this.palte = palte; 133 | } 134 | 135 | public int getParkId() { 136 | return parkId; 137 | } 138 | 139 | public void setParkId(int parkId) { 140 | this.parkId = parkId; 141 | } 142 | 143 | public double getPayNum() { 144 | return payNum; 145 | } 146 | 147 | public void setPayNum(double payNum) { 148 | this.payNum = payNum; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/dto/Result.java: -------------------------------------------------------------------------------- 1 | package com.park.dto; 2 | 3 | /** 4 | * 数据传输层DTO 5 | * 返回给手机的数据 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public class Result { 9 | 10 | private boolean status; 11 | private String statusInfo; 12 | private T data; 13 | //停车场名 14 | private String parkName; 15 | //车位号 16 | private int lotId; 17 | //支付费用 18 | private double payNum; 19 | 20 | private String phone; 21 | 22 | private int parkId; 23 | 24 | public String getPhone() { 25 | return phone; 26 | } 27 | 28 | public void setPhone(String phone) { 29 | this.phone = phone; 30 | } 31 | 32 | public int getParkId() { 33 | return parkId; 34 | } 35 | 36 | public void setParkId(int parkId) { 37 | this.parkId = parkId; 38 | } 39 | 40 | public double getPayNum() { 41 | return payNum; 42 | } 43 | 44 | public void setPayNum(double payNum) { 45 | this.payNum = payNum; 46 | } 47 | 48 | public void setPayNum(int payNum) { 49 | this.payNum = payNum; 50 | } 51 | 52 | public String getParkName() { 53 | return parkName; 54 | } 55 | 56 | public void setParkName(String parkName) { 57 | this.parkName = parkName; 58 | } 59 | 60 | public int getLotId() { 61 | return lotId; 62 | } 63 | 64 | public void setLotId(int lotId) { 65 | this.lotId = lotId; 66 | } 67 | 68 | public Result(boolean status, String statusInfo){ 69 | this.status = status; 70 | this.statusInfo = statusInfo; 71 | } 72 | 73 | public boolean isStatus() { 74 | return status; 75 | } 76 | 77 | public void setStatus(boolean status) { 78 | this.status = status; 79 | } 80 | 81 | public String getStatusInfo() { 82 | return statusInfo; 83 | } 84 | 85 | public void setStatusInfo(String statusInfo) { 86 | this.statusInfo = statusInfo; 87 | } 88 | 89 | public T getData() { 90 | return data; 91 | } 92 | 93 | public void setData(T data) { 94 | this.data = data; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/enity/OrderInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | /** 4 | * Created by ansore on 16-10-6. 5 | */ 6 | public class OrderInfo { 7 | //停车场Id 8 | private int parkid; 9 | 10 | //用户手机号 11 | private String phone; 12 | 13 | public int getParkid() { 14 | return parkid; 15 | } 16 | 17 | public void setParkid(int parkid) { 18 | this.parkid = parkid; 19 | } 20 | 21 | public String getPhone() { 22 | return phone; 23 | } 24 | 25 | public void setPhone(String phone) { 26 | this.phone = phone; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/enity/ParkInfo.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | /** 4 | * ParkInfo Enity 5 | * 数据库实体 6 | * Created by ansore on 16-9-11. 7 | */ 8 | public class ParkInfo { 9 | 10 | private int parkid; 11 | private String password; 12 | private String name; 13 | private String telephone; 14 | private String address; 15 | private String remark; 16 | 17 | //是否连上服务器 true 是 false 否 18 | private boolean alive; 19 | 20 | public String getAddress() { 21 | return address; 22 | } 23 | 24 | public void setAddress(String address) { 25 | this.address = address; 26 | } 27 | 28 | public String getRemark() { 29 | return remark; 30 | } 31 | 32 | public void setRemark(String remark) { 33 | this.remark = remark; 34 | } 35 | 36 | public boolean isAlive() { 37 | return alive; 38 | } 39 | 40 | public void setAlive(boolean alive) { 41 | this.alive = alive; 42 | } 43 | 44 | public int getParkid() { 45 | return parkid; 46 | } 47 | 48 | public void setParkid(int parkid) { 49 | this.parkid = parkid; 50 | } 51 | 52 | public String getPassword() { 53 | return password; 54 | } 55 | 56 | public void setPassword(String password) { 57 | this.password = password; 58 | } 59 | 60 | public String getName() { 61 | return name; 62 | } 63 | 64 | public void setName(String name) { 65 | this.name = name; 66 | } 67 | 68 | public String getTelephone() { 69 | return telephone; 70 | } 71 | 72 | public void setTelephone(String telephone) { 73 | this.telephone = telephone; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/enity/ParkStatus.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | /** 4 | * 与PC交互实体类 5 | * 停车场车位状态实体类 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public class ParkStatus implements java.io.Serializable { 9 | 10 | private int id; 11 | private int locked; 12 | private int ordered; 13 | private int blank; 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | 19 | public void setId(int id) { 20 | this.id = id; 21 | } 22 | 23 | public int getLocked() { 24 | return locked; 25 | } 26 | 27 | public void setLocked(int locked) { 28 | this.locked = locked; 29 | } 30 | 31 | public int getOrdered() { 32 | return ordered; 33 | } 34 | 35 | public void setOrdered(int ordered) { 36 | this.ordered = ordered; 37 | } 38 | 39 | public int getBlank() { 40 | return blank; 41 | } 42 | 43 | public void setBlank(int blank) { 44 | this.blank = blank; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/enity/User.java: -------------------------------------------------------------------------------- 1 | package com.park.enity; 2 | 3 | /** 4 | * User enity 5 | * 用户 6 | * 数据库实体 7 | * Created by ansore on 16-9-11. 8 | */ 9 | public class User { 10 | 11 | private String telephone; 12 | private String password; 13 | private String username; 14 | private String palte; 15 | 16 | public String getTelephone() { 17 | return telephone; 18 | } 19 | 20 | public void setTelephone(String telephone) { 21 | this.telephone = telephone; 22 | } 23 | 24 | public String getPassword() { 25 | return password; 26 | } 27 | 28 | public void setPassword(String password) { 29 | this.password = password; 30 | } 31 | 32 | public String getUsername() { 33 | return username; 34 | } 35 | 36 | public void setUsername(String username) { 37 | this.username = username; 38 | } 39 | 40 | public String getPalte() { 41 | return palte; 42 | } 43 | 44 | public void setPalte(String palte) { 45 | this.palte = palte; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/exception/ParkException.java: -------------------------------------------------------------------------------- 1 | package com.park.exception; 2 | 3 | /** 4 | * 处理运行期异常 5 | * 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public class ParkException extends RuntimeException { 9 | 10 | private int statusCode = 100; 11 | private String statusInfo = "服务器错误"; 12 | 13 | public ParkException(StatusEnum statusEnum) { 14 | this.statusCode = statusEnum.getStatusCode(); 15 | this.statusInfo = statusEnum.getStatusInfo(); 16 | } 17 | 18 | public int getStatusCode() { 19 | return statusCode; 20 | } 21 | 22 | public void setStatusCode(int statusCode) { 23 | this.statusCode = statusCode; 24 | } 25 | 26 | public String getStatusInfo() { 27 | return statusInfo; 28 | } 29 | 30 | public void setStatusInfo(String statusInfo) { 31 | this.statusInfo = statusInfo; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/exception/StatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.park.exception; 2 | 3 | /** 4 | * 异常枚举类 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public enum StatusEnum { 8 | FAILED(-1,"失败"), 9 | SUCCESS(0,"成功"), 10 | SERVERERROR(100,"服务器错误"), 11 | ERORR(101,"未知错误"), 12 | VALUENOTCOMPLETE(102,"参数不齐全"), 13 | REQUESTERROR(103,"请求方式应为POST"), 14 | PCNOCON(104,"客户端未链接"), 15 | GETTIMEOUT(105,"请求超时"), 16 | ORDERED(106,"已经预约"), 17 | NOORDER(107,"没有预约"), 18 | LOGINSUCCESS(200,"登录成功"), 19 | REGFILED(201,"注册成功"), 20 | GETSUCESS(202,"获取成功"), 21 | PAYSUCESS(203,"支付成功"), 22 | CONTROLSUCESS(204,"控制成功"), 23 | ORDERSUCESS(205,"预约成功"), 24 | USERISEXIST(300,"用户已存在"), 25 | USERREGFAILED(301,"用户注册失败"), 26 | USERLOGINFAILED(302,"用户名或密码错误"), 27 | USERISNOEXIST(303,"获取用户失败"), 28 | PARKISEXIST(400,"停车场已存在"), 29 | PARKREGFAILED(401,"停车场注册失败"), 30 | PARKRLOGINFAILED(402,"用户名或密码错误") 31 | ; 32 | 33 | private int statusCode; 34 | private String statusInfo; 35 | 36 | private StatusEnum(int statusCode,String statusInfo){ 37 | this.statusCode = statusCode; 38 | this.statusInfo = statusInfo; 39 | } 40 | 41 | public static StatusEnum getStatusCode(int statusCode){ 42 | for(StatusEnum statusEnum : values()){ 43 | if(statusEnum.getStatusCode()==statusCode){ 44 | return statusEnum; 45 | } 46 | } 47 | return null; 48 | } 49 | 50 | public int getStatusCode() { 51 | return statusCode; 52 | } 53 | 54 | public void setStatusCode(int statusCode) { 55 | this.statusCode = statusCode; 56 | } 57 | 58 | public String getStatusInfo() { 59 | return statusInfo; 60 | } 61 | 62 | public void setStatusInfo(String statusInfo) { 63 | this.statusInfo = statusInfo; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/listener/SocketServiceLoader.java: -------------------------------------------------------------------------------- 1 | package com.park.listener; 2 | 3 | import com.park.socket.ServerSocketThread; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.servlet.ServletContextEvent; 7 | import javax.servlet.ServletContextListener; 8 | 9 | /** 10 | * 监听类 启动ServerSocket 线程 11 | * Created by ansore on 16-9-12. 12 | */ 13 | public class SocketServiceLoader implements ServletContextListener { 14 | 15 | //Socket服务器线程 16 | private ServerSocketThread serverSocketThread; 17 | 18 | 19 | @Override 20 | public void contextInitialized(ServletContextEvent sce) { 21 | System.out.println("进入监听器"); 22 | //启动线程 23 | if(null == serverSocketThread) { 24 | serverSocketThread = new ServerSocketThread(); 25 | serverSocketThread.start(); 26 | System.out.println("启动线程"); 27 | } 28 | } 29 | 30 | @Override 31 | public void contextDestroyed(ServletContextEvent sce) { 32 | //结束后销毁线程 33 | if(null != serverSocketThread) { 34 | //释放资源 , 结束线程 35 | serverSocketThread.destroyedServerSocket(); 36 | serverSocketThread.interrupt(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/service/ParkService.java: -------------------------------------------------------------------------------- 1 | package com.park.service; 2 | 3 | import com.park.enity.ParkInfo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 停车场Service 9 | * Created by ansore on 16-9-12. 10 | */ 11 | public interface ParkService { 12 | 13 | /** 14 | * 注册停车场 15 | * @param parkInfo 16 | * @return 1成功 17 | * 0失败 18 | */ 19 | int parkRegister(ParkInfo parkInfo); 20 | 21 | /** 22 | * 停车场登录 23 | * @param parkid 24 | * @param password 25 | * @return 26 | */ 27 | int parkLogin(int parkid,String password); 28 | 29 | /** 30 | * 获取停车场列表 31 | * @return 32 | */ 33 | List getParksInfoList(); 34 | } 35 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.park.service; 2 | 3 | import com.park.enity.User; 4 | import com.park.vo.LoginVo; 5 | import com.park.vo.RegisterVo; 6 | 7 | /** 8 | * Created by ansore on 16-9-12. 9 | */ 10 | public interface UserService { 11 | 12 | /** 13 | * 用户注册 14 | * @param registerVo 15 | * @return 1成功 16 | * 0失败 17 | */ 18 | int userRegister(RegisterVo registerVo); 19 | 20 | /** 21 | * 用户登录 22 | * @param loginVo 23 | * @return 24 | */ 25 | int userLogin(LoginVo loginVo); 26 | 27 | /** 28 | * 根据手机号码获取用户信息 29 | * @param telephone 30 | * @return 31 | */ 32 | User getUser(String telephone); 33 | } 34 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/service/impl/ParkServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.park.service.impl; 2 | 3 | import com.park.dao.ParkInfoDAO; 4 | import com.park.enity.ParkInfo; 5 | import com.park.exception.ParkException; 6 | import com.park.exception.StatusEnum; 7 | import com.park.service.ParkService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | 14 | /** 15 | * Created by ansore on 16-9-12. 16 | */ 17 | @Service 18 | public class ParkServiceImpl implements ParkService { 19 | 20 | @Autowired 21 | ParkInfoDAO parkInfoDAO; 22 | 23 | @Override 24 | public int parkRegister(ParkInfo parkInfo) { 25 | 26 | int result = 0; 27 | 28 | //检测是否注册 29 | if(parkInfoDAO.parkIsExist(parkInfo.getParkid())==1) { 30 | throw new ParkException(StatusEnum.getStatusCode(400)); 31 | } 32 | 33 | if(parkInfoDAO.addPark(parkInfo)==1) { 34 | result = 1; 35 | } 36 | else { 37 | throw new ParkException(StatusEnum.getStatusCode(401)); 38 | } 39 | 40 | return result; 41 | } 42 | 43 | @Override 44 | public int parkLogin(int parkid, String password) { 45 | 46 | int result = 0; 47 | 48 | int i = parkInfoDAO.parkLogin(parkid,password); 49 | 50 | if(i==0) { 51 | throw new ParkException(StatusEnum.getStatusCode(402)); 52 | } 53 | 54 | if(i>1) { 55 | throw new ParkException(StatusEnum.getStatusCode(100)); 56 | } 57 | 58 | if(i==1) { 59 | result = 1; 60 | } 61 | 62 | return result; 63 | } 64 | 65 | /** 66 | * 获取停车场列表 67 | * @return 68 | */ 69 | 70 | @Override 71 | public List getParksInfoList() { 72 | List l = null; 73 | 74 | l = parkInfoDAO.getParksList(); 75 | 76 | if(l==null || l.size()==0) { 77 | throw new ParkException(StatusEnum.getStatusCode(100)); 78 | } 79 | return l; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.park.service.impl; 2 | 3 | import com.park.dao.UserDAO; 4 | import com.park.exception.ParkException; 5 | import com.park.exception.StatusEnum; 6 | import com.park.service.UserService; 7 | import com.park.vo.LoginVo; 8 | import com.park.vo.RegisterVo; 9 | import com.park.enity.User; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.annotation.Resource; 13 | 14 | /** 15 | * Created by ansore on 16-9-12. 16 | */ 17 | @Service 18 | public class UserServiceImpl implements UserService { 19 | 20 | @Resource 21 | UserDAO userDAO; 22 | 23 | @Override 24 | public int userRegister(RegisterVo registerVo) { 25 | 26 | int result = 0; 27 | 28 | //检测用户是否存在 29 | if(userDAO.userIsExist(registerVo.getTelephone())==1){ 30 | throw new ParkException(StatusEnum.getStatusCode(300)); 31 | } 32 | 33 | //实体转化 34 | User u = new User(); 35 | u.setPassword(registerVo.getPassword()); 36 | u.setTelephone(registerVo.getTelephone()); 37 | u.setPalte(registerVo.getPalte()); 38 | u.setUsername(registerVo.getUsername()); 39 | 40 | //注册用户 41 | if(userDAO.addUser(u)==1){ 42 | result = 1; 43 | } 44 | else { 45 | throw new ParkException(StatusEnum.getStatusCode(301)); 46 | } 47 | return result; 48 | } 49 | 50 | @Override 51 | public int userLogin(LoginVo loginVo) { 52 | 53 | int result = 0; 54 | int i = userDAO.userLogin(loginVo.getTelephone(),loginVo.getPassword()); 55 | if(i==0){ 56 | throw new ParkException(StatusEnum.getStatusCode(302)); 57 | } 58 | if(i>1) { 59 | throw new ParkException(StatusEnum.getStatusCode(100)); 60 | } 61 | if(i==1) { 62 | result = 1; 63 | } 64 | return result; 65 | } 66 | 67 | @Override 68 | public User getUser(String telephone) { 69 | User user= null; 70 | user = userDAO.getUser(telephone); 71 | if(user == null) { 72 | throw new ParkException(StatusEnum.getStatusCode(303)); 73 | } 74 | return user; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/socket/SocketThread.java: -------------------------------------------------------------------------------- 1 | package com.park.socket; 2 | 3 | import com.park.data.Data; 4 | import com.park.dto.Message; 5 | import com.park.socketmanage.SocketThreadManage; 6 | 7 | import java.io.ObjectInputStream; 8 | import java.io.ObjectOutputStream; 9 | import java.net.Socket; 10 | 11 | /** 12 | * Created by ansore on 16-9-12. 13 | */ 14 | 15 | public class SocketThread extends Thread { 16 | 17 | private Socket socket; 18 | //链接键值 19 | private int key; 20 | 21 | private Message info; 22 | 23 | //输入输出流 24 | private ObjectInputStream ois; 25 | private ObjectOutputStream oos; 26 | 27 | public SocketThread(Socket s, int k) { 28 | 29 | this.key = k; 30 | this.socket = s; 31 | 32 | try{ 33 | this.ois = new ObjectInputStream(s.getInputStream()); 34 | this.oos = new ObjectOutputStream(s.getOutputStream()); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | 39 | } 40 | 41 | public void sendMessage(Message message){ 42 | try { 43 | this.oos.writeObject(message); 44 | this.oos.flush(); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | 50 | public Message sendMessageWait(Message message) { 51 | Message message1 = new Message(); 52 | message1.setStatu(false); 53 | try { 54 | this.oos.writeObject(message); 55 | this.oos.flush(); 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | } 59 | int i=0; 60 | while(i<10) { 61 | if(info!=null){ 62 | if(info.getMessageType()==Data.Answer) { 63 | return info; 64 | }} 65 | i++; 66 | try { 67 | Thread.sleep(700); 68 | } catch (InterruptedException e) { 69 | e.printStackTrace(); 70 | } 71 | } 72 | return message1; 73 | } 74 | 75 | public void freeMessage() { 76 | this.info = null; 77 | } 78 | 79 | @Override 80 | public void run() { 81 | 82 | System.out.println("服务器一个线程启动"); 83 | boolean b = true; 84 | 85 | while(b) { 86 | System.out.println("读取消息"); 87 | try { 88 | Message m = (Message) this.ois.readObject(); 89 | 90 | switch (m.getMessageType()) { 91 | case Data.Answer: 92 | this.info = m; 93 | break; 94 | } 95 | 96 | } catch (Exception e) { 97 | try { 98 | b = false; 99 | System.out.println("捕获异常1"); 100 | //结束线程 101 | SocketThreadManage.socketThread.get(this.key).interrupt(); 102 | SocketThreadManage.socketThread.remove(this.key); 103 | this.socket.close(); 104 | } catch (Exception e2) { 105 | b = false; 106 | System.out.println("捕获异常2"); 107 | e2.printStackTrace(); 108 | } 109 | e.printStackTrace(); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/socketmanage/SocketThreadManage.java: -------------------------------------------------------------------------------- 1 | package com.park.socketmanage; 2 | 3 | import com.park.socket.SocketThread; 4 | 5 | import java.util.HashMap; 6 | 7 | /** 8 | * Created by ansore on 16-9-13. 9 | */ 10 | public class SocketThreadManage { 11 | public static HashMap socketThread = new HashMap(); 12 | } 13 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/CommonVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 手机客户端请求Vo公共类 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class CommonVo { 8 | 9 | private String action; 10 | 11 | public String getAction() { 12 | return action; 13 | } 14 | 15 | public void setAction(String action) { 16 | this.action = action; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/EndParkVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 结束停车Vo 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class EndParkVo { 8 | 9 | //停车场Id 10 | private int parkId; 11 | //车位Id 12 | private int spaceId; 13 | 14 | public int getParkId() { 15 | return parkId; 16 | } 17 | 18 | public void setParkId(int parkId) { 19 | this.parkId = parkId; 20 | } 21 | 22 | public int getSpaceId() { 23 | return spaceId; 24 | } 25 | 26 | public void setSpaceId(int spaceId) { 27 | this.spaceId = spaceId; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/GetAllParkInfoVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 5 | * Created by ansore on 16-10-2. 6 | */ 7 | public class GetAllParkInfoVo { 8 | 9 | private String action; 10 | 11 | public String getAction() { 12 | return action; 13 | } 14 | 15 | public void setAction(String action) { 16 | this.action = action; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/GetLotInfoVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 获取某停车场车位信息 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class GetLotInfoVo extends CommonVo { 8 | private int parkId; 9 | 10 | public int getParkid() { 11 | return parkId; 12 | } 13 | 14 | public void setParkid(int parkId) { 15 | this.parkId = parkId; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/GetOrderInfoVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 获取预订信息 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class GetOrderInfoVo extends CommonVo { 8 | 9 | private String telephone; 10 | 11 | public String getTelephone() { 12 | return telephone; 13 | } 14 | 15 | public void setTelephone(String telephone) { 16 | this.telephone = telephone; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/LockRelayVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 解锁车位Vo 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class LockRelayVo { 8 | 9 | //停车场Id 10 | private int parkId; 11 | //车位Id 12 | private int spaceId; 13 | 14 | public int getParkId() { 15 | return parkId; 16 | } 17 | 18 | public void setParkId(int parkId) { 19 | this.parkId = parkId; 20 | } 21 | 22 | public int getSpaceId() { 23 | return spaceId; 24 | } 25 | 26 | public void setSpaceId(int spaceId) { 27 | this.spaceId = spaceId; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/LoginVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 登录Vo 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class LoginVo extends CommonVo { 8 | 9 | private String telephone; 10 | private String password; 11 | 12 | public String getTelephone() { 13 | return telephone; 14 | } 15 | 16 | public void setTelephone(String telephone) { 17 | this.telephone = telephone; 18 | } 19 | 20 | public String getPassword() { 21 | return password; 22 | } 23 | 24 | public void setPassword(String password) { 25 | this.password = password; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/OrderParkVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * Created by ansore on 16-9-12. 5 | */ 6 | public class OrderParkVo extends CommonVo { 7 | 8 | //停车场ID 9 | private int parkId; 10 | 11 | //车位ID 12 | private int spaceId; 13 | 14 | //手机号 15 | private String telephone; 16 | 17 | public int getParkId() { 18 | return parkId; 19 | } 20 | 21 | public void setParkId(int parkId) { 22 | this.parkId = parkId; 23 | } 24 | 25 | public int getSpaceId() { 26 | return spaceId; 27 | } 28 | 29 | public void setSpaceId(int spaceId) { 30 | this.spaceId = spaceId; 31 | } 32 | 33 | public String getTelephone() { 34 | return telephone; 35 | } 36 | 37 | public void setTelephone(String telephone) { 38 | this.telephone = telephone; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/RegisterVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 注册实体 5 | * Created by ansore on 16-9-12. 6 | */ 7 | public class RegisterVo extends CommonVo { 8 | private String telephone; 9 | private String password; 10 | private String username; 11 | private String palte; 12 | 13 | public String getTelephone() { 14 | return telephone; 15 | } 16 | 17 | public void setTelephone(String telephone) { 18 | this.telephone = telephone; 19 | } 20 | 21 | public String getPassword() { 22 | return password; 23 | } 24 | 25 | public void setPassword(String password) { 26 | this.password = password; 27 | } 28 | 29 | public String getUsername() { 30 | return username; 31 | } 32 | 33 | public void setUsername(String username) { 34 | this.username = username; 35 | } 36 | 37 | public String getPalte() { 38 | return palte; 39 | } 40 | 41 | public void setPalte(String palte) { 42 | this.palte = palte; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/RequestVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 手机客户端请求实体 5 | * Created by ansore on 16-9-13. 6 | */ 7 | public class RequestVo { 8 | 9 | private String action; 10 | //停车场Id 11 | private int parkId; 12 | //车位Id 13 | private int spaceId; 14 | 15 | private String telephone; 16 | private String password; 17 | private String username; 18 | private String palte; 19 | 20 | public String getAction() { 21 | return action; 22 | } 23 | 24 | public void setAction(String action) { 25 | this.action = action; 26 | } 27 | 28 | public int getParkId() { 29 | return parkId; 30 | } 31 | 32 | public void setParkId(int parkId) { 33 | this.parkId = parkId; 34 | } 35 | 36 | public int getSpaceId() { 37 | return spaceId; 38 | } 39 | 40 | public void setSpaceId(int spaceId) { 41 | this.spaceId = spaceId; 42 | } 43 | 44 | public String getTelephone() { 45 | return telephone; 46 | } 47 | 48 | public void setTelephone(String telephone) { 49 | this.telephone = telephone; 50 | } 51 | 52 | public String getPassword() { 53 | return password; 54 | } 55 | 56 | public void setPassword(String password) { 57 | this.password = password; 58 | } 59 | 60 | public String getUsername() { 61 | return username; 62 | } 63 | 64 | public void setUsername(String username) { 65 | this.username = username; 66 | } 67 | 68 | public String getPalte() { 69 | return palte; 70 | } 71 | 72 | public void setPalte(String palte) { 73 | this.palte = palte; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /park-server/src/main/java/com/park/vo/UnlockRelayVo.java: -------------------------------------------------------------------------------- 1 | package com.park.vo; 2 | 3 | /** 4 | * 5 | * 解锁车位Vo 6 | * Created by ansore on 16-9-12. 7 | */ 8 | public class UnlockRelayVo extends CommonVo { 9 | 10 | //停车场Id 11 | private int parkId; 12 | //车位Id 13 | private int spaceId; 14 | 15 | public int getParkId() { 16 | return parkId; 17 | } 18 | 19 | public void setParkId(int parkId) { 20 | this.parkId = parkId; 21 | } 22 | 23 | public int getSpaceId() { 24 | return spaceId; 25 | } 26 | 27 | public void setSpaceId(int spaceId) { 28 | this.spaceId = spaceId; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /park-server/src/main/resources/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=com.mysql.jdbc.Driver 2 | jdbcurl=jdbc:mysql://139.129.35.50:3306/stallserver?useUnicode=true&characterEncoding=utf8 3 | password=ansore 4 | mysqluser=ansore 5 | 6 | -------------------------------------------------------------------------------- /park-server/src/main/resources/mapper/orderinfo-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into orderinfo (parkid,phone) value (#{parkid},#{phone}); 7 | 8 | 9 | 12 | 13 | 14 | delete from orderinfo where phone = #{phone}; 15 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /park-server/src/main/resources/mapper/parkinfo-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | insert into parkinfo (parkid,password,name,telephone,address,remark) value (#{parkid},#{password},#{name},#{telephone},#{address}, #{remark}); 6 | 7 | 8 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /park-server/src/main/resources/mapper/user-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | insert into user (telephone,password,username,palte) value (#{telephone,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{username,jdbcType=VARCHAR},#{palte,jdbcType=VARCHAR}); 10 | 11 | 12 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /park-server/src/main/resources/mybatis/mybatis_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /park-server/src/main/resources/schema/stallserver.sql: -------------------------------------------------------------------------------- 1 | /** 2 | * 环境:mysql 3 | */ 4 | 5 | DROP DATABASE IF EXISTS stallserver; 6 | 7 | CREATE DATABASE stallserver; 8 | 9 | USE stallserver; 10 | 11 | DROP TABLE IF EXISTS user; 12 | 13 | CREATE TABLE user ( 14 | telephone varchar(11) primary key COMMENT '用户手机号', 15 | password varchar(16) not null COMMENT '密码', 16 | username varchar(15) not null COMMENT '用户姓名', 17 | palte varchar(15) not null COMMENT '车牌号' 18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 19 | 20 | DROP TABLE IF EXISTS parkinfo; 21 | CREATE TABLE parkinfo ( 22 | parkid INT(10) primary key COMMENT '停车场ID', 23 | password varchar(16) not null COMMENT '密码', 24 | name varchar(20) not null COMMENT '停车场名', 25 | telephone varchar(11) not null COMMENT '停车场联系电话', 26 | address VARCHAR(50) NOT NULL COMMENT '停车场地址', 27 | remark VARCHAR(100) NOT NULL COMMENT '停车场备注' 28 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 29 | 30 | CREATE TABLE orderinfo ( 31 | id int primary key auto_increment COMMENT '自增ID', 32 | parkid int not null COMMENT '停车场ID', 33 | phone varchar(11) not null COMMENT '用户手机号' 34 | 35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 36 | 37 | insert into user value('11111111111','123','我是谁','ESP1234'); 38 | insert into parkinfo value('1111111111','123','天虹','12345678910'); 39 | -------------------------------------------------------------------------------- /park-server/src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /park-server/src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /park-server/src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/src/main/resources/spring/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /park-server/src/main/webapp/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/src/main/webapp/WEB-INF/jsp/login.jsp -------------------------------------------------------------------------------- /park-server/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | com.park.listener.SocketServiceLoader 11 | 12 | 13 | 14 | park 15 | org.springframework.web.servlet.DispatcherServlet 16 | 17 | contextConfigLocation 18 | classpath:spring/spring.xml 19 | 20 | 1 21 | 22 | 23 | 24 | park 25 | / 26 | 27 | 28 | 29 | default 30 | /js/* 31 | /css/* 32 | /images/* 33 | /fonts/* 34 | 35 | 36 | CharacterEncodingFilter 37 | org.springframework.web.filter.CharacterEncodingFilter 38 | 39 | encoding 40 | utf-8 41 | 42 | 43 | 44 | CharacterEncodingFilter 45 | /* 46 | 47 | 48 | -------------------------------------------------------------------------------- /park-server/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /park-server/src/test/java/com/park/dao/ParkInfoDAOTest.java: -------------------------------------------------------------------------------- 1 | //package com.park.dao; 2 | // 3 | //import com.park.enity.ParkInfo; 4 | //import org.junit.Test; 5 | //import org.junit.runner.RunWith; 6 | //import org.slf4j.Logger; 7 | //import org.slf4j.LoggerFactory; 8 | //import org.springframework.beans.factory.annotation.Autowired; 9 | //import org.springframework.test.context.ContextConfiguration; 10 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | // 12 | //import java.util.List; 13 | // 14 | //import static org.junit.Assert.*; 15 | // 16 | ///** 17 | // * Created by ansore on 16-9-12. 18 | // */ 19 | //@RunWith(SpringJUnit4ClassRunner.class) 20 | //@ContextConfiguration("classpath:spring/spring.xml") 21 | //public class ParkInfoDAOTest { 22 | // 23 | // Logger logger = LoggerFactory.getLogger(this.getClass()); 24 | // 25 | // @Autowired 26 | // ParkInfoDAO parkInfoDAO; 27 | // 28 | // @Test 29 | // public void addPark() throws Exception { 30 | // ParkInfo p = new ParkInfo(); 31 | // p.setTelephone("11111111111"); 32 | // p.setParkid(11); 33 | // p.setName("向启怀"); 34 | // p.setPassword("123"); 35 | // 36 | // int i = parkInfoDAO.addPark(p); 37 | // 38 | // logger.info("Result={}",i); 39 | // } 40 | // 41 | // @Test 42 | // public void parkIsExistTest() throws Exception { 43 | // int id = 1234; 44 | // int i = parkInfoDAO.parkIsExist(id); 45 | // logger.info("result = {}", i); 46 | // 47 | // } 48 | // 49 | // @Test 50 | // public void parkLogin() throws Exception { 51 | // 52 | // int id = 12345; 53 | // String p = "13"; 54 | // 55 | // int i = parkInfoDAO.parkLogin(id,p); 56 | // 57 | // logger.info("result is = {}", i); 58 | // 59 | // } 60 | // 61 | // @Test 62 | // public void getParksList() throws Exception { 63 | // 64 | // List l = parkInfoDAO.getParksList(); 65 | // 66 | // for(int i = 0; i 2 | 3 | 4 | 5 | 6 | insert into orderinfo (parkid,phone) value (#{parkid},#{phone}); 7 | 8 | 9 | 12 | 13 | 14 | delete from orderinfo where phone = #{phone}; 15 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /park-server/target/classes/mapper/parkinfo-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | insert into parkinfo (parkid,password,name,telephone) value (#{parkid},#{password},#{name},#{telephone}); 6 | 7 | 8 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /park-server/target/classes/mapper/user-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | insert into user (telephone,password,username,palte) value (#{telephone,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{username,jdbcType=VARCHAR},#{palte,jdbcType=VARCHAR}); 10 | 11 | 12 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /park-server/target/classes/mybatis/mybatis_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /park-server/target/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /park-server/target/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /park-server/target/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/target/classes/spring/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /park-server/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/park/exception/ParkException.class 2 | com/park/vo/LockRelayVo.class 3 | com/park/enity/ParkInfo.class 4 | com/park/data/Data.class 5 | com/park/vo/UnlockRelayVo.class 6 | com/park/dao/ParkInfoDAO.class 7 | com/park/vo/GetAllParkInfoVo.class 8 | com/park/listener/SocketServiceLoader.class 9 | com/park/exception/StatusEnum.class 10 | com/park/service/impl/ParkServiceImpl.class 11 | com/park/dao/UserDAO.class 12 | com/park/vo/GetOrderInfoVo.class 13 | com/park/controller/PhoneController.class 14 | com/park/vo/RequestVo.class 15 | com/park/service/impl/UserServiceImpl.class 16 | com/park/enity/ParkStatus.class 17 | com/park/enity/User.class 18 | com/park/dto/Result.class 19 | com/park/service/ParkService.class 20 | com/park/socketmanage/SocketThreadManage.class 21 | com/park/vo/RegisterVo.class 22 | com/park/service/UserService.class 23 | com/park/vo/EndParkVo.class 24 | com/park/vo/LoginVo.class 25 | com/park/vo/CommonVo.class 26 | com/park/dao/OrderInfoDAO.class 27 | com/park/dto/Message.class 28 | com/park/socket/SocketThread.class 29 | com/park/vo/GetLotInfoVo.class 30 | com/park/enity/OrderInfo.class 31 | com/park/socket/ServerSocketThread.class 32 | com/park/vo/OrderParkVo.class 33 | -------------------------------------------------------------------------------- /park-server/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/ansore/park/park/park-server/src/main/java/com/park/controller/PhoneController.java 2 | /home/ansore/park/park/park-server/src/main/java/com/park/data/Data.java 3 | /home/ansore/park/park/park-server/src/main/java/com/park/exception/ParkException.java 4 | /home/ansore/park/park/park-server/src/main/java/com/park/dao/ParkInfoDAO.java 5 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/LockRelayVo.java 6 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/GetAllParkInfoVo.java 7 | /home/ansore/park/park/park-server/src/main/java/com/park/listener/SocketServiceLoader.java 8 | /home/ansore/park/park/park-server/src/main/java/com/park/service/ParkService.java 9 | /home/ansore/park/park/park-server/src/main/java/com/park/enity/ParkStatus.java 10 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/UnlockRelayVo.java 11 | /home/ansore/park/park/park-server/src/main/java/com/park/service/UserService.java 12 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/GetOrderInfoVo.java 13 | /home/ansore/park/park/park-server/src/main/java/com/park/enity/User.java 14 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/GetLotInfoVo.java 15 | /home/ansore/park/park/park-server/src/main/java/com/park/enity/ParkInfo.java 16 | /home/ansore/park/park/park-server/src/main/java/com/park/exception/StatusEnum.java 17 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/RegisterVo.java 18 | /home/ansore/park/park/park-server/src/main/java/com/park/socketmanage/SocketThreadManage.java 19 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/LoginVo.java 20 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/CommonVo.java 21 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/RequestVo.java 22 | /home/ansore/park/park/park-server/src/main/java/com/park/dto/Result.java 23 | /home/ansore/park/park/park-server/src/main/java/com/park/socket/ServerSocketThread.java 24 | /home/ansore/park/park/park-server/src/main/java/com/park/service/impl/UserServiceImpl.java 25 | /home/ansore/park/park/park-server/src/main/java/com/park/dao/UserDAO.java 26 | /home/ansore/park/park/park-server/src/main/java/com/park/socket/SocketThread.java 27 | /home/ansore/park/park/park-server/src/main/java/com/park/service/impl/ParkServiceImpl.java 28 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/EndParkVo.java 29 | /home/ansore/park/park/park-server/src/main/java/com/park/vo/OrderParkVo.java 30 | /home/ansore/park/park/park-server/src/main/java/com/park/enity/OrderInfo.java 31 | /home/ansore/park/park/park-server/src/main/java/com/park/dao/OrderInfoDAO.java 32 | /home/ansore/park/park/park-server/src/main/java/com/park/dto/Message.java 33 | -------------------------------------------------------------------------------- /park-server/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst -------------------------------------------------------------------------------- /park-server/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/ansore/park/park/park-server/src/test/java/com/park/dao/ParkInfoDAOTest.java 2 | /home/ansore/park/park/park-server/src/test/java/com/park/service/ParkServiceTest.java 3 | /home/ansore/park/park/park-server/src/test/java/com/park/dao/UserDaoTest.java 4 | -------------------------------------------------------------------------------- /park-server/target/park.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park.war -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/controller/PhoneController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/controller/PhoneController.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/dao/OrderInfoDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/dao/OrderInfoDAO.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/dao/ParkInfoDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/dao/ParkInfoDAO.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/dao/UserDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/dao/UserDAO.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/data/Data.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/data/Data.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/dto/Message.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/dto/Message.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/dto/Result.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/dto/Result.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/enity/OrderInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/enity/OrderInfo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/enity/ParkInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/enity/ParkInfo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/enity/ParkStatus.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/enity/ParkStatus.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/enity/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/enity/User.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/exception/ParkException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/exception/ParkException.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/exception/StatusEnum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/exception/StatusEnum.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/listener/SocketServiceLoader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/listener/SocketServiceLoader.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/service/ParkService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/service/ParkService.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/service/UserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/service/UserService.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/service/impl/ParkServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/service/impl/ParkServiceImpl.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/service/impl/UserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/service/impl/UserServiceImpl.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/socket/ServerSocketThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/socket/ServerSocketThread.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/socket/SocketThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/socket/SocketThread.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/socketmanage/SocketThreadManage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/socketmanage/SocketThreadManage.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/CommonVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/CommonVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/EndParkVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/EndParkVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/GetAllParkInfoVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/GetAllParkInfoVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/GetLotInfoVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/GetLotInfoVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/GetOrderInfoVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/GetOrderInfoVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/LockRelayVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/LockRelayVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/LoginVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/LoginVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/OrderParkVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/OrderParkVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/RegisterVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/RegisterVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/RequestVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/RequestVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/com/park/vo/UnlockRelayVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/classes/com/park/vo/UnlockRelayVo.class -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=com.mysql.jdbc.Driver 2 | jdbcurl=jdbc:mysql://139.129.35.50:3306/stallserver?useUnicode=true&characterEncoding=utf8 3 | password=ansore 4 | mysqluser=ansore 5 | 6 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/mapper/orderinfo-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into orderinfo (parkid,phone) value (#{parkid},#{phone}); 7 | 8 | 9 | 12 | 13 | 14 | delete from orderinfo where phone = #{phone}; 15 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/mapper/parkinfo-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | insert into parkinfo (parkid,password,name,telephone) value (#{parkid},#{password},#{name},#{telephone}); 6 | 7 | 8 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/mapper/user-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | insert into user (telephone,password,username,palte) value (#{telephone,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{username,jdbcType=VARCHAR},#{palte,jdbcType=VARCHAR}); 10 | 11 | 12 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/mybatis/mybatis_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/classes/spring/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/jsp/index.jsp: -------------------------------------------------------------------------------- 1 | hello -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/aopalliance-1.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/c3p0-0.9.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/c3p0-0.9.2.1.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/commons-logging-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/commons-logging-1.2.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/guava-19.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/guava-19.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/jackson-annotations-2.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/jackson-annotations-2.6.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/jackson-core-2.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/jackson-core-2.6.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/jackson-databind-2.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/jackson-databind-2.6.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/jstl-1.2.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/junit-4.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/junit-4.11.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/logback-classic-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/logback-classic-1.1.3.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/logback-core-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/logback-core-1.1.3.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/mybatis-3.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/mybatis-3.3.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/mybatis-spring-1.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/mybatis-spring-1.2.3.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/mysql-connector-java-5.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/mysql-connector-java-5.1.6.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/okhttp-3.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/okhttp-3.3.1.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/okio-1.8.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/okio-1.8.0.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/slf4j-api-1.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/slf4j-api-1.7.3.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-context-support-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-context-support-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/lib/standard-1.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ansore/park/fcf3c545850168dae35497a667fc2e1f02d21554/park-server/target/park/WEB-INF/lib/standard-1.1.2.jar -------------------------------------------------------------------------------- /park-server/target/park/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | com.park.listener.SocketServiceLoader 11 | 12 | 13 | 14 | park 15 | org.springframework.web.servlet.DispatcherServlet 16 | 17 | contextConfigLocation 18 | classpath:spring/spring.xml 19 | 20 | 1 21 | 22 | 23 | 24 | park 25 | / 26 | 27 | 28 | 29 | default 30 | /js/* 31 | /css/* 32 | /images/* 33 | /fonts/* 34 | 35 | 36 | CharacterEncodingFilter 37 | org.springframework.web.filter.CharacterEncodingFilter 38 | 39 | encoding 40 | utf-8 41 | 42 | 43 | 44 | CharacterEncodingFilter 45 | /* 46 | 47 | 48 | -------------------------------------------------------------------------------- /park-server/target/park/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | --------------------------------------------------------------------------------