From 2a5310d52269a1707996e49f119ac1b4146aa05c Mon Sep 17 00:00:00 2001 From: HouXinyu <2283543175@qq.com> Date: Sun, 15 Dec 2024 22:33:41 +0800 Subject: [PATCH] update --- .../5b23e521-053a-47c0-ae28-a98b513bc6ec.xml | 1697 ----------------- .../supermarket/componet/BGPanel.class | Bin 1147 -> 1147 bytes .../dao/impl/outOrderServiceImpl.class | Bin 5023 -> 5013 bytes .../dao/impl/outRecordServiceImpl.class | Bin 4354 -> 4344 bytes .../dao/impl/prodCatalogImpl.class | Bin 4891 -> 4891 bytes .../dao/impl/storageRecordImpl.class | Bin 3919 -> 3919 bytes .../supermarket/utils/CreateOrder.class | Bin 2373 -> 2373 bytes .../lingnan/supermarket/utils/DateUtil.class | Bin 879 -> 879 bytes .../lingnan/supermarket/utils/EmailTest.class | Bin 532 -> 532 bytes .../lingnan/supermarket/utils/JDBCUtil.class | Bin 2461 -> 2461 bytes .../com/lingnan/supermarket/utils/Test.class | Bin 504 -> 504 bytes .../supermarket/utils/TimeAndOrder.class | Bin 1731 -> 1712 bytes .../supermarket/utils/tplbTest$1.class | Bin 867 -> 867 bytes .../lingnan/supermarket/utils/tplbTest.class | Bin 2153 -> 2147 bytes .../view/InView$MyItemListener.class | Bin 1434 -> 1434 bytes .../com/lingnan/supermarket/view/InView.class | Bin 14274 -> 14247 bytes .../lingnan/supermarket/view/MainView.class | Bin 14903 -> 14903 bytes .../com/lingnan/supermarket/view/Nimbus.class | Bin 649 -> 649 bytes .../lingnan/supermarket/view/UserView.class | Bin 5675 -> 5675 bytes .../supermarket/view/base/BaseView.class | Bin 1916 -> 1957 bytes Supermarket/bin/config/jdbc.properties | 2 +- Supermarket/bin/jdbc.properties | 2 +- Supermarket/config/jdbc.properties | 2 +- .../lingnan/supermarket/componet/BGPanel.java | 9 +- .../dao/impl/outOrderServiceImpl.java | 130 +- .../dao/impl/outRecordServiceImpl.java | 82 +- .../supermarket/dao/impl/prodCatalogImpl.java | 255 +-- .../dao/impl/storageRecordImpl.java | 133 +- .../supermarket/utils/CreateOrder.java | 46 +- .../lingnan/supermarket/utils/DateUtil.java | 25 +- .../lingnan/supermarket/utils/EmailTest.java | 8 +- .../lingnan/supermarket/utils/JDBCUtil.java | 90 +- .../com/lingnan/supermarket/utils/Test.java | 6 +- .../supermarket/utils/TimeAndOrder.java | 75 +- .../lingnan/supermarket/utils/tplbTest.java | 121 +- .../com/lingnan/supermarket/view/InView.java | 759 ++++---- .../lingnan/supermarket/view/MainView.java | 764 ++++---- .../com/lingnan/supermarket/view/Nimbus.java | 18 +- .../lingnan/supermarket/view/UserView.java | 36 +- .../supermarket/view/base/BaseView.java | 96 +- 40 files changed, 1363 insertions(+), 2993 deletions(-) delete mode 100644 Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml deleted file mode 100644 index a5df588..0000000 --- a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml +++ /dev/null @@ -1,1697 +0,0 @@ - - - -<<<<<<< HEAD - - lower/lower - InnoDB - InnoDB - |root||root|localhost|ALLOW_NONEXISTENT_DEFINER|G -|root||root|localhost|ALTER|G -|root||root|localhost|ALTER ROUTINE|G -|root||root|localhost|APPLICATION_PASSWORD_ADMIN|G -|root||mysql.infoschema|localhost|AUDIT_ABORT_EXEMPT|G -|root||mysql.session|localhost|AUDIT_ABORT_EXEMPT|G -|root||mysql.sys|localhost|AUDIT_ABORT_EXEMPT|G -|root||root|localhost|AUDIT_ABORT_EXEMPT|G -|root||root|localhost|AUDIT_ADMIN|G -|root||mysql.session|localhost|AUTHENTICATION_POLICY_ADMIN|G -|root||root|localhost|AUTHENTICATION_POLICY_ADMIN|G -|root||mysql.session|localhost|BACKUP_ADMIN|G -|root||root|localhost|BACKUP_ADMIN|G -|root||root|localhost|BINLOG_ADMIN|G -|root||root|localhost|BINLOG_ENCRYPTION_ADMIN|G -|root||mysql.session|localhost|CLONE_ADMIN|G -|root||root|localhost|CLONE_ADMIN|G -|root||mysql.session|localhost|CONNECTION_ADMIN|G -|root||root|localhost|CONNECTION_ADMIN|G -|root||root|localhost|CREATE|G -|root||root|localhost|CREATE ROLE|G -|root||root|localhost|CREATE ROUTINE|G -|root||root|localhost|CREATE TABLESPACE|G -|root||root|localhost|CREATE TEMPORARY TABLES|G -|root||root|localhost|CREATE USER|G -|root||root|localhost|CREATE VIEW|G -|root||root|localhost|DELETE|G -|root||root|localhost|DROP|G -|root||root|localhost|DROP ROLE|G -|root||root|localhost|ENCRYPTION_KEY_ADMIN|G -|root||root|localhost|EVENT|G -|root||root|localhost|EXECUTE|G -|root||root|localhost|FILE|G -|root||mysql.infoschema|localhost|FIREWALL_EXEMPT|G -|root||mysql.session|localhost|FIREWALL_EXEMPT|G -|root||mysql.sys|localhost|FIREWALL_EXEMPT|G -|root||root|localhost|FIREWALL_EXEMPT|G -|root||root|localhost|FLUSH_OPTIMIZER_COSTS|G -|root||root|localhost|FLUSH_PRIVILEGES|G -|root||root|localhost|FLUSH_STATUS|G -|root||root|localhost|FLUSH_TABLES|G -|root||root|localhost|FLUSH_USER_RESOURCES|G -|root||root|localhost|GROUP_REPLICATION_ADMIN|G -|root||root|localhost|GROUP_REPLICATION_STREAM|G -|root||root|localhost|INDEX|G -|root||root|localhost|INNODB_REDO_LOG_ARCHIVE|G -|root||root|localhost|INNODB_REDO_LOG_ENABLE|G -|root||root|localhost|INSERT|G -|root||root|localhost|LOCK TABLES|G -|root||root|localhost|OPTIMIZE_LOCAL_TABLE|G -|root||root|localhost|PASSWORDLESS_USER_ADMIN|G -|root||mysql.session|localhost|PERSIST_RO_VARIABLES_ADMIN|G -|root||root|localhost|PERSIST_RO_VARIABLES_ADMIN|G -|root||root|localhost|PROCESS|G -|root||root|localhost|REFERENCES|G -|root||root|localhost|RELOAD|G -|root||root|localhost|REPLICATION CLIENT|G -|root||root|localhost|REPLICATION SLAVE|G -|root||root|localhost|REPLICATION_APPLIER|G -|root||root|localhost|REPLICATION_SLAVE_ADMIN|G -|root||root|localhost|RESOURCE_GROUP_ADMIN|G -|root||root|localhost|RESOURCE_GROUP_USER|G -|root||root|localhost|ROLE_ADMIN|G -|root||mysql.infoschema|localhost|SELECT|G -|root||root|localhost|SELECT|G -|root||root|localhost|SENSITIVE_VARIABLES_OBSERVER|G -|root||root|localhost|SERVICE_CONNECTION_ADMIN|G -|root||mysql.session|localhost|SESSION_VARIABLES_ADMIN|G -|root||root|localhost|SESSION_VARIABLES_ADMIN|G -|root||root|localhost|SET_ANY_DEFINER|G -|root||root|localhost|SHOW DATABASES|G -|root||root|localhost|SHOW VIEW|G -|root||root|localhost|SHOW_ROUTINE|G -|root||mysql.session|localhost|SHUTDOWN|G -|root||root|localhost|SHUTDOWN|G -|root||mysql.session|localhost|SUPER|G -|root||root|localhost|SUPER|G -|root||mysql.infoschema|localhost|SYSTEM_USER|G -|root||mysql.session|localhost|SYSTEM_USER|G -|root||mysql.sys|localhost|SYSTEM_USER|G -|root||root|localhost|SYSTEM_USER|G -|root||mysql.session|localhost|SYSTEM_VARIABLES_ADMIN|G -|root||root|localhost|SYSTEM_VARIABLES_ADMIN|G -|root||root|localhost|TABLE_ENCRYPTION_ADMIN|G -|root||root|localhost|TELEMETRY_LOG_ADMIN|G -|root||root|localhost|TRANSACTION_GTID_TAG|G -|root||root|localhost|TRIGGER|G -|root||root|localhost|UPDATE|G -|root||root|localhost|XA_RECOVER_ADMIN|G -|root||root|localhost|grant option|G -performance_schema|schema||mysql.session|localhost|SELECT|G -sys|schema||mysql.sys|localhost|TRIGGER|G - 8.4.0 - -======= - ->>>>>>> remotes/origin/developer - - big5 - 1 - - - big5 - - - dec8 - 1 - - - dec8 - - - cp850 - 1 - - - cp850 - - - hp8 - 1 - - - hp8 - - - koi8r - 1 - - - koi8r - - - latin1 - - - latin1 - 1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin1 - - - latin2 - - - latin2 - 1 - - - latin2 - - - latin2 - - - latin2 - - - swe7 - 1 - - - swe7 - - - ascii - 1 - - - ascii - - - ujis - 1 - - - ujis - - - sjis - 1 - - - sjis - - - hebrew - 1 - - - hebrew - - - tis620 - 1 - - - tis620 - - - euckr - 1 - - - euckr - - - koi8u - 1 - - - koi8u - - - gb2312 - 1 - - - gb2312 - - - greek - 1 - - - greek - - - cp1250 - 1 - - - cp1250 - - - cp1250 - - - cp1250 - - - cp1250 - - - gbk - 1 - - - gbk - - - latin5 - 1 - - - latin5 - - - armscii8 - 1 - - - armscii8 - - - ucs2 - 1 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - ucs2 - - - cp866 - 1 - - - cp866 - - - keybcs2 - 1 - - - keybcs2 - - - macce - 1 - - - macce - - - macroman - 1 - - - macroman - - - cp852 - 1 - - - cp852 - - - latin7 - - - latin7 - 1 - - - latin7 - - - latin7 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - cp1251 - - - cp1251 - - - cp1251 - - - cp1251 - 1 - - - cp1251 - - - utf16 - 1 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16 - - - utf16le - 1 - - - utf16le - - - cp1256 - 1 - - - cp1256 - - - cp1257 - - - cp1257 - - - cp1257 - 1 - - - utf32 - 1 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - utf32 - - - binary - 1 - - - geostd8 - 1 - - - geostd8 - - - cp932 - 1 - - - cp932 - - - eucjpms - 1 - - - eucjpms - - - gb18030 - 1 - - - gb18030 - - - gb18030 - - - utf8mb3 - 1 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb3 - - - utf8mb4 - 1 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb4 - - - utf8mb3_general_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - utf8mb4_0900_ai_ci - - - localhost - caching_sha2_password - - - 0 - localhost - caching_sha2_password - - - 0 - localhost - caching_sha2_password - - - 0 - localhost - caching_sha2_password - - - root@localhost - procedure - 320 - - - root@localhost - procedure - 196 - - - root@localhost - procedure - 199 - - - root@localhost - procedure - 184 - - - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - InnoDB - utf8mb4_0900_ai_ci -
- - varchar(30)|0s - 1 - - - timestamp|0s - 2 - - - varchar(20)|0s - 3 - - - int|0s - 4 - - - float|0s - 5 - - - varchar(10)|0s - 1 - - - int|0s - 2 - - - varchar(10)|0s - 1 - - - int|0s - 2 - - - varchar(30)|0s - 1 - - - timestamp|0s - 2 - - - varchar(20)|0s - 3 - - - int|0s - 4 - - - float|0s - 5 - - - varchar(20)|0s - 1 - 1 - - - varchar(20)|0s - 2 - - - float|0s - 3 - - - float|0s - 4 - - - int|0s - 5 - - - int|0s - 6 - - - int|0s - 7 - - - varchar(20)|0s - 8 - - - varchar(20)|0s - 9 - - - float|0s - 10 - - - int|0s - 0 - 11 - - - supplyId - id - supplierinf - - - id2 - id - prodcatalog - - - id - btree - 1 - - - name - btree - 1 - - - supplyId - btree - - - id2 - btree - - - 1 - 1 - PRIMARY - - - name - - - varchar(30)|0s - 1 - 1 - - - float|0s - 2 - - - timestamp|0s - 3 - - - varchar(15)|0s - 4 - - - int|0s - 2 - 5 - - - int|0s - 1 - 6 - - - iNumber - btree - 1 - - - 1 - 1 - PRIMARY - - - varchar(30)|0s - 1 - - - varchar(20)|0s - 2 - - - int|0s - 3 - - - float|0s - 4 - - - iNumber - iNumber - inorder - - - iNumber - btree - - - varchar(20)|0s - 1 - 1 - - - varchar(20)|0s - 2 - - - float|0s - 3 - - - float|0s - 4 - - - int|0s - 5 - - - int|0s - 6 - - - int|0s - 7 - - - varchar(20)|0s - 8 - - - varchar(20)|0s - 9 - - - float|0s - 10 - - - int|0s - 0 - 11 - - - supplyId - id - supplierinf - - - id2 - id - prodcatalog - - - id - btree - 1 - - - name - btree - 1 - - - supplyId - btree - - - id2 - btree - - - 1 - 1 - PRIMARY - - - name - - - varchar(30)|0s - 1 - 1 - - - float|0s - 2 - - - timestamp|0s - 3 - - - varchar(15)|0s - 4 - - - int|0s - 1 - 5 - - - oNumber - btree - 1 - - - 1 - 1 - PRIMARY - - - varchar(30)|0s - 1 - - - varchar(20)|0s - 2 - - - int|0s - 3 - - - float|0s - 4 - - - oNumber - oNumber - outorder - - - oNumber - btree - - - varchar(20)|0s - 1 - 1 - - - varchar(20)|0s - 2 - - - id - btree - 1 - - - 1 - 1 - PRIMARY - - - varchar(20)|0s - 1 - 1 - - - varchar(20)|0s - 2 - - - float|0s - 3 - - - float|0s - 4 - - - int|0s - 5 - - - int|0s - 6 - - - int|0s - 7 - - - varchar(20)|0s - 8 - - - varchar(20)|0s - 9 - - - float|0s - 10 - - - int|0s - 1 - 11 - - - id2 - id - prodcatalog - - - id - btree - 1 - - - name - btree - 1 - - - id2 - btree - - - 1 - 1 - PRIMARY - - - name - - - varchar(30)|0s - 1 - - - timestamp|0s - 2 - - - varchar(20)|0s - 3 - - - enum('+', '-')|0e - 4 - - - int|0s - 5 - - - 8 - int|0s - 1 - 1 - - - varchar(30)|0s - 2 - - - varchar(50)|0s - 3 - - - varchar(11)|0s - 4 - - - varchar(50)|0s - 5 - - - int|0s - 1 - 6 - - - id - btree - 1 - - - name - btree - 1 - - - 1 - 1 - PRIMARY - - - name - - - 5 - int|0s - 1 - 1 - - - varchar(15)|0s - 2 - - - varchar(15)|0s - 3 - - - varchar(20)|0s - 1 - 4 - - - varchar(11)|0s - 5 - - - int|0s - 1 - 6 - - - varchar(50)|0s - 7 - - - int|0s - 1 - 8 - - - id - btree - 1 - - - name - btree - 1 - - - 1 - 1 - PRIMARY - - - name - -
-
\ No newline at end of file diff --git a/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class b/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class index c96b6fde8f4ec45ec014e77064c52fc1e67a2293..6b0e55c625538615fc26f49525b2d46e4ddbe96b 100644 GIT binary patch delta 65 zcmey(@tb2q7_%rB0}BHW11AGNgD`_2gDj9#W)Pj6&78_B4wR7u%E$oaurw8URfE2~Pk3 diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/outOrderServiceImpl.class index d1062dcfc0c36158b30e8dee50e89f5003434fa4..21ab99d91b5e5494e704b645f2f6ea52c4f108fd 100644 GIT binary patch delta 494 zcmWNNZA(*O9L9e~+Axy2C6x~$7;Z;^rP>qTfHi$a@(o3DH5APDVLTk_)7`$Q+lLr<-N2 zu}T;3^=3x%rsjflTe?e6#i`3$iC$Us$>Ij}^mCE{&gzGLZWCmX>qNAPGRzR;#F*hO zFBu~(U6ig8=Yww786l^+sQHt$B;Dh_DS6&mD<)W9zBi)i@PryBR3=FS&p6F<+L%=I zDaCq0FVpg#kxz;{sxihJ9?0(@uXxOBo@zI#-L!O8nr7aFyzAB#bKqSH-x45rD~A=_ zN_LzzxooIUR={!sRuGt?U>L5F7lcjWE2w#qo6?9h##ZH{ugi*l5tbcc`6?{C!cwA< rZ({#ljQ90vSz&)DY(?d(Bybe)rx5*8t*WXxs!>%$hXsBcZ$sukbR1-p delta 506 zcmW-dSxXd97>1t{%}_MxnC-MoWiw(~q6yg^6}DmvEu&3Ep+OYYWQEyOSc=UwX`T!U zA_yetN|>8&ySD$}f9MB94{_kUydU2=?=qeHnwyB@L{Wtz|vy$a=T2fi5z1vysbeVt~yI(!?-ZcuotWY-OAr zWty3gf0Ta`zlk%n)_$fYL!n)X4kdO{PbW*+r9hV->}ETAWP3TvJ}$7I8yuj>As#7M z5?_kr9HYV!s%}lmKg+*}-^Cvsk27^+p%S;%&-V2i0(w}$8N-~Tk@HS2vW83l?YEHE zN3U9azQ5vTfwOAnxhcEqxyE%*zq7l}?u$>w68*6wT@9V_S9;{+2@}9=Rql{2Kx8T*=uvD8=xStB{HB_(o6=1B92<}>kHyrbdk zFwvSo3l3U|rHuqS$e>FCua@>uL$6l*l=jiDZwx;R3=m|HFe982;G7{YB)--h(flI5 zif@eC<>YsBXI&{DW20mNlSDBs(=5r%%e1JomdIsQwsqMyWZR^hExESk+1IWES%Zx0 zj0yIbQMRmXRooFn99d85qp7pssbO!o%7J59PKnW>@p@SXSL9(S=0=u?%6L*`w<_SC U1|DRL(5|dg^of3+?Pc1=Kk-aX)c^nh delta 427 zcmWNNOKVe66otRjdSgvZV~yH?R+ID*LlK`BO|6Zhq@~rqXuy~@sU`$bqiw29dJ_s} zAQBM=M-WtSTu>}z?C6>oBf3Ff#(j!B-9 zqRwqvq-hKKk-L22o<^qmuKb5|SNfA_`z-Lwe6!)c--SE_pc!2(h_pz6C6Sh8B_k^j z_5G}fk3`IgxS|=W>dvdXsN0gN1y$A*A1f>JLh+S!TiT>-W5KV+wSR)G*%^+D^jxG0 vK3;N!4Xv&!+NKuvnql6Ef>d93@ZanTw=V{t^$EyDU1{g`V diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class index dfab04b57e3449a6c063fff7275db95e29cf38bf..cf4cbfd6f0a4abc03ff043cfdc2bb2b023ff9205 100644 GIT binary patch delta 540 zcmWNOX-kz+6h_w@8Qm}~Cn_^-aHPq|hHD05-ii!|5;V#(EyGM~vMy8-6?b6ES?`-~Qi7EL80!J3ib$im4Sma~pjHjqv( z8Ej%B1r)M{U2J8)yCW3SNC{^=xyWuVQAQWr>CxZP-%%f`kJ%G`T@?*#qaqKnf+`{$ z7F|s?HRKT!cFf1eiBj)rgXj~U*16Wxq;FQ+)OMP}%GCB?pp|9TP2ntQoDdqMO=@7URvlg=?$)Oo165z-s1uHO?j6`#2M5l^e@#hb({h7W0i>a zDRzB;mHLS=H!UxyeqxBH_A}`9Gy54LhZp3FC}x;aUQ^B+_KMrbD=PIh`k30Fp5kp7 zPmcx7y>#wQ( zYMk$3*4px*_J`;hll>%cTQGsmgrBwM&ZjLU528e6$e1Gn@K^pDhM>I6H&Z>w5^c(cfTtYAM84v22? z2Zw~Ui#;s%2(3apiFv((=Y4MQklT!K$CNi2_wAHEqkpZ=s&m|BFGz}bUt;SP zR_f=&>av=kbI1^n?UVNUiG7AyE3TGNOFyNNNt$?W<1yP#(5648PpExrKQF>`G!Z0U zIm@(|te7{fW=70g_s&zNHt>#J$o; diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/storageRecordImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/storageRecordImpl.class index caa03f09b84e679143c1b9561034d8dbdc9cbfbe..696d216f5dc7f1c38014ce609c19bc66fba5d7b1 100644 GIT binary patch delta 298 zcmWNMT`Ple7>BQi(w=53iy}Osn2;8dm&}1O9B9KZYBttN$y>H0d0Se|me!P3<80z= z_V^zAN`6OI*T4Svb>9uEVb$uU;jwMgWyCvi&`m2nxap;hJ~|k{Vvr%c_!wrE5dw@6 zW}G9vTrfd~Npeh4V4gP?cxRe2GknUc@^A51{A1DXcfJ~tWtv!_g;h+}lv}5rpfVeZ zY-#8=bL=RyD~k|kk5l%!S1?OLsVI436y;@kMf?(fNa~0sBXmNuJ~%kT$+<4MqKmZd pxMq|a?RkrzJ1y|YCQpjxIN*gto;4)PvHVh=5+B42h0=$+{ttktHy;21 delta 298 zcmWNM-7AA(9EPvgO5Qdrg__#CkZ+cvg|w4xKK6lOG_}@i%4f92R!*#Tuo6j>RyZTh z*z5n;zvS*YxSqRy&vX6mmesO;nx@g~IA*6|_tAkL4;EembTL2=gGxgT>r6AkJfkc# zMuu?;Oi*N!8dKa7){!soBf5kr*oqqR&k&Vzsly+j6EJ?RYH*ska z5+tQbvA~)%>uj@uO`3ByxgkrPJ*hI>vCE@!L-|$w6u-%-M8rtjxY$>d0&Wh}T;}oPqf!5Va{05r(0aGLzz4ky(nq=Qd4E!DqM+GvBve&o45H7y^%D_ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class b/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class index 1c9a168c81732b9103026ec0596eda5273fcc683..57d07cd1977fab78fb20089dcfc3df200ce980fe 100644 GIT binary patch delta 68 zcmX>qbW~^q2RkF@W={4zMngUZ76t(ZIR;?{69!R+00uFJsSM%_GZ>^8HZ#aFTxO7G Yc*mf~$ibk@D9516Xu_Z|c?HK@0F@;Rxc~qF delta 68 zcmX>qbW~^q2RkFjW={4zMnfJ376x7hIR-uk69#^U00seusSJV)GZ=&zHZuq_TxJkq Yc*h{h$iX1SD90eqXu=>lc?HK@0E=o1NdN!< diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/DateUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/DateUtil.class index 1c6928379dbe0c947444d85eaaee3c3455ddea48..7129ff21db99579e81d6ca680e876b99e4a0aa28 100644 GIT binary patch delta 27 jcmaFQ_MUCSMkYq~$(xvhIfWTG7(^Mw7{n*@F((25b2SEA delta 27 jcmaFQ_MUCSMkYqK$(xvhIRzLv7z7!_7=$MCF((25a=r#m diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/EmailTest.class b/Supermarket/bin/com/lingnan/supermarket/utils/EmailTest.class index 41a0d5c22ad85618801683cbebdd2fa09b1cc754..2a92b224352d35631162291e09e9b8eeaeda8f4b 100644 GIT binary patch delta 19 bcmbQjGKFQsCPqf~$(tE17+QFm6SX>nxNQ3uP7>Y81JY&B*Mgtfa=m;#>O<%5U+1 zJiF65J@0$Eq!8F9Yjg>=F~~OmXooJHyYMAPXX_iLoTkiX@x+ z){(OvLbw$I3Sm-2N%KNhl;M>(QI>)RMcJ}!RlOnCR)1ITh`aIw`Js3u|0zEv&le>< atMH@MA2m+2_@~a9CKp{u11&4)JU#(_935x? delta 206 zcmWNK%Wgqo6h@asPUCV6dMYKTOHdRwFmP!wkRZhE7>Ebx$b>L!Vk8m<250OYns^rP zwjms{LbF6%^D_k0yKD~={$^WrjMHeUWTG0-WU^N!Ur}lw1c3A3?o$qC`j#Bdz(V60*ECzlfeXQo`4aU)DW#^rcGlY#d{ z+dJ+ZWBs788BcP|oZ>dfM5@$<4!SVLVo8~m1QUrtTOL>v?@0D|2UR=`8v-@6hn*z9tGl5bahBFCdHIAGcv5nvL(lkJV#MyN|(1eoc4rpfQorw z&+mjbsmv9#xZy5){eW;lWHs-%`~v`{7sdbp diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest$1.class b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest$1.class index 4f46f87aefa24ac2a81239ca2b6173f8a0265014..d530c2e518f82b243349f0de73a9ab957737a2c2 100644 GIT binary patch delta 35 rcmaFN_LyzMDketD$*Y;-1nn6380;A&7#tWB85|kZ7@Q_cF?#|4uQ3O{ delta 35 rcmaFN_LyzMDketL$*Y;-1g#kO7_1p27;G368EhHU80;oXF?#|4t-%MT diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class index 8eb35e4c77c618a047486b782fc968f19e596399..eea67473eb5e75a4558d85017ced598673da3ff2 100644 GIT binary patch delta 123 zcmaDU@K|6&HP8zgRzY^Ae^MW=8(WoNW2BstgI~8h8VpJdnn0+N?~Rcn9R(UFRR4B!Jy2*&!EB}&7jJl z#GuBY$)L_)z@Wik&Y(HDpDjpGk3oPzpFs*NX2_t!U^Mv?n;oYs12cmg0~>?;W=nQ< kMrC0J5e89)ItCL4CI)8)1|aDIG=_nJi-8enGzf4209?2u{r~^~ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class index 998ea75c96504fe4d01ce6476907d576c8f8d9d8..8dc13e9e9162a293a44e14d48f27b7a04b573296 100644 GIT binary patch delta 63 zcmV-F0Kos63z`eCT?7HylU@X|E!_YJ0Nwx)0N(%^0N?;60O0^G0O9~T0OJ5d0OSBq V0ObH!0OkN;0O$a30O^xF1zv5v6H@>H delta 63 zcmV-F0Kos63z`eCT?7H+lU@X|E$09T0O$Y^0O}BOQ)%INISDGm&p|tcwH=H-iG3g)Te}cXcq%a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fv|50gWFKR>S%U{0)dWM7jps8b|AMxo~5at%Zd5-V2&NKcgypTb&_eg7a;U+juVPE z+e1!NUd$~$^I?S?;;xq>8#{)=FXuQF^2)H_tHIZTe+#}Ia?0e5oP<(wa}q)cQTcm? z9Ol}${)kDU_pD0)py=jgqsBkk7{M#G@e!C?DxEo2M2ojZ@a^C`RVrpy9UDFy>j=IZ z+@v%??lyt-OTY~z%A1un*lVo01i4ZJLnQ^nSsILBRvszm;~MFTQPKm~Nk0}+BQaX? zFh<5>tQ29KOlM&=2NU_;Ok&YAS?D2uJ_m@fMep22Sz#qusnKk}Q-@!gT ziv4;V2lQ(^tKZXE0ti%5!v10`YQ4dZQ<~cx;lA z*eNWZ2cs9q;#eb(iJhWX6E(dM<{-V+D7IOT^24fsjGiFCOaT|L4)W7+Z@#NeAen3X z@MTS~<`FfQurLf*OXX#l-*$0Uscb<%zP0hz2fX+)zP7gYi;Tbkp5j>33K%Gm zb7Gu%QTtXs!GWc?99OV{ND0ismDEiAf_jbAJ1ISE3~ql?&czA2_LOAX7{Y(QN&{B# zb#YqyvKJ}HZZPaB8&`8F5u9sdsEuJZV?}=0|WZD_o3>KO+~3b#@Ia z;PxpFu3>PQ3hPLAZNKh_Rq<`Bl|VMGrEAO|8`n`ka919~FjfMw+~r@9IA#HCB@?Tw zs~;1q?&2zsaWE!U)NyTNzs3@&;U|mseiAaZIsDo@c1B;GIMzQmUp^#td0lsTPd*U* E57uy8g#Z8m diff --git a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class index 42e052606ed6a501da2d67ffd21999b39a00decb..3e699f8fd8e0a787dcfb6e6869ca11bafee0bff2 100644 GIT binary patch delta 1276 zcmW-g32={B6vcn%ecu;GB$W^m6(x~sBvG^j0&JP+xB|fwIV~NFAxHH-p;QNw5CQ!=?#4wQz zzM>10Y!j0i#1uyIwJn%xqXm3}pCV?mk?Cx*jcj8UCCuh1-*KP03gCNHW1b?IuZApC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B!f}5naYaijhOZ$fq)FG!6SIT8s+17#rzod`CB9Ki!R^ z^e`^c)A)-$jaK@o-t46U*jo*xuZmqL3Qy})0K&{Oka*R1DRwF;TSWKW6cR1XQuEq zGn22Id7Nn4ILWm0O|zWI=9ipoRx!og!!&b0rUvV-61RmYt? z%4(kBE?(qrUS$ohvzE8%WIOjd?GdM#un#V*ho}BtQ9PhqJBVB!LOu_}!5^@ZM{$IW zILTvZ=LtOKNd{`*7@p%~o_Ca4$Mcfo@7R8h7HcT4{I8rtBDXU8svgTVJ(eZ}vl)@R zjySgHaoo`On;PGW6}*K?-o_^0(PL=SZn&#|emk0Y51qV^E_TqD5BLfnGJ>5P$45-( zV`lRSi}>6b7FED3Axsf?hyg!Q7%V2NVnMvPAX$1~n!JE)afMBrq(t1YT0F2pJh4rB zqFTIgP`uG7J~$`6w1IkSv-oO5^kEO_OCRxfJR6zKU`JMT3`2Em0gk=V>qCd?io@V4 z5%8Abh!88{Boe9GdNU;oxiS)SBpM4O&hbu69+SHB+G9dEzFUom4dJA2Risr~x2o4F PU8^_TGC-yR5T^YH6dOkv diff --git a/Supermarket/bin/com/lingnan/supermarket/view/Nimbus.class b/Supermarket/bin/com/lingnan/supermarket/view/Nimbus.class index 841691534ed7186cddc180927e513390620d1312..1705b3894b671cb89f90ebb04ce6656940d0e37b 100644 GIT binary patch delta 35 pcmeBV?PT4+$i&DtnTg3)kcWYlL4bjSftP`kfgeZ;PEKIb1OQy81Xch5 delta 35 qcmeBV?PT4+$i&DpnTg3)kduLxfro*Efs28Yft!Jsfp>BOlO_OLj|4&h diff --git a/Supermarket/bin/com/lingnan/supermarket/view/UserView.class b/Supermarket/bin/com/lingnan/supermarket/view/UserView.class index 7aac3e5b903d271f72f7a1692c05fccd75efbea6..f1bd6db9678b68e1677d23de05863cd106fc8edc 100644 GIT binary patch delta 361 zcmWNNNhri|9K}E1L6rE9VU#sXqEIr*MY$+RmJ$s~s7Vq=4YGt1NfQ1kTR5R6OD3|# zLCS%W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iRs2HTn7H#d^ar?bF*`T1 zF~*(7oiY9Z|Aqg97~eaIWno+}H+k>Lz305=xo1A4jt5`<{Qd0*(BOs701cl}=8Y`) zEOOn*jU+c&GO}zgR*W=_tQu(}au6`dctF|6LmmY@Hu8l1fQzQ?DTm=(I~RM#^YD{h{rby( zZw-%%+I$HtvgD*=Vdxz8&gyI$Upj!pAW2eML*z+QA;S_Qtg2#DHQS8o9GY^09SWS& zZld#y%h5y=itH#VQX;1Oy1|uqMN7=YBZ4VI0O9NSLBvp1XXNO}Gbz86GV^k)P!z)y zEk#>YqyAky<+l6%+x`CSe*d=WOn;MCQJoV-7oz@oY7tXHHzmqF9lDNVh6m9;tz?VK zN{b+QqbC`wlGQ1^BbiBcK9VgsM+%1&o+-qSNMzET+Gi!jFf*Nu80#vW(X?g>nA1cX zn&P}(xFF8O=q*KJJ>%SeOo=Pvu~az0Rh`>h)4fmZn82m(ySkhCFInb findAllOutOrder() { + // 存储查询到的所有出库订单信息的向量集合 Vector outOrders = new Vector(); + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - ResultSet resultSet=null; - + ResultSet resultSet = null; + + // 从OutOrder表中查询所有记录,并按oDate字段降序排序 String SQL = "select * from OutOrder order by oDate desc"; - + try { + // 根据SQL语句创建预编译的Statement对象 preparedStatement = conn.prepareStatement(SQL); + // 执行查询操作 resultSet = preparedStatement.executeQuery(); - while(resultSet.next()) { + // 遍历结果集,将每条记录封装成OutOrder对象,并添加到outOrders集合中 + while (resultSet.next()) { OutOrder outOrder = new OutOrder(); outOrder.setoNumber(resultSet.getString("oNumber")); outOrder.setAllOutPrice(resultSet.getFloat("allOutPrice")); @@ -35,117 +43,147 @@ public class outOrderServiceImpl implements outOrderService{ outOrder.setPrincipal(resultSet.getString("principal")); outOrders.add(outOrder); } - + } catch (SQLException e) { e.printStackTrace(); } finally { + // 关闭结果集、预编译语句以及数据库连接,释放相关资源 JDBCUtil.close(resultSet, preparedStatement, conn); } return outOrders; } + // 根据订单编号查询对应的出库订单信息 @Override public OutOrder findByIdOutOrder(String oNumber) { + // 用于存储查询到的出库订单信息的对象 OutOrder outOrder = new OutOrder(); + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { - preparedStatement = conn.prepareStatement("select * from outOrder where oNumber = ?"); + // 根据订单编号查询对应的出库订单记录 + preparedStatement = conn.prepareStatement("select * from outOrder where oNumber =?"); + // 设置查询的订单编号 preparedStatement.setString(1, oNumber); + // 执行查询操作 resultSet = preparedStatement.executeQuery(); + // 如果结果集中有记录,说明找到了对应的订单,则将记录中的各字段值封装到outOrder对象中 if (resultSet.next()) { outOrder.setoNumber(resultSet.getString("oNumber")); outOrder.setAllOutPrice(resultSet.getFloat("allOutPrice")); outOrder.setoDate(resultSet.getDate("oDate")); outOrder.setPrincipal(resultSet.getString("principal")); } else { - return null; // 没有找到该订单或订单不存在,返回null - } + // 如果结果集中没有记录,说明没有找到该订单或订单不存在,返回null + return null; + } } catch (SQLException e) { e.printStackTrace(); } finally { + // 关闭结果集、预编译语句以及数据库连接,释放相关资源 JDBCUtil.close(resultSet, preparedStatement, conn); } return outOrder; - } + // 向数据库中添加一条出库订单记录 @Override public int addOutOrder(String oNumber, float allOutPrice) { int flag = 0; - Timestamp oDate = new Timestamp(System.currentTimeMillis()); - + // 获取当前系统时间戳,用于作为出库订单的日期(oDate)字段值,表示订单创建时间 + Timestamp oDate = new Timestamp(System.currentTimeMillis()); + + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - + try { - preparedStatement = conn.prepareStatement - ("insert into outOrder values (?,?,?,?)"); + // 创建预编译的SQL插入语句,向outOrder表中插入一条记录 + preparedStatement = conn.prepareStatement("insert into outOrder values (?,?,?,?)"); + // 设置预编译语句中的参数,依次为订单编号、总出库价格、订单日期、负责人(此处写死为"a1",可能后续需要改进) preparedStatement.setString(1, oNumber); preparedStatement.setFloat(2, allOutPrice); preparedStatement.setTimestamp(3, oDate); preparedStatement.setString(4, "a1"); + // 执行插入操作 preparedStatement.executeUpdate(); + // 如果插入成功,将标志位flag设置为1,表示操作成功 flag = 1; } catch (SQLException e) { + // 如果插入出现异常,将标志位flag设置为 -1,表示操作失败 flag = -1; e.printStackTrace(); } finally { - JDBCUtil.close(null,preparedStatement, conn); + // 关闭预编译语句以及数据库连接,释放相关资源 + JDBCUtil.close(null, preparedStatement, conn); } - + return flag; } + // 根据订单编号从数据库中删除对应的出库订单记录 @Override public int deleteOutOrder(String oNumber) { int flag = 0; - + + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - + try { - preparedStatement = conn.prepareStatement - ("delete from outOrder where oNumber = ?"); + // 创建预编译的SQL删除语句,根据订单编号(oNumber)删除对应的出库订单记录 + preparedStatement = conn.prepareStatement("delete from outOrder where oNumber =?"); + // 设置预编译语句中的参数,即要删除的订单编号 preparedStatement.setString(1, oNumber); + // 执行删除操作 preparedStatement.executeUpdate(); + // 如果删除成功,将标志位flag设置为1,表示操作成功 flag = 1; } catch (SQLException e) { + // 如果删除出现异常,将标志位flag设置为 -1,表示操作失败 flag = -1; e.printStackTrace(); } finally { - JDBCUtil.close(null,preparedStatement, conn); + // 关闭预编译语句以及数据库连接,释放相关资源 + JDBCUtil.close(null, preparedStatement, conn); } return flag; } - - //获取今日进货金额 - public Float TodayOutPrice(String date) { - - InOrder inOrder = new InOrder(); - Connection conn = JDBCUtil.getConn(); - PreparedStatement preparedStatement = null; - ResultSet resultSet = null; - Float allInPrice=(float) 0; - - try { - preparedStatement = conn.prepareStatement("select sum(allOutPrice) from outOrder where oDate>=? and oDate<=date_add(?,interval 1 day)"); - preparedStatement.setString(1, date); - preparedStatement.setString(2, date); - resultSet = preparedStatement.executeQuery(); - if (resultSet.next()) { - allInPrice=resultSet.getFloat("sum(allOutPrice)"); - } - } catch (SQLException e) { - e.printStackTrace(); - } finally { - JDBCUtil.close(resultSet, preparedStatement, conn); + // 获取指定日期的今日出库金额总和(此处方法名可能有点混淆,从代码逻辑看是获取指定日期的出库金额总和) + public Float TodayOutPrice(String date) { + // 创建一个InOrder对象 + InOrder inOrder = new InOrder(); + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + // 用于存储查询到的今日出库金额总和,初始为0 + Float allInPrice = (float) 0; + + try { + // 通过求和函数查询指定日期范围内的总出库价格 + preparedStatement = conn.prepareStatement("select sum(allOutPrice) from outOrder where oDate>=? and oDate<=date_add(?,interval 1 day)"); + // 设置两个参数均为传入的日期值,用于限定查询的日期范围 + preparedStatement.setString(1, date); + preparedStatement.setString(2, date); + // 执行查询操作 + resultSet = preparedStatement.executeQuery(); + // 如果结果集中有记录,说明查询到了对应的金额数据,则将其取出赋值给allInPrice变量 + if (resultSet.next()) { + allInPrice = resultSet.getFloat("sum(allOutPrice)"); } - return allInPrice; + } catch (SQLException e) { + e.printStackTrace(); + } finally { + // 关闭结果集、预编译语句以及数据库连接,释放相关资源 + JDBCUtil.close(resultSet, preparedStatement, conn); } -} + return allInPrice; + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java index 5347d19..98f4958 100644 --- a/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/outRecordServiceImpl.java @@ -12,49 +12,66 @@ import com.lingnan.supermarket.dto.InRecord; import com.lingnan.supermarket.dto.OutRecord; import com.lingnan.supermarket.utils.JDBCUtil; -public class outRecordServiceImpl implements outRecordService{ +// 实现了outRecordService接口--用于处理出库记录相关的数据操作逻辑 +public class outRecordServiceImpl implements outRecordService { + // 查询所有出库记录信息 @Override public Vector findAllOutRecord() { + // 用于存储查询到的所有出库记录信息的向量集合 Vector outRecords = new Vector(); + // 通过JDBCUtil工具类的静态方法来获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - ResultSet resultSet=null; - + ResultSet resultSet = null; + + // 从outRecord表中获取所有记录 String SQL = "select * from outRecord"; - + try { + // 根据SQL语句创建预编译的Statement对象 preparedStatement = conn.prepareStatement(SQL); + // 执行查询操作 resultSet = preparedStatement.executeQuery(); - while(resultSet.next()) { + // 遍历结果集,将每条记录封装成OutRecord对象,并添加到outRecords集合中 + while (resultSet.next()) { OutRecord outRecord = new OutRecord(); outRecord.setoNumber(resultSet.getString("oNumber")); outRecord.setSum(resultSet.getInt("sum")); outRecord.setOutPrice(resultSet.getFloat("outPrice")); outRecords.add(outRecord); } - + } catch (SQLException e) { e.printStackTrace(); } finally { + // 关闭结果集、预编译语句以及数据库连接,释放相关资源 JDBCUtil.close(resultSet, preparedStatement, conn); } return outRecords; } + // 根据订单编号查询对应的出库记录信息,返回符合条件的多条记录 @Override public Vector findByIdOutRecordr(String oNumber) { - OutRecord outRecord ; + // 用于临时存储单个出库记录信息的对象 + OutRecord outRecord; + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; ResultSet resultSet = null; + // 存储查询到的符合条件的所有出库记录信息的向量集合 Vector v = new Vector(); try { - preparedStatement = conn.prepareStatement("select * from outRecord where oNumber = ?"); + //根据给定的订单编号查询outRecord表中对应的记录 + preparedStatement = conn.prepareStatement("select * from outRecord where oNumber =?"); + // 设置要查询的订单编号 preparedStatement.setString(1, oNumber); + // 执行查询操作,获取结果集 resultSet = preparedStatement.executeQuery(); + // 遍历结果集,将每条符合条件的记录封装成OutRecord对象,并添加到向量集合v中 while (resultSet.next()) { outRecord = new OutRecord(); outRecord.setoNumber(resultSet.getString("oNumber")); @@ -62,68 +79,83 @@ public class outRecordServiceImpl implements outRecordService{ outRecord.setSum(resultSet.getInt("sum")); outRecord.setOutPrice(resultSet.getFloat("Price")); v.add(outRecord); - } + } } catch (SQLException e) { e.printStackTrace(); } finally { + // 关闭结果集、预编译语句以及数据库连接,释放相关资源 JDBCUtil.close(resultSet, preparedStatement, conn); } return v; } + // 向数据库中添加一条出库记录信息 @Override public int addoutRecord(OutRecord or) { - int flag = 0; - + + // 获取要添加的出库记录对象中的订单编号 String oNumber = or.getoNumber(); + // 获取要添加的出库记录对象中的数量 int sum = or.getSum(); + // 获取要添加的出库记录对象中的出库价格 Float outPrice = or.getOutPrice(); - + + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - + try { - preparedStatement = conn.prepareStatement - ("insert into outRecord values (?,?,?)"); + // 创建预编译的SQL插入语句,向outRecord表中插入一条记录,包含订单编号、数量、出库价格三个字段的值 + preparedStatement = conn.prepareStatement("insert into outRecord values (?,?,?)"); + // 设置预编译语句中的参数,依次为订单编号、数量、出库价格 preparedStatement.setString(1, oNumber); preparedStatement.setInt(2, sum); preparedStatement.setFloat(3, outPrice); + // 执行插入操作 preparedStatement.executeUpdate(); + // 如果插入成功,将标志位flag设置为1,表示操作成功 flag = 1; } catch (SQLException e) { + // 如果插入出现异常,将标志位flag设置为 -1,表示操作失败 flag = -1; e.printStackTrace(); } finally { - JDBCUtil.close(null,preparedStatement, conn); + // 关闭预编译语句以及数据库连接,释放相关资源,此处结果集为null + JDBCUtil.close(null, preparedStatement, conn); } - + return flag; } + // 根据订单编号从数据库中删除对应的出库记录信息 @Override public int deleteOutOrder(String oNumber) { int flag = 0; - + + // 获取数据库连接 Connection conn = JDBCUtil.getConn(); PreparedStatement preparedStatement = null; - + try { - preparedStatement = conn.prepareStatement - ("delete from outRecord where oNumber = ?"); + // 创建预编译的SQL删除语句,根据给定的订单编号删除outRecord表中对应的记录 + preparedStatement = conn.prepareStatement("delete from outRecord where oNumber =?"); + // 设置要删除的订单编号 preparedStatement.setString(1, oNumber); + // 执行删除操作 preparedStatement.executeUpdate(); + // 如果删除成功,将标志位flag设置为1,表示操作成功 flag = 1; } catch (SQLException e) { + // 如果删除出现异常,将标志位flag设置为 -1,表示操作失败 flag = -1; e.printStackTrace(); } finally { - JDBCUtil.close(null,preparedStatement, conn); + // 关闭预编译语句以及数据库连接,释放相关资源,此处结果集为null + JDBCUtil.close(null, preparedStatement, conn); } return flag; } - - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java index 805f16f..917c235 100644 --- a/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/prodCatalogImpl.java @@ -12,214 +12,241 @@ import com.lingnan.supermarket.dao.prodCatalogService; import com.lingnan.supermarket.dto.ProdCatalog; import com.lingnan.supermarket.utils.JDBCUtil; -public class prodCatalogImpl implements prodCatalogService{ +// 实现prodCatalogService接口--用于处理商品目录相关的数据持久化操作 +public class prodCatalogImpl implements prodCatalogService { - /*将商品目录表和商品表联合查询*/ + // 将商品目录表和商品表联合查询,获取商品目录及相关商品信息 @Override public Vector findProdCatalogAndProd() { - Connection conn=JDBCUtil.getConn(); + // 通过JDBCUtil工具类来获取已经配置好的连接对象 + Connection conn = JDBCUtil.getConn(); + // 创建一个Vector容器,存放查询到的ProdCatalog对象 Vector v = new Vector(); ProdCatalog prodCatalog; PreparedStatement pstmt = null; - ResultSet resultSet=null; + ResultSet resultSet = null; try { + // 通过预编译语句准备调用存储过程allProdCatalog pstmt = conn.prepareStatement("call allProdCatalog()"); + // 执行查询操作 resultSet = pstmt.executeQuery(); - while(resultSet.next()){ + // 遍历结果集,将每一条记录封装成ProdCatalog对象,并添加到Vector容器中 + while (resultSet.next()) { prodCatalog = new ProdCatalog(); + // 设置ProdCatalog对象的id属性 prodCatalog.setId(resultSet.getString("id")); + // 设置ProdCatalog对象的name属性 prodCatalog.setName(resultSet.getString("name")); v.add(prodCatalog); } } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 通过JDBCUtil工具类提供的方法进行关闭操作 JDBCUtil.close(resultSet, pstmt, conn); } - - + return v; - - + } - - + + // 根据给定的id1查找商品目录名称 @Override - public String findProdCatalog(String id1 ) { - Connection conn=JDBCUtil.getConn(); - + public String findProdCatalog(String id1) { + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; - ResultSet resultSet=null; - String catalog=null; + ResultSet resultSet = null; + String catalog = null; try { + // 预编译SQL语句,用于根据给定的id2查询prodCatalog表中的记录 pstmt = conn.prepareStatement("select *from prodCatalog where id2 =?"); - pstmt.setString(1,id1); - + // 设置SQL语句中的参数,将传入的id1赋值给查询语句中的占位符 + pstmt.setString(1, id1); + // 执行查询操作 resultSet = pstmt.executeQuery(); - if(resultSet.next()){ - catalog=resultSet.getString("name1"); + // 如果结果集中有下一条记录,则获取对应记录中的name1字段值作为商品目录名称 + if (resultSet.next()) { + catalog = resultSet.getString("name1"); } } catch (SQLException e) { - // TODO Auto-generated catch block e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - - + return catalog; - - + } + // 向商品目录表prodCatalog中添加一条记录 @Override public int addProdCatalog(String id1, String id2) { - int flag=0; - String name1=null; - //01 食品 02 电器 03 生活用品 04 其他 - if(id1.equals("01")) - name1="食品"; - else if(id1.equals("02")) - name1="电器"; - else if(id1.equals("03")) - name1="生活用品"; - else - name1="其他"; - - //连接jdbc - Connection conn=JDBCUtil.getConn(); + int flag = 0; + String name1 = null; + // 根据传入的id1判断商品类别名称,01对应食品,02对应电器,03对应生活用品,04对应其他 + if (id1.equals("01")) + name1 = "食品"; + else if (id1.equals("02")) + name1 = "电器"; + else if (id1.equals("03")) + name1 = "生活用品"; + else + name1 = "其他"; + + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); PreparedStatement pstmt = null; - ResultSet resultSet=null; - + ResultSet resultSet = null; + try { + // 预编译插入数据的SQL语句,向prodCatalog表中插入三条数据 pstmt = conn.prepareStatement("insert into prodCatalog values(?,?,?)"); - pstmt.setString(1,id1); - pstmt.setString(2,name1); - pstmt.setString(3,id2); - + // 设置SQL语句中的第一个参数 + pstmt.setString(1, id1); + // 设置SQL语句中的第二个参数 + pstmt.setString(2, name1); + // 设置SQL语句中的第三个参数 + pstmt.setString(3, id2); + // 执行插入操作,若插入成功,将flag置为1,表示添加成功 pstmt.executeUpdate(); - flag=1; - + flag = 1; + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - + return flag; } - + // 根据给定的id2删除商品目录表prodCatalog中的一条记录 @Override public int deleteProdCatalog(String id2) { - int flag=0; - //连接jdbc - Connection conn=JDBCUtil.getConn(); + int flag = 0; + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); PreparedStatement pstmt = null; - ResultSet resultSet=null; - + ResultSet resultSet = null; + try { + // 预编译删除数据的SQL语句,根据传入的id2作为条件,从prodCatalog表中删除对应的记录 pstmt = conn.prepareStatement("delete from prodCatalog where id2=?"); - pstmt.setString(1,id2); + // 设置SQL语句中的参数,将传入的id2赋值给查询语句中的占位符(?) + pstmt.setString(1, id2); + // 执行删除操作,若删除成功,将flag置为1,表示删除成功 pstmt.executeUpdate(); - flag=1; - + flag = 1; + } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - + return flag; } - + // 根据商品类production的name查询并输出类别id,如果传入的name为"全部",则直接返回默认的catalogid "0" @Override - //根据商品类production的name查询并输出类别id public String findProdCatalogByname(String name) { - Connection conn=JDBCUtil.getConn(); - + Connection conn = JDBCUtil.getConn(); + PreparedStatement pstmt = null; - ResultSet resultSet=null; - - String catalogid="0"; + ResultSet resultSet = null; + + String catalogid = "0"; try { - if(name.equals("全部")){ + // 如果传入的商品名称为"全部",则直接返回默认的catalogid + if (name.equals("全部")) { return catalogid; } + // 预编译SQL语句,用于根据给定的商品名称查询prodCatalog表中的记录,获取对应的类别id pstmt = conn.prepareStatement("select * from prodCatalog where name =?"); - pstmt.setString(1,name); - + // 设置SQL语句中的参数,将传入的name赋值给查询语句中的占位符 + pstmt.setString(1, name); + // 执行查询操作,获取结果集 resultSet = pstmt.executeQuery(); - if(resultSet.next()){ - catalogid=resultSet.getString("id"); + // 如果结果集中有下一条记录,则获取对应记录中的id字段值作为类别id + if (resultSet.next()) { + catalogid = resultSet.getString("id"); } } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - - + return catalogid; } -/* public static void main(String[] args) { - ProdCatalog p=new ProdCatalog(); - prodCatalogImpl pi=new prodCatalogImpl(); - p.setName("全部"); - System.out.println(pi.findProdCatalogByname(p.getName())); - }*/ - + /* + public static void main(String[] args) { + ProdCatalog p = new ProdCatalog(); + prodCatalogImpl pi = new prodCatalogImpl(); + p.setName("全部"); + System.out.println(pi.findProdCatalogByname(p.getName())); + } + */ + // 查询商品目录表prodCatalog中的所有商品类别名称,并添加"全部"作为第一个元素后返回 @Override public ArrayList findNameProdCatalog() { - Connection conn=JDBCUtil.getConn(); + Connection conn = JDBCUtil.getConn(); ArrayList v = new ArrayList(); + // 先添加"全部"作为默认的第一个类别名称 v.add("全部"); ProdCatalog prodCatalog; PreparedStatement pstmt = null; - ResultSet resultSet=null; + ResultSet resultSet = null; try { + // 预编译查询所有记录的SQL语句,用于获取prodCatalog表中的所有商品类别名称 pstmt = conn.prepareStatement("select * from prodCatalog"); + // 执行查询操作 resultSet = pstmt.executeQuery(); - while(resultSet.next()){ - + // 遍历结果集,将每条记录中的商品类别名称添加到ArrayList容器中 + while (resultSet.next()) { + v.add(resultSet.getString("name")); } } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - - + return v; } - /*public static void main(String[] args) { - prodCatalogImpl pi=new prodCatalogImpl(); - ArrayListlog=null; - - - log=pi.findNameProdCatalog(); - String []s=new String[log.size()]; - for(int i=0;i log = null; + + + log = pi.findNameProdCatalog(); + String[] s = new String[log.size()]; + for (int i = 0; i < log.size(); i++) { + s[i] = log.get(i); + System.out.println(log.get(i)); + } + for (int i = 0; i < s.length; i++) { + System.out.println(s[i]); + } -} + } + */ +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java b/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java index c3bfb3e..b5ee6b8 100644 --- a/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java +++ b/Supermarket/src/com/lingnan/supermarket/dao/impl/storageRecordImpl.java @@ -8,117 +8,136 @@ import java.sql.Statement; import java.util.Iterator; import java.util.Vector; - - - - - - +// 导入相关的业务逻辑接口、数据传输对象以及工具类,用于数据库操作和日期处理等功能 import com.lingnan.supermarket.dao.storageRecordService; import com.lingnan.supermarket.dto.StorageRecord; import com.lingnan.supermarket.utils.DateUtil; import com.lingnan.supermarket.utils.JDBCUtil; +// 实现storageRecordService接口--用于处理库存记录相关的数据持久化操作 public class storageRecordImpl implements storageRecordService { + // 查询所有库存记录信息,并以Vector容器存储返回 @Override public Vector findAllStorageRecord() { - Vector v=new Vector(); - - - Connection conn=JDBCUtil.getConn(); + // 创建一个Vector容器,用于存放查询到的StorageRecord对象 + Vector v = new Vector(); + + // 获取数据库连接,通过JDBCUtil工具类来获取已经配置好的连接对象 + Connection conn = JDBCUtil.getConn(); PreparedStatement pstmt = null; - ResultSet resultSet=null; + ResultSet resultSet = null; try { + // 编写SQL查询语句,从storageRecord表中查询所有记录,并按照cDate字段降序排序 + String sql = "select * from storageRecord order by cDate desc"; + // 使用获取到的数据库连接对象,预编译SQL语句 + pstmt = conn.prepareStatement(sql); - String sql="select * from storageRecord order by cDate desc"; - pstmt=conn.prepareStatement(sql); - - resultSet=pstmt.executeQuery(); - while(resultSet.next()) { - StorageRecord sr=new StorageRecord(); + // 执行查询操作 + resultSet = pstmt.executeQuery(); + // 遍历结果集,将每一条记录封装成StorageRecord对象,并添加到Vector容器中 + while (resultSet.next()) { + StorageRecord sr = new StorageRecord(); + // 设置StorageRecord对象的id属性 sr.setId(resultSet.getString("id")); + // 设置StorageRecord对象的库存编号属性 sr.setTheNumber(resultSet.getString("theNumber")); + // 设置StorageRecord对象的数量属性 sr.setNum(resultSet.getInt("num")); + // 设置StorageRecord对象的执行情况属性 sr.setExecute(resultSet.getString("execute")); + // 通过DateUtil工具类的dateToString方法将数据库中获取的时间戳类型的日期数据转换为字符串类型,方便后续使用(第二个参数为null可能表示使用默认的日期格式转换,具体看DateUtil实现) sr.setcDate(DateUtil.dateToString(resultSet.getTimestamp("cDate"), null)); v.add(sr); - } - - - } + } - catch (SQLException e) { + } catch (SQLException e) { + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally { + } finally { + // 通过JDBCUtil工具类提供的方法进行关闭操作 JDBCUtil.close(resultSet, pstmt, conn); - + } - - - return v; + return v; } - + // 根据给定的库存编号(theNumber)查找对应的库存记录信息并返回 @Override public StorageRecord findByIdStorageRecord(String theNumber) { - - StorageRecord sr=null; - Connection conn=JDBCUtil.getConn(); + // 初始化一个StorageRecord对象为null,用于存放查询到的库存记录信息,如果没查到则返回null + StorageRecord sr = null; + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); PreparedStatement pstmt = null; - ResultSet resultSet=null; + ResultSet resultSet = null; try { - sr=new StorageRecord(); + // 创建一个新的StorageRecord对象,用于后续封装查询到的数据 + sr = new StorageRecord(); + // 预编译SQL语句,用于根据给定的库存编号(theNumber)查询storageRecord表中的记录 pstmt = conn.prepareStatement("select *from storageRecord where theNumber=?"); - pstmt.setString(1,theNumber); + // 设置SQL语句中的参数,将传入的库存编号赋值给查询语句中的占位符 + pstmt.setString(1, theNumber); + // 执行查询操作,获取结果集 resultSet = pstmt.executeQuery(); - if(resultSet.next()){ + // 如果结果集中有下一条记录,则将对应记录中的各字段值封装到StorageRecord对象中 + if (resultSet.next()) { sr.setTheNumber((resultSet.getString("theNumber"))); sr.setId((resultSet.getString("id"))); sr.setNum(resultSet.getInt("num")); sr.setExecute(resultSet.getString("execute")); sr.setcDate(DateUtil.dateToString(resultSet.getTimestamp("cDate"), null)); } - + } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - - + return sr; } - public boolean insertStorageRecord(String iNumber,String time,String prodId,String execute,int sum) { + // 向库存记录表storageRecord中插入一条新的库存记录信息 + public boolean insertStorageRecord(String iNumber, String time, String prodId, String execute, int sum) { + // 定义一个布尔变量用于标记插入操作是否成功,初始化为false boolean flag = false; - Connection conn=JDBCUtil.getConn(); + // 获取数据库连接 + Connection conn = JDBCUtil.getConn(); PreparedStatement pstmt = null; - ResultSet resultSet=null; + ResultSet resultSet = null; try { + // 预编译插入数据的SQL语句,向storageRecord表中插入五条数据 pstmt = conn.prepareStatement("insert into storageRecord values(?,?,?,?,?) "); - pstmt.setString(1,iNumber); - pstmt.setString(2,time); - pstmt.setString(3,prodId); - pstmt.setString(4,execute); - pstmt.setInt(5,sum); - - if(pstmt.executeUpdate()==1){ - flag = true; + // 设置SQL语句中的第一个参数 + pstmt.setString(1, iNumber); + // 设置SQL语句中的第二个参数 + pstmt.setString(2, time); + // 设置SQL语句中的第三个参数 + pstmt.setString(3, prodId); + // 设置SQL语句中的第四个参数 + pstmt.setString(4, execute); + // 设置SQL语句中的第五个参数 + pstmt.setInt(5, sum); + + // 执行插入操作,若受影响的行数为1,则将flag置为true,表示插入成功 + if (pstmt.executeUpdate() == 1) { + flag = true; } - + } catch (SQLException e) { - // TODO Auto-generated catch block + // 若出现SQL异常,打印异常栈信息 e.printStackTrace(); - }finally{ + } finally { + // 关闭相关资源 JDBCUtil.close(resultSet, pstmt, conn); } - - + return flag; } -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java b/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java index 89a9565..ee5a9bb 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/CreateOrder.java @@ -5,24 +5,38 @@ import java.util.Vector; import com.lingnan.supermarket.dto.Buffer; import com.lingnan.supermarket.dto.Production; +// 用于创建订单相关文本内容 public class CreateOrder { - - public String CreateOrder(Vector v,String oNumber,String time,Float allPrice,String username) { - String xx="----------------------------------------------------------------------------\r\n"; - String InRequireText=time+"\r\n"+xx; - InRequireText += "#名称 #单价 #数量 #金额\r\n";/*生成订单小票*/ - for(Production p:v) { - InRequireText+=p.getName()+" "+p.getInPrice()+" "+p.getSum()+" "+p.getPrice()+"\r\n"; + // 用于生成一个完整的订单文本信息,接收商品信息向量、订单编号、时间、总价以及负责人用户名等参数 + public String CreateOrder(Vector v, String oNumber, String time, Float allPrice, String username) { + // 分割线 + String xx = "----------------------------------------------------------------------------\r\n"; + // 初始化订单文本内容 + String InRequireText = time + "\r\n" + xx; + + // 添加订单小票中商品信息展示的表头部分 + InRequireText += "#名称 #单价 #数量 #金额\r\n"; + //循环遍历传入的商品信息向量,将每个商品的具体信息按照设定的格式拼接添加到订单文本中 + for (Production p : v) { + InRequireText += p.getName() + " " + p.getInPrice() + " " + p.getSum() + " " + p.getPrice() + "\r\n"; } - InRequireText+="\r\n"+xx; - InRequireText+="#总进货金额:"+allPrice+"元"; - InRequireText+="\r\n#负责人:"+username; - InRequireText+="\r\n#订单编号:"+oNumber; - InRequireText+="\r\n#地址:新民超市"; - InRequireText+="\r\n#联系电话:xxx"; - + + // 添加一条分割线 + InRequireText += "\r\n" + xx; + + // 显示本次进货的总价金额 + InRequireText += "#总进货金额:" + allPrice + "元"; + // 显示订单的负责人 + InRequireText += "\r\n#负责人:" + username; + // 添加订单编号信息到订单文本中 + InRequireText += "\r\n#订单编号:" + oNumber; + // 添加超市地址信息到订单文本中,注明订单对应的收货地址等相关信息 + InRequireText += "\r\n#地址:新民超市"; + // 添加联系电话信息到订单文本中 + InRequireText += "\r\n#联系电话:xxx"; + + // 返回最终生成的完整订单文本内容 return InRequireText; } - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java index 21e4522..8297759 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/DateUtil.java @@ -3,20 +3,23 @@ package com.lingnan.supermarket.utils; import java.text.SimpleDateFormat; import java.util.Date; +// DateUtil类,从名称可以推测是用于处理日期相关操作的工具类 public class DateUtil { - - + /** - * 格式化日期 - * @param date - * @param pattern - * @return + * dateToString方法用于将给定的Date类型日期对象按照指定的格式转换为字符串表示形式。 + * + * @param date 要进行格式化的Date类型日期对象,代表一个具体的时间点,例如某个操作发生的时间等。 + * @param pattern 用于指定日期格式化的模式字符串,例如"yyyy-MM-dd HH:mm:ss"表示年-月-日 时:分:秒的格式。 + * 如果传入的pattern为null,则默认使用"yyyy-MM-dd HH:mm:ss"格式进行格式化。 + * @return 返回一个按照指定格式(或默认格式)格式化后的日期字符串,方便在界面显示、数据存储等场景使用。 */ - public static String dateToString(Date date,String pattern) { + public static String dateToString(Date date, String pattern) { + // 创建SimpleDateFormat对象,它是Java中用于格式化日期的类,通过指定的模式将日期转换为相应格式的字符串。 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); - simpleDateFormat.applyPattern(pattern==null?"yyyy-MM-dd HH:mm:ss":pattern); + // 使用applyPattern方法设置日期格式化的模式。如果传入的pattern为null,就使用默认的"yyyy-MM-dd HH:mm:ss"格式。 + simpleDateFormat.applyPattern(pattern == null? "yyyy-MM-dd HH:mm:ss" : pattern); + // 调用format方法,将传入的Date对象按照设置好的模式进行格式化,最终返回格式化后的日期字符串。 return simpleDateFormat.format(date); } - - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java b/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java index f3769fb..7fcaf89 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/EmailTest.java @@ -3,12 +3,12 @@ package com.lingnan.supermarket.utils; import javax.mail.MessagingException; import javax.mail.internet.AddressException; +// EmailTest类 public class EmailTest { + //Java程序的入口点 + // 这里声明抛出AddressException和MessagingException异常,意味着在方法执行过程中如果出现邮件地址相关或邮件发送相关的异常,将直接向上抛出,由调用者处理 public static void main(String[] args) throws AddressException, MessagingException { // TODO Auto-generated method stub - - } - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java b/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java index fbc664e..045ffcc 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/JDBCUtil.java @@ -8,23 +8,35 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; - + +// JDBCUtil工具类,用于管理数据库连接相关的操作,如加载数据库配置、获取数据库连接以及释放相关资源等 public class JDBCUtil { - + + // 用于存储数据库连接相关的配置信息,通过读取配置文件将配置项加载到该对象中 private static Properties properties; + // 数据库连接的URL地址 private static String url; + // 数据库连接的用户名 private static String user; + // 数据库连接的密码 private static String password; + + // 静态代码块,在类加载时执行,主要用于加载数据库配置文件并注册数据库驱动,同时获取配置文件中的连接相关信息 static { + // 通过类加载器获取配置文件的输入流,该文件应位于类路径下,以便能够正确读取 InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); - + + // 创建一个Properties对象,用于存储键值对形式的配置信息 properties = new Properties(); try { + // 将从输入流中读取配置文件的内容加载到Properties对象中 properties.load(inputStream); } catch (IOException e) { + // 若加载配置文件出现IO异常,打印异常栈信息 e.printStackTrace(); - }finally { - if(inputStream!=null){ + } finally { + // 在完成配置文件读取后释放资源 + if (inputStream!= null) { try { inputStream.close(); } catch (IOException e) { @@ -32,24 +44,29 @@ public class JDBCUtil { } } } - - //注册驱动 + + // 注册数据库驱动 try { - //类加载会触发static里面代码 + // 从配置文件中获取驱动类名属性,并加载该驱动类,类加载过程会执行驱动类中相关的静态代码,完成驱动在系统中的注册 Class.forName(properties.getProperty("driver")); - - url= properties.getProperty("url"); - user= properties.getProperty("user"); - password= properties.getProperty("password"); + + // 从配置文件中获取数据库连接的URL地址属性 + url = properties.getProperty("url"); + // 从配置文件中获取数据库连接的用户名属性 + user = properties.getProperty("user"); + // 从配置文件中获取数据库连接的密码属性 + password = properties.getProperty("password"); } catch (ClassNotFoundException e) { + // 若找不到指定的驱动类,打印异常栈信息 e.printStackTrace(); } } - - + /** - * 获取连接 - * @return + * 获取数据库连接的方法,通过DriverManager根据之前从配置文件中读取并设置好的URL、用户名和密码来建立数据库连接,并返回该连接对象。 + * 如果建立连接过程中出现SQL异常,会打印异常栈信息,并返回null,表示获取连接失败。 + * + * @return 返回建立好的数据库连接对象,若失败则返回null */ public static Connection getConn() { try { @@ -59,30 +76,31 @@ public class JDBCUtil { return null; } } - - + /** - * 释放资源 - * @param resultSet - * @param statement - * @param connection + * 释放数据库相关资源的方法,用于关闭ResultSet(结果集)、Statement(语句执行对象)以及Connection(数据库连接对象),避免资源泄漏。 + * 分别判断传入的对象是否为null,若不为null则调用相应的close方法进行关闭操作,若关闭过程中出现SQL异常,会打印异常栈信息。 + * + * @param resultSet 要关闭的结果集对象,通常是执行查询语句后返回的结果集,可为null + * @param statement 要关闭的语句执行对象,如PreparedStatement、Statement等,用于执行SQL语句,可为null + * @param connection 要关闭的数据库连接对象,用于与数据库建立连接,可为null */ - public static void close(ResultSet resultSet,Statement statement,Connection connection) { + public static void close(ResultSet resultSet, Statement statement, Connection connection) { try { - if(resultSet!=null) { - resultSet.close(); - } - if(statement!=null) { - statement.close(); - } - if(connection!=null) { - connection.close(); - } + // 如果结果集对象不为null,则关闭结果集,释放相关资源 + if (resultSet!= null) { + resultSet.close(); + } + // 如果语句执行对象不为null,则关闭语句执行对象,释放相关资源 + if (statement!= null) { + statement.close(); + } + // 如果数据库连接对象不为null,则关闭数据库连接,释放相关资源 + if (connection!= null) { + connection.close(); + } } catch (SQLException e) { e.printStackTrace(); } } - - - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/Test.java b/Supermarket/src/com/lingnan/supermarket/utils/Test.java index 0a416b5..ab6921b 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/Test.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/Test.java @@ -1,9 +1,9 @@ package com.lingnan.supermarket.utils; +//测试类,用于演示静态代码块的使用 public class Test { - static { - System.out.println("tasdasd."); + System.out.println("tasdasd."); // 打印一条测试信息 } -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java b/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java index 55cb65f..302fa1e 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/TimeAndOrder.java @@ -4,40 +4,69 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Random; +//具类,用于生成订单号和时间戳 public class TimeAndOrder { + + /** + * 生成订单号和当前时间戳。 + * 订单号由用户名、随机数、当前时间戳和另一个随机数组成。 + * 时间戳格式为 "yyyy-MM-dd HH:mm:ss"。 + * + * @param username 用户名,用于生成订单号的一部分。 + * @return 返回一个字符串数组,包含订单号和当前时间戳。 + */ public static String[] TimeAndOrder(String username) { - // TODO Auto-generated method stub - + // 创建一个长度为2的字符串数组,用于存储订单号和时间戳 String[] s = new String[2]; - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + + // 创建两个SimpleDateFormat对象,分别用于格式化日期和时间 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 格式化时间为 "yyyy-MM-dd HH:mm:ss" + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmss"); // 格式化时间为 "yyyyMMddHHmmss" + + // 获取当前时间的Calendar实例 Calendar cal = Calendar.getInstance(); - String date1 = sdf1.format(cal.getTime()); - String date2 = sdf2.format(cal.getTime()); - Random random=new Random(); - int result1=random.nextInt(10); - int result2=random.nextInt(10); + // 获取当前时间并格式化为字符串 + String date1 = sdf1.format(cal.getTime()); // 格式化时间为 "yyyy-MM-dd HH:mm:ss" + String date2 = sdf2.format(cal.getTime()); // 格式化时间为 "yyyyMMddHHmmss" - s[0]=username+result1+date2+result2; - s[1]=date1; - System.out.println(s[0]); - System.out.println(s[1]); + // 创建一个随机数生成器 + Random random = new Random(); - return s; + // 生成两个随机数 + int result1 = random.nextInt(10); // 生成0到9之间的随机数 + int result2 = random.nextInt(10); // 生成0到9之间的随机数 + + // 生成订单号:用户名 + 随机数 + 时间戳 + 随机数 + s[0] = username + result1 + date2 + result2; + + // 将当前时间戳存入数组的第二个元素 + s[1] = date1; + + // 打印订单号和时间戳(用于调试) + System.out.println(s[0]); // 打印订单号 + System.out.println(s[1]); // 打印时间戳 + // 返回包含订单号和时间戳的字符串数组 + return s; } - + + /** + * 生成当前日期,格式为 "yyyy-MM-dd"。 + * + * @return 返回当前日期的字符串表示。 + */ public static String yMdTime() { - // TODO Auto-generated method stub - - String[] s = new String[2]; - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); + // 创建一个SimpleDateFormat对象,用于格式化日期 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); // 格式化日期为 "yyyy-MM-dd" + + // 获取当前时间的Calendar实例 Calendar cal = Calendar.getInstance(); - String date = sdf1.format(cal.getTime()); - return date; + // 获取当前日期并格式化为字符串 + String date = sdf1.format(cal.getTime()); // 格式化日期为 "yyyy-MM-dd" + // 返回当前日期的字符串表示 + return date; } - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java b/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java index 07db185..c466bd4 100644 --- a/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java +++ b/Supermarket/src/com/lingnan/supermarket/utils/tplbTest.java @@ -1,82 +1,79 @@ package com.lingnan.supermarket.utils; -import java.awt. *; + +import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; - -import javax.swing. *; - - - +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Scanner; import java.awt.event.*; -public class tplbTest extends JFrame implements ActionListener -{ - static tplbTest tplb=new tplbTest(); - static JLabel pan=new JLabel(); - - static ImageIcon[] imgs = { - new ImageIcon("static\\bg\\bg1.jpg"), - new ImageIcon("static\\bg\\bg2.jpg"), - new ImageIcon("static\\bg\\bg3.jpg"), - new ImageIcon("static\\bg\\bg4.jpg"), - new ImageIcon("static\\bg\\bg5.jpg"), - new ImageIcon("static\\bg\\bg6.jpg"), - new ImageIcon("static\\bg\\bg7.jpg"), - new ImageIcon("static\\bg\\bg8.jpg"), - }; - - public static void settplb()/*�ܿ��*/ - { - tplb.setTitle("ͼƬ�ֲ�����"); - tplb.setLayout(null); - tplb.setSize(700,800); - tplb.setResizable(false); - tplb.setLocationRelativeTo(null);/*���þ���*/ - tplb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/*�رճ���*/ - tplb.setVisible(true); + +//用于展示图片轮播效果 +public class tplbTest extends JFrame implements ActionListener { + + // 创建一个tplbTest实例 + static tplbTest tplb = new tplbTest(); + + // 创建一个JLabel用于显示图片 + static JLabel pan = new JLabel(); + + // 定义图片数组,包含多个图片路径 + static ImageIcon[] imgs = { + new ImageIcon("static\\bg\\bg1.jpg"), + new ImageIcon("static\\bg\\bg2.jpg"), + new ImageIcon("static\\bg\\bg3.jpg"), + new ImageIcon("static\\bg\\bg4.jpg"), + new ImageIcon("static\\bg\\bg5.jpg"), + new ImageIcon("static\\bg\\bg6.jpg"), + new ImageIcon("static\\bg\\bg7.jpg"), + new ImageIcon("static\\bg\\bg8.jpg"), + }; + + //设置窗口的基本属性 + public static void settplb() { + tplb.setTitle("图片轮播测试"); // 设置窗口标题 + tplb.setLayout(null); // 设置布局为空布局 + tplb.setSize(700, 800); // 设置窗口大小 + tplb.setResizable(false); // 设置窗口不可调整大小 + tplb.setLocationRelativeTo(null); // 设置窗口居中显示 + tplb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭窗口时退出程序 + tplb.setVisible(true); // 设置窗口可见 + } + + //设置图片显示区域,并启动定时器实现图片轮播 + public static void setpan() { + pan.setBounds(50, 50, 500, 500); // 设置图片显示区域的坐标和大小 + tplb.add(pan); // 将图片显示区域添加到窗口中 + + // 创建一个定时器,每隔1000毫秒(1秒)触发一次 + Timer timer = new Timer(1000, L); + timer.start(); // 启动定时器 } + //定义一个ActionListener,用于定时切换图片 + static ActionListener L = new ActionListener() { + int index; // 图片索引 - public static void setpan() - { - pan.setBounds(50, 50, 500, 500); - tplb.add(pan); - Timer timer = new Timer(1000,L); - timer.start(); - } - - static ActionListener L=new ActionListener() - { - int index; @Override - public void actionPerformed(ActionEvent e) - { - pan.setIcon(imgs[index]); - index++; - if(index==7) - index=0; + public void actionPerformed(ActionEvent e) { + pan.setIcon(imgs[index]); // 设置当前显示的图片 + index++; // 图片索引加1 + if (index == 7) // 如果索引超出图片数组范围 + index = 0; // 重置索引为0 } }; - - - - - public static void main(String[] args) { - settplb(); - setpan(); - } + public static void main(String[] args) { + settplb(); // 设置窗口属性 + setpan(); // 设置图片显示区域并启动定时器 + } + //实现ActionListener接口的方法,用于处理事件 @Override public void actionPerformed(ActionEvent e) { - // TODO �Զ����ɵķ������ - + // 未实现 } - - - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/InView.java b/Supermarket/src/com/lingnan/supermarket/view/InView.java index 3a2e30d..585a2ee 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/InView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/InView.java @@ -20,7 +20,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; -import javax.swing.text.html.HTMLDocument.Iterator; import com.lingnan.supermarket.componet.BGPanel; import com.lingnan.supermarket.dao.impl.BufferImpl; @@ -43,471 +42,421 @@ import com.lingnan.supermarket.utils.SendQQMailUtil; import com.lingnan.supermarket.utils.TimeAndOrder; import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; -public class InView extends JPanel implements ActionListener{ - - - //上面 +/** + * 用于显示进货系统的界面。 + * 包含进货系统的各种操作按钮、搜索框、表格等组件。 + */ +public class InView extends JPanel implements ActionListener { + + // 顶部工具栏面板 private JPanel toolBarPanel; - + + // 搜索面板 private JPanel searchPanel; - private JLabel nameLabel,locationLabel; + private JLabel nameLabel, locationLabel; private JTextField nameSearchTF; - private JButton searchBtn,StockBtn,exitBtn; - + private JButton searchBtn, StockBtn, exitBtn; + + // 操作面板 private JPanel opePanel; - private JButton addBtn,updateBtn,deleteBtn,historyBtn,backBtn,detailBtn; - - //中间 + private JButton addBtn, updateBtn, deleteBtn, historyBtn, backBtn, detailBtn; + + // 中间表格区域 private JScrollPane tableScrollPane; private JTable inTable; - - //下面 - private JPanel bottomPanel,bottomPanelLeft,bottomPanelRight; - private JLabel countInfoLabel,countInfoLabel2; - + + // 底部面板 + private JPanel bottomPanel, bottomPanelLeft, bottomPanelRight; + private JLabel countInfoLabel, countInfoLabel2; + + // 缓冲区对象 private Buffer Buffer; private BufferImpl BufferImpl; - - private static Vector v = new Vector(); - + + // 商品向量 + private static Vector v = new Vector(); + + // 状态下拉框 private JComboBox combo; - private String[] status ={"全部","已入库","待入库","已取消"}; + private String[] status = {"全部", "已入库", "待入库", "已取消"}; private int catalog; - + + // 主窗口和用户信息 private JFrame jFrame; private User user; - - private InTableModel inTableModel ; - + + // 表格模型 + private InTableModel inTableModel; + + // 缓冲区实现类 private BufferImpl bufferImpl = new BufferImpl(); - - private int mark;/*标记从提醒那里来1是进货表,0是提醒过来的表*/ - + + // 标记从提醒那里来1是进货表,0是提醒过来的表 + private int mark; + + // 进货订单服务实现类 private inOrderServiceImpl inOrderImpl; - + + // 总价和行数 private Float allPrice; private int row; private String uname; - - public InView(JFrame jFrame,User user,Vector v,int mark) { - this.setLayout(new BorderLayout()); - this.jFrame = jFrame; - this.user = user; - //获得进货缓冲区的保存的货物并删除缓冲区 - this.v =bufferImpl.allInBuffer(); - bufferImpl.DelAllInBuffer(); - - this.mark=mark; - System.out.println("mark="+mark); - uname = user.getUsername(); - initView(); - - + + //构造函数 + + public InView(JFrame jFrame, User user, Vector v, int mark) { + this.setLayout(new BorderLayout()); // 设置布局为BorderLayout + this.jFrame = jFrame; // 设置主窗口 + this.user = user; // 设置用户信息 + // 获得进货缓冲区的保存的货物并删除缓冲区 + this.v = bufferImpl.allInBuffer(); // 从缓冲区获取商品数据 + bufferImpl.DelAllInBuffer(); // 清空缓冲区 + + this.mark = mark; // 设置标记 + System.out.println("mark=" + mark); // 打印标记值 + uname = user.getUsername(); // 获取用户名 + initView(); // 初始化界面 } - + + // 初始化界面组件。 private void initView() { - - - toolBarPanel = new JPanel(new BorderLayout()); - - searchPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - nameLabel = new JLabel("订单号"); - nameSearchTF = new JTextField(20); - searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); - searchBtn.addActionListener(this); - locationLabel=new JLabel("当前位置>进货系统"); - locationLabel.setFont(new FontUtil().userFont); - locationLabel.setForeground(new Color(18, 150, 219)); - - - - combo = new JComboBox(status); - combo.addItemListener(new MyItemListener()); - - - - opePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - addBtn =new JButton(new ImageIcon("static\\icon\\add.png")); - updateBtn =new JButton(new ImageIcon("static\\icon\\change.png")); - deleteBtn =new JButton(new ImageIcon("static\\icon\\delete.png")); - historyBtn =new JButton(new ImageIcon("static\\icon\\history.png")); - backBtn =new JButton(new ImageIcon("static\\icon\\back.png")); - detailBtn = new JButton(new ImageIcon("static\\icon\\detail.png")); - - addBtn.addActionListener(this); - updateBtn.addActionListener(this); - deleteBtn.addActionListener(this); - historyBtn.addActionListener(this); - backBtn.addActionListener(this); - detailBtn.addActionListener(this); - - backBtn.setVisible(false);/*在记录页面显示出来*/ - detailBtn.setVisible(false);/*在订单详情页显示出来*/ - - opePanel.add(addBtn); - opePanel.add(backBtn); - opePanel.add(detailBtn); - opePanel.add(updateBtn); - opePanel.add(deleteBtn); - opePanel.add(historyBtn); - - - searchPanel.add(locationLabel); - searchPanel.add(nameLabel); - searchPanel.add(nameSearchTF); - searchPanel.add(searchBtn); - searchPanel.add(combo); - - - - toolBarPanel.add(searchPanel,"West"); - toolBarPanel.add(opePanel,"East"); - - - //中间表 - inTableModel = new InTableModel(v); - - inTable = new JTable(inTableModel); - inTable.setFont(FontUtil.tableFont); - inTable.setRowHeight(50); - tableScrollPane = new JScrollPane(inTable); - - allPrice = inTableModel.getAllPrice(); - row = inTableModel.getRowCount(); - - - //下面 - bottomPanelLeft = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - countInfoLabel = new JLabel("商品种类:"+row+",总价:"+allPrice); - bottomPanelLeft.add(countInfoLabel,"Left"); - - bottomPanelRight = new JPanel(new FlowLayout(FlowLayout.LEFT)); - StockBtn =new JButton(new ImageIcon("static\\icon\\stock.png"));/*结账按钮*/ - exitBtn =new JButton(new ImageIcon("static\\icon\\exit.png"));/*退出按钮*/ - StockBtn.addActionListener(this); - exitBtn.addActionListener(this); - bottomPanelRight.add(StockBtn); - bottomPanelRight.add(exitBtn); - - bottomPanel = new JPanel(new BorderLayout()); - bottomPanel.add(bottomPanelRight,"East"); - bottomPanel.add(bottomPanelLeft,"West"); - - - this.add(toolBarPanel,"North"); - this.add(tableScrollPane,"Center");/*将表格放到中间*/ - this.add(bottomPanel,"South"); - - if(mark==1) /*判断是不是从提醒那里过来的*/{ - refreshBuffer(v); - } - - else if(mark==0) { - InOrderRecord(); - } - + toolBarPanel = new JPanel(new BorderLayout()); // 创建顶部工具栏面板 + + searchPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // 创建搜索面板 + nameLabel = new JLabel("订单号"); // 创建订单号标签 + nameSearchTF = new JTextField(20); // 创建订单号搜索文本框 + searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); // 创建搜索按钮 + searchBtn.addActionListener(this); // 为搜索按钮添加事件监听器 + locationLabel = new JLabel("当前位置>进货系统"); // 创建位置标签 + locationLabel.setFont(new FontUtil().userFont); // 设置字体 + locationLabel.setForeground(new Color(18, 150, 219)); // 设置颜色 + + combo = new JComboBox(status); // 创建状态下拉框 + combo.addItemListener(new MyItemListener()); // 为下拉框添加事件监听器 + + opePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); // 创建操作面板 + addBtn = new JButton(new ImageIcon("static\\icon\\add.png")); // 创建添加按钮 + updateBtn = new JButton(new ImageIcon("static\\icon\\change.png")); // 创建更新按钮 + deleteBtn = new JButton(new ImageIcon("static\\icon\\delete.png")); // 创建删除按钮 + historyBtn = new JButton(new ImageIcon("static\\icon\\history.png")); // 创建历史记录按钮 + backBtn = new JButton(new ImageIcon("static\\icon\\back.png")); // 创建返回按钮 + detailBtn = new JButton(new ImageIcon("static\\icon\\detail.png")); // 创建详情按钮 + + addBtn.addActionListener(this); // 为添加按钮添加事件监听器 + updateBtn.addActionListener(this); // 为更新按钮添加事件监听器 + deleteBtn.addActionListener(this); // 为删除按钮添加事件监听器 + historyBtn.addActionListener(this); // 为历史记录按钮添加事件监听器 + backBtn.addActionListener(this); // 为返回按钮添加事件监听器 + detailBtn.addActionListener(this); // 为详情按钮添加事件监听器 + + backBtn.setVisible(false); // 隐藏返回按钮 + detailBtn.setVisible(false); // 隐藏详情按钮 + + opePanel.add(addBtn); // 添加添加按钮到操作面板 + opePanel.add(backBtn); // 添加返回按钮到操作面板 + opePanel.add(detailBtn); // 添加详情按钮到操作面板 + opePanel.add(updateBtn); // 添加更新按钮到操作面板 + opePanel.add(deleteBtn); // 添加删除按钮到操作面板 + opePanel.add(historyBtn); // 添加历史记录按钮到操作面板 + + searchPanel.add(locationLabel); // 添加位置标签到搜索面板 + searchPanel.add(nameLabel); // 添加订单号标签到搜索面板 + searchPanel.add(nameSearchTF); // 添加订单号搜索文本框到搜索面板 + searchPanel.add(searchBtn); // 添加搜索按钮到搜索面板 + searchPanel.add(combo); // 添加状态下拉框到搜索面板 + + toolBarPanel.add(searchPanel, "West"); // 将搜索面板添加到工具栏面板的西侧 + toolBarPanel.add(opePanel, "East"); // 将操作面板添加到工具栏面板的东侧 + + // 中间表 + inTableModel = new InTableModel(v); // 创建表格模型 + + inTable = new JTable(inTableModel); // 创建表格 + inTable.setFont(FontUtil.tableFont); // 设置表格字体 + inTable.setRowHeight(50); // 设置表格行高 + tableScrollPane = new JScrollPane(inTable); // 创建表格滚动面板 + + allPrice = inTableModel.getAllPrice(); // 获取总价 + row = inTableModel.getRowCount(); // 获取行数 + + // 下面 + bottomPanelLeft = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // 创建底部左侧面板 + countInfoLabel = new JLabel("商品种类:" + row + ",总价:" + allPrice); // 创建商品种类和总价标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + + bottomPanelRight = new JPanel(new FlowLayout(FlowLayout.LEFT)); // 创建底部右侧面板 + StockBtn = new JButton(new ImageIcon("static\\icon\\stock.png")); // 创建结账按钮 + exitBtn = new JButton(new ImageIcon("static\\icon\\exit.png")); // 创建退出按钮 + StockBtn.addActionListener(this); // 为结账按钮添加事件监听器 + exitBtn.addActionListener(this); // 为退出按钮添加事件监听器 + bottomPanelRight.add(StockBtn); // 将结账按钮添加到底部右侧面板 + bottomPanelRight.add(exitBtn); // 将退出按钮添加到底部右侧面板 + + bottomPanel = new JPanel(new BorderLayout()); // 创建底部面板 + bottomPanel.add(bottomPanelRight, "East"); // 将底部右侧面板添加到底部面板的东侧 + bottomPanel.add(bottomPanelLeft, "West"); // 将底部左侧面板添加到底部面板的西侧 - + this.add(toolBarPanel, "North"); // 将工具栏面板添加到顶部 + this.add(tableScrollPane, "Center"); // 将表格滚动面板添加到中间 + this.add(bottomPanel, "South"); // 将底部面板添加到底部 - - setVisible(true); - - + if (mark == 1) { // 判断是否从提醒那里过来的 + refreshBuffer(v); // 刷新缓冲区 + } else if (mark == 0) { + InOrderRecord(); // 调出进货订单表 + } - - - + setVisible(true); // 设置可见 } - - public static Vector getVector(){ + //获取商品数量 + public static Vector getVector() { return v; } - - + + //处理状态下拉框的选项变化 public class MyItemListener implements ItemListener { @Override public void itemStateChanged(ItemEvent e) { - JComboBox cb = (JComboBox) e.getSource(); - String catalog1 = (String) cb.getSelectedItem(); - if(catalog1.equals("全部")) - catalog=0; - else if(catalog1.equals("已入库")) - catalog=1; - else if(catalog1.equals("待入库")) - catalog=2; - else if(catalog1.equals("已取消")) - catalog=3; - - resultOfFindStatus(catalog); - - } + JComboBox cb = (JComboBox) e.getSource(); // 获取事件源 + String catalog1 = (String) cb.getSelectedItem(); // 获取选中的状态 + if (catalog1.equals("全部")) + catalog = 0; + else if (catalog1.equals("已入库")) + catalog = 1; + else if (catalog1.equals("待入库")) + catalog = 2; + else if (catalog1.equals("已取消")) + catalog = 3; + resultOfFindStatus(catalog); // 根据状态查询结果 } + } - - - - //按钮组件隐藏 + //按钮组件隐藏。 public void OrderView() { - backBtn.setVisible(true); - detailBtn.setVisible(true); - updateBtn.setVisible(true); - deleteBtn.setVisible(true); - addBtn.setVisible(false); - historyBtn.setVisible(false); + backBtn.setVisible(true); // 显示返回按钮 + detailBtn.setVisible(true); // 显示详情按钮 + updateBtn.setVisible(true); // 显示更新按钮 + deleteBtn.setVisible(true); // 显示删除按钮 + addBtn.setVisible(false); // 隐藏添加按钮 + historyBtn.setVisible(false); // 隐藏历史记录按钮 } - - + + //根据订单号查询结果 public void resultOfNumber(String iNumber) { - this.mark=0; - InOrderTM inOrderTM = new InOrderTM(); - inOrderTM.resultOfNumber(iNumber); - inTable.setModel(inOrderTM); - bottomPanelLeft.removeAll(); - countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); - bottomPanelLeft.add(countInfoLabel); - OrderView(); - } - + this.mark = 0; // 设置标记为0 + InOrderTM inOrderTM = new InOrderTM(); // 创建进货订单表格模型 + inOrderTM.resultOfNumber(iNumber); // 根据订单号查询结果 + inTable.setModel(inOrderTM); // 设置表格模型 + bottomPanelLeft.removeAll(); // 清空底部左侧面板 + countInfoLabel = new JLabel("共" + inOrderTM.getRowCount() + "条记录"); // 创建记录数标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + OrderView(); // 调用OrderView方法 + } + + //根据状态查询结果 public void resultOfFindStatus(int catalog) { - this.mark=0; - InOrderTM inOrderTM = new InOrderTM(); - inOrderTM.resultOfFind(catalog); - inTable.setModel(inOrderTM); - bottomPanelLeft.removeAll(); - countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); - bottomPanelLeft.add(countInfoLabel); - OrderView(); + this.mark = 0; // 设置标记为0 + InOrderTM inOrderTM = new InOrderTM(); // 创建进货订单表格模型 + inOrderTM.resultOfFind(catalog); // 根据状态查询结果 + inTable.setModel(inOrderTM); // 设置表格模型 + bottomPanelLeft.removeAll(); // 清空底部左侧面板 + countInfoLabel = new JLabel("共" + inOrderTM.getRowCount() + "条记录"); // 创建记录数标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + OrderView(); // 调用OrderView方法 } - - /*刷新*/ - public void refreshBuffer(Vector v) { - this.mark=1; - - InTableModel inTableModel = new InTableModel(v); - inTable.setModel(inTableModel); - bottomPanelLeft.removeAll(); - countInfoLabel = new JLabel("商品种类:"+inTableModel.getRowCount()+",总价:"+inTableModel.getAllPrice()); - bottomPanelLeft.add(countInfoLabel); - backBtn.setVisible(false); - detailBtn.setVisible(false); - historyBtn.setVisible(true); - updateBtn.setVisible(true); - addBtn.setVisible(true); - deleteBtn.setVisible(true); - - allPrice = inTableModel.getAllPrice(); - row = inTableModel.getRowCount(); + //刷新缓冲区 + public void refreshBuffer(Vector v) { + this.mark = 1; // 设置标记为1 + + InTableModel inTableModel = new InTableModel(v); // 创建表格模型 + inTable.setModel(inTableModel); // 设置表格模型 + bottomPanelLeft.removeAll(); // 清空底部左侧面板 + countInfoLabel = new JLabel("商品种类:" + inTableModel.getRowCount() + ",总价:" + inTableModel.getAllPrice()); // 创建商品种类和总价标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + backBtn.setVisible(false); // 隐藏返回按钮 + detailBtn.setVisible(false); // 隐藏详情按钮 + historyBtn.setVisible(true); // 显示历史记录按钮 + updateBtn.setVisible(true); // 显示更新按钮 + addBtn.setVisible(true); // 显示添加按钮 + deleteBtn.setVisible(true); // 显示删除按钮 + + allPrice = inTableModel.getAllPrice(); // 获取总价 + row = inTableModel.getRowCount(); // 获取行数 } - - /*调出进货订单表*/ + + //调出进货订单表。 public void InOrderRecord() { - this.mark=0; - InOrderTM inOrderTM = new InOrderTM(); - inOrderTM.allInOrderRecord(); - inTable.setModel(inOrderTM); - bottomPanelLeft.removeAll(); - countInfoLabel = new JLabel("共"+inOrderTM.getRowCount()+"条记录"); - bottomPanelLeft.add(countInfoLabel); - OrderView(); - + this.mark = 0; // 设置标记为0 + InOrderTM inOrderTM = new InOrderTM(); // 创建进货订单表格模型 + inOrderTM.allInOrderRecord(); // 查询所有进货订单记录 + inTable.setModel(inOrderTM); // 设置表格模型 + bottomPanelLeft.removeAll(); // 清空底部左侧面板 + countInfoLabel = new JLabel("共" + inOrderTM.getRowCount() + "条记录"); // 创建记录数标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + OrderView(); // 调用OrderView方法 } - - /*调出进货订单表*/ + + // 调出进货订单表 public void InRecord(String iNumber) { - this.mark=2; - InRecordTM inRecordTM = new InRecordTM(iNumber); - inRecordTM.findInRecordByINumber(); - inTable.setModel(inRecordTM); - bottomPanelLeft.removeAll(); - countInfoLabel = new JLabel("订单号@"+iNumber+"共有"+inRecordTM.getRowCount()+"条记录"); - bottomPanelLeft.add(countInfoLabel); - backBtn.setVisible(true); - detailBtn.setVisible(false); - updateBtn.setVisible(false); - addBtn.setVisible(false); - historyBtn.setVisible(false); - deleteBtn.setVisible(false); - + this.mark = 2; // 设置标记为2 + InRecordTM inRecordTM = new InRecordTM(iNumber); // 创建进货记录表格模型 + inRecordTM.findInRecordByINumber(); // 根据订单号查询进货记录 + inTable.setModel(inRecordTM); // 设置表格模型 + bottomPanelLeft.removeAll(); // 清空底部左侧面板 + countInfoLabel = new JLabel("订单号@" + iNumber + "共有" + inRecordTM.getRowCount() + "条记录"); // 创建记录数标签 + bottomPanelLeft.add(countInfoLabel); // 将标签添加到底部左侧面板 + backBtn.setVisible(true); // 显示返回按钮 + detailBtn.setVisible(false); // 隐藏详情按钮 + updateBtn.setVisible(false); // 隐藏更新按钮 + addBtn.setVisible(false); // 隐藏添加按钮 + historyBtn.setVisible(false); // 隐藏历史记录按钮 + deleteBtn.setVisible(false); // 隐藏删除按钮 } - - - - - /*按钮监听时间*/ + //按钮监听事件 @Override public void actionPerformed(ActionEvent e) { - BufferImpl = new BufferImpl();/*获得购物车*/ - Object source = e.getSource(); - - if(searchBtn==source) { - String number = nameSearchTF.getText(); - System.out.println("搜索后的订单:"+number); - resultOfNumber(number); - } + BufferImpl = new BufferImpl(); // 获取购物车 + Object source = e.getSource(); // 获取事件源 - else if(addBtn==source) {/*添加*/ - InDialog outDialog = new InDialog(jFrame,v,user); - outDialog.setVisible(true); - v=outDialog.getVector(); - refreshBuffer(v); - - } - - - else if(updateBtn==source) {/*更新*/ - System.out.println("mark="+mark); - int rowIndex = inTable.getSelectedRow(); - if(rowIndex==-1) { - JOptionPane.showMessageDialog(this,"请选中一条进行更改数量"); - return; - } - //进货表修改 - if(mark==1) { - String id =(String) inTable.getValueAt(rowIndex,0); - ChangeSumDialog changesumDialog = new ChangeSumDialog(jFrame,id,"In",v); - changesumDialog.setVisible(true); - v = changesumDialog.getVector(); - System.out.println("更改状态后v.size="+v.size()); - refreshBuffer(v); + if (searchBtn == source) { // 如果是搜索按钮 + String number = nameSearchTF.getText(); // 获取搜索的订单号 + System.out.println("搜索后的订单:" + number); // 打印订单号 + resultOfNumber(number); // 根据订单号查询结果 + } else if (addBtn == source) { // 如果是添加按钮 + InDialog outDialog = new InDialog(jFrame, v, user); // 创建添加对话框 + outDialog.setVisible(true); // 显示对话框 + v = outDialog.getVector(); // 获取更新后的商品向量 + refreshBuffer(v); // 刷新缓冲区 + } else if (updateBtn == source) { // 如果是更新按钮 + System.out.println("mark=" + mark); // 打印标记值 + int rowIndex = inTable.getSelectedRow(); // 获取选中的行 + if (rowIndex == -1) { // 如果没有选中行 + JOptionPane.showMessageDialog(this, "请选中一条进行更改数量"); // 提示用户选中行 + return; + } + // 进货表修改 + if (mark == 1) { + String id = (String) inTable.getValueAt(rowIndex, 0); // 获取选中行的ID + ChangeSumDialog changesumDialog = new ChangeSumDialog(jFrame, id, "In", v); // 创建更改数量对话框 + changesumDialog.setVisible(true); // 显示对话框 + v = changesumDialog.getVector(); // 获取更新后的商品向量 + System.out.println("更改状态后v.size=" + v.size()); // 打印商品向量大小 + refreshBuffer(v); // 刷新缓冲区 } - - //inOrder修改,修改状态 - else if(mark==0) { - String iNumber =(String) inTable.getValueAt(rowIndex,0); - String status =(String) inTable.getValueAt(rowIndex,4); - if(status.equals("已入库")) { - JOptionPane.showMessageDialog(this,"订单上的货物已入库无法修改状态","提示",JOptionPane.INFORMATION_MESSAGE); + // inOrder修改,修改状态 + else if (mark == 0) { + String iNumber = (String) inTable.getValueAt(rowIndex, 0); // 获取选中行的订单号 + String status = (String) inTable.getValueAt(rowIndex, 4); // 获取选中行的状态 + if (status.equals("已入库")) { // 如果状态是已入库 + JOptionPane.showMessageDialog(this, "订单上的货物已入库无法修改状态", "提示", JOptionPane.INFORMATION_MESSAGE); // 提示用户无法修改状态 return; } - - ChangeStatusDialog changeStatusDialog = new ChangeStatusDialog(jFrame,iNumber,status); - changeStatusDialog.setVisible(true); - MainView.refreshRemind(); - HomeView.refreshHome(); - InOrderRecord(); + + ChangeStatusDialog changeStatusDialog = new ChangeStatusDialog(jFrame, iNumber, status); // 创建更改状态对话框 + changeStatusDialog.setVisible(true); // 显示对话框 + MainView.refreshRemind(); // 刷新提醒 + HomeView.refreshHome(); // 刷新主页 + InOrderRecord(); // 调出进货订单表 + } + } else if (deleteBtn == source) { // 如果是删除按钮 + int rowIndex = inTable.getSelectedRow(); // 获取选中的行 + if (rowIndex == -1) { // 如果没有选中行 + JOptionPane.showMessageDialog(this, "请选中一条"); // 提示用户选中行 + return; } - - } - - - else if(deleteBtn==source) { - int rowIndex = inTable.getSelectedRow(); - if(rowIndex==-1) { - JOptionPane.showMessageDialog(this,"请选中一条"); - return; - } - - /*删除进货表的*/ - if(mark==1) { - System.out.println("删除进货表"); - String id =(String) inTable.getValueAt(rowIndex,0); - int select = JOptionPane.showConfirmDialog(this,"是否删除id为"+id+"的记录","提示",JOptionPane.YES_NO_OPTION); - if(select==JOptionPane.YES_OPTION) {/*选择是*/ - for(int i =0;i(); - refreshBuffer(v); - MainView.refreshRemind(); - JOptionPane.showConfirmDialog(null,"发送邮件成功\r\n订单号:"+s[0]+"\r\n负责人:"+uname, "提示", JOptionPane.YES_OPTION); - + + /* 生成订单文本 */ + CreateOrder createOrder = new CreateOrder(); // 创建订单生成工具类 + String OrderText = createOrder.CreateOrder(v, s[0], s[1], allPrice, uname); // 生成订单文本 + try { // 发送邮件 + SendQQMailUtil QQEmail = new SendQQMailUtil("cwfeng5@qq.com", "wlcinslohrgpdiac", "1912638153@qq.com", "@新民超市进货需求申请", OrderText); // 创建邮件发送工具类 + } catch (MessagingException e1) { // 捕获异常 + e1.printStackTrace(); // 打印异常信息 } - - - } - - }else if(exitBtn==source) { - int res = JOptionPane.showConfirmDialog(null,"确定退出并清空购物车吗", "结账", JOptionPane.YES_NO_OPTION); - if(res==JOptionPane.YES_OPTION)/*如果退出*/{ - v=new Vector();/*将数组置空*/ - refreshBuffer(v); - JOptionPane.showConfirmDialog(null,"退出成功", "提示", JOptionPane.PLAIN_MESSAGE); + v = new Vector(); // 清空商品向量 + refreshBuffer(v); // 刷新缓冲区 + MainView.refreshRemind(); // 刷新提醒 + JOptionPane.showConfirmDialog(null, "发送邮件成功\r\n订单号:" + s[0] + "\r\n负责人:" + uname, "提示", JOptionPane.YES_OPTION); // 提示用户发送邮件成功 } } + } else if (exitBtn == source) { // 如果是退出按钮 + int res = JOptionPane.showConfirmDialog(null, "确定退出并清空购物车吗", "结账", JOptionPane.YES_NO_OPTION); // 提示用户确认退出 + if (res == JOptionPane.YES_OPTION) { // 如果用户选择是 + v = new Vector(); // 清空商品向量 + refreshBuffer(v); // 刷新缓冲区 + JOptionPane.showConfirmDialog(null, "退出成功", "提示", JOptionPane.PLAIN_MESSAGE); // 提示用户退出成功 + } } } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/MainView.java b/Supermarket/src/com/lingnan/supermarket/view/MainView.java index 6aff0af..0dfd24f 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/MainView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/MainView.java @@ -40,337 +40,282 @@ import com.lingnan.supermarket.view.base.BaseView; import java.awt.*; -public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{ - - - JMenuBar menuBar; - JMenu settingMenu,helpMenu; - - JMenuItem skinMenuItem,configMenuItem; - - - JSplitPane containerPanel; - - CardLayout rightPanelLayout; - JPanel leftPanel,rightPanel; - - /*菜单栏*/ - JLabel logoLabel,userMenuLabel1,homeMenuLabel,userMenuLabel,inMenuLabel, - outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel; - - static JLabel remindMenuLabel;/*全局调用刷新*/ - - JPanel bottomPanel; - - JLabel timeLabel; - - JPanel purposePanel,timePanel; - JLabel purposeLabel; - - - JButton saveBtn,unSaveBtn,cancleBtn;/*退出时按钮*/ - - // - Timer timer; - - private User user ;/*从登录界面传过来的用户信息*/ - - private BufferImpl bufferImpl; - - private Image bgImage ; - private String iconSkin; - private int skin; - - private Vector vP=new Vector() ;/*用于进货缓存*/ - - - private int location; - - private int sSuper=-1;//界面权限 - - private static inOrderServiceImpl inOrderImpl = new inOrderServiceImpl(); - private static int unConfirmmark;/*未确认订单*/ - - public MainView(User user,int skin,String iconSkin) { - super(1300,850,"新民超市管理系统欢迎您",user,skin); - timer = new Timer(1000,this); - timer.start(); - this.user = user; - - this.sSuper=user.getUsuper();//界面权限 - System.out.println("userid="+user.getId()); - this.addWindowListener(this); - - this.skin = skin; - this.iconSkin = iconSkin; - ImageIcon icon=new ImageIcon(iconSkin); //xxx代表图片存放路径,2.png图片名称及格式 - this.setIconImage(icon.getImage()); - - //获得未进货的信息 +//主界面类,继承自BaseView,实现了ActionListener、MouseListener和WindowListener接口。 + +public class MainView extends BaseView implements ActionListener, MouseListener, WindowListener { + + JMenuBar menuBar; // 菜单栏 + JMenu settingMenu, helpMenu; // 设置菜单和帮助菜单 + JMenuItem skinMenuItem, configMenuItem; // 皮肤菜单项和配置菜单项 + JSplitPane containerPanel; // 主界面容器,分为左右两部分 + CardLayout rightPanelLayout; // 右侧面板的布局管理器 + JPanel leftPanel, rightPanel; // 左侧和右侧的面板 + + /* 菜单栏 */ + JLabel logoLabel, userMenuLabel1, homeMenuLabel, userMenuLabel, inMenuLabel, + outMenuLabel, storageMenuLabel, supplierMenuLabel, catalogMenuLabel; + + static JLabel remindMenuLabel; // 全局调用刷新的提醒标签 + + JPanel bottomPanel; // 底部面板 + JLabel timeLabel; // 显示时间的标签 + JPanel purposePanel, timePanel; // 显示当前位置和时间的面板 + JLabel purposeLabel; // 显示当前位置的标签 + + JButton saveBtn, unSaveBtn, cancleBtn; // 退出时的按钮 + + Timer timer; // 定时器,用于更新时间 + + private User user; // 从登录界面传过来的用户信息 + private BufferImpl bufferImpl; // 缓存实现类 + private Image bgImage; // 背景图片 + private String iconSkin; // 图标皮肤 + private int skin; // 当前皮肤编号 + private Vector vP = new Vector(); // 用于进货缓存 + private int location; // 当前界面的位置 + private int sSuper = -1; // 界面权限 + + private static inOrderServiceImpl inOrderImpl = new inOrderServiceImpl(); // 进货订单服务实现类 + private static int unConfirmmark; // 未确认订单数量 + + //构造函数,初始化主界面并设置用户信息和皮肤 + public MainView(User user, int skin, String iconSkin) { + super(1300, 850, "新民超市管理系统欢迎您", user, skin); + timer = new Timer(1000, this); // 创建定时器,每秒触发一次 + timer.start(); // 启动定时器 + this.user = user; // 设置用户信息 + this.sSuper = user.getUsuper(); // 获取用户权限 + System.out.println("userid=" + user.getId()); // 打印用户ID + this.addWindowListener(this); // 添加窗口监听器 + this.skin = skin; // 设置皮肤编号 + this.iconSkin = iconSkin; // 设置图标皮肤路径 + ImageIcon icon = new ImageIcon(iconSkin); // 创建图标 + this.setIconImage(icon.getImage()); // 设置窗口图标 + + // 获取未进货的信息 Vector vInOrder; - vInOrder = inOrderImpl.findUnconfirmInOrder(); - unConfirmmark=vInOrder.size(); - + vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找未确认的进货订单 + unConfirmmark = vInOrder.size(); // 设置未确认订单数量 - initView(user,skin); + initView(user, skin); // 初始化界面 } + //构造函数,初始化主界面并设置用户信息 public MainView(User user) { - super(1300,850,"新民超市管理系统欢迎您"); - timer = new Timer(1000,this); - timer.start(); - this.user = user; - - this.sSuper=user.getUsuper();//界面权限 - System.out.println("userid="+user.getId()); - this.addWindowListener(this); - - - //获得未进货的信息 + super(1300, 850, "新民超市管理系统欢迎您"); + timer = new Timer(1000, this); // 创建定时器,每秒触发一次 + timer.start(); // 启动定时器 + this.user = user; // 设置用户信息 + this.sSuper = user.getUsuper(); // 获取用户权限 + System.out.println("userid=" + user.getId()); // 打印用户ID + this.addWindowListener(this); // 添加窗口监听器 + + // 获取未进货的信息 Vector vInOrder; - vInOrder = inOrderImpl.findUnconfirmInOrder(); - unConfirmmark=vInOrder.size(); - + vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找未确认的进货订单 + unConfirmmark = vInOrder.size(); // 设置未确认订单数量 - initView(user,skin); + initView(user, skin); // 初始化界面 } + //刷新提醒标签,更新未确认订单数量 public static void refreshRemind() { Vector vInOrder; - vInOrder = inOrderImpl.findUnconfirmInOrder(); - unConfirmmark=vInOrder.size(); - remindMenuLabel.setText("待确认进货:"+unConfirmmark); + vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找未确认的进货订单 + unConfirmmark = vInOrder.size(); // 更新未确认订单数量 + remindMenuLabel.setText("待确认进货:" + unConfirmmark); // 更新提醒标签的文本 } - - - - -/* public static User getUserInf() { - return user; - }*/ - + //初始化界面,设置菜单栏、左侧菜单栏、右侧内容面板等 @Override - protected void initView(User user,int skin) { - - - - - /*菜单栏*/ - menuBar = new JMenuBar(); - - settingMenu = new JMenu("设置"); - - helpMenu = new JMenu("帮助"); - - skinMenuItem = new JMenuItem("随机切换皮肤",new ImageIcon("static\\icon\\skin.png")); - -/* for(int i = 3;i<9;i++) { - - }*/ - configMenuItem = new JMenuItem("参数设置",new ImageIcon("static\\icon\\setting.png")); - skinMenuItem.addActionListener(this); - - settingMenu.add(configMenuItem); - settingMenu.add(skinMenuItem); - menuBar.add(settingMenu); - menuBar.add(helpMenu); - - setJMenuBar(menuBar); - - - /*左边菜单栏设置*/ - - + protected void initView(User user, int skin) { + /* 菜单栏 */ + menuBar = new JMenuBar(); // 创建菜单栏 + settingMenu = new JMenu("设置"); // 创建设置菜单 + helpMenu = new JMenu("帮助"); // 创建帮助菜单 + skinMenuItem = new JMenuItem("随机切换皮肤", new ImageIcon("static\\icon\\skin.png")); // 创建皮肤菜单项 + configMenuItem = new JMenuItem("参数设置", new ImageIcon("static\\icon\\setting.png")); // 创建配置菜单项 + skinMenuItem.addActionListener(this); // 为皮肤菜单项添加事件监听器 + settingMenu.add(configMenuItem); // 将配置菜单项添加到设置菜单 + settingMenu.add(skinMenuItem); // 将皮肤菜单项添加到设置菜单 + menuBar.add(settingMenu); // 将设置菜单添加到菜单栏 + menuBar.add(helpMenu); // 将帮助菜单添加到菜单栏 + setJMenuBar(menuBar); // 设置窗口的菜单栏 + + //左边菜单栏设置 try { - bgImage = ImageIO.read(new File("static\\bg\\bg"+skin+".jpg")); + bgImage = ImageIO.read(new File("static\\bg\\bg" + skin + ".jpg")); // 读取背景图片 } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + e.printStackTrace(); // 捕获并打印异常 } - leftPanel = new BGPanel(bgImage);/*皮肤*/ - leftPanel.setLayout(null); - - - /*菜单栏:用户登录信息*/ - System.out.println("用户头像地址=="+user.getImg()); - JLabel logoLabel = new JLabel(new ImageIcon(user.getImg()),JLabel.LEFT); - System.out.println(user.getImg()); - leftPanel.add(logoLabel); - logoLabel.setBounds(25, 30,150,150); - - /*账号名字*/ - String x = UsuperIcon(user.getUsuper());/*判断权限返回icon地址*/ - System.out.println("身份地址:"+x); - userMenuLabel1 = new JLabel("|"+user.getUsername()+"|"+user.getRname(),new ImageIcon(x),JLabel.LEFT); - userMenuLabel1.setFont(FontUtil.userFont); - userMenuLabel1.addMouseListener(this); - userMenuLabel1.setBounds(20, 170,180,32); - userMenuLabel1.setForeground(Color.white); - leftPanel.add(userMenuLabel1);/*添加用户选项到菜单栏*/ - - - - /*菜单栏:首页*/ - homeMenuLabel = new JLabel("新民首页",new ImageIcon("static\\icon\\home1.png"),JLabel.LEFT); - homeMenuLabel.setFont(FontUtil.menuFont); - homeMenuLabel.addMouseListener(this); - homeMenuLabel.setBounds(20, 250,150,32); - homeMenuLabel.setForeground(Color.white); - leftPanel.add(homeMenuLabel);/*添加用户选项到菜单栏*/ - - - - /*菜单栏:人员管理*/ - userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT); - userMenuLabel.setFont(FontUtil.menuFont); - userMenuLabel.addMouseListener(this); - userMenuLabel.setBounds(20, 300,150,32); - userMenuLabel.setForeground(Color.white); - leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/ - - /*菜单栏:进货系统*/ - inMenuLabel = new JLabel("进货系统",new ImageIcon("static\\icon\\in1.png") ,JLabel.LEFT); - inMenuLabel.setFont(FontUtil.menuFont); - inMenuLabel.addMouseListener(this); - inMenuLabel.setBounds(20, 350,150,32); - inMenuLabel.setForeground(Color.white); - leftPanel.add(inMenuLabel); - - /*菜单栏:收银系统*/ - outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT); - outMenuLabel.setFont(FontUtil.menuFont); - outMenuLabel.addMouseListener(this); - outMenuLabel.setBounds(20, 400,150,32); - outMenuLabel.setForeground(Color.white); - leftPanel.add(outMenuLabel); - - /*菜单栏:库存*/ - storageMenuLabel = new JLabel("商品库存",new ImageIcon("static\\icon\\storage1.png") ,JLabel.LEFT); - storageMenuLabel.setFont(FontUtil.menuFont); - storageMenuLabel.addMouseListener(this); - storageMenuLabel.setBounds(20, 450,150,32); - storageMenuLabel.setForeground(Color.white); - leftPanel.add(storageMenuLabel); - - /*菜单栏:供应商*/ - supplierMenuLabel = new JLabel("供应商",new ImageIcon("static\\icon\\supplier1.png") ,JLabel.LEFT); - supplierMenuLabel.setFont(FontUtil.menuFont); - supplierMenuLabel.addMouseListener(this); - supplierMenuLabel.setBounds(20, 500,150,32); - supplierMenuLabel.setForeground(Color.white); - leftPanel.add(supplierMenuLabel); - - /*菜单栏:商品目录*/ - catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT); - catalogMenuLabel.setFont(FontUtil.menuFont); - catalogMenuLabel.addMouseListener(this); - catalogMenuLabel.setBounds(20,550,150,32); - catalogMenuLabel.setForeground(Color.white); - leftPanel.add(catalogMenuLabel); - - /*提醒进货确认模块*/ - remindMenuLabel = new JLabel("待确认进货:"+unConfirmmark,new ImageIcon("static\\icon\\remind1.png") ,JLabel.LEFT); - remindMenuLabel.setFont(FontUtil.remindFont); - remindMenuLabel.addMouseListener(this); - remindMenuLabel.setBounds(0,650,200,32); - remindMenuLabel.setForeground(Color.white); - leftPanel.add(remindMenuLabel); - - - rightPanelLayout = new CardLayout(); - - //0.超市首页展示 - JPanel homePanel = new HomeView(this); - - //1.用户管理界面:用户的列表 - JPanel userPanel = new UserView(this); - - //2.进货系统界面 - JPanel inPanel = new InView(this,user,vP,1); - - //3收银系统界面 - JPanel outPanel = new OutView(this,user); - - //4.库存系统界面 - JPanel storagePanel = new StorageView(this); - - //5.供应商界面 - JPanel supplierPanel = new SupplierView(this); - - //6商品目录界面 - JPanel ProdCatalogPanel = new ProdCatalogView(this); - - //7商品目录界面 - JPanel superPanel = new SuperView(this); - - //8进货信息提示 - JPanel inPanel2 = new InView(this,user,vP,0); - - /*添加界面并给索引*/ - rightPanel = new JPanel(rightPanelLayout); - rightPanel.add(homePanel, "0"); - rightPanel.add(userPanel, "1"); - rightPanel.add(inPanel, "2"); - rightPanel.add(outPanel, "3"); - rightPanel.add(storagePanel, "4"); - rightPanel.add(supplierPanel, "5"); - rightPanel.add(ProdCatalogPanel, "6"); - rightPanel.add(superPanel, "7"); - rightPanel.add(inPanel2, "8"); - - - containerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel); - containerPanel.setDividerLocation(180); - containerPanel.setDividerSize(0); - - bottomPanel = new JPanel();//默认的布局是流式布局 - - bottomPanel.setBackground(Color.WHITE); - bottomPanel.setLayout(new BorderLayout()); - - purposePanel = new JPanel(); - purposePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); - purposePanel.setBackground(Color.WHITE); - purposeLabel = new JLabel("当前位置是:超市首页"); - purposePanel.add(purposeLabel); - - timePanel=new JPanel(); - timePanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); - timePanel.setBackground(Color.WHITE); - timeLabel = new JLabel(DateUtil.dateToString(new Date(),null)); - timePanel.add(timeLabel); - - bottomPanel.add(purposePanel,"West"); - bottomPanel.add(timePanel,"East"); - Container container = getContentPane(); - container.add(containerPanel,"Center"); - container.add(bottomPanel,"South"); + leftPanel = new BGPanel(bgImage); // 创建带有背景图片的面板 + leftPanel.setLayout(null); // 设置布局为空,自定义布局 + + //菜单栏:用户登录信息 + System.out.println("用户头像地址==" + user.getImg()); // 打印用户头像地址 + JLabel logoLabel = new JLabel(new ImageIcon(user.getImg()), JLabel.LEFT); // 创建用户头像标签 + System.out.println(user.getImg()); // 打印用户头像地址 + leftPanel.add(logoLabel); // 将用户头像标签添加到左侧面板 + logoLabel.setBounds(25, 30, 150, 150); // 设置用户头像标签的位置和大小 + + //账号名字 + String x = UsuperIcon(user.getUsuper()); // 根据用户权限返回对应的图标地址 + System.out.println("身份地址:" + x); // 打印身份图标地址 + userMenuLabel1 = new JLabel("|" + user.getUsername() + "|" + user.getRname(), new ImageIcon(x), JLabel.LEFT); // 创建用户信息标签 + userMenuLabel1.setFont(FontUtil.userFont); // 设置字体 + userMenuLabel1.addMouseListener(this); // 添加鼠标监听器 + userMenuLabel1.setBounds(20, 170, 180, 32); // 设置位置和大小 + userMenuLabel1.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(userMenuLabel1); // 将用户信息标签添加到左侧面板 + + // 菜单栏:首页 + homeMenuLabel = new JLabel("新民首页", new ImageIcon("static\\icon\\home1.png"), JLabel.LEFT); // 创建首页标签 + homeMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + homeMenuLabel.addMouseListener(this); // 添加鼠标监听器 + homeMenuLabel.setBounds(20, 250, 150, 32); // 设置位置和大小 + homeMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(homeMenuLabel); // 将首页标签添加到左侧面板 + + // 菜单栏:人员管理 + userMenuLabel = new JLabel("人员管理", new ImageIcon("static\\icon\\user1.png"), JLabel.LEFT); // 创建人员管理标签 + userMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + userMenuLabel.addMouseListener(this); // 添加鼠标监听器 + userMenuLabel.setBounds(20, 300, 150, 32); // 设置位置和大小 + userMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(userMenuLabel); // 将人员管理标签添加到左侧面板 + + // 菜单栏:进货系统 + inMenuLabel = new JLabel("进货系统", new ImageIcon("static\\icon\\in1.png"), JLabel.LEFT); // 创建进货系统标签 + inMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + inMenuLabel.addMouseListener(this); // 添加鼠标监听器 + inMenuLabel.setBounds(20, 350, 150, 32); // 设置位置和大小 + inMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(inMenuLabel); // 将进货系统标签添加到左侧面板 + + // 菜单栏:收银系统 + outMenuLabel = new JLabel("收银系统", new ImageIcon("static\\icon\\out1.png"), JLabel.LEFT); // 创建收银系统标签 + outMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + outMenuLabel.addMouseListener(this); // 添加鼠标监听器 + outMenuLabel.setBounds(20, 400, 150, 32); // 设置位置和大小 + outMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(outMenuLabel); // 将收银系统标签添加到左侧面板 + + // 菜单栏:库存 + storageMenuLabel = new JLabel("商品库存", new ImageIcon("static\\icon\\storage1.png"), JLabel.LEFT); // 创建库存标签 + storageMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + storageMenuLabel.addMouseListener(this); // 添加鼠标监听器 + storageMenuLabel.setBounds(20, 450, 150, 32); // 设置位置和大小 + storageMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(storageMenuLabel); // 将库存标签添加到左侧面板 + + // 菜单栏:供应商 + supplierMenuLabel = new JLabel("供应商", new ImageIcon("static\\icon\\supplier1.png"), JLabel.LEFT); // 创建供应商标签 + supplierMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + supplierMenuLabel.addMouseListener(this); // 添加鼠标监听器 + supplierMenuLabel.setBounds(20, 500, 150, 32); // 设置位置和大小 + supplierMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(supplierMenuLabel); // 将供应商标签添加到左侧面板 + + // 菜单栏:商品目录 + catalogMenuLabel = new JLabel("商品目录", new ImageIcon("static\\icon\\catalog1.png"), JLabel.LEFT); // 创建商品目录标签 + catalogMenuLabel.setFont(FontUtil.menuFont); // 设置字体 + catalogMenuLabel.addMouseListener(this); // 添加鼠标监听器 + catalogMenuLabel.setBounds(20, 550, 150, 32); // 设置位置和大小 + catalogMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(catalogMenuLabel); // 将商品目录标签添加到左侧面板 + + // 提醒进货确认模块 + remindMenuLabel = new JLabel("待确认进货:" + unConfirmmark, new ImageIcon("static\\icon\\remind1.png"), JLabel.LEFT); // 创建提醒标签 + remindMenuLabel.setFont(FontUtil.remindFont); // 设置字体 + remindMenuLabel.addMouseListener(this); // 添加鼠标监听器 + remindMenuLabel.setBounds(0, 650, 200, 32); // 设置位置和大小 + remindMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + leftPanel.add(remindMenuLabel); // 将提醒标签添加到左侧面板 + + rightPanelLayout = new CardLayout(); // 创建卡片布局管理器 + + // 0.超市首页展示 + JPanel homePanel = new HomeView(this); // 创建首页面板 + + // 1.用户管理界面:用户的列表 + JPanel userPanel = new UserView(this); // 创建用户管理面板 + + // 2.进货系统界面 + JPanel inPanel = new InView(this, user, vP, 1); // 创建进货系统面板 + + // 3收银系统界面 + JPanel outPanel = new OutView(this, user); // 创建收银系统面板 + + // 4.库存系统界面 + JPanel storagePanel = new StorageView(this); // 创建库存系统面板 + + // 5.供应商界面 + JPanel supplierPanel = new SupplierView(this); // 创建供应商面板 + + // 6商品目录界面 + JPanel ProdCatalogPanel = new ProdCatalogView(this); // 创建商品目录面板 + + // 7商品目录界面 + JPanel superPanel = new SuperView(this); // 创建普通用户界面 + + // 8进货信息提示 + JPanel inPanel2 = new InView(this, user, vP, 0); // 创建进货信息提示面板 + + /* 添加界面并给索引 */ + rightPanel = new JPanel(rightPanelLayout); // 创建右侧内容面板 + rightPanel.add(homePanel, "0"); // 添加首页面板并设置索引 + rightPanel.add(userPanel, "1"); // 添加用户管理面板并设置索引 + rightPanel.add(inPanel, "2"); // 添加进货系统面板并设置索引 + rightPanel.add(outPanel, "3"); // 添加收银系统面板并设置索引 + rightPanel.add(storagePanel, "4"); // 添加库存系统面板并设置索引 + rightPanel.add(supplierPanel, "5"); // 添加供应商面板并设置索引 + rightPanel.add(ProdCatalogPanel, "6"); // 添加商品目录面板并设置索引 + rightPanel.add(superPanel, "7"); // 添加普通用户面板并设置索引 + rightPanel.add(inPanel2, "8"); // 添加进货信息提示面板并设置索引 + + containerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel); // 创建左右分割面板 + containerPanel.setDividerLocation(180); // 设置分割位置 + containerPanel.setDividerSize(0); // 设置分割线宽度为0 + + bottomPanel = new JPanel(); // 创建底部面板 + bottomPanel.setBackground(Color.WHITE); // 设置背景颜色为白色 + bottomPanel.setLayout(new BorderLayout()); // 设置布局为边界布局 + + purposePanel = new JPanel(); // 创建当前位置面板 + purposePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); // 设置布局为流式布局(左对齐) + purposePanel.setBackground(Color.WHITE); // 设置背景颜色为白色 + purposeLabel = new JLabel("当前位置是:超市首页"); // 创建当前位置标签 + purposePanel.add(purposeLabel); // 将当前位置标签添加到当前位置面板 + + timePanel = new JPanel(); // 创建时间面板 + timePanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); // 设置布局为流式布局(右对齐) + timePanel.setBackground(Color.WHITE); // 设置背景颜色为白色 + timeLabel = new JLabel(DateUtil.dateToString(new Date(), null)); // 创建时间标签 + timePanel.add(timeLabel); // 将时间标签添加到时间面板 + + bottomPanel.add(purposePanel, "West"); // 将当前位置面板添加到底部面板的左侧 + bottomPanel.add(timePanel, "East"); // 将时间面板添加到底部面板的右侧 + Container container = getContentPane(); // 获取内容面板 + container.add(containerPanel, "Center"); // 将主界面容器添加到内容面板的中间 + container.add(bottomPanel, "South"); // 将底部面板添加到内容面板的底部 } @Override public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - timeLabel.setText(DateUtil.dateToString(new Date(),null)); - if(source==skinMenuItem)/*换肤*/{ - System.out.println("切换皮肤"); - Random random=new Random(); - skin=random.nextInt(10); - this.dispose(); - new MainView(user,skin,iconSkin); + Object source = e.getSource(); // 获取事件来源 + timeLabel.setText(DateUtil.dateToString(new Date(), null)); // 更新时间标签 + if (source == skinMenuItem) /* 换肤 */ { + System.out.println("切换皮肤"); // 打印日志 + Random random = new Random(); // 创建随机数生成器 + skin = random.nextInt(10); // 随机生成皮肤编号 + this.dispose(); // 关闭当前窗口 + new MainView(user, skin, iconSkin); // 重新创建主界面 } - } - - /** - * cwf 2024/12/11 - * 修改不同权限用户的功能代码 - */ - + //左侧菜单栏点击事件处理方法。 @Override - /* 左侧菜单栏点击事件 */ public void mouseClicked(MouseEvent e) { Object source = e.getSource(); // 获取点击事件的来源 @@ -477,175 +422,146 @@ public class MainView extends BaseView implements ActionListener, MouseListener, refreshRemove(); // 刷新当前界面的位置信息 } - //获取当前位置 - public void refreshRemove(){ - - purposePanel.removeAll(); - if(location==0){ - purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText()); - - }else if(location==1){ - purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText()); - - }else if(location==2){ - purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText()); - - }else if(location==3){ - purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText()); - - }else if(location==4){ - purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText()); - - }else if(location==5){ - purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText()); - - }else{ - purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText()); + //刷新当前界面的位置信息。 + public void refreshRemove() { + purposePanel.removeAll(); // 移除当前位置面板的所有组件 + if (location == 0) { + purposeLabel = new JLabel("当前位置是:" + homeMenuLabel.getText()); // 设置当前位置为首页 + } else if (location == 1) { + purposeLabel = new JLabel("当前位置是:" + userMenuLabel.getText()); // 设置当前位置为人员管理 + } else if (location == 2) { + purposeLabel = new JLabel("当前位置是:" + inMenuLabel.getText()); // 设置当前位置为进货系统 + } else if (location == 3) { + purposeLabel = new JLabel("当前位置是:" + outMenuLabel.getText()); // 设置当前位置为收银系统 + } else if (location == 4) { + purposeLabel = new JLabel("当前位置是:" + storageMenuLabel.getText()); // 设置当前位置为库存系统 + } else if (location == 5) { + purposeLabel = new JLabel("当前位置是:" + supplierMenuLabel.getText()); // 设置当前位置为供应商 + } else { + purposeLabel = new JLabel("当前位置是:" + catalogMenuLabel.getText()); // 设置当前位置为商品目录 } - purposePanel.add(purposeLabel); - + purposePanel.add(purposeLabel); // 将当前位置标签添加到当前位置面板 } @Override public void mousePressed(MouseEvent e) { - // TODO Auto-generated method stub - + // 鼠标按下事件,暂未实现 } @Override public void mouseReleased(MouseEvent e) { - // TODO Auto-generated method stub - + // 鼠标释放事件,暂未实现 } - @Override/*鼠标焦点时*/ + @Override + // 鼠标焦点时 public void mouseEntered(MouseEvent e) { - Object source = e.getSource(); - if(source==homeMenuLabel) { - homeMenuLabel.setForeground(new Color(18, 150, 219)); - homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home2.png")); + Object source = e.getSource(); // 获取事件来源 + if (source == homeMenuLabel) { + homeMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home2.png")); // 设置图标 } - if(source==userMenuLabel) { - userMenuLabel.setForeground(new Color(18, 150, 219)); - userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); - }else if(source==inMenuLabel) { - inMenuLabel.setForeground(new Color(18, 150, 219)); - inMenuLabel.setIcon(new ImageIcon("static\\icon\\in2.png")); - }else if(source==outMenuLabel) { - outMenuLabel.setForeground(new Color(18, 150, 219)); - outMenuLabel.setIcon(new ImageIcon("static\\icon\\out2.png")); - }else if(source==storageMenuLabel) { - storageMenuLabel.setForeground(new Color(18, 150, 219)); - storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage2.png")); - }else if(source==supplierMenuLabel) { - supplierMenuLabel.setForeground(new Color(18, 150, 219)); - supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); - }else if(source==catalogMenuLabel) { - catalogMenuLabel.setForeground(new Color(18, 150, 219)); - catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog2.png")); - } else if(source==userMenuLabel1) { - userMenuLabel1.setForeground(new Color(18, 150, 219)); - + if (source == userMenuLabel) { + userMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); // 设置图标 + } else if (source == inMenuLabel) { + inMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + inMenuLabel.setIcon(new ImageIcon("static\\icon\\in2.png")); // 设置图标 + } else if (source == outMenuLabel) { + outMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + outMenuLabel.setIcon(new ImageIcon("static\\icon\\out2.png")); // 设置图标 + } else if (source == storageMenuLabel) { + storageMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage2.png")); // 设置图标 + } else if (source == supplierMenuLabel) { + supplierMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); // 设置图标 + } else if (source == catalogMenuLabel) { + catalogMenuLabel.setForeground(new Color(18, 150, 219)); // 设置字体颜色 + catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog2.png")); // 设置图标 + } else if (source == userMenuLabel1) { + userMenuLabel1.setForeground(new Color(18, 150, 219)); // 设置字体颜色 } -} + } @Override public void mouseExited(MouseEvent e) { - Object source = e.getSource(); - if(source==homeMenuLabel) { - homeMenuLabel.setForeground(Color.white); - homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); - } else if(source==userMenuLabel) { - userMenuLabel.setForeground(Color.white); - userMenuLabel.setIcon(new ImageIcon("static\\icon\\user1.png")); - }else if(source==inMenuLabel) { - inMenuLabel.setForeground(Color.white); - inMenuLabel.setIcon(new ImageIcon("static\\icon\\in1.png")); - }else if(source==outMenuLabel) { - outMenuLabel.setForeground(Color.white); - outMenuLabel.setIcon(new ImageIcon("static\\icon\\out1.png")); - }else if(source==storageMenuLabel) { - storageMenuLabel.setForeground(Color.white); - storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage1.png")); - }else if(source==supplierMenuLabel) { - supplierMenuLabel.setForeground(Color.white); - supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); - }else if(source==catalogMenuLabel) { - catalogMenuLabel.setForeground(Color.white); - catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); - } else { - userMenuLabel1.setForeground(Color.white); - + Object source = e.getSource(); // 获取事件来源 + if (source == homeMenuLabel) { + homeMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); // 设置图标 + } else if (source == userMenuLabel) { + userMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + userMenuLabel.setIcon(new ImageIcon("static\\icon\\user1.png")); // 设置图标 + } else if (source == inMenuLabel) { + inMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + inMenuLabel.setIcon(new ImageIcon("static\\icon\\in1.png")); // 设置图标 + } else if (source == outMenuLabel) { + outMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + outMenuLabel.setIcon(new ImageIcon("static\\icon\\out1.png")); // 设置图标 + } else if (source == storageMenuLabel) { + storageMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + storageMenuLabel.setIcon(new ImageIcon("static\\icon\\storage1.png")); // 设置图标 + } else if (source == supplierMenuLabel) { + supplierMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); // 设置图标 + } else if (source == catalogMenuLabel) { + catalogMenuLabel.setForeground(Color.white); // 设置字体颜色为白色 + catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); // 设置图标 + } else { + userMenuLabel1.setForeground(Color.white); // 设置字体颜色为白色 } - } - @Override protected void initView() { - // TODO Auto-generated method stub - + // 初始化界面,未实现 } @Override public void windowOpened(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口打开事件,未实现 } @Override public void windowClosing(WindowEvent e) { - // TODO Auto-generated method stub - Object source = e.getSource(); - if(source==this) {/*关闭窗口时检查进货系统和出货系统是否还有记录*/ - this.vP =InView.getVector(); - System.out.println("v的size="+vP.size()); - bufferImpl = new BufferImpl(); - if(vP.size()!=0||bufferImpl.allOutBuffer().size()!=0) {/*如果购物车还有记录*/ - CloseDialog closeDialog = new CloseDialog(this,vP); - closeDialog.setVisible(true); - }else - System.exit(0); - - + Object source = e.getSource(); // 获取事件来源 + if (source == this) { // 关闭窗口时检查进货系统和出货系统是否还有记录 + this.vP = InView.getVector(); // 获取进货缓存 + System.out.println("v的size=" + vP.size()); // 打印进货缓存大小 + bufferImpl = new BufferImpl(); // 创建缓存实现类 + if (vP.size() != 0 || bufferImpl.allOutBuffer().size() != 0) { // 如果购物车还有记录 + CloseDialog closeDialog = new CloseDialog(this, vP); // 创建关闭对话框 + closeDialog.setVisible(true); // 显示关闭对话框 + } else { + System.exit(0); // 退出程序 + } } } @Override public void windowClosed(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口关闭事件,未实现 } @Override public void windowIconified(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口最小化事件,未实现 } @Override public void windowDeiconified(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口恢复事件,未实现 } @Override public void windowActivated(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口激活事件,未实现 } @Override public void windowDeactivated(WindowEvent e) { - // TODO Auto-generated method stub - + // 窗口失活事件,未实现 } - - - - - - - -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java b/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java index bdfaac6..906fae8 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java +++ b/Supermarket/src/com/lingnan/supermarket/view/Nimbus.java @@ -1,14 +1,18 @@ package com.lingnan.supermarket.view; + import javax.swing.UIManager; +// 用于设置Java Swing界面的Nimbus风格 public class Nimbus { - /*nimbus风格*/ + // 用于设置Java Swing界面呈现为Nimbus风格 public static void Nimbus() { - try { - UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); - } catch (Exception e) { - e.printStackTrace(); - } + try { + // 通过UIManager的setLookAndFeel方法来设置界面的外观风格为Nimbus风格 + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); + } catch (Exception e) { + // 如果在设置外观风格的过程中出现异常,则打印异常堆栈信息 + e.printStackTrace(); + } } -} +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/view/UserView.java b/Supermarket/src/com/lingnan/supermarket/view/UserView.java index d8eec3c..47edf1f 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/UserView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/UserView.java @@ -38,7 +38,7 @@ public class UserView extends JPanel implements ActionListener { // 用于触发搜索操作的按钮 private JButton searchBtn; - // 用于存放操作按钮(添加、更新、删除等)的面板 + // 用于存放操作按钮的面板 private JPanel opePanel; // 用于触发添加用户操作的按钮 private JButton addBtn, updateBtn, deleteBtn; @@ -86,9 +86,9 @@ public class UserView extends JPanel implements ActionListener { searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); // 创建一个显示当前位置提示信息的标签,这里显示为"当前位置>人员管理" locationLabel = new JLabel("当前位置>人员管理"); - // 设置标签的字体为通过FontUtil类获取的特定字体(这里假设FontUtil类用于统一管理字体相关设置) + // 设置标签的字体为通过FontUtil类获取的特定字体 locationLabel.setFont(new FontUtil().userFont); - // 设置标签的前景色(文字颜色)为特定的蓝色(RGB值为18, 150, 219) + // 设置标签的前景色为特定的蓝色 locationLabel.setForeground(new Color(18, 150, 219)); // 创建一个显示"姓名"文字的标签,用于提示用户在旁边的文本框中输入姓名进行搜索 nameLabel = new JLabel("姓名"); @@ -97,7 +97,7 @@ public class UserView extends JPanel implements ActionListener { // 创建一个按钮,使用指定路径下的图标文件作为按钮的图标,用于触发搜索操作 searchBtn = new JButton(new ImageIcon("static\\icon\\search.png")); - // 创建一个新的面板opePanel,设置其布局为FlowLayout,且组件右对齐,用于存放操作按钮(添加、更新、删除) + // 创建一个新的面板opePanel,设置其布局为FlowLayout,且组件右对齐,用于存放操作按钮 opePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // 创建一个按钮,使用指定路径下的图标文件("static\\icon\\add.png")作为按钮的图标,用于触发添加用户操作 addBtn = new JButton(new ImageIcon("static\\icon\\add.png")); @@ -106,7 +106,7 @@ public class UserView extends JPanel implements ActionListener { // 创建一个按钮,使用指定路径下的图标文件("static\\icon\\delete.png")作为按钮的图标,用于触发删除用户操作 deleteBtn = new JButton(new ImageIcon("static\\icon\\delete.png")); - // 为添加、更新、删除和搜索按钮添加点击事件监听器,将按钮的点击事件绑定到当前类(实现了ActionListener接口)的actionPerformed方法上,以便处理相应的操作逻辑 + // 为添加、更新、删除和搜索按钮添加点击事件监听器,将按钮的点击事件绑定到当前类的actionPerformed方法上,以便处理相应的操作逻辑 addBtn.addActionListener(this); updateBtn.addActionListener(this); deleteBtn.addActionListener(this); @@ -123,18 +123,18 @@ public class UserView extends JPanel implements ActionListener { searchPanel.add(nameSearchTF); searchPanel.add(searchBtn); - // 将搜索面板添加到toolBarPanel的西边(左侧)区域,将操作按钮面板添加到toolBarPanel的东边(右侧)区域 + // 将搜索面板添加到toolBarPanel的西边区域,将操作按钮面板添加到toolBarPanel的东边区域 toolBarPanel.add(searchPanel, "West"); toolBarPanel.add(opePanel, "East"); // 创建用户表格数据模型对象 userTableModel = new UserTableModel(); - // 调用数据模型的方法获取所有用户数据,用于初始化表格显示内容(这里假设UserTableModel类中的all方法用于从数据库等数据源获取全部用户数据并填充到模型中) + // 调用数据模型的方法获取所有用户数据,用于初始化表格显示内容 userTableModel.all(); // 创建一个JTable对象,使用前面创建的用户表格数据模型userTableModel来管理表格中的数据展示和交互 userTable = new JTable(userTableModel); - // 设置表格的字体为通过FontUtil类获取的适用于表格的特定字体(假设FontUtil类中定义了相关字体常量) + // 设置表格的字体为通过FontUtil类获取的适用于表格的特定字体 userTable.setFont(FontUtil.tableFont); // 设置表格每行的高度为50像素,调整表格的显示样式 userTable.setRowHeight(50); @@ -143,29 +143,29 @@ public class UserView extends JPanel implements ActionListener { // 创建一个新的面板bottomPanel,设置其布局为FlowLayout,且组件左对齐,用于存放记录数相关提示信息 bottomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - // 创建一个显示用户记录总数的标签,初始文本为"总共"加上通过用户表格数据模型获取的行数(假设UserTableModel类的getRowCount方法返回当前模型中的数据行数)以及"条"字 + // 创建一个显示用户记录总数的标签,初始文本为"总共"加上通过用户表格数据模型获取的行数 countInfoLabel = new JLabel("总共" + userTableModel.getRowCount() + "条"); // 将记录数标签添加到bottomPanel面板中 bottomPanel.add(countInfoLabel); - // 将顶部工具栏面板添加到当前面板(UserView)的北部(上方)区域 + // 将顶部工具栏面板添加到当前面板的北部区域 this.add(toolBarPanel, "North"); - // 将包含用户表格的滚动面板添加到当前面板(UserView)的中部区域,使其在界面中间显示 + // 将包含用户表格的滚动面板添加到当前面板的中部区域,使其在界面中间显示 this.add(tableScrollPane, "Center"); - // 将记录数面板添加到当前面板(UserView)的南部(下方)区域 + // 将记录数面板添加到当前面板的南部区域 this.add(bottomPanel, "South"); - // 设置当前面板(UserView)可见,使其在界面上显示出来 + // 设置当前面板可见,使其在界面上显示出来 setVisible(true); } // 处理按钮点击等用户交互动作的方法,实现了ActionListener接口中的方法 @Override public void actionPerformed(ActionEvent e) { - // 获取触发事件的源组件(即被点击的按钮等组件) + // 获取触发事件的源组件 Object source = e.getSource(); if (addBtn == source) { - // 如果点击的是添加按钮,执行以下操作: + // 如果点击的是添加按钮执行以下操作: // 创建一个用于添加用户信息的对话框 UserDialog userDialog = new UserDialog(jFrame); @@ -189,9 +189,9 @@ public class UserView extends JPanel implements ActionListener { // 弹出确认对话框,询问用户是否确定删除指定id的用户记录,提供"是"和"否"两个选项,返回用户选择的结果 int select = JOptionPane.showConfirmDialog(this, "是否删除id=" + id, "提示", JOptionPane.YES_NO_OPTION); if (select == JOptionPane.YES_OPTION) { - // 如果用户选择了"是"(确认删除),执行以下操作: + // 如果用户选择了是,执行以下操作: - // 调用用户服务接口的删除用户方法,传入要删除的用户id,尝试从数据库中删除对应的用户记录,并获取返回结果(假设返回1表示删除成功,其他值表示失败) + // 调用用户服务接口的删除用户方法,传入要删除的用户id,尝试从数据库中删除对应的用户记录,并获取返回结果 if (userService.deleteUser(id) == 1) { // 如果删除成功,弹出提示框显示"删除成功"的消息,提示框的图标为信息图标 JOptionPane.showMessageDialog(this, "删除成功", "提示", JOptionPane.INFORMATION_MESSAGE); @@ -203,7 +203,7 @@ public class UserView extends JPanel implements ActionListener { // 无论删除操作是否成功,都调用刷新用户数据的方法,更新界面上的用户数据显示,确保表格等显示内容与数据库中的最新数据一致 refreshUser(); } else { - // 如果点击的是搜索按钮(即其他未明确匹配的按钮点击情况,这里目前代码逻辑中只存在搜索按钮可能进入此分支),执行以下操作: + // 如果点击的是搜索按钮,执行以下操作: System.out.println("搜索"); // 调用刷新按姓名搜索结果的方法,根据用户在姓名搜索文本框中输入的内容进行数据刷新和表格显示更新 diff --git a/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java b/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java index 1a219ad..256c187 100644 --- a/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java +++ b/Supermarket/src/com/lingnan/supermarket/view/base/BaseView.java @@ -2,70 +2,92 @@ package com.lingnan.supermarket.view.base; import java.awt.Toolkit; import java.util.Vector; - import javax.swing.JFrame; +// 导入相关的业务数据对象类,用于在视图相关操作中可能涉及的数据传递等情况 import com.lingnan.supermarket.dto.Production; import com.lingnan.supermarket.dto.User; +// 定义抽象类BaseView继承自JFrame,用于统一管理视图的一些通用属性和行为 public abstract class BaseView extends JFrame { - - public BaseView(int initWidth,int initHeigth,String title) { + + // 基本构造方法,用于创建一个具有指定初始宽度、高度和标题的窗口,并进行一些初始化设置 + public BaseView(int initWidth, int initHeigth, String title) { + // 设置窗口的标题 this.setTitle(title); - this.setSize(initWidth,initHeigth); + // 设置窗口的初始大小 + this.setSize(initWidth, initHeigth); + + // 通过Toolkit.getDefaultToolkit().getScreenSize()方法获取屏幕尺寸信息 int width = Toolkit.getDefaultToolkit().getScreenSize().width; int height = Toolkit.getDefaultToolkit().getScreenSize().height; - this.setLocation((width-getWidth())/2,(height-getHeight())/2); - + // 通过计算屏幕中心与窗口大小差值的一半来确定窗口左上角坐标 + this.setLocation((width - getWidth()) / 2, (height - getHeight()) / 2); + + // 调用抽象方法initView() initView(); + // 设置窗口为可见状态,使其显示出来 this.setVisible(true); + // 设置窗口关闭操作的默认行为,当关闭窗口时,整个应用程序将退出 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } - - /*带对象参数的构造方法*/ - public BaseView(int initWidth,int initHeigth,String title,User user,int skin) { + + // 用于创建一个具有指定初始宽度、高度、标题以及关联用户信息和皮肤相关参数的窗口,并进行一些初始化设置 + public BaseView(int initWidth, int initHeigth, String title, User user, int skin) { + // 设置窗口的标题 this.setTitle(title); - this.setSize(initWidth,initHeigth); + // 设置窗口的初始大小 + this.setSize(initWidth, initHeigth); + + // 获取屏幕的宽度和高度 int width = Toolkit.getDefaultToolkit().getScreenSize().width; int height = Toolkit.getDefaultToolkit().getScreenSize().height; - this.setLocation((width-getWidth())/2,(height-getHeight())/2); - - + // 设置窗口在屏幕中的位置,使其居中显示 + this.setLocation((width - getWidth()) / 2, (height - getHeight()) / 2); + // 设置窗口为可见状态,使其显示出来 this.setVisible(true); + // 设置窗口关闭操作的默认行为,这里设置为DO_NOTHING_ON_CLOSE,表示关闭窗口时不执行任何默认操作,通常由子类根据具体需求自定义关闭行为 this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); } - - + // 抽象方法,由具体的子类实现,用于进行特定视图的初始化操作,比如添加各种组件、设置布局等 protected abstract void initView(); - protected abstract void initView(User user,int skin); - - /*判断权限并返回字符*/ + // 抽象方法,由具体的子类实现,用于进行特定视图的初始化操作 + protected abstract void initView(User user, int skin); + + // 根据传入的权限值判断对应的权限角色,并返回相应的角色名称字符串 public String Usuper(int usuper) { - String x=null; - if(usuper==0) - x="管理员"; - else if(usuper==1) - x="进货员"; - else if(usuper==2) - x="收银员"; + String x = null; + // 如果权限值为0,则对应的角色是管理员 + if (usuper == 0) + x = "管理员"; + // 如果权限值为1,则对应的角色是进货员 + else if (usuper == 1) + x = "进货员"; + // 如果权限值为2,则对应的角色是收银员 + else if (usuper == 2) + x = "收银员"; + // 如果权限值为3,则对应的角色是超级管理员 + else if (usuper == 3) + x = "超级管理员"; return x; } - - /*判断权限并返回icon地址*/ + + // 根据传入的权限值判断对应的权限角色,并返回相应角色对应的图标文件地址字符串 public String UsuperIcon(int usuper) { - String x=null; - if(usuper==0) - x="static\\icon\\admin.png"; - else if(usuper==1) - x="static\\icon\\carrier.png"; - else if(usuper==2) - x="static\\icon\\cashier.png"; + String x = null; + // 如果权限值为0,则返回管理员角色对应的图标文件地址 + if (usuper == 0) + x = "static\\icon\\admin.png"; + // 如果权限值为1,则返回进货员角色对应的图标文件地址 + else if (usuper == 1) + x = "static\\icon\\carrier.png"; + // 如果权限值为2,则返回收银员角色对应的图标文件地址 + else if (usuper == 2) + x = "static\\icon\\cashier.png"; return x; } - - -} +} \ No newline at end of file -- 2.34.1