├── design ├── 数据库PJER图.png └── 数据库pj数据库设计.png ├── .idea ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── modules.xml ├── database_project.iml ├── compiler.xml └── misc.xml ├── propertyManagement ├── 用户手册 ├── 用户手册.pdf ├── .idea │ ├── dictionaries │ │ └── .xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── libraries │ │ ├── commons_dbutils_1_7.xml │ │ ├── commons_dbutils_1_7__2_.xml │ │ ├── mysql_connector_java_8_0_11.xml │ │ └── mysql_connector_java_8_0_11__2_.xml │ ├── modules.xml │ ├── misc.xml │ ├── propertyManagement.iml │ ├── compiler.xml │ └── uiDesigner.xml ├── web │ ├── lib │ │ ├── mail.jar │ │ ├── activation.jar │ │ ├── commons-io-2.6.jar │ │ ├── commons-dbutils-1.7.jar │ │ ├── commons-fileupload-1.3.3.jar │ │ └── mysql-connector-java-8.0.11.jar │ ├── WEB-INF │ │ ├── web.xml │ │ ├── equipmentCheck.jsp │ │ ├── equipmentRepair.jsp │ │ ├── parkingmanage.jsp │ │ └── parkingview.jsp │ └── index.jsp ├── src │ ├── dao │ │ ├── database.properties │ │ ├── daoInterface │ │ │ ├── DAO.java │ │ │ └── JdbcDaoImpl.java │ │ ├── JDBCUtil.java │ │ └── classDao │ │ │ ├── relationDao │ │ │ ├── equipmentDao │ │ │ │ ├── InEquipCheckDao.java │ │ │ │ ├── OutEquipCheckDao.java │ │ │ │ ├── OutEquipRepairDao.java │ │ │ │ ├── InEquipRepairDao.java │ │ │ │ └── EquipmentIssueDao.java │ │ │ ├── PropertyRecordDao.java │ │ │ ├── buildingDao │ │ │ │ ├── HousePurchaseRecordDao.java │ │ │ │ └── ComplaintDao.java │ │ │ ├── ProperMonthRecordDao.java │ │ │ ├── parkingDao │ │ │ │ ├── LeasedParkingRecordDao.java │ │ │ │ ├── OwnedParkingRecordDao.java │ │ │ │ └── TemporaryParkingRecordDao.java │ │ │ └── residentDao │ │ │ │ └── ResidentCostDao.java │ │ │ └── entityDao │ │ │ ├── houseDao │ │ │ ├── HouseDao.java │ │ │ ├── CommunityDao.java │ │ │ └── BuildingDao.java │ │ │ ├── ResidentDao.java │ │ │ ├── parkingspaceDao │ │ │ ├── OwnedParkingSpaceDao.java │ │ │ ├── TemporaryParkingSpaceDao.java │ │ │ └── LeasedParkingSpaceDao.java │ │ │ └── equipmentDao │ │ │ ├── OutdoorEquipmentDao.java │ │ │ └── IndoorEquipmentDao.java │ ├── model │ │ ├── entity │ │ │ ├── house │ │ │ │ ├── Building.java │ │ │ │ ├── House.java │ │ │ │ └── Community.java │ │ │ ├── parkingspace │ │ │ │ ├── OwnedParkingSpace.java │ │ │ │ ├── LeasedParkingSpace.java │ │ │ │ └── TemporaryParkingSpace.java │ │ │ ├── Resident.java │ │ │ └── equipment │ │ │ │ ├── IndoorEquipment.java │ │ │ │ └── OutdoorEquipment.java │ │ └── relation │ │ │ ├── ProperMonthRecord.java │ │ │ ├── equipment │ │ │ ├── IndoorEquipCheck.java │ │ │ ├── OutdoorEquipCheck.java │ │ │ ├── IndoorEquipRepair.java │ │ │ ├── OutdoorEquipRepair.java │ │ │ └── EquipmentIssue.java │ │ │ ├── PropertyRecord.java │ │ │ ├── building │ │ │ ├── HousePurchaseRecord.java │ │ │ └── Complaint.java │ │ │ ├── parking │ │ │ ├── OwnedParkingRecord.java │ │ │ ├── LeasedParkingRecord.java │ │ │ └── TemporaryParkingRecord.java │ │ │ └── resident │ │ │ └── ResidentCost.java │ ├── service │ │ ├── ResidentService.java │ │ ├── HouseService.java │ │ ├── FeedbackService.java │ │ ├── EquipmentService.java │ │ ├── ParkingService.java │ │ └── PaymentService.java │ ├── addData.java │ └── UI.java ├── .gitignore └── propertyManagement.iml └── README.md /design/数据库PJER图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/design/数据库PJER图.png -------------------------------------------------------------------------------- /design/数据库pj数据库设计.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/design/数据库pj数据库设计.png -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /propertyManagement/用户手册: -------------------------------------------------------------------------------- 1 | Temporary_parking_space: 2 | 临时车位里 停车状态为 0没车停,1有车停。 3 | 4 | Outdoor_equipment: 5 | 设备完好 0 ,设备出错 1. -------------------------------------------------------------------------------- /propertyManagement/用户手册.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/用户手册.pdf -------------------------------------------------------------------------------- /propertyManagement/.idea/dictionaries/.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /propertyManagement/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /propertyManagement/web/lib/mail.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/mail.jar -------------------------------------------------------------------------------- /propertyManagement/web/lib/activation.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/activation.jar -------------------------------------------------------------------------------- /propertyManagement/web/lib/commons-io-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/commons-io-2.6.jar -------------------------------------------------------------------------------- /propertyManagement/web/lib/commons-dbutils-1.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/commons-dbutils-1.7.jar -------------------------------------------------------------------------------- /propertyManagement/web/lib/commons-fileupload-1.3.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/commons-fileupload-1.3.3.jar -------------------------------------------------------------------------------- /propertyManagement/web/lib/mysql-connector-java-8.0.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaopenglalala/database_project/HEAD/propertyManagement/web/lib/mysql-connector-java-8.0.11.jar -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/database.properties: -------------------------------------------------------------------------------- 1 | jdbcdriver=com.mysql.jdbc.Driver 2 | dburl=jdbc:mysql://localhost:3306/communitysystem?serverTimezone=GMT&useUnicode=true&characterEncoding=utf-8 3 | user=root 4 | password=123456 -------------------------------------------------------------------------------- /propertyManagement/.gitignore: -------------------------------------------------------------------------------- 1 | # comment 2 | /out/ 3 | /.idea/workspace.xml 4 | /.idea/artifacts/propertyManagement_war_exploded.xml 5 | /json/test.json 6 | /web/res/ 7 | /web/classes 8 | 9 | # mac bin 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /propertyManagement/.idea/libraries/commons_dbutils_1_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /propertyManagement/.idea/libraries/commons_dbutils_1_7__2_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /propertyManagement/.idea/libraries/mysql_connector_java_8_0_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /propertyManagement/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /propertyManagement/.idea/libraries/mysql_connector_java_8_0_11__2_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /propertyManagement/web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /propertyManagement/web/WEB-INF/equipmentCheck.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: 妖风 4 | Date: 2019/1/4 5 | Time: 12:52 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /propertyManagement/web/WEB-INF/equipmentRepair.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: 妖风 4 | Date: 2019/1/4 5 | Time: 12:52 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /propertyManagement/web/WEB-INF/parkingmanage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: 妖风 4 | Date: 2019/1/4 5 | Time: 12:56 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | Title 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /propertyManagement/web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: 妖风 4 | Date: 2018/12/28 5 | Time: 14:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | $Title$ 12 | 13 | 14 | $END$ 15 | 16 | 17 | -------------------------------------------------------------------------------- /propertyManagement/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /propertyManagement/web/WEB-INF/parkingview.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: 妖风 4 | Date: 2019/1/4 5 | Time: 12:47 6 | To change this template use File | Settings | File Templates. 7 | 此页面用于: 8 | 1.记录临时停车信息 9 | 2.车位租借 10 | 3.车位购买 11 | 用户可以选择小区,展示车位情况,选中车位后进入车位管理界面 12 | --%> 13 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 14 | 15 | 16 | Title 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/database_project.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/daoInterface/DAO.java: -------------------------------------------------------------------------------- 1 | package dao.daoInterface; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | import java.util.List; 6 | 7 | public interface DAO { 8 | int update(Connection connection, String sql, Object... args) throws Exception; 9 | 10 | T get(Connection connection, String sql, Object... args) throws Exception; 11 | 12 | List getList(Connection connection, String sql, Object... args) throws Exception; 13 | 14 | E getValue(Connection connection, String sql, Object... args) throws SQLException, Exception; 15 | } 16 | -------------------------------------------------------------------------------- /propertyManagement/.idea/propertyManagement.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /propertyManagement/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/house/Building.java: -------------------------------------------------------------------------------- 1 | package model.entity.house; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class Building { 7 | private Integer building_id; 8 | private Integer community_id; 9 | private String name; 10 | 11 | public Integer getBuilding_id() { 12 | return building_id; 13 | } 14 | 15 | public void setBuilding_id(Integer building_id) { 16 | this.building_id = building_id; 17 | } 18 | 19 | public Integer getCommunity_id() { 20 | return community_id; 21 | } 22 | 23 | public void setCommunity_id(Integer community_id) { 24 | this.community_id = community_id; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/parkingspace/OwnedParkingSpace.java: -------------------------------------------------------------------------------- 1 | package model.entity.parkingspace; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class OwnedParkingSpace { 7 | private Integer parking_space_id; 8 | private Integer community_id; 9 | private String description; 10 | 11 | public Integer getParking_space_id() { 12 | return parking_space_id; 13 | } 14 | 15 | public void setParking_space_id(Integer parking_space_id) { 16 | this.parking_space_id = parking_space_id; 17 | } 18 | 19 | public Integer getCommunity_id() { 20 | return community_id; 21 | } 22 | 23 | public void setCommunity_id(Integer community_id) { 24 | this.community_id = community_id; 25 | } 26 | 27 | public String getDescription() { 28 | return description; 29 | } 30 | 31 | public void setDescription(String description) { 32 | this.description = description; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/ProperMonthRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class ProperMonthRecord { 7 | private Integer year; 8 | private Integer month; 9 | private Integer type; 10 | private Float amount; 11 | 12 | public Integer getYear() { 13 | return year; 14 | } 15 | 16 | public void setYear(Integer year) { 17 | this.year = year; 18 | } 19 | 20 | public Integer getMonth() { 21 | return month; 22 | } 23 | 24 | public void setMonth(Integer month) { 25 | this.month = month; 26 | } 27 | 28 | public Integer getType() { 29 | return type; 30 | } 31 | 32 | public void setType(Integer type) { 33 | this.type = type; 34 | } 35 | 36 | public Float getAmount() { 37 | return amount; 38 | } 39 | 40 | public void setAmount(Float amount) { 41 | this.amount = amount; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/house/House.java: -------------------------------------------------------------------------------- 1 | package model.entity.house; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class House { 7 | private Integer house_id; 8 | private Integer building_id; 9 | private String name; 10 | private Integer size; 11 | 12 | public Integer getHouse_id() { 13 | return house_id; 14 | } 15 | 16 | public void setHouse_id(Integer house_id) { 17 | this.house_id = house_id; 18 | } 19 | 20 | public Integer getBuilding_id() { 21 | return building_id; 22 | } 23 | 24 | public void setBuilding_id(Integer building_id) { 25 | this.building_id = building_id; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public Integer getSize() { 37 | return size; 38 | } 39 | 40 | public void setSize(Integer size) { 41 | this.size = size; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/Resident.java: -------------------------------------------------------------------------------- 1 | package model.entity; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class Resident { 7 | private Integer resident_id ; 8 | private String identity_card; 9 | private String name; 10 | private long tel; 11 | public Integer getResident_id() { 12 | return resident_id; 13 | } 14 | 15 | public void setResident_id(Integer resident_id) { 16 | this.resident_id = resident_id; 17 | } 18 | 19 | public String getIdentity_card() { 20 | return identity_card; 21 | } 22 | 23 | public void setIdentity_card(String identity_card) { 24 | this.identity_card = identity_card; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public long getTel() { 36 | return tel; 37 | } 38 | 39 | public void setTel(long tel) { 40 | this.tel = tel; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/house/Community.java: -------------------------------------------------------------------------------- 1 | package model.entity.house; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class Community { 7 | private Integer communityId; 8 | private String name; 9 | private float longitude; 10 | private float latitude; 11 | 12 | public Integer getCommunityId() { 13 | return communityId; 14 | } 15 | 16 | public void setCommunityId(Integer community_id) { 17 | this.communityId = community_id; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | 28 | public float getLongitude() { 29 | return longitude; 30 | } 31 | 32 | public void setLongitude(float longitude) { 33 | this.longitude = longitude; 34 | } 35 | 36 | public float getLatitude() { 37 | return latitude; 38 | } 39 | 40 | public void setLatitude(float latitude) { 41 | this.latitude = latitude; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/equipment/IndoorEquipCheck.java: -------------------------------------------------------------------------------- 1 | package model.relation.equipment; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class IndoorEquipCheck { 9 | private int check_id; 10 | private int equipment_id; 11 | private int state; 12 | private Date time; 13 | 14 | public int getCheck_id() { 15 | return check_id; 16 | } 17 | 18 | public void setCheck_id(int check_id) { 19 | this.check_id = check_id; 20 | } 21 | 22 | public int getEquipment_id() { 23 | return equipment_id; 24 | } 25 | 26 | public void setEquipment_id(int equipment_id) { 27 | this.equipment_id = equipment_id; 28 | } 29 | 30 | public int getState() { 31 | return state; 32 | } 33 | 34 | public void setState(int state) { 35 | this.state = state; 36 | } 37 | 38 | public Date getTime() { 39 | return time; 40 | } 41 | 42 | public void setTime(Date time) { 43 | this.time = time; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/equipment/OutdoorEquipCheck.java: -------------------------------------------------------------------------------- 1 | package model.relation.equipment; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class OutdoorEquipCheck { 9 | private int check_id; 10 | private int equipment_id; 11 | private int state; 12 | private Date time; 13 | 14 | public int getCheck_id() { 15 | return check_id; 16 | } 17 | 18 | public void setCheck_id(int check_id) { 19 | this.check_id = check_id; 20 | } 21 | 22 | public int getEquipment_id() { 23 | return equipment_id; 24 | } 25 | 26 | public void setEquipment_id(int equipment_id) { 27 | this.equipment_id = equipment_id; 28 | } 29 | 30 | public int getState() { 31 | return state; 32 | } 33 | 34 | public void setState(int state) { 35 | this.state = state; 36 | } 37 | 38 | public Date getTime() { 39 | return time; 40 | } 41 | 42 | public void setTime(Date time) { 43 | this.time = time; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /propertyManagement/propertyManagement.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/JDBCUtil.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import java.io.FileInputStream; 4 | import java.sql.Connection; 5 | import java.sql.DriverManager; 6 | import java.util.Properties; 7 | 8 | public class JDBCUtil { 9 | private static Connection connection; 10 | private static final String FILEPATH = JDBCUtil.class.getClassLoader().getResource("./dao/database.properties").getPath(); 11 | 12 | public static Connection getConnection(){ 13 | if (connection != null) return connection; 14 | 15 | try{ 16 | Properties properties = new Properties(); 17 | properties.load(new FileInputStream(FILEPATH)); 18 | String JDBC_DRIVER = properties.getProperty("jdbcdriver"); 19 | String DB_URL = properties.getProperty("dburl"); 20 | String USER = properties.getProperty("user"); 21 | String PASSWORD = properties.getProperty("password"); 22 | 23 | Class.forName(JDBC_DRIVER); 24 | connection = DriverManager.getConnection(DB_URL, USER, PASSWORD); 25 | return connection; 26 | } catch (Exception e){ 27 | e.printStackTrace(); 28 | } 29 | 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/parkingspace/LeasedParkingSpace.java: -------------------------------------------------------------------------------- 1 | package model.entity.parkingspace; 2 | 3 | /** 4 | * Created by MoonBird on 2019/1/3. 5 | */ 6 | public class LeasedParkingSpace { 7 | private Integer parking_space_id; 8 | private Integer community_id; 9 | private String description; 10 | private Integer parking_state; 11 | 12 | public Integer getParking_space_id() { 13 | return parking_space_id; 14 | } 15 | 16 | public void setParking_space_id(Integer parking_space_id) { 17 | this.parking_space_id = parking_space_id; 18 | } 19 | 20 | public Integer getCommunity_id() { 21 | return community_id; 22 | } 23 | 24 | public void setCommunity_id(Integer community_id) { 25 | this.community_id = community_id; 26 | } 27 | 28 | public String getDescription() { 29 | return description; 30 | } 31 | 32 | public void setDescription(String description) { 33 | this.description = description; 34 | } 35 | 36 | public Integer getParking_state() { 37 | return parking_state; 38 | } 39 | 40 | public void setParking_state(Integer parking_state) { 41 | this.parking_state = parking_state; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/parkingspace/TemporaryParkingSpace.java: -------------------------------------------------------------------------------- 1 | package model.entity.parkingspace; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class TemporaryParkingSpace { 7 | private Integer parking_space_id; 8 | private Integer community_id; 9 | private String description; 10 | private Integer parking_state; 11 | 12 | public Integer getParking_space_id() { 13 | return parking_space_id; 14 | } 15 | 16 | public void setParking_space_id(Integer parking_space_id) { 17 | this.parking_space_id = parking_space_id; 18 | } 19 | 20 | public Integer getCommunity_id() { 21 | return community_id; 22 | } 23 | 24 | public void setCommunity_id(Integer community_id) { 25 | this.community_id = community_id; 26 | } 27 | 28 | public String getDescription() { 29 | return description; 30 | } 31 | 32 | public void setDescription(String description) { 33 | this.description = description; 34 | } 35 | 36 | public Integer getParking_state() { 37 | return parking_state; 38 | } 39 | 40 | public void setParking_state(Integer parking_state) { 41 | this.parking_state = parking_state; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/PropertyRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class PropertyRecord { 9 | private int order_id; 10 | private int type; 11 | private float amount; 12 | private String description; 13 | private Date time; 14 | 15 | public int getOrder_id() { 16 | return order_id; 17 | } 18 | 19 | public void setOrder_id(int order_id) { 20 | this.order_id = order_id; 21 | } 22 | 23 | public int getType() { 24 | return type; 25 | } 26 | 27 | public void setType(int type) { 28 | this.type = type; 29 | } 30 | 31 | public float getAmount() { 32 | return amount; 33 | } 34 | 35 | public void setAmount(float amount) { 36 | this.amount = amount; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | } 46 | 47 | public Date getTime() { 48 | return time; 49 | } 50 | 51 | public void setTime(Date time) { 52 | this.time = time; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/equipment/IndoorEquipRepair.java: -------------------------------------------------------------------------------- 1 | package model.relation.equipment; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class IndoorEquipRepair { 9 | private int repair_id; 10 | private int equipment_id; 11 | private int state; 12 | private float cost; 13 | private Date time; 14 | 15 | public int getRepair_id() { 16 | return repair_id; 17 | } 18 | 19 | public void setRepair_id(int repair_id) { 20 | this.repair_id = repair_id; 21 | } 22 | 23 | public int getEquipment_id() { 24 | return equipment_id; 25 | } 26 | 27 | public void setEquipment_id(int equipment_id) { 28 | this.equipment_id = equipment_id; 29 | } 30 | 31 | public int getState() { 32 | return state; 33 | } 34 | 35 | public void setState(int state) { 36 | this.state = state; 37 | } 38 | 39 | public float getCost() { 40 | return cost; 41 | } 42 | 43 | public void setCost(float cost) { 44 | this.cost = cost; 45 | } 46 | 47 | public Date getTime() { 48 | return time; 49 | } 50 | 51 | public void setTime(Date time) { 52 | this.time = time; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/equipment/OutdoorEquipRepair.java: -------------------------------------------------------------------------------- 1 | package model.relation.equipment; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class OutdoorEquipRepair { 9 | private int repair_id; 10 | private int equipment_id; 11 | private int state; 12 | private float cost; 13 | private Date time; 14 | 15 | public int getRepair_id() { 16 | return repair_id; 17 | } 18 | 19 | public void setRepair_id(int repair_id) { 20 | this.repair_id = repair_id; 21 | } 22 | 23 | public int getEquipment_id() { 24 | return equipment_id; 25 | } 26 | 27 | public void setEquipment_id(int equipment_id) { 28 | this.equipment_id = equipment_id; 29 | } 30 | 31 | public int getState() { 32 | return state; 33 | } 34 | 35 | public void setState(int state) { 36 | this.state = state; 37 | } 38 | 39 | public float getCost() { 40 | return cost; 41 | } 42 | 43 | public void setCost(float cost) { 44 | this.cost = cost; 45 | } 46 | 47 | public Date getTime() { 48 | return time; 49 | } 50 | 51 | public void setTime(Date time) { 52 | this.time = time; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/building/HousePurchaseRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation.building; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class HousePurchaseRecord { 9 | private int order_id; 10 | private int house_id; 11 | private int resident_id; 12 | private float cost; 13 | private Date time; 14 | 15 | public int getOrder_id() { 16 | return order_id; 17 | } 18 | 19 | public void setOrder_id(int order_id) { 20 | this.order_id = order_id; 21 | } 22 | 23 | public int getHouse_id() { 24 | return house_id; 25 | } 26 | 27 | public void setHouse_id(int house_id) { 28 | this.house_id = house_id; 29 | } 30 | 31 | public int getResident_id() { 32 | return resident_id; 33 | } 34 | 35 | public void setResident_id(int resident_id) { 36 | this.resident_id = resident_id; 37 | } 38 | 39 | public float getCost() { 40 | return cost; 41 | } 42 | 43 | public void setCost(float cost) { 44 | this.cost = cost; 45 | } 46 | 47 | public Date getTime() { 48 | return time; 49 | } 50 | 51 | public void setTime(Date time) { 52 | this.time = time; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/equipment/IndoorEquipment.java: -------------------------------------------------------------------------------- 1 | package model.entity.equipment; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class IndoorEquipment { 7 | private Integer equipment_id; 8 | private Integer building_id; 9 | private String type; 10 | private String description; 11 | private Integer state; 12 | 13 | public Integer getEquipment_id() { 14 | return equipment_id; 15 | } 16 | 17 | public void setEquipment_id(Integer equipment_id) { 18 | this.equipment_id = equipment_id; 19 | } 20 | 21 | public Integer getBuilding_id() { 22 | return building_id; 23 | } 24 | 25 | public void setBuilding_id(Integer building_id) { 26 | this.building_id = building_id; 27 | } 28 | 29 | public String getType() { 30 | return type; 31 | } 32 | 33 | public void setType(String type) { 34 | this.type = type; 35 | } 36 | 37 | public String getDescription() { 38 | return description; 39 | } 40 | 41 | public void setDescription(String description) { 42 | this.description = description; 43 | } 44 | 45 | public Integer getState() { 46 | return state; 47 | } 48 | 49 | public void setState(Integer state) { 50 | this.state = state; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/parking/OwnedParkingRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation.parking; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class OwnedParkingRecord { 9 | private int record_id; 10 | private int parking_space_id; 11 | private int resident_id; 12 | private Date date; 13 | private float cost; 14 | 15 | public int getRecord_id() { 16 | return record_id; 17 | } 18 | 19 | public void setRecord_id(int record_id) { 20 | this.record_id = record_id; 21 | } 22 | 23 | public int getParking_space_id() { 24 | return parking_space_id; 25 | } 26 | 27 | public void setParking_space_id(int parking_space_id) { 28 | this.parking_space_id = parking_space_id; 29 | } 30 | 31 | public int getResident_id() { 32 | return resident_id; 33 | } 34 | 35 | public void setResident_id(int resident_id) { 36 | this.resident_id = resident_id; 37 | } 38 | 39 | public Date getDate() { 40 | return date; 41 | } 42 | 43 | public void setDate(Date date) { 44 | this.date = date; 45 | } 46 | 47 | public float getCost() { 48 | return cost; 49 | } 50 | 51 | public void setCost(float cost) { 52 | this.cost = cost; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/model/entity/equipment/OutdoorEquipment.java: -------------------------------------------------------------------------------- 1 | package model.entity.equipment; 2 | 3 | /** 4 | * Created by your dad on 2019/1/3. 5 | */ 6 | public class OutdoorEquipment { 7 | private Integer equipment_id; 8 | private Integer community_id; 9 | private String type; 10 | private String description; 11 | private Integer state; 12 | 13 | public Integer getEquipment_id() { 14 | return equipment_id; 15 | } 16 | 17 | public void setEquipment_id(Integer equipment_id) { 18 | this.equipment_id = equipment_id; 19 | } 20 | 21 | public Integer getCommunity_id() { 22 | return community_id; 23 | } 24 | 25 | public void setCommunity_id(Integer community_id) { 26 | this.community_id = community_id; 27 | } 28 | 29 | public String getType() { 30 | return type; 31 | } 32 | 33 | public void setType(String type) { 34 | this.type = type; 35 | } 36 | 37 | public String getDescription() { 38 | return description; 39 | } 40 | 41 | public void setDescription(String description) { 42 | this.description = description; 43 | } 44 | 45 | public Integer getState() { 46 | return state; 47 | } 48 | 49 | public void setState(Integer state) { 50 | this.state = state; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/equipmentDao/InEquipCheckDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.equipment.IndoorEquipCheck; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by MoonBird on 2019/1/4. 12 | */ 13 | public class InEquipCheckDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | 16 | public InEquipCheckDao(){ 17 | init(); 18 | } 19 | 20 | public boolean addCheck(IndoorEquipCheck check){ 21 | String sql = "INSERT INTO in_equip_check (equipment_id, state, time)" + 22 | "value (?,?,?)"; 23 | return update(connection, sql, check.getEquipment_id(), check.getState(), check.getTime()) != 0; 24 | } 25 | 26 | public List getChecksByEquipId(int equipId){ 27 | String sql = "SELECT * FROM in_equip_check where equipment_id = ?"; 28 | return getList(connection, sql, equipId); 29 | } 30 | 31 | public IndoorEquipCheck getCheckByCheckId(int checkId){ 32 | String sql = "SELECT * FROM in_equip_check where check_id = ?"; 33 | return get(connection, sql, checkId); 34 | } 35 | 36 | private static void init(){ 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/equipmentDao/OutEquipCheckDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.equipment.OutdoorEquipCheck; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by MoonBird on 2019/1/4. 12 | */ 13 | public class OutEquipCheckDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | 16 | public OutEquipCheckDao(){ 17 | init(); 18 | } 19 | 20 | public boolean addCheck(OutdoorEquipCheck check){ 21 | String sql = "INSERT INTO out_equip_check (equipment_id, state, time)" + 22 | "value (?,?,?)"; 23 | return update(connection, sql, check.getEquipment_id(), check.getState(), check.getTime()) != 0; 24 | } 25 | 26 | public List getChecksByEquipId(int equipId){ 27 | String sql = "SELECT * FROM out_equip_check where equipment_id = ?"; 28 | return getList(connection, sql, equipId); 29 | } 30 | 31 | public OutdoorEquipCheck getCheckByCheckId(int checkId){ 32 | String sql = "SELECT * FROM out_equip_check where check_id = ?"; 33 | return get(connection, sql, checkId); 34 | } 35 | 36 | private static void init(){ 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/PropertyRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.PropertyRecord; 6 | 7 | import java.sql.Connection; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class PropertyRecordDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public PropertyRecordDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addPropertyRecord(PropertyRecord record){ 22 | String sql = "INSERT INTO property_record (type, amount, description, time)" + 23 | " value (?, ?, ?, ?)"; 24 | return update(connection, sql, record.getType(), record.getAmount(), record.getDescription(), record.getTime()) != 0; 25 | } 26 | 27 | public List getRecordsByTime(Date startTime, Date endTime){ 28 | String sql = "SELECT * FROM property_record where time > ? and time < ?"; 29 | return getList(connection, sql, startTime, endTime); 30 | } 31 | public List getAllRecords(){ 32 | String sql = "SELECT * FROM property_record "; 33 | return getList(connection, sql); 34 | } 35 | private static void init(){ 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/parking/LeasedParkingRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation.parking; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class LeasedParkingRecord { 9 | private int record_id; 10 | private int parking_space_id; 11 | private int resident_id; 12 | private Date start_time; 13 | private Date end_time; 14 | 15 | public int getRecord_id() { 16 | return record_id; 17 | } 18 | 19 | public void setRecord_id(int record_id) { 20 | this.record_id = record_id; 21 | } 22 | 23 | public int getParking_space_id() { 24 | return parking_space_id; 25 | } 26 | 27 | public void setParking_space_id(int parking_space_id) { 28 | this.parking_space_id = parking_space_id; 29 | } 30 | 31 | public int getResident_id() { 32 | return resident_id; 33 | } 34 | 35 | public void setResident_id(int resident_id) { 36 | this.resident_id = resident_id; 37 | } 38 | 39 | public Date getStart_time() { 40 | return start_time; 41 | } 42 | 43 | public void setStart_time(Date start_time) { 44 | this.start_time = start_time; 45 | } 46 | 47 | public Date getEnd_time() { 48 | return end_time; 49 | } 50 | 51 | public void setEnd_time(Date end_time) { 52 | this.end_time = end_time; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/houseDao/HouseDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.houseDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.house.House; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by your dad on 2019/1/4. 12 | */ 13 | public class HouseDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | public HouseDao(){ 16 | init(); 17 | } 18 | private static void init() { 19 | 20 | } 21 | 22 | public boolean addHouse(House house) { 23 | String sql = "INSERT INTO house (building_id, name, size) " + 24 | "values (?,?,?)"; 25 | update(connection,sql,house.getBuilding_id(), house.getName(),house.getSize()); 26 | return true; 27 | } 28 | 29 | public List getHousesByBuildingId(int building_id){ 30 | String sql = "SELECT * FROM house where building_id = ?"; 31 | return getList(connection, sql, building_id); 32 | } 33 | 34 | public List getAllHouse(){ 35 | String sql = "SELECT * " + 36 | "FROM house ORDER BY house_id DESC"; 37 | return getList(connection, sql); 38 | } 39 | 40 | public House getHouseByHouseId(int houseId){ 41 | String sql = "SELECT * FROM house where house_id = ?"; 42 | return get(connection, sql, houseId); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/resident/ResidentCost.java: -------------------------------------------------------------------------------- 1 | package model.relation.resident; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class ResidentCost { 9 | private int cost_id; 10 | private int resident_id; 11 | private String description; 12 | private float cost; 13 | private Date time; 14 | private int state;//0已缴费,1未缴费 15 | 16 | public int getCost_id() { 17 | return cost_id; 18 | } 19 | 20 | public void setCost_id(int cost_id) { 21 | this.cost_id = cost_id; 22 | } 23 | 24 | public int getResident_id() { 25 | return resident_id; 26 | } 27 | 28 | public void setResident_id(int resident_id) { 29 | this.resident_id = resident_id; 30 | } 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public Date getTime() { 41 | return time; 42 | } 43 | 44 | public void setTime(Date time) { 45 | this.time = time; 46 | } 47 | 48 | public float getCost() { 49 | return cost; 50 | } 51 | 52 | public void setCost(float cost) { 53 | this.cost = cost; 54 | } 55 | 56 | public int getState() { 57 | return state; 58 | } 59 | 60 | public void setState(int state) { 61 | this.state = state; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/ResidentDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.Resident; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by your dad on 2019/1/4. 12 | */ 13 | public class ResidentDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | 16 | public ResidentDao(){ 17 | init(); 18 | } 19 | private static void init(){} 20 | 21 | public boolean addResident(Resident resident) { 22 | String sql = "INSERT INTO resident (identity_card, name,tel) " + 23 | "values (?,?,?)"; 24 | update(connection,sql,resident.getIdentity_card(), resident.getName(),resident.getTel()); 25 | return true; 26 | } 27 | 28 | public Resident getResidentByResidentId(int residentId){ 29 | String sql = "SELECT * FROM resident where resident_id = ?"; 30 | return get(connection, sql, residentId); 31 | } 32 | 33 | public Resident getResidentByIdentity(String identity){ 34 | String sql = "SELECT * FROM resident where identity_card = ?"; 35 | return get(connection, sql, identity); 36 | } 37 | 38 | public List getAllResident(){ 39 | String sql = "SELECT * " + 40 | "FROM resident ORDER BY resident_id DESC"; 41 | return getList(connection, sql); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/building/Complaint.java: -------------------------------------------------------------------------------- 1 | package model.relation.building; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class Complaint { 9 | private Integer feedback_id; 10 | private Integer house_id; 11 | private Integer type; 12 | private String description; 13 | private String process; 14 | private Date date; 15 | 16 | public Integer getFeedback_id() { 17 | return feedback_id; 18 | } 19 | 20 | public void setFeedback_id(Integer feedback_id) { 21 | this.feedback_id = feedback_id; 22 | } 23 | 24 | public Integer getHouse_id() { 25 | return house_id; 26 | } 27 | 28 | public void setHouse_id(Integer house_id) { 29 | this.house_id = house_id; 30 | } 31 | 32 | public Integer getType() { 33 | return type; 34 | } 35 | 36 | public void setType(Integer type) { 37 | this.type = type; 38 | } 39 | 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | public void setDescription(String description) { 45 | this.description = description; 46 | } 47 | 48 | public String getProcess() { 49 | return process; 50 | } 51 | 52 | public void setProcess(String process) { 53 | this.process = process; 54 | } 55 | 56 | public Date getDate() { 57 | return date; 58 | } 59 | 60 | public void setDate(Date date) { 61 | this.date = date; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 1.8 29 | 30 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/parking/TemporaryParkingRecord.java: -------------------------------------------------------------------------------- 1 | package model.relation.parking; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class TemporaryParkingRecord { 9 | private int record_id; 10 | private int parking_space_id; 11 | private String car_id; 12 | private Date start_time; 13 | private Date end_time; 14 | private float cost; 15 | 16 | public int getRecord_id() { 17 | return record_id; 18 | } 19 | 20 | public void setRecord_id(int record_id) { 21 | this.record_id = record_id; 22 | } 23 | 24 | public int getParking_space_id() { 25 | return parking_space_id; 26 | } 27 | 28 | public void setParking_space_id(int parking_space_id) { 29 | this.parking_space_id = parking_space_id; 30 | } 31 | 32 | public String getCar_id() { 33 | return car_id; 34 | } 35 | 36 | public void setCar_id(String car_id) { 37 | this.car_id = car_id; 38 | } 39 | 40 | public Date getStart_time() { 41 | return start_time; 42 | } 43 | 44 | public void setStart_time(Date start_time) { 45 | this.start_time = start_time; 46 | } 47 | 48 | public Date getEnd_time() { 49 | return end_time; 50 | } 51 | 52 | public void setEnd_time(Date end_time) { 53 | this.end_time = end_time; 54 | } 55 | 56 | public float getCost() { 57 | return cost; 58 | } 59 | 60 | public void setCost(float cost) { 61 | this.cost = cost; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/buildingDao/HousePurchaseRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.buildingDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.building.HousePurchaseRecord; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by moonBird on 2019/1/4. 12 | */ 13 | public class HousePurchaseRecordDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | 16 | public HousePurchaseRecordDao(){ 17 | init(); 18 | } 19 | 20 | public boolean addRecord(HousePurchaseRecord housePurchaseRecord){ 21 | if (getRecordByHouseId(housePurchaseRecord.getHouse_id()) != null) return false;//房屋已经被购买 22 | String sql = "INSERT INTO house_purchase_record (house_id, resident_id, cost, time) " + 23 | " value (?,?,?,?)"; 24 | update(connection, sql, housePurchaseRecord.getHouse_id(), housePurchaseRecord.getResident_id(), housePurchaseRecord.getCost(), housePurchaseRecord.getTime()); 25 | return true; 26 | } 27 | 28 | public HousePurchaseRecord getRecordByHouseId(int houseId){ 29 | String sql = "SELECT * FROM house_purchase_record where house_id = ?"; 30 | return get(connection, sql, houseId); 31 | } 32 | 33 | public List getAll(){ 34 | String sql = "SELECT * FROM house_purchase_record"; 35 | return getList(connection, sql); 36 | } 37 | 38 | private static void init(){ 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/ProperMonthRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.ProperMonthRecord; 6 | import model.relation.resident.ResidentCost; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class ProperMonthRecordDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public ProperMonthRecordDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addProperMonthRecord(ProperMonthRecord record){ 22 | String sql = "INSERT INTO proper_month_record (year, month, type, amount)" + 23 | " value (?, ?, ?, ?)"; 24 | return update(connection, sql, record.getYear(),record.getMonth(), record.getType(), record.getAmount()) != 0; 25 | } 26 | 27 | public List getRecordsByYear(int year){ 28 | String sql = "SELECT * FROM proper_month_record where year = ?"; 29 | return getList(connection, sql, year); 30 | } 31 | 32 | public List getRecordsByMonth(int month){ 33 | String sql = "SELECT * FROM proper_month_record where month = ?"; 34 | return getList(connection, sql, month); 35 | } 36 | 37 | public ProperMonthRecord getRecordByYearAndMonth(int year, int month){ 38 | String sql = "SELECT * FROM proper_month_record where year = ? and month = ?"; 39 | return get(connection, sql, year, month); 40 | } 41 | 42 | private static void init(){ 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/parkingDao/LeasedParkingRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.parkingDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.parking.LeasedParkingRecord; 6 | 7 | import java.sql.Connection; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class LeasedParkingRecordDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public LeasedParkingRecordDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addRecord(LeasedParkingRecord record){ 22 | String sql = "INSERT INTO leased_parking_record (parking_space_id, resident_id, start_time, end_time)" + 23 | " value (?, ?, ?, ?)"; 24 | return update(connection, sql, record.getParking_space_id(),record.getResident_id(), record.getStart_time(), record.getEnd_time()) != 0; 25 | } 26 | 27 | public List getRecordsBySpaceId(int parkingSpaceId){ 28 | String sql = "SELECT * FROM leased_parking_record where parking_space_id = ?"; 29 | return getList(connection, sql, parkingSpaceId); 30 | } 31 | 32 | public List getRecordsByResidentId(int residentId){ 33 | String sql = "SELECT * FROM leased_parking_record where resident_id = ?"; 34 | return getList(connection, sql, residentId); 35 | } 36 | 37 | public List getRecordsValid(Date date){ 38 | String sql = "SELECT * FROM leased_parking_record where end_time > ?"; 39 | return getList(connection, sql, date); 40 | } 41 | 42 | private static void init(){ 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/parkingDao/OwnedParkingRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.parkingDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.parking.LeasedParkingRecord; 6 | import model.relation.parking.OwnedParkingRecord; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class OwnedParkingRecordDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public OwnedParkingRecordDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addRecord(OwnedParkingRecord record){ 22 | if (getRecordBySpaceId(record.getParking_space_id()) != null) return false; 23 | String sql = "INSERT INTO owned_parking_record (parking_space_id, resident_id, date, cost)" + 24 | " value (?, ?, ?, ?)"; 25 | return update(connection, sql, record.getParking_space_id(),record.getResident_id(), record.getDate(), record.getCost()) != 0; 26 | } 27 | 28 | public OwnedParkingRecord getRecordBySpaceId(int parkingSpaceId){ 29 | String sql = "SELECT * FROM owned_parking_record where parking_space_id = ?"; 30 | return get(connection, sql, parkingSpaceId); 31 | } 32 | 33 | public List getRecordByResidentId(int residentId){ 34 | String sql = "SELECT * FROM owned_parking_record where resident_id = ?"; 35 | return getList(connection, sql, residentId); 36 | } 37 | 38 | public List getAll(){ 39 | String sql = "SELECT * FROM owned_parking_record "; 40 | return getList(connection, sql); 41 | } 42 | 43 | private static void init(){ 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /propertyManagement/src/model/relation/equipment/EquipmentIssue.java: -------------------------------------------------------------------------------- 1 | package model.relation.equipment; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by your dad on 2019/1/3. 7 | */ 8 | public class EquipmentIssue { 9 | private Integer feedback_id; 10 | private Integer house_id; 11 | private Integer equipment_id; 12 | private Integer repair_id; 13 | private Integer type; 14 | private String description; 15 | private Date time; 16 | 17 | public Integer getFeedback_id() { 18 | return feedback_id; 19 | } 20 | 21 | public void setFeedback_id(Integer feedback_id) { 22 | this.feedback_id = feedback_id; 23 | } 24 | 25 | public Integer getHouse_id() { 26 | return house_id; 27 | } 28 | 29 | public void setHouse_id(Integer house_id) { 30 | this.house_id = house_id; 31 | } 32 | 33 | public Integer getEquipment_id() { 34 | return equipment_id; 35 | } 36 | 37 | public void setEquipment_id(Integer equipment_id) { 38 | this.equipment_id = equipment_id; 39 | } 40 | 41 | public Integer getRepair_id() { 42 | return repair_id; 43 | } 44 | 45 | public void setRepair_id(Integer repair_id) { 46 | this.repair_id = repair_id; 47 | } 48 | 49 | public Integer getType() { 50 | return type; 51 | } 52 | 53 | public void setType(Integer type) { 54 | this.type = type; 55 | } 56 | 57 | public String getDescription() { 58 | return description; 59 | } 60 | 61 | public void setDescription(String description) { 62 | this.description = description; 63 | } 64 | 65 | public Date getTime() { 66 | return time; 67 | } 68 | 69 | public void setTime(Date time) { 70 | this.time = time; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/equipmentDao/OutEquipRepairDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.equipment.OutdoorEquipRepair; 6 | 7 | import java.sql.Connection; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class OutEquipRepairDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public boolean addRepair(OutdoorEquipRepair repair) { 18 | String sql = "INSERT INTO out_equip_repair (equipment_id, state, cost, time) " + 19 | "value (?,?,?,?)"; 20 | return update(connection, sql, repair.getEquipment_id(), repair.getState(), repair.getCost(), repair.getTime()) != 0; 21 | } 22 | 23 | public boolean modifyRepairState(int repairId, int state) { 24 | String sql = "UPDATE out_equip_repair SET state = ? where repair_id = ?"; 25 | return update(connection, sql, state, repairId) != 0; 26 | } 27 | 28 | public List getRepairsByEquimentId(int equipmentId) { 29 | String sql = "SELECT * FROM out_equip_repair where equipment_id = ?"; 30 | return getList(connection, sql, equipmentId); 31 | } 32 | 33 | public List getAllRepairs() { 34 | String sql = "SELECT * FROM out_equip_repair where cost > 0"; 35 | return getList(connection, sql); 36 | } 37 | 38 | public List getRepairsByTime(Date start, Date end) { 39 | String sql = "SELECT * FROM out_equip_repair where time > ? and time < ?"; 40 | return getList(connection, sql,start,end); 41 | } 42 | 43 | private static void init() { 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/residentDao/ResidentCostDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.residentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.resident.ResidentCost; 6 | 7 | import java.sql.Connection; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class ResidentCostDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public ResidentCostDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addCost(ResidentCost cost){ 22 | String sql = "INSERT INTO resident_cost (resident_id, description, cost, time, state)" + 23 | " value (?, ?, ?, ?, ?)"; 24 | return update(connection, sql, cost.getResident_id(), cost.getDescription(), 25 | cost.getCost(), cost.getTime(), cost.getState()) != 0; 26 | } 27 | 28 | public boolean modifyState(int costId, int state){ 29 | String sql = "UPDATE resident_cost SET state = ? where cost_id = ?"; 30 | return update(connection, sql, state, costId) != 0; 31 | } 32 | 33 | public List getCostsByResidentId(int residentId){ 34 | String sql = "SELECT * FROM resident_cost where resident_id = ?"; 35 | return getList(connection, sql, residentId); 36 | } 37 | public List getAllCosts(){ 38 | String sql = "SELECT * FROM resident_cost "; 39 | return getList(connection, sql); 40 | } 41 | 42 | public List getCostsByTime(Date start, Date end){ 43 | String sql = "SELECT * FROM resident_cost where time > ? and time < ?"; 44 | return getList(connection, sql, start, end); 45 | } 46 | 47 | private static void init(){ 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/equipmentDao/InEquipRepairDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.equipment.IndoorEquipRepair; 6 | 7 | import java.sql.Connection; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class InEquipRepairDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public boolean addRepair(IndoorEquipRepair repair){ 18 | String sql = "INSERT INTO in_equip_repair (equipment_id, state, cost, time) " + 19 | "value (?,?,?,?)"; 20 | return update(connection, sql, repair.getEquipment_id(), repair.getState(), repair.getCost(), repair.getTime()) != 0; 21 | } 22 | 23 | public boolean modifyRepairState(int repairId, int state){ 24 | String sql = "UPDATE in_equip_repair SET state = ? where repair_id = ?"; 25 | return update(connection, sql, state, repairId) != 0; 26 | } 27 | 28 | public List getRepairsByEquipmentId(int equipmentId){ 29 | String sql = "SELECT * FROM in_equip_repair where equipment_id = ?"; 30 | return getList(connection, sql, equipmentId); 31 | } 32 | 33 | public IndoorEquipRepair getRepairByRepairId(int repairId){ 34 | String sql = "SELECT * FROM in_equip_repair where repair_id = ?"; 35 | return get(connection, sql, repairId); 36 | } 37 | 38 | public List getAllRepairs(){ 39 | String sql = "SELECT * FROM in_equip_repair where cost >0"; 40 | return getList(connection, sql); 41 | } 42 | 43 | public List getRepairsByTime(Date start, Date end){ 44 | String sql = "SELECT * FROM in_equip_repair where time > ? and time < ?"; 45 | return getList(connection, sql, start, end); 46 | } 47 | 48 | private static void init(){ 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/parkingspaceDao/OwnedParkingSpaceDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.parkingspaceDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.house.Community; 6 | import model.entity.parkingspace.OwnedParkingSpace; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by your dad on 2019/1/4. 13 | */ 14 | public class OwnedParkingSpaceDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public OwnedParkingSpaceDao() { 18 | init(); 19 | } 20 | 21 | private static void init() { 22 | } 23 | 24 | public boolean addOwnedParkingSpace(OwnedParkingSpace ownedParkingSpace) { 25 | String sql = "INSERT INTO owned_parking_space (community_id, description) " + 26 | "values (?,?)"; 27 | update(connection, sql, ownedParkingSpace.getCommunity_id(), ownedParkingSpace.getDescription()); 28 | return true; 29 | } 30 | /* public OwnedParkingSpace getOwnedParkingSpace(int temporaryParkingSpaceId){ 31 | String sql = "SELECT * " + 32 | "FROM temporary_parking_space where answer_id = ? "; 33 | return get(connection, sql, temporaryParkingSpaceId); 34 | }*/ 35 | 36 | public List getOwnedParkingSpacesByCommunity(Community community) { 37 | String sql = "SELECT * FROM owned_parking_space where community_id = ?"; 38 | return getList(connection, sql, community.getCommunityId()); 39 | } 40 | 41 | public List getAllOwnedParkingSpace() { 42 | String sql = "SELECT * " + 43 | "FROM owned_parking_space ORDER BY parking_space_id DESC"; 44 | return getList(connection, sql); 45 | } 46 | 47 | public OwnedParkingSpace getOwnedParkingSpaceBySpaceId(int spaceId){ 48 | String sql = "SELECT * FROM owned_parking_space where parking_space_id = ?"; 49 | return get(connection, sql, spaceId); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/parkingDao/TemporaryParkingRecordDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.parkingDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.parking.TemporaryParkingRecord; 6 | 7 | import java.sql.Connection; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by MoonBird on 2019/1/4. 12 | */ 13 | public class TemporaryParkingRecordDao extends JdbcDaoImpl { 14 | private static Connection connection = JDBCUtil.getConnection(); 15 | 16 | public TemporaryParkingRecordDao(){ 17 | init(); 18 | } 19 | 20 | public boolean addRecord(TemporaryParkingRecord record){ 21 | String sql = "INSERT INTO temporary_parking_record (parking_space_id, car_id, start_time, end_time, cost)" + 22 | " value (?, ?, ?, ?, ?)"; 23 | return update(connection, sql, record.getParking_space_id(),record.getCar_id(), record.getStart_time(), record.getEnd_time(), record.getCost()) != 0; 24 | } 25 | 26 | public boolean updateRecord(TemporaryParkingRecord record){ 27 | String sql = "UPDATE temporary_parking_record SET end_time = ?, cost = ? where record_id = ?" ; 28 | return update(connection, sql, record.getEnd_time(), record.getCost() ,record.getRecord_id()) != 0; 29 | } 30 | 31 | public List getRecordsBySpaceId(int parkingSpaceId){ 32 | String sql = "SELECT * FROM temporary_parking_record where parking_space_id = ?"; 33 | return getList(connection, sql, parkingSpaceId); 34 | } 35 | 36 | public List getRecordsByCostNoNull(){ 37 | String sql = "SELECT * FROM temporary_parking_record where cost > 1"; 38 | return getList(connection, sql); 39 | } 40 | 41 | 42 | public TemporaryParkingRecord getRecordLatest(int spaceId){ 43 | String sql = "SELECT * FROM temporary_parking_record where parking_space_id = ? ORDER BY record_id DESC LIMIT 1"; 44 | return get(connection, sql, spaceId); 45 | } 46 | 47 | 48 | 49 | private static void init(){ 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/houseDao/CommunityDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.houseDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.house.Community; 6 | 7 | import java.sql.Connection; 8 | import java.sql.Statement; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by your dad on 2019/1/4. 13 | */ 14 | public class CommunityDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | public CommunityDao(){ 17 | init(); 18 | } 19 | private static void init() { 20 | try { 21 | Statement statement = connection.createStatement(); 22 | statement.executeUpdate( 23 | "CREATE TABLE IF not exists community\n" + 24 | "(\n" + 25 | " community_id INT(32) PRIMARY KEY NOT NULL,\n" + 26 | " name VARCHAR(255),\n" + 27 | " longitude FLOAT(255,1),\n" + 28 | " latitude FLOAT(255,1)\n" + 29 | ");" 30 | ); 31 | statement.close(); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | public boolean addCommunity(Community community) { 38 | String sql = "INSERT INTO community (name, longitude, latitude) " + 39 | "values (?,?,?)"; 40 | update(connection,sql,community.getName(), community.getLongitude(),community.getLatitude()); 41 | return true; 42 | } 43 | 44 | public List getAllCommunity(){ 45 | String sql = "SELECT community_id as communityId, name, longitude, latitude " + 46 | "FROM community "; 47 | /* List> maps = getMap(connection, sql); 48 | for (Map map : maps){ 49 | System.out.print(map.get("communityId")); 50 | } 51 | List communities = getList(connection, sql); 52 | for (int i = 0; i < communities.size(); i++) { 53 | System.out.println(communities.get(i).getCommunityId()+ " " + communities.get(i).getName()); 54 | }*/ 55 | return getList(connection, sql); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/houseDao/BuildingDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.houseDao; 2 | import dao.JDBCUtil; 3 | import dao.daoInterface.JdbcDaoImpl; 4 | import model.entity.house.Building; 5 | 6 | import java.sql.Connection; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by your dad on 2019/1/4. 11 | */ 12 | public class BuildingDao extends JdbcDaoImpl { 13 | private static Connection connection = JDBCUtil.getConnection(); 14 | public BuildingDao(){ 15 | init(); 16 | } 17 | private static void init() { 18 | /* try { 19 | Statement statement = connection.createStatement(); 20 | statement.executeUpdate("CREATE TABLE IF not exists building\n" + 21 | "(\n" + 22 | " building_id INT(32) PRIMARY KEY NOT NULL,\n" + 23 | " community_id INT(32) NOT NULL,\n" + 24 | " name VARCHAR(255),\n" + 25 | " CONSTRAINT community_id FOREIGN KEY (community_id) REFERENCES community (community_id)\n" + 26 | ");\n" + 27 | "CREATE INDEX community_id ON building (community_id);" 28 | ); 29 | statement.close(); 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | }*/ 33 | } 34 | 35 | public boolean addBuilding(Building building) { 36 | String sql = "INSERT INTO building (community_id, name) " + 37 | "values (?,?)"; 38 | update(connection,sql,building.getCommunity_id(), building.getName()); 39 | return true; 40 | } 41 | 42 | public List getBuildingsByCommunityId(int communityId){ 43 | String sql = "SELECT * FROM building where community_id = ?"; 44 | return getList(connection, sql, communityId); 45 | } 46 | 47 | public List getAllBuildings(){ 48 | String sql = "SELECT * " + 49 | "FROM building ORDER BY building_id DESC"; 50 | return getList(connection, sql); 51 | } 52 | 53 | public Building getBuildingByBuildingId(int buildingId){ 54 | String sql = "SELECT * FROM building where building_id = ?"; 55 | return get(connection, sql, buildingId); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /propertyManagement/src/service/ResidentService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.entityDao.ResidentDao; 4 | import dao.classDao.relationDao.buildingDao.HousePurchaseRecordDao; 5 | import dao.classDao.relationDao.residentDao.ResidentCostDao; 6 | import model.entity.Resident; 7 | import model.entity.house.House; 8 | import model.relation.building.HousePurchaseRecord; 9 | import model.relation.resident.ResidentCost; 10 | 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | public class ResidentService { 15 | private ResidentDao residentDao; 16 | private HousePurchaseRecordDao housePurchaseRecordDao; 17 | private ResidentCostDao residentCostDao; 18 | 19 | 20 | public ResidentService(){ 21 | residentDao = new ResidentDao(); 22 | housePurchaseRecordDao = new HousePurchaseRecordDao(); 23 | residentCostDao = new ResidentCostDao(); 24 | } 25 | 26 | public List getAllResidents(){ 27 | return residentDao.getAllResident(); 28 | } 29 | 30 | public Resident getResidentByIdentityCard(String identity){ 31 | return residentDao.getResidentByIdentity(identity); 32 | } 33 | 34 | public Resident getResidentByResidentId(int residentId){ 35 | return residentDao.getResidentByResidentId(residentId); 36 | } 37 | 38 | public Resident getHouseOwner(House house){ 39 | HousePurchaseRecord housePurchaseRecord = housePurchaseRecordDao.getRecordByHouseId(house.getHouse_id()); 40 | if (housePurchaseRecord == null) return null; 41 | return residentDao.getResidentByResidentId(housePurchaseRecord.getResident_id()); 42 | } 43 | 44 | /** 45 | * 46 | * @param residentId 47 | * @param description 48 | * @param cost 49 | * @return false 表示不存在该用户 50 | */ 51 | public boolean addCost(int residentId, String description, float cost){ 52 | if (getResidentByResidentId(residentId) == null) return false; 53 | ResidentCost residentCost = new ResidentCost(); 54 | residentCost.setResident_id(residentId); 55 | residentCost.setDescription(description); 56 | residentCost.setCost(cost); 57 | residentCost.setTime(new Date()); 58 | residentCost.setState(1); 59 | residentCostDao.addCost(residentCost); 60 | return true; 61 | } 62 | 63 | public List getCostsBetweenTime(Date startTime, Date endTime){ 64 | return residentCostDao.getCostsByTime(startTime, endTime); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/parkingspaceDao/TemporaryParkingSpaceDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.parkingspaceDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.house.Community; 6 | import model.entity.parkingspace.TemporaryParkingSpace; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MoonBird on 2019/1/4. 13 | */ 14 | public class TemporaryParkingSpaceDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | public TemporaryParkingSpaceDao(){ 17 | init(); 18 | } 19 | private static void init(){} 20 | public boolean addTemporaryParkingSpace(TemporaryParkingSpace temporaryParkingSpace) { 21 | String sql = "INSERT INTO temporary_parking_space (community_id, description,parking_state) " + 22 | "values (?,?,?)"; 23 | update(connection,sql,temporaryParkingSpace.getCommunity_id(), temporaryParkingSpace.getDescription(),temporaryParkingSpace.getParking_state()); 24 | return true; 25 | } 26 | public TemporaryParkingSpace getTemporaryParkingSpace(int temporaryParkingSpaceId){ 27 | String sql = "SELECT * " + 28 | "FROM temporary_parking_space where parking_space_id = ? "; 29 | return get(connection, sql, temporaryParkingSpaceId); 30 | } 31 | public boolean updateTemporaryParkingSpace(TemporaryParkingSpace temporaryParkingSpace){ 32 | String sql = "UPDATE temporary_parking_space SET parking_state = ? where parking_space_id = ?"; 33 | update(connection,sql,temporaryParkingSpace.getParking_state(), temporaryParkingSpace.getParking_space_id()); 34 | return true; 35 | } 36 | public List getAllTemporaryParkingSpace(){ 37 | String sql = "SELECT * " + 38 | "FROM temporary_parking_space ORDER BY parking_space_id DESC"; 39 | return getList(connection, sql); 40 | } 41 | 42 | public List getTempParkingByCommunityAndState(Community community, int state){ 43 | String sql = "SELECT * FROM temporary_parking_space where community_id = ? and parking_state = ?"; 44 | return getList(connection, sql, community.getCommunityId(), state); 45 | } 46 | 47 | public List getTempParkingSpacesByCommunity(Community community){ 48 | String sql = "SELECT * FROM temporary_parking_space where community_id = ?"; 49 | return getList(connection, sql, community.getCommunityId()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/equipmentDao/EquipmentIssueDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.equipmentDao; 2 | import dao.JDBCUtil; 3 | import dao.daoInterface.JdbcDaoImpl; 4 | import model.relation.equipment.EquipmentIssue; 5 | 6 | import java.sql.Connection; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by MoonBird on 2019/1/4. 11 | */ 12 | public class EquipmentIssueDao extends JdbcDaoImpl { 13 | private static Connection connection = JDBCUtil.getConnection(); 14 | 15 | public EquipmentIssueDao(){ 16 | init(); 17 | } 18 | 19 | public boolean addIssue(EquipmentIssue equipmentIssue){ 20 | String sql = "INSERT INTO equipment_issue (house_id, equipment_id, repair_id, type, description, time) " + 21 | "value (?,?,?,?,?,?)"; 22 | return update(connection, sql,equipmentIssue.getHouse_id(),equipmentIssue.getEquipment_id(),equipmentIssue.getRepair_id(),equipmentIssue.getType(),equipmentIssue.getDescription(),equipmentIssue.getTime()) != 0; 23 | } 24 | 25 | public boolean modifyRepairId(int issueId, int repairId){ 26 | String sql = "UPDATE equipment_issue SET repair_id = ? where feedback_id = ?"; 27 | return (update(connection, sql, repairId, issueId) != 0); 28 | } 29 | 30 | public List getNotSolvedIssues(int buildingId){ 31 | String sql = "SELECT * FROM house natural join equipment_issue where building_id = ? and repair_id is null"; 32 | return getList(connection, sql, buildingId); 33 | } 34 | 35 | public List getSolvingIssues(int buildingId){ 36 | String sql = "SELECT * FROM house natural join equipment_issue where building_id = ? and repair_id is not null"; 37 | return getList(connection, sql, buildingId); 38 | } 39 | 40 | public List getIssuesByBuildingId(int buildingId){ 41 | String sql = "SELECT feedback_id, house_id, equipment_id, repair_id, type, description, time " + 42 | "FROM HouseService natural join equipment_issue where building_id = ?"; 43 | return getList(connection, sql, buildingId); 44 | } 45 | 46 | public List getIssuesByEquipId(int equipId){ 47 | String sql = "SELECT * " + 48 | "FROM equipment_issue where equipment_id = ?"; 49 | return getList(connection, sql, equipId); 50 | } 51 | 52 | public List getIssuesByHouseId(int houseId){ 53 | String sql = "SELECT * FROM equipment_issue where house_id = ?"; 54 | return getList(connection, sql, houseId); 55 | } 56 | 57 | public EquipmentIssue getIssueByFBId(int issueId){ 58 | String sql = "SELECT * FROM equipment_issue where feedback_id = ?"; 59 | return get(connection, sql, issueId); 60 | } 61 | 62 | private static void init(){ 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/relationDao/buildingDao/ComplaintDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.relationDao.buildingDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.relation.building.Complaint; 6 | 7 | import java.sql.Connection; 8 | import java.sql.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by moonBird on 2019/1/4. 13 | */ 14 | public class ComplaintDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public ComplaintDao(){ 18 | init(); 19 | } 20 | 21 | public boolean addComplaint(Complaint complaint){ 22 | String sql = "INSERT INTO complaint (house_id, type, description, process, date)" + 23 | "value (?,?,?,?,?)"; 24 | update(connection, sql, complaint.getHouse_id(), complaint.getType(), 25 | complaint.getDescription(), complaint.getProcess(), complaint.getDate()); 26 | 27 | return true; 28 | } 29 | 30 | public boolean modifyComplaint(Complaint complaint){ 31 | String sql = "UPDATE complaint SET process = ? where feedback_id = ? ";//false 表示不存在这个投诉 32 | return update(connection, sql, complaint.getProcess(), complaint.getFeedback_id()) != 0; 33 | } 34 | 35 | public List getComplaintsByBuildingId(int building_id){ 36 | String sql = "SELECT feedback_id, house_id, type, description, process, date FROM HouseService natural join complaint where building_id = ?"; 37 | return getList(connection, sql, building_id); 38 | } 39 | 40 | public List getComplaintsByHouseId(int house_id){ 41 | String sql = "SELECT * FROM complaint where house_id = ?"; 42 | return getList(connection, sql, house_id); 43 | } 44 | 45 | public List getComplaintsByTime(Date start, Date end){ 46 | String sql = "SELECT * FROM complaint where date > ? and date < ?"; 47 | return getList(connection, sql, start, end); 48 | } 49 | 50 | public List getComplaintsByType(int type){ 51 | String sql = "SELECT * FROM complaint where type = ?"; 52 | return getList(connection, sql, type); 53 | } 54 | 55 | public List getNotSolvedComplaint(){ 56 | String sql = "SELECT * FROM complaint where process is null"; 57 | return getList(connection, sql); 58 | } 59 | 60 | public List getSolvingComplaint(){ 61 | String sql = "SELECT * FROM complaint where process is not null"; 62 | return getList(connection, sql); 63 | } 64 | 65 | public List getAllComplaints(){ 66 | String sql = "SELECT * FROM complaint"; 67 | return getList(connection, sql); 68 | } 69 | 70 | public Complaint getComplaintByFBid(int feedback_id){ 71 | String sql = "SELECT * FROM complaint where feedback_id = ?"; 72 | return get(connection, sql, feedback_id); 73 | } 74 | 75 | private static void init(){ 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # database_project 2 | 数据库设计project——物业集团管理系统 3 | 4 | ## 需求描述(Request) 5 | ### 某物业集团管理信息系统 6 | ### 一、系统概述 7 | 物业管理信息系统是现代居住小区不可缺少的一部分。一个好的物业管理信息系统可以提升小区的管理水平,使小区的日常管理更加方便。某物业集团目前受聘管理上海市A、B、C三个小区。为了更好地管理各小区业务,提供优质物业服务,同时满足集团了解各个小区物业管理团队经营情况的需要,该物业集团需要一套物业管理信息系统,实现停车管理、设备管理、费用管理、投诉意见管理、房屋住户管理等主要功能,并为集团统计相关经营信息提供支持。请根据分析下述原始要求,并设计该系统。请特别注意识别系统边界,给出合理的数据库设计,并能完成数据处理任务。 8 | 9 | ### 二、系统功能 10 | #### 停车管理 11 | 为了更好的车位利用,物业集团将各小区车位划分为临时停车位,租用车位和购买车位。临时车位按不同时长进行收费,时间向上取整;租用车位价格各小区不同,并且按月起租,若单次租用时间长达1年,费用打8折(例如单月为200元,则一年为1920元),购买车位价格各小区不同,并需要每月交车位管理费,具体车位管理规则如下: 12 | 13 | 1.临时车位:提供给没有租用车位和购买车位的车辆,停靠时间小于1小时:免费,停靠时间1-8小时:5元,停靠时间8-24小时:10元,大于24小时每24小时收费10元。为了计算小区的收支情况,以及车位利用情况,需要记录临时车位的停放情况(例如:车牌号沪A1234,停靠时间:5小时,收费:5元)。 14 | 15 | 2.租用车位:仅该小区的户主可以申请该小区车位的车位租用,按月起租,月租费A小区200元,B小区250元,C小区300元。另外还需缴纳管理费用每月50元。 16 | 3. 购买车位:仅该小区的户主可以申请该小区车位的购买,购买费用A小区为20万元,B小区为22万元,C小区为24万元,并且每月需要缴纳管理费用50元。 17 | 18 | 物业集团已经购置了一套智能停车管理系统,可以根据各小区的停车要求定制相应的收费规则。小区物业只需要将相应的停车收入情况(包括临停、车位管理费、车位购买费)进行汇总统计,用于每月的财务报告(例如停车费等作为收入)和日常的车位信息查询统计。 19 | 20 | #### 设备管理 21 | 物业集团为了方便小区居民的生活,为小区居民提供室外设备:健身设施、小区内照明灯、公告牌等,室内设备:楼道声控灯、楼房门禁设备、电梯等,为了防止设备的损坏,需要进行定期维护,具体维护内容如下: 22 | 23 | 1.室外设备管理:对于室外设备每半年安排人员进行一次排查,并做好相应记录,若有损坏情况则安排相应人员进行维修,并按不同设备的价格记录维修费用(例如健身设施维修费用为100元) 24 | 25 | 2.室内设备管理:对于室内设备每月安排人员进行一次排查,并做好相应记录,若有损坏情况则安排相应人员进行维修,并按不同设备的价格记录维修费用 26 | 27 | 为了使业主的遇到的问题可以快速解决,该集团为业主提供了室内设备报修单填写功能,业主填写自己的楼号,单元号,报修项目,报修原因即可进行报修,集团收到报修单则根据业主遇到的问题安排时间进行维修,并做好相应维修记录: 28 | 29 | 1.报修:业主填写楼号,单元号,报修项目,报修原因等进行报修,报修项目有电梯、楼道灯、下水道堵塞等,集团在每一天对所有收到的报修单进行分类,根据类别安排时间进行报修,并填写报修记录和完成情况 30 | 31 | 2.月度、季度报修表:为了分析各个小区的报修情况,需要制定月度和季度报修表,可以方便查看到每户报修次数,每个类目的报修次数,以及维修总费用等。 32 | 33 | 物业集团需要为小区内的所有设备做好详细的排查和维修记录,在每个月末可以查询到哪些设备损坏率较高,及各项设备花费的维修费用。 34 | #### 费用管理 35 | 物业集团需要支付设备和公共设施的修理费用。小区业主每年需要缴纳一定的物业费、车位管理费(如果租用或购买了车位)给物业集团,作为物业集团收入。物业集团还会获得一些其他收入,比如楼梯广告收入、临时停车费收入等。 36 | 37 | 1.物业费缴纳:户主需要根据自己的房屋面积缴纳相应的物业费,具体标准为A小区1.00元/月.平方米,B小区1.50元/月.平方米,C小区2.00元/月.平方米,作为物业的收入 38 | 39 | 2.停车费用缴纳:临时车位的停车费用、租用、购买车位的费用要缴纳给物业集团,作为物业的收入 40 | 41 | 3.报修设备费用缴纳:物业集团对设备维修和公共设施修缮需支付所需费用,作为物业的支出 42 | 43 | 4.物业月度、季度收支报表:为了分析物业集团的收支情况,需要制定月度、季度收支报表,可以方便地查看该物业集团的收入、支出情况以及盈利情况等 44 | 45 | #### 投诉意见和报修信息管理 46 | 小区业主可以向物业进行投诉或提出意见,例如邻居扰民(装修噪音、生活噪音等)、设备运行质量不佳(电梯损坏、消防设施损坏、地库排气损坏等)、公共设施损坏(健身设施损坏、地库渗水等)、安保措施不到位、缴纳费用过高,等等。投诉或报修具体方式如下: 47 | 48 | 1.住户可以电话投诉或报修,物业需要记录报修人的楼号、单元号、房间号、时间、投诉类别(住户问题、设备问题、安保问题、费用问题、其他等)、具体投诉内容等信息,并记录相应的处理过程和结果 49 | 50 | 2.月度、季度投诉和报修记录查询和汇总:物业集团需要记录每条投诉信息,整理月度、季度投诉意见,可以查看投诉意见按小区(包括楼宇、单元甚至可以细化到每户)、时间、类别等的分布情况 51 | 52 | #### 房屋、住户管理 53 | 物业集团针对房屋、住户的管理: 54 | 55 | 1.闲置房屋统计:统计小区内闲置的房间数目、具体信息(包括闲置房间的楼宇分布、小区分布等) 56 | 57 | 2.住户信息登记:对小区内每户的住户进行基本信息登记 58 | 59 | 3.住户月账单管理:对小区内每户住户,计算每月需要缴纳的费用账单,跟踪记录其缴费完成进度 60 | 61 | ## 设计实现 62 | 63 | [ER图](https://www.processon.com/diagraming/5c1c5ce6e4b0b71ee503f6cf) 64 | 65 | ![ER图](https://raw.githubusercontent.com/yaopenglalala/database_project/master/design/%E6%95%B0%E6%8D%AE%E5%BA%93PJER%E5%9B%BE.png) 66 | 67 | [数据库表设计](https://www.processon.com/diagraming/5c25aaa9e4b0beb24860148c) 68 | 69 | ![数据库表结构](https://raw.githubusercontent.com/yaopenglalala/database_project/master/design/%E6%95%B0%E6%8D%AE%E5%BA%93pj%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1.png) -------------------------------------------------------------------------------- /propertyManagement/src/dao/daoInterface/JdbcDaoImpl.java: -------------------------------------------------------------------------------- 1 | package dao.daoInterface; 2 | 3 | import org.apache.commons.dbutils.QueryRunner; 4 | import org.apache.commons.dbutils.handlers.BeanHandler; 5 | import org.apache.commons.dbutils.handlers.BeanListHandler; 6 | import org.apache.commons.dbutils.handlers.MapListHandler; 7 | import org.apache.commons.dbutils.handlers.ScalarHandler; 8 | 9 | import java.lang.reflect.ParameterizedType; 10 | import java.lang.reflect.Type; 11 | import java.sql.Connection; 12 | import java.sql.SQLException; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | public class JdbcDaoImpl implements DAO { 17 | private QueryRunner queryRunner = null; 18 | private Class type; 19 | 20 | public JdbcDaoImpl(){ 21 | queryRunner = new QueryRunner(); 22 | Type genType = getClass().getGenericSuperclass(); 23 | 24 | Class superClassGenericParameterizedType = null; 25 | 26 | // 判断父类是否有泛型 27 | if (genType instanceof ParameterizedType) { 28 | // 向下转型,以便调用方法 29 | ParameterizedType pt = (ParameterizedType) genType; 30 | // 只取第一个,因为一个类只能继承一个父类 31 | Type superClazz = pt.getActualTypeArguments()[0]; 32 | // 转换为Class类型 33 | superClassGenericParameterizedType = (Class) superClazz; 34 | } 35 | 36 | type = superClassGenericParameterizedType; 37 | } 38 | 39 | //增删改操作 40 | @Override 41 | public int update(Connection connection, String sql, Object... args){ 42 | try{ 43 | return queryRunner.update(connection,sql,args); 44 | } catch (SQLException e){ 45 | e.printStackTrace(); 46 | } 47 | return 0; 48 | } 49 | 50 | //一系列查询操作 51 | @Override 52 | public T get(Connection connection, String sql, Object... args){ 53 | try { 54 | return queryRunner.query(connection, sql, new BeanHandler<>(type),args); 55 | } catch (SQLException e){ 56 | e.printStackTrace(); 57 | } 58 | return null; 59 | } 60 | 61 | @Override 62 | public List getList(Connection connection, String sql, Object... args){ 63 | try { 64 | return queryRunner.query(connection, sql, new BeanListHandler<>(type), args); 65 | } catch (SQLException e){ 66 | e.printStackTrace(); 67 | } 68 | return null; 69 | } 70 | 71 | @Override 72 | public E getValue(Connection connection, String sql, Object... args) throws Exception { 73 | try{ 74 | return (E) queryRunner.execute(connection, sql, new ScalarHandler(), args); 75 | } catch (SQLException e){ 76 | e.printStackTrace(); 77 | } 78 | return null; 79 | } 80 | 81 | public List> getMap(Connection connection, String sql, Object... args){ 82 | try{ 83 | return queryRunner.query(connection, sql, new MapListHandler(), args); 84 | } catch (SQLException e){ 85 | e.printStackTrace(); 86 | } 87 | return null; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/parkingspaceDao/LeasedParkingSpaceDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.parkingspaceDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.house.Community; 6 | import model.entity.parkingspace.LeasedParkingSpace; 7 | 8 | import java.sql.Connection; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by your dad on 2019/1/4. 13 | */ 14 | public class LeasedParkingSpaceDao extends JdbcDaoImpl { 15 | private static Connection connection = JDBCUtil.getConnection(); 16 | 17 | public LeasedParkingSpaceDao() { 18 | init(); 19 | } 20 | 21 | private static void init() { 22 | } 23 | 24 | public boolean addLeasedParkingSpace(LeasedParkingSpace leasedParkingSpace) { 25 | String sql = "INSERT INTO leased_parking_space (community_id, description,parking_state) " + 26 | "values (?,?,?)"; 27 | update(connection, sql, leasedParkingSpace.getCommunity_id(), leasedParkingSpace.getDescription(),leasedParkingSpace.getParking_state()); 28 | return true; 29 | } 30 | 31 | 32 | public boolean updateLeasedParkingSpace(LeasedParkingSpace leasedParkingSpace) { 33 | // if (getInEquipByEquipId(indoorEquipment.getEquipment_id()) == null) return false; 34 | String sql = "UPDATE leased_parking_space SET parking_state=? where parking_space_id = ?"; 35 | update(connection, sql, leasedParkingSpace.getParking_state(), leasedParkingSpace.getParking_space_id()); 36 | return true; 37 | } 38 | /* public OwnedParkingSpace getOwnedParkingSpace(int temporaryParkingSpaceId){ 39 | String sql = "SELECT * " + 40 | "FROM temporary_parking_space where answer_id = ? "; 41 | return get(connection, sql, temporaryParkingSpaceId); 42 | }*/ 43 | 44 | public boolean modifyLeasedParkingSpaceState(int spaceId, int state){ 45 | String sql = "UPDATE leased_parking_space SET parking_state = ? where parking_space_id = ?"; 46 | return update(connection, sql, state, spaceId) != 0; 47 | } 48 | 49 | public List getLeasedParkingByCommunityAndState(Community community, int state) { 50 | String sql = "SELECT * FROM leased_parking_space where community_id = ? and parking_state = ?"; 51 | return getList(connection, sql, community.getCommunityId(), state); 52 | } 53 | 54 | public List getLeasedParkingSpacesByCommunity(Community community) { 55 | String sql = "SELECT * FROM leased_parking_space where community_id = ?"; 56 | return getList(connection, sql, community.getCommunityId()); 57 | } 58 | 59 | public LeasedParkingSpace getLeasedParkingSpaceBySpaceId(int spaceId) { 60 | String sql = "SELECT * FROM leased_parking_space where parking_space_id = ?"; 61 | return get(connection, sql, spaceId); 62 | } 63 | 64 | public List getAllLeasedParkingSpace() { 65 | String sql = "SELECT * " + 66 | "FROM leased_parking_space ORDER BY parking_space_id DESC"; 67 | return getList(connection, sql); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/equipmentDao/OutdoorEquipmentDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.equipment.OutdoorEquipment; 6 | import model.entity.house.Community; 7 | 8 | import java.sql.Connection; 9 | import java.sql.Statement; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by your dad on 2019/1/4. 14 | */ 15 | public class OutdoorEquipmentDao extends JdbcDaoImpl { 16 | 17 | private static Connection connection = JDBCUtil.getConnection(); 18 | 19 | public OutdoorEquipmentDao(){ 20 | init(); 21 | } 22 | 23 | public boolean addOutdoorEquipment(OutdoorEquipment outdoorEquipment) { 24 | String sql = "INSERT INTO outdoor_equipment (community_id, type,description,state) " + 25 | "values (?,?,?,?)"; 26 | update(connection,sql,outdoorEquipment.getCommunity_id(), outdoorEquipment.getType(),outdoorEquipment.getDescription(),outdoorEquipment.getState()); 27 | return true; 28 | } 29 | 30 | public OutdoorEquipment getOutEquipByEquipId(Integer id){ 31 | String sql = "SELECT * " + 32 | "FROM outdoor_equipment where equipment_id = ?"; 33 | return get(connection, sql, id); 34 | } 35 | 36 | public boolean removeOutdoorEquipment(int outdoorEquipment){ 37 | if (getOutEquipByEquipId(outdoorEquipment) == null) return false; 38 | String sql = "DELETE FROM outdoor_equipment where equipment_id = ?"; 39 | update(connection,sql,outdoorEquipment); 40 | return true; 41 | } 42 | 43 | public boolean updateOutdoorEquipment(OutdoorEquipment outdoorEquipment){ 44 | if (getOutEquipByEquipId(outdoorEquipment.getEquipment_id()) == null) return false; 45 | String sql = "UPDATE outdoor_equipment SET state=? where equipment_id = ?"; 46 | update(connection,sql,outdoorEquipment.getState(),outdoorEquipment.getEquipment_id()); 47 | return true; 48 | } 49 | 50 | public List getOutEquipByState(Community community, int state){ 51 | String sql = "SELECT * " + 52 | "FROM outdoor_equipment where community_id = ? and state = ?"; 53 | return getList(connection, sql, community.getCommunityId(), state); 54 | } 55 | 56 | public List getOutEquipByCommunity(Community community){ 57 | String sql = "SELECT * FROM outdoor_equipment where community_id = ? "; 58 | return getList(connection, sql, community.getCommunityId()); 59 | } 60 | 61 | public List getAllOutdoorEquipment(){ 62 | String sql = "SELECT * " + 63 | "FROM outdoor_equipment"; 64 | return getList(connection, sql); 65 | } 66 | 67 | private static void init() { 68 | try { 69 | Statement statement = connection.createStatement(); 70 | statement.executeUpdate("CREATE TABLE IF not exists outdoor_equipment\n" + 71 | "(\n" + 72 | " equipment_id INT(32) PRIMARY KEY NOT NULL,\n" + 73 | " community_id INT(32) NOT NULL,\n" + 74 | " type VARCHAR(255) NOT NULL,\n" + 75 | " description VARCHAR(255),\n" + 76 | " state INT(2) DEFAULT '0' NOT NULL\n" + 77 | ");"); 78 | statement.close(); 79 | } catch (Exception e) { 80 | e.printStackTrace(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /propertyManagement/src/service/HouseService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.entityDao.houseDao.BuildingDao; 4 | import dao.classDao.entityDao.houseDao.CommunityDao; 5 | import dao.classDao.entityDao.houseDao.HouseDao; 6 | import dao.classDao.relationDao.buildingDao.HousePurchaseRecordDao; 7 | import model.entity.Resident; 8 | import model.entity.house.Building; 9 | import model.entity.house.Community; 10 | import model.entity.house.House; 11 | import model.relation.building.HousePurchaseRecord; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | public class HouseService { 18 | private CommunityDao communityDao; 19 | private BuildingDao buildingDao; 20 | private HouseDao houseDao; 21 | 22 | private HousePurchaseRecordDao housePurchaseRecordDao; 23 | 24 | public HouseService(){ 25 | communityDao = new CommunityDao(); 26 | buildingDao = new BuildingDao(); 27 | houseDao = new HouseDao(); 28 | housePurchaseRecordDao = new HousePurchaseRecordDao(); 29 | } 30 | 31 | public List getCommunitys(){ 32 | return communityDao.getAllCommunity(); 33 | } 34 | 35 | public List getBuildings(Community community){ 36 | return buildingDao.getBuildingsByCommunityId(community.getCommunityId()); 37 | } 38 | 39 | public List getHouses(Building building){ 40 | return houseDao.getHousesByBuildingId(building.getBuilding_id()); 41 | } 42 | 43 | public List getEmptyHousesByCommunity(Community community){ 44 | List res = new ArrayList<>(); 45 | List buildings = getBuildings(community); 46 | for (Building building : buildings) { 47 | res.addAll(getEmptyHousesByBuilding(building)); 48 | } 49 | return res; 50 | } 51 | 52 | public List getEmptyHousesByBuilding(Building building){ 53 | List res = new ArrayList<>(); 54 | List houses = getHouses(building); 55 | for (House house : houses){ 56 | if (housePurchaseRecordDao.getRecordByHouseId(house.getHouse_id()) == null) 57 | res.add(house); 58 | } 59 | return res; 60 | } 61 | 62 | /** 63 | * 64 | * @param residentId 65 | * @param house 66 | * @return 1表示住户不存在,2表示房屋已出售,0表示购买操作成功 67 | */ 68 | public int housePurchase(int residentId, House house, float cost){ 69 | ResidentService residentService = new ResidentService(); 70 | Resident resident = residentService.getResidentByResidentId(residentId); 71 | if (resident == null) return 1; 72 | if (housePurchaseRecordDao.getRecordByHouseId(house.getHouse_id()) != null) return 2; 73 | HousePurchaseRecord purchaseRecord = new HousePurchaseRecord(); 74 | purchaseRecord.setHouse_id(house.getHouse_id()); 75 | purchaseRecord.setResident_id(residentId); 76 | purchaseRecord.setCost(cost); 77 | purchaseRecord.setTime(new Date()); 78 | housePurchaseRecordDao.addRecord(purchaseRecord); 79 | residentService.addCost(residentId, "Purchase house", cost); 80 | return 0; 81 | } 82 | 83 | public List getAllPurchasedRecord(){ 84 | return housePurchaseRecordDao.getAll(); 85 | } 86 | 87 | public House getHouseByHouseId(int houseId){ 88 | return houseDao.getHouseByHouseId(houseId); 89 | } 90 | 91 | public Building getBuildingByBuildingId(int buildingId){ 92 | return buildingDao.getBuildingByBuildingId(buildingId); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /propertyManagement/src/dao/classDao/entityDao/equipmentDao/IndoorEquipmentDao.java: -------------------------------------------------------------------------------- 1 | package dao.classDao.entityDao.equipmentDao; 2 | 3 | import dao.JDBCUtil; 4 | import dao.daoInterface.JdbcDaoImpl; 5 | import model.entity.equipment.IndoorEquipment; 6 | import model.entity.house.Building; 7 | 8 | import java.sql.Connection; 9 | import java.sql.Statement; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by your dad on 2019/1/4. 14 | */ 15 | public class IndoorEquipmentDao extends JdbcDaoImpl { 16 | private static Connection connection = JDBCUtil.getConnection(); 17 | 18 | public IndoorEquipmentDao(){ 19 | init(); 20 | } 21 | private static void init() { 22 | try { 23 | Statement statement = connection.createStatement(); 24 | statement.executeUpdate( 25 | "CREATE TABLE IF not exists indoor_equipment\n" + 26 | "(\n" + 27 | " equipment_id INT(32) PRIMARY KEY NOT NULL,\n" + 28 | " building_id INT(32) NOT NULL,\n" + 29 | " type VARCHAR(255) NOT NULL,\n" + 30 | " description VARCHAR(255),\n" + 31 | " state INT(2) DEFAULT '0' NOT NULL\n" + 32 | ");" 33 | ); 34 | statement.close(); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | } 39 | 40 | public boolean addIndoorEquipment(IndoorEquipment indoorEquipment) { 41 | String sql = "INSERT INTO indoor_equipment (building_id, type,description,state) " + 42 | "values (?,?,?,?)"; 43 | update(connection,sql,indoorEquipment.getBuilding_id(), indoorEquipment.getType(),indoorEquipment.getDescription(),indoorEquipment.getState()); 44 | return true; 45 | } 46 | 47 | public IndoorEquipment getInEquipByEquipId(Integer id){ 48 | String sql = "SELECT * " + 49 | "FROM indoor_equipment where equipment_id = ?"; 50 | return get(connection, sql, id); 51 | } 52 | 53 | public boolean removeIndoorEquipment(int indoorEquipmentId){ 54 | if (getInEquipByEquipId(indoorEquipmentId) == null) return false; 55 | String sql = "DELETE FROM indoor_equipment where equipment_id = ?"; 56 | update(connection,sql,indoorEquipmentId); 57 | return true; 58 | } 59 | 60 | public boolean updateIndoorEquipment(IndoorEquipment indoorEquipment){ 61 | if (getInEquipByEquipId(indoorEquipment.getEquipment_id()) == null) return false; 62 | String sql = "UPDATE indoor_equipment SET state=? where equipment_id = ?"; 63 | update(connection,sql,indoorEquipment.getState(),indoorEquipment.getEquipment_id()); 64 | return true; 65 | } 66 | 67 | public List getAllIndoorEquipment(){ 68 | String sql = "SELECT * " + 69 | "FROM indoor_equipment"; 70 | return getList(connection, sql); 71 | } 72 | public IndoorEquipment getIndoorEquipment(int id){ 73 | String sql = "SELECT * " + 74 | "FROM indoor_equipment WHERE equipment_id = ?"; 75 | return get(connection, sql,id); 76 | } 77 | 78 | public List getInEquipByState(Building building, int state){ 79 | String sql = "SELECT * FROM indoor_equipment where building_id = ? and state = ?"; 80 | return getList(connection, sql); 81 | } 82 | 83 | public List getInEquipByBuilding(Building building){ 84 | String sql = "SELECT * FROM indoor_equipment where building_id = ?"; 85 | return getList(connection, sql,building.getBuilding_id()); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /propertyManagement/src/addData.java: -------------------------------------------------------------------------------- 1 | import dao.classDao.entityDao.equipmentDao.IndoorEquipmentDao; 2 | 3 | /** 4 | * Created by your dad on 2019/1/5. 5 | */ 6 | public class addData { 7 | public static void main(String[] args) { 8 | /* HouseDao houseDao =new HouseDao(); 9 | for(int i=0;i<15;i++){ 10 | for(int j=0;j<10;j++){ 11 | House house =new House(); 12 | house.setBuilding_id(i); 13 | house.setName(j/5+"0"+j%5); 14 | house.setSize(40+j*5); 15 | houseDao.addHouse(house); 16 | } 17 | }*/ 18 | /* LeasedParkingSpaceDao leasedParkingSpaceDao = new LeasedParkingSpaceDao(); 19 | OwnedParkingSpaceDao ownedParkingSpaceDao = new OwnedParkingSpaceDao(); 20 | TemporaryParkingSpaceDao temporaryParkingSpaceDao = new TemporaryParkingSpaceDao(); 21 | for (int i = 0; i < 3; i++) { 22 | LeasedParkingSpace leasedParkingSpace = new LeasedParkingSpace(); 23 | OwnedParkingSpace ownedParkingSpace = new OwnedParkingSpace(); 24 | TemporaryParkingSpace temporaryParkingSpace = new TemporaryParkingSpace(); 25 | for (int j = 0; j < 10; j++) { 26 | String community = ""; 27 | switch (i) { 28 | case 0: 29 | community = "A"; 30 | break; 31 | case 1: 32 | community = "B"; 33 | break; 34 | 35 | case 2: 36 | community = "C"; 37 | break; 38 | } 39 | leasedParkingSpace.setCommunity_id(i); 40 | leasedParkingSpace.setDescription("第"+community+"社区 第" + (j + 1) + "租赁车位"); 41 | ownedParkingSpace.setCommunity_id(i); 42 | ownedParkingSpace.setDescription("第"+community+"社区 第" + (j + 1) + "购买车位"); 43 | temporaryParkingSpace.setCommunity_id(i); 44 | temporaryParkingSpace.setDescription("第"+community+"社区 第" + (j + 1) + "临时车位"); 45 | leasedParkingSpaceDao.addLeasedParkingSpace(leasedParkingSpace); 46 | ownedParkingSpaceDao.addOwnedParkingSpace(ownedParkingSpace); 47 | temporaryParkingSpaceDao.addTemporaryParkingSpace(temporaryParkingSpace); 48 | } 49 | } 50 | */ 51 | IndoorEquipmentDao indoorEquipmentDao=new IndoorEquipmentDao(); 52 | /* OutdoorEquipmentDao outdoorEquipmentDao=new OutdoorEquipmentDao(); 53 | 54 | for(int i=0;i<3;i++){ 55 | String community = ""; 56 | switch (i) { 57 | case 0: 58 | community = "A"; 59 | break; 60 | case 1: 61 | community = "B"; 62 | break; 63 | 64 | case 2: 65 | community = "C"; 66 | break; 67 | } 68 | OutdoorEquipment outdoorEquipment = new OutdoorEquipment(); 69 | for(int j=0;j<10;j++) { 70 | outdoorEquipment.setCommunity_id(i); 71 | outdoorEquipment.setType("第"+community+"社区 第"+j+"设备"); 72 | outdoorEquipment.setDescription("没啥可说的设备,made in china"); 73 | outdoorEquipmentDao.addOutdoorEquipment(outdoorEquipment); 74 | } 75 | }*/ 76 | /* for(int i=0;i<15;i++){ 77 | IndoorEquipment indoorEquipment=new IndoorEquipment(); 78 | 79 | for(int j=0;j<5;j++){ 80 | indoorEquipment.setBuilding_id(i); 81 | indoorEquipment.setType("第"+j+"设备"); 82 | indoorEquipment.setDescription("没啥可说的设备,made in china"); 83 | indoorEquipmentDao.addIndoorEquipment(indoorEquipment); 84 | } 85 | }*/ 86 | 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /propertyManagement/src/service/FeedbackService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.entityDao.equipmentDao.IndoorEquipmentDao; 4 | import dao.classDao.relationDao.buildingDao.ComplaintDao; 5 | import dao.classDao.relationDao.equipmentDao.EquipmentIssueDao; 6 | import model.entity.equipment.IndoorEquipment; 7 | import model.entity.house.Building; 8 | import model.entity.house.House; 9 | import model.relation.building.Complaint; 10 | import model.relation.equipment.EquipmentIssue; 11 | 12 | import java.util.ArrayList; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | public class FeedbackService { 17 | EquipmentIssueDao issueDao; 18 | ComplaintDao complaintDao; 19 | 20 | public FeedbackService(){ 21 | issueDao = new EquipmentIssueDao(); 22 | complaintDao = new ComplaintDao(); 23 | } 24 | 25 | public List getIssuesByEquip(IndoorEquipment equipment){ 26 | return issueDao.getIssuesByEquipId(equipment.getEquipment_id()); 27 | } 28 | 29 | public List getIssuesByHouse(House house){ 30 | return issueDao.getIssuesByHouseId(house.getHouse_id()); 31 | } 32 | 33 | public List getIssuesByBuiding(Building building){ 34 | return issueDao.getIssuesByBuildingId(building.getBuilding_id()); 35 | } 36 | 37 | //还未处理的问题 38 | public List getNotSolvedIssues(Building building){ 39 | return issueDao.getNotSolvedIssues(building.getBuilding_id()); 40 | } 41 | 42 | //正在处理的问题 43 | public List getSolvingIssues(Building building){ 44 | return getEquipmentIssues(building, 1); 45 | } 46 | 47 | //已经解决的问题 48 | public List getSolvedIssues(Building building){ 49 | return getEquipmentIssues(building, 0); 50 | } 51 | 52 | private List getEquipmentIssues(Building building, int i) { 53 | EquipmentService equipmentService = new EquipmentService(); 54 | ArrayList res = new ArrayList<>(); 55 | List solvingIssues = issueDao.getSolvingIssues(building.getBuilding_id()); 56 | for (EquipmentIssue issue : solvingIssues) { 57 | if (equipmentService.getInEquipRepairByRepairId(issue.getRepair_id()).getState() 58 | == i) res.add(issue); 59 | } 60 | return res; 61 | } 62 | 63 | public boolean addInEquipIssue(IndoorEquipment equipment, int house, int type, String description){ 64 | EquipmentIssue issue = new EquipmentIssue(); 65 | IndoorEquipmentDao indoorDao= new IndoorEquipmentDao(); 66 | equipment.setState(1); 67 | indoorDao.updateIndoorEquipment(equipment); 68 | issue.setEquipment_id(equipment.getEquipment_id()); 69 | issue.setHouse_id(house); 70 | issue.setRepair_id(null); 71 | issue.setType(type); 72 | issue.setDescription(description); 73 | issue.setTime(new Date()); 74 | return issueDao.addIssue(issue); 75 | } 76 | 77 | /** 78 | * 修改保修的设备的维修状态 79 | * @param issue 80 | * @param repairId 81 | * @return 0表示成功,1表示该次维修不存在 82 | */ 83 | public int modifyIssueRepairId(EquipmentIssue issue, int repairId){ 84 | EquipmentService equipmentService = new EquipmentService(); 85 | if (equipmentService.getInEquipRepairByRepairId(repairId) == null) return 1; 86 | else { 87 | issueDao.modifyRepairId(issue.getFeedback_id(),repairId); 88 | return 0; 89 | } 90 | } 91 | 92 | 93 | public boolean addComplaint(int house, int type, String description){ 94 | Complaint complaint = new Complaint(); 95 | complaint.setHouse_id(house); 96 | complaint.setType(type); 97 | complaint.setDescription(description); 98 | complaint.setProcess(null); 99 | complaint.setDate(new Date()); 100 | return complaintDao.addComplaint(complaint); 101 | } 102 | 103 | public List getComplaintByHouse(House house){ 104 | return complaintDao.getComplaintsByHouseId(house.getHouse_id()); 105 | } 106 | 107 | public List getComplaintByType(int type){ 108 | return complaintDao.getComplaintsByType(type); 109 | } 110 | 111 | public List getNotSolvedComplaint(){ 112 | return complaintDao.getNotSolvedComplaint(); 113 | } 114 | 115 | public List getSolvingComplaint(){ 116 | return complaintDao.getSolvingComplaint(); 117 | } 118 | 119 | public boolean modifyComplaintProcess(Complaint complaint, String process){ 120 | complaint.setProcess(process); 121 | return complaintDao.modifyComplaint(complaint); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /propertyManagement/src/service/EquipmentService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.entityDao.equipmentDao.IndoorEquipmentDao; 4 | import dao.classDao.entityDao.equipmentDao.OutdoorEquipmentDao; 5 | import dao.classDao.relationDao.equipmentDao.*; 6 | import model.entity.equipment.IndoorEquipment; 7 | import model.entity.equipment.OutdoorEquipment; 8 | import model.entity.house.Building; 9 | import model.entity.house.Community; 10 | import model.relation.equipment.IndoorEquipCheck; 11 | import model.relation.equipment.IndoorEquipRepair; 12 | import model.relation.equipment.OutdoorEquipCheck; 13 | import model.relation.equipment.OutdoorEquipRepair; 14 | 15 | import java.util.Date; 16 | import java.util.List; 17 | 18 | public class EquipmentService { 19 | private IndoorEquipmentDao indoorDao; 20 | private OutdoorEquipmentDao outdoorDao; 21 | 22 | private InEquipCheckDao inCheckDao; 23 | private OutEquipCheckDao outCheckDao; 24 | 25 | private InEquipRepairDao inRepairDao; 26 | private OutEquipRepairDao outRepairDao; 27 | 28 | private EquipmentIssueDao issueDao; 29 | 30 | public EquipmentService (){ 31 | indoorDao = new IndoorEquipmentDao(); 32 | outdoorDao = new OutdoorEquipmentDao(); 33 | 34 | inCheckDao = new InEquipCheckDao(); 35 | outCheckDao = new OutEquipCheckDao(); 36 | 37 | inRepairDao = new InEquipRepairDao(); 38 | outRepairDao = new OutEquipRepairDao(); 39 | 40 | issueDao = new EquipmentIssueDao(); 41 | } 42 | 43 | public List getAllIndoorEquipByBuilding(Building building){ 44 | return indoorDao.getInEquipByBuilding(building); 45 | } 46 | 47 | public List getAllOutdoorEquipByCommunity(Community community){ 48 | return outdoorDao.getOutEquipByCommunity(community); 49 | } 50 | 51 | public List getInEquipByBuildingAndState(Building building, int state){ 52 | return indoorDao.getInEquipByState(building,state); 53 | } 54 | 55 | public List getOutEquipByCommunityAndState(Community community, int state){ 56 | return outdoorDao.getOutEquipByState(community, state); 57 | } 58 | 59 | public List getInEquipCheck(IndoorEquipment equipment){ 60 | return inCheckDao.getChecksByEquipId(equipment.getEquipment_id()); 61 | } 62 | 63 | public List getOutEquipCheck(OutdoorEquipment equipment){ 64 | return outCheckDao.getChecksByEquipId(equipment.getEquipment_id()); 65 | } 66 | 67 | public List getInEquipRepair(IndoorEquipment equipment){ 68 | return inRepairDao.getRepairsByEquipmentId(equipment.getEquipment_id()); 69 | } 70 | 71 | public IndoorEquipRepair getInEquipRepairByRepairId(int repairId){ 72 | return inRepairDao.getRepairByRepairId(repairId); 73 | } 74 | 75 | public List getOutEquipRepair(OutdoorEquipment outdoorEquipment){ 76 | return outRepairDao.getRepairsByEquimentId(outdoorEquipment.getEquipment_id()); 77 | } 78 | 79 | public int addInEquipCheck(IndoorEquipment equipment, int state){ 80 | if (indoorDao.getInEquipByEquipId(equipment.getEquipment_id()) == null) return 1; 81 | equipment.setState(state); 82 | indoorDao.updateIndoorEquipment(equipment); 83 | IndoorEquipCheck check = new IndoorEquipCheck(); 84 | check.setEquipment_id(equipment.getEquipment_id()); 85 | check.setState(state); 86 | check.setTime(new Date()); 87 | inCheckDao.addCheck(check); 88 | return 0; 89 | } 90 | 91 | public IndoorEquipment getIE(int id){ 92 | return indoorDao.getIndoorEquipment(id); 93 | } 94 | 95 | public int addOutEquipCheck(OutdoorEquipment equipment, int state){ 96 | if (outdoorDao.getOutEquipByEquipId(equipment.getEquipment_id()) == null) return 1; 97 | equipment.setState(state); 98 | outdoorDao.updateOutdoorEquipment(equipment); 99 | OutdoorEquipCheck check = new OutdoorEquipCheck(); 100 | check.setEquipment_id(equipment.getEquipment_id()); 101 | check.setState(state); 102 | check.setTime(new Date()); 103 | outCheckDao.addCheck(check); 104 | return 0; 105 | } 106 | 107 | public int addInEquipRepair(IndoorEquipment equipment, float cost){ 108 | if (indoorDao.getInEquipByEquipId(equipment.getEquipment_id()) == null) return 1; 109 | equipment.setState(2); 110 | indoorDao.updateIndoorEquipment(equipment); 111 | IndoorEquipRepair repair = new IndoorEquipRepair(); 112 | repair.setEquipment_id(equipment.getEquipment_id()); 113 | repair.setCost(cost); 114 | repair.setState(1); 115 | repair.setTime(new Date()); 116 | inRepairDao.addRepair(repair); 117 | return 0; 118 | } 119 | 120 | public int addOutEquipRepair(OutdoorEquipment equipment, float cost){ 121 | if (outdoorDao.getOutEquipByEquipId(equipment.getEquipment_id()) == null) return 1; 122 | equipment.setState(2); 123 | outdoorDao.updateOutdoorEquipment(equipment); 124 | OutdoorEquipRepair repair = new OutdoorEquipRepair(); 125 | repair.setEquipment_id(equipment.getEquipment_id()); 126 | repair.setCost(cost); 127 | repair.setState(1); 128 | repair.setTime(new Date()); 129 | outRepairDao.addRepair(repair); 130 | return 0; 131 | } 132 | 133 | public boolean modifyInEquipRepairState(IndoorEquipRepair repair, int state){ 134 | if (state == 0) { 135 | IndoorEquipment equipment = indoorDao.getInEquipByEquipId(repair.getEquipment_id()); 136 | equipment.setState(0); 137 | indoorDao.updateIndoorEquipment(equipment); 138 | } 139 | return inRepairDao.modifyRepairState(repair.getRepair_id(), state); 140 | } 141 | 142 | public boolean modifyOutEquipRepairState(OutdoorEquipRepair repair, int state){ 143 | if (state == 0){ 144 | OutdoorEquipment equipment = outdoorDao.getOutEquipByEquipId(repair.getEquipment_id()); 145 | equipment.setState(0); 146 | outdoorDao.updateOutdoorEquipment(equipment); 147 | } 148 | return outRepairDao.modifyRepairState(repair.getRepair_id(), state); 149 | } 150 | 151 | public List getInRepairsByTime(Date startTime, Date endTime){ 152 | return inRepairDao.getRepairsByTime(startTime, endTime); 153 | } 154 | 155 | public List getOutRepairsByTime(Date startTime, Date endTime){ 156 | return outRepairDao.getRepairsByTime(startTime, endTime); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /propertyManagement/src/service/ParkingService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.entityDao.parkingspaceDao.LeasedParkingSpaceDao; 4 | import dao.classDao.entityDao.parkingspaceDao.OwnedParkingSpaceDao; 5 | import dao.classDao.entityDao.parkingspaceDao.TemporaryParkingSpaceDao; 6 | import dao.classDao.relationDao.parkingDao.LeasedParkingRecordDao; 7 | import dao.classDao.relationDao.parkingDao.OwnedParkingRecordDao; 8 | import dao.classDao.relationDao.parkingDao.TemporaryParkingRecordDao; 9 | import model.entity.Resident; 10 | import model.entity.house.Community; 11 | import model.entity.parkingspace.LeasedParkingSpace; 12 | import model.entity.parkingspace.OwnedParkingSpace; 13 | import model.entity.parkingspace.TemporaryParkingSpace; 14 | import model.relation.parking.LeasedParkingRecord; 15 | import model.relation.parking.OwnedParkingRecord; 16 | import model.relation.parking.TemporaryParkingRecord; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Date; 20 | import java.util.List; 21 | 22 | public class ParkingService { 23 | LeasedParkingSpaceDao leasedDao; 24 | OwnedParkingSpaceDao ownedDao; 25 | TemporaryParkingSpaceDao tempDao; 26 | 27 | LeasedParkingRecordDao leasedRecordDao; 28 | OwnedParkingRecordDao ownedRecordDao; 29 | TemporaryParkingRecordDao tempRecordDao; 30 | 31 | public ParkingService(){ 32 | leasedDao = new LeasedParkingSpaceDao(); 33 | leasedRecordDao = new LeasedParkingRecordDao(); 34 | 35 | ownedDao = new OwnedParkingSpaceDao(); 36 | ownedRecordDao = new OwnedParkingRecordDao(); 37 | 38 | tempDao = new TemporaryParkingSpaceDao(); 39 | tempRecordDao = new TemporaryParkingRecordDao(); 40 | } 41 | 42 | public List getAllTempParkingSpaces(Community community){ 43 | return tempDao.getTempParkingSpacesByCommunity(community); 44 | } 45 | 46 | public List getAllLeasedParkingSpaces(Community community){ 47 | return leasedDao.getLeasedParkingSpacesByCommunity(community); 48 | } 49 | 50 | public List getOwnedParkingSpaceByCommunityId(Community community){ 51 | return ownedDao.getOwnedParkingSpacesByCommunity(community); 52 | } 53 | 54 | public List getEmptyTempParkingSpaces(Community community){ 55 | return tempDao.getTempParkingByCommunityAndState(community, 0); 56 | } 57 | 58 | public List getEmptyLeasedParkingSpaces(Community community){ 59 | return leasedDao.getLeasedParkingByCommunityAndState(community, 0); 60 | } 61 | 62 | public List getEmptyOwnedParkingSpaces(Community community){ 63 | List res = new ArrayList<>(); 64 | List allSpaces = ownedDao.getOwnedParkingSpacesByCommunity(community); 65 | for (OwnedParkingSpace space : allSpaces){ 66 | if (ownedRecordDao.getRecordBySpaceId(space.getParking_space_id()) == null ) 67 | res.add(space); 68 | } 69 | return res; 70 | } 71 | 72 | /** 73 | * 用于模拟临时停车(修改车位状态) 74 | * @param space 75 | * @return 0表示操作完成,1表示已有人使用,2表示没有该车位 76 | */ 77 | public int tempParking(TemporaryParkingSpace space, String carId){ 78 | space = tempDao.getTemporaryParkingSpace(space.getParking_space_id()); 79 | if (space == null) return 2; 80 | else if (space.getParking_state() == 1) return 1; 81 | else { 82 | space.setParking_state(1); 83 | tempDao.updateTemporaryParkingSpace(space); 84 | TemporaryParkingRecord record = new TemporaryParkingRecord(); 85 | record.setParking_space_id(space.getParking_space_id()); 86 | record.setCar_id(carId); 87 | record.setStart_time(new Date()); 88 | tempRecordDao.addRecord(record); 89 | } 90 | return 0; 91 | } 92 | 93 | /** 94 | * 车位离开 95 | * @param space 96 | * @param cost 97 | * @return 0表示操作完成,1表示没有使用,2表示没有该车位 98 | */ 99 | public int tempLeaving(TemporaryParkingSpace space, float cost){ 100 | space = tempDao.getTemporaryParkingSpace(space.getParking_space_id()); 101 | if (space == null) return 2; 102 | else if (space.getParking_state() == 0) return 1; 103 | else { 104 | space.setParking_state(0); 105 | tempDao.updateTemporaryParkingSpace(space); 106 | TemporaryParkingRecord record = tempRecordDao.getRecordLatest(space.getParking_space_id()); 107 | record.setParking_space_id(space.getParking_space_id()); 108 | record.setEnd_time(new Date()); 109 | record.setCost(cost); 110 | tempRecordDao.updateRecord(record); 111 | } 112 | return 0; 113 | } 114 | 115 | /** 116 | * 用于添加车位租赁信息 117 | * @param resident 118 | * @param parkingSpace 119 | * @return 0表示操作完成,1表示已有人使用,2表示没有该车位 120 | */ 121 | public int rentParkingSpace(Resident resident, LeasedParkingSpace parkingSpace, Date startTime, Date endTime){ 122 | parkingSpace = leasedDao.getLeasedParkingSpaceBySpaceId(parkingSpace.getParking_space_id()); 123 | if (parkingSpace == null) return 2; 124 | if (parkingSpace.getParking_state() != 0){ 125 | return 1; 126 | } else { 127 | leasedDao.modifyLeasedParkingSpaceState(parkingSpace.getParking_space_id(), 1); 128 | LeasedParkingRecord record = new LeasedParkingRecord(); 129 | record.setResident_id(resident.getResident_id()); 130 | record.setParking_space_id(parkingSpace.getParking_space_id()); 131 | record.setStart_time(startTime); 132 | record.setEnd_time(endTime); 133 | leasedRecordDao.addRecord(record); 134 | return 0; 135 | } 136 | } 137 | 138 | /** 139 | * 140 | * @param resident 141 | * @param space 142 | * @param cost 143 | * @return 0表示操作完成,1表示已有人使用,2表示没有该车位 144 | */ 145 | public int purchaseParkingSpace(Resident resident, OwnedParkingSpace space, float cost){ 146 | if (ownedDao.getOwnedParkingSpaceBySpaceId(space.getParking_space_id()) == null) return 2; 147 | else if (ownedRecordDao.getRecordBySpaceId(space.getParking_space_id()) != null) return 1; 148 | else { 149 | OwnedParkingRecord record = new OwnedParkingRecord(); 150 | ResidentService residentService = new ResidentService(); 151 | residentService.addCost(resident.getResident_id(),"Purchase parking space.", cost); 152 | record.setResident_id(resident.getResident_id()); 153 | record.setParking_space_id(space.getParking_space_id()); 154 | record.setCost(cost); 155 | record.setDate(new Date()); 156 | ownedRecordDao.addRecord(record); 157 | return 1; 158 | } 159 | } 160 | 161 | public LeasedParkingSpace getParkingSpaceBySpaceId(int spaceId){ 162 | return leasedDao.getLeasedParkingSpaceBySpaceId(spaceId); 163 | } 164 | 165 | /** 166 | * 得到给定时间在结束时间之前的车位租赁信息,为有效信息 167 | * @param date 168 | * @return 169 | */ 170 | public List getValidRentRecord(Date date){ 171 | return leasedRecordDao.getRecordsValid(date); 172 | } 173 | 174 | public List getOwnedParkingRecord(){ 175 | return ownedRecordDao.getAll(); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /propertyManagement/src/service/PaymentService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import dao.classDao.relationDao.ProperMonthRecordDao; 4 | import dao.classDao.relationDao.PropertyRecordDao; 5 | import dao.classDao.relationDao.equipmentDao.InEquipRepairDao; 6 | import dao.classDao.relationDao.equipmentDao.OutEquipRepairDao; 7 | import dao.classDao.relationDao.parkingDao.TemporaryParkingRecordDao; 8 | import dao.classDao.relationDao.residentDao.ResidentCostDao; 9 | import model.entity.house.Building; 10 | import model.entity.house.House; 11 | import model.relation.ProperMonthRecord; 12 | import model.relation.PropertyRecord; 13 | import model.relation.building.HousePurchaseRecord; 14 | import model.relation.equipment.IndoorEquipRepair; 15 | import model.relation.equipment.OutdoorEquipRepair; 16 | import model.relation.parking.LeasedParkingRecord; 17 | import model.relation.parking.OwnedParkingRecord; 18 | import model.relation.parking.TemporaryParkingRecord; 19 | import model.relation.resident.ResidentCost; 20 | 21 | import java.text.ParseException; 22 | import java.text.SimpleDateFormat; 23 | import java.util.Calendar; 24 | import java.util.Date; 25 | import java.util.List; 26 | 27 | /** 28 | * Created by your dad on 2019/1/5. 29 | */ 30 | public class PaymentService { 31 | private int[] parkingRentCost = {200, 250, 300}; 32 | private float[] houseManagingCost = {1.0f, 1.5f, 2.0f}; 33 | private int parkingManagingCost = 50; 34 | 35 | private TemporaryParkingRecordDao temporaryParkingRecordDao; 36 | private ResidentCostDao residentCostDao; 37 | private InEquipRepairDao indoorEquipRepairDao; 38 | private OutEquipRepairDao outEquipRepairDao; 39 | private PropertyRecordDao propertyRecordDao; 40 | private ProperMonthRecordDao properMonthRecordDao; 41 | 42 | public PaymentService() { 43 | temporaryParkingRecordDao = new TemporaryParkingRecordDao(); 44 | residentCostDao = new ResidentCostDao(); 45 | indoorEquipRepairDao = new InEquipRepairDao(); 46 | outEquipRepairDao = new OutEquipRepairDao(); 47 | propertyRecordDao = new PropertyRecordDao(); 48 | properMonthRecordDao = new ProperMonthRecordDao(); 49 | } 50 | 51 | //用户付款状态调整 52 | public boolean pay(int costId) { 53 | return residentCostDao.modifyState(costId, 0); 54 | } 55 | 56 | public List getTemParkingRecordCost() { 57 | return temporaryParkingRecordDao.getRecordsByCostNoNull(); 58 | } 59 | 60 | public List getResidentCost() { 61 | return residentCostDao.getAllCosts(); 62 | } 63 | 64 | public List getInRepairCost() { 65 | return indoorEquipRepairDao.getAllRepairs(); 66 | } 67 | 68 | public List getOutRepairCost() { 69 | return outEquipRepairDao.getAllRepairs(); 70 | } 71 | 72 | public List getPropertyRecordCost() { 73 | return propertyRecordDao.getAllRecords(); 74 | } 75 | 76 | public List getResidentCostByResidentId(int id) { 77 | return residentCostDao.getCostsByResidentId(id); 78 | } 79 | 80 | public ProperMonthRecord monthProperty() throws ParseException { 81 | int firstMonthFlag = 0; 82 | Calendar calendar = Calendar.getInstance(); 83 | if (calendar.get(Calendar.MONTH) == 0) firstMonthFlag = 1; 84 | 85 | int currentYear = calendar.get(Calendar.YEAR); 86 | int currentMonth = calendar.get(Calendar.MONTH) + 1; 87 | 88 | int lastMonthYear = currentYear - firstMonthFlag; 89 | System.out.println(lastMonthYear); 90 | int lastMonthMonth = currentMonth - 1; 91 | if (lastMonthMonth == 0) lastMonthMonth = 12; 92 | System.out.println(lastMonthMonth); 93 | 94 | calendar.set(currentYear, currentYear, 1); 95 | Date currentMonthStart = calendar.getTime(); 96 | calendar.set(currentYear, currentMonth, 30); 97 | Date currentMonthEnd = calendar.getTime(); 98 | 99 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 100 | Date lastMonthStart = sdf.parse(lastMonthYear + "-" + lastMonthMonth + "-" + "01"); 101 | System.out.println(lastMonthStart); 102 | Date lastMonthEnd = sdf.parse(lastMonthYear + "-" + lastMonthMonth + "-" + "30"); 103 | System.out.println(lastMonthEnd); 104 | 105 | 106 | ProperMonthRecord monthRecord = properMonthRecordDao.getRecordByYearAndMonth(lastMonthYear, lastMonthMonth); 107 | if (monthRecord != null) return monthRecord; 108 | 109 | ParkingService parkingService = new ParkingService(); 110 | ResidentService residentService = new ResidentService(); 111 | HouseService houseService = new HouseService(); 112 | EquipmentService equipmentService = new EquipmentService(); 113 | /* 114 | 向resident_cost添加本月应缴费用 115 | */ 116 | //租借车位费与租借车位管理费 117 | List leasedParkingRecords = parkingService.getValidRentRecord(currentMonthStart); 118 | for (LeasedParkingRecord record : leasedParkingRecords){ 119 | residentService.addCost(record.getResident_id(), "Rent parking space cost.", 120 | parkingRentCost[parkingService.getParkingSpaceBySpaceId(record.getParking_space_id()).getCommunity_id()]); 121 | residentService.addCost(record.getResident_id(), "Rent parking managing cost", parkingManagingCost); 122 | } 123 | 124 | //购买车位管理费 125 | List ownedParkingRecords = parkingService.getOwnedParkingRecord(); 126 | for (OwnedParkingRecord record : ownedParkingRecords){ 127 | residentService.addCost(record.getResident_id(), "Purchased parking space managing cost.", parkingManagingCost); 128 | } 129 | 130 | //物业费 131 | List housePurchaseRecords = houseService.getAllPurchasedRecord(); 132 | for (HousePurchaseRecord record : housePurchaseRecords){ 133 | House house = houseService.getHouseByHouseId(record.getHouse_id()); 134 | Building building = houseService.getBuildingByBuildingId(house.getBuilding_id()); 135 | residentService.addCost(record.getResident_id(), "Purchased house managing cost.", 136 | house.getSize() * houseManagingCost[building.getCommunity_id()]); 137 | } 138 | 139 | //计算物业收支 140 | //收入 141 | //来自用户的收入 142 | float income = 0; 143 | List residentCosts = residentService.getCostsBetweenTime(lastMonthStart, lastMonthEnd); 144 | for (ResidentCost cost : residentCosts) { 145 | income += cost.getCost(); 146 | } 147 | //支出 148 | //维修费支出 149 | float expenses = 0; 150 | List inRepairs = equipmentService.getInRepairsByTime(lastMonthStart, lastMonthEnd); 151 | for (IndoorEquipRepair repair : inRepairs){ 152 | expenses += repair.getCost(); 153 | } 154 | 155 | List outRepairs = equipmentService.getOutRepairsByTime(lastMonthStart, lastMonthEnd); 156 | for (OutdoorEquipRepair repair : outRepairs){ 157 | expenses += repair.getCost(); 158 | } 159 | 160 | //其他收入与其他支出 161 | List otherIncomes = propertyRecordDao.getRecordsByTime(lastMonthStart, lastMonthEnd); 162 | for (PropertyRecord record : otherIncomes){ 163 | if (record.getType() == 0) { 164 | income += record.getAmount(); 165 | } else if (record.getType() == 1){ 166 | expenses += record.getAmount(); 167 | } 168 | } 169 | 170 | float properMonthRes = income - expenses; 171 | monthRecord = new ProperMonthRecord(); 172 | monthRecord.setYear(lastMonthYear); 173 | monthRecord.setMonth(lastMonthMonth); 174 | monthRecord.setAmount(Math.abs(properMonthRes)); 175 | 176 | if (properMonthRes > 0) { 177 | monthRecord.setType(0); 178 | properMonthRecordDao.addProperMonthRecord(monthRecord); 179 | } else if (properMonthRes <= 0){ 180 | monthRecord.setType(1); 181 | properMonthRecordDao.addProperMonthRecord(monthRecord); 182 | } 183 | return monthRecord; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /propertyManagement/.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /propertyManagement/src/UI.java: -------------------------------------------------------------------------------- 1 | import model.entity.Resident; 2 | import model.entity.equipment.IndoorEquipment; 3 | import model.entity.equipment.OutdoorEquipment; 4 | import model.entity.house.Building; 5 | import model.entity.house.Community; 6 | import model.entity.house.House; 7 | import model.entity.parkingspace.LeasedParkingSpace; 8 | import model.entity.parkingspace.OwnedParkingSpace; 9 | import model.entity.parkingspace.TemporaryParkingSpace; 10 | import model.relation.ProperMonthRecord; 11 | import model.relation.PropertyRecord; 12 | import model.relation.building.Complaint; 13 | import model.relation.equipment.*; 14 | import model.relation.parking.TemporaryParkingRecord; 15 | import model.relation.resident.ResidentCost; 16 | import service.*; 17 | 18 | import java.text.ParseException; 19 | import java.util.Date; 20 | import java.util.List; 21 | import java.util.Scanner; 22 | 23 | /** 24 | * Created by your dad on 2019/1/4. 25 | */ 26 | public class UI { 27 | public static void main(String[] args) { 28 | System.out.println("welcome to Community System"); 29 | while (true) { 30 | //0 31 | while (true) { 32 | floor_1(); 33 | String input = Input(); 34 | if (!(input.equals("1") || input.equals("2") || input.equals("3") || input.equals("4"))) { 35 | System.out.println("已经最上层"); 36 | break; 37 | } 38 | if (input.equals("1")) { 39 | //1 40 | while (true) { 41 | floor_2(); 42 | input = Input(); 43 | if (!(input.equals("1") || input.equals("2"))) { 44 | System.out.println("已返回,请重新输入"); 45 | break; 46 | } 47 | if (input.equals("1")) { 48 | HouseService houseService = new HouseService(); 49 | List communities = houseService.getCommunitys(); 50 | System.out.println("小区编号 " + "小区名称"); 51 | for (int i = 0; i < communities.size(); i++) { 52 | System.out.println((i + 1) + " " + communities.get(i).getName()); 53 | } 54 | /*coding 55 | List<> 56 | 打印 57 | 1->小区名称 58 | 2->... 59 | 完成 60 | */ 61 | //1.1 62 | while (true) { 63 | System.out.println("请输入小区编号"); 64 | int inputInteger = Integer.parseInt(Input()); 65 | if (!(inputInteger >= 1 && inputInteger <= communities.size())) { 66 | // System.out.println("已返回,请重新输入"); 67 | break; 68 | } 69 | List buildings = houseService.getBuildings(communities.get(inputInteger - 1)); 70 | System.out.println("楼编号 " + "楼名称"); 71 | for (int i = 0; i < buildings.size(); i++) { 72 | System.out.println((i + 1) + " " + buildings.get(i).getName()); 73 | } 74 | /*coding 75 | List<> 76 | 打印 77 | 1->楼宇名称 78 | 2->... 79 | 完成 80 | */ 81 | while (true) { 82 | System.out.println("请输入楼编号"); 83 | inputInteger = Integer.parseInt(Input()); 84 | if (!(inputInteger >= 1 && inputInteger <= buildings.size())) { 85 | // System.out.println("已返回,请重新输入"); 86 | break; 87 | } 88 | List houses = houseService.getEmptyHousesByBuilding(buildings.get(inputInteger - 1)); 89 | System.out.println("房子编号 " + "房子名称 " + "房子size"); 90 | for (int i = 0; i < houses.size(); i++) { 91 | System.out.println((i + 1) + " " + houses.get(i).getName() + " " + houses.get(i).getSize()); 92 | } 93 | /*coding 94 | List<> 95 | 打印 96 | 1->空闲房屋名称 97 | 2->... 98 | 完成 99 | */ 100 | while (true) { 101 | System.out.println("买房请输入房屋序号:"); 102 | inputInteger = Integer.parseInt(Input()); 103 | if (!(inputInteger >= 1 && inputInteger <= houses.size())) { 104 | // System.out.println("已返回,请重新输入"); 105 | break; 106 | } 107 | System.out.println("输入买房者ID(此处可以为0)"); 108 | int inputInteger2 = Integer.parseInt(Input()); 109 | /*查询ID, break;*/ 110 | ResidentService residentService = new ResidentService(); 111 | if (residentService.getResidentByResidentId(inputInteger2) == null) { 112 | System.out.println("ID无效"); 113 | break; 114 | } 115 | houseService.housePurchase(inputInteger2, houses.get(inputInteger - 1), 100000 * houses.get(inputInteger - 1).getSize()); 116 | /*添加买房记录,暂时不交(物业费 完成 117 | * */ 118 | System.out.println("购房成功"); 119 | break; 120 | } 121 | } 122 | 123 | } 124 | 125 | } 126 | //1.2 127 | if (input.equals("2")) { 128 | ResidentService residentService = new ResidentService(); 129 | List residents = residentService.getAllResidents(); 130 | for (int i = 0; i < residents.size(); i++) { 131 | System.out.println("ID:" + residents.get(i).getResident_id() + " 姓名:" + residents.get(i).getName() + " 电话:" + residents.get(i).getTel()); 132 | } 133 | /*得到所有住户,展示其每月支出和代缴费用 134 | List<> 135 | ID+1-> 136 | ID+1->打印 137 | * */ 138 | //1.2.1 139 | while (true) { 140 | System.out.println("输入用户ID,展示具体代缴款额"); 141 | int inputInteger = Integer.parseInt(Input()); 142 | if (!(inputInteger > 0 && inputInteger <= residents.size())) { 143 | break; 144 | } 145 | PaymentService paymentService = new PaymentService(); 146 | List residentCosts = paymentService.getResidentCostByResidentId(inputInteger); 147 | for (int i = 0; i < residentCosts.size(); i++) { 148 | System.out.println("编号ID:" + residentCosts.get(i).getCost_id() + " 描述:" + residentCosts.get(i).getDescription() + " 时间:" + residentCosts.get(i).getTime() + " 金额:" + residentCosts.get(i).getCost() + " 支付情况:" + residentCosts.get(i).getState()); 149 | } 150 | /*List<> 151 | * 1-> 152 | * 2-> 153 | * */ 154 | System.out.println("输入代缴编号ID,完成缴费"); 155 | inputInteger = Integer.parseInt(Input()); 156 | if (inputInteger == 0) //inputInteger不在0-size之间 157 | break; 158 | /* 159 | * 缴费 160 | * */ 161 | paymentService.pay(inputInteger); 162 | System.out.println("缴费成功"); 163 | } 164 | } 165 | } 166 | } 167 | if (input.equals("2")) { 168 | //2 169 | HouseService houseService = new HouseService(); 170 | List communities = houseService.getCommunitys(); 171 | for (int i = 0; i < communities.size(); i++) { 172 | System.out.println("小区编号:" + (i + 1) + "小区名称:" + communities.get(i).getName() + " "); 173 | } 174 | System.out.println("输入小区号"); 175 | int inputIN = Integer.parseInt(Input()); 176 | Community community = communities.get(inputIN - 1); 177 | while (true) { 178 | ParkingService parkingService = new ParkingService(); 179 | /** 180 | * List<> 3个记录 181 | 临时车位信息 182 | 租用车位信息 183 | 购买车位信息 184 | */ 185 | floor_3(); 186 | input = Input(); 187 | if (!(input.equals("1") || input.equals("2") || input.equals("3"))) { 188 | System.out.println("已返回,请重新输入"); 189 | break; 190 | } 191 | if (input.equals("1")) { 192 | //2.1 193 | // List leasedParkingSpacesEmpty = parkingService.getEmptyLeasedParkingSpaces(community); 194 | while (true) { 195 | List temporaryParkingSpaces = parkingService.getAllTempParkingSpaces(community); 196 | System.out.println("车位编号 " + "描述" + "状态"); 197 | for (int i = 0; i < temporaryParkingSpaces.size(); i++) { 198 | System.out.println((i + 1) + " " + temporaryParkingSpaces.get(i).getDescription() + " " + temporaryParkingSpaces.get(i).getParking_state()); 199 | } 200 | 201 | /* System.out.println("1.临时车位借"); 202 | System.out.println("2.临时车位还"); 203 | input = Input(); 204 | if (!(input.equals("1") || input.equals("2"))) { 205 | System.out.println("已返回,请重新输入"); 206 | break; 207 | }*/ 208 | //2.1.1 209 | System.out.println("选择状态为0的默认停车,为1的为还车"); 210 | int inputInteger = Integer.parseInt(Input()); 211 | /*判断*/ 212 | if (!(inputInteger > 0 && inputInteger <= temporaryParkingSpaces.size())) { 213 | break; 214 | }//来进车 215 | if (temporaryParkingSpaces.get(inputInteger - 1).getParking_state() == 0) { 216 | System.out.println("输入车牌号"); 217 | input = Input(); 218 | parkingService.tempParking(temporaryParkingSpaces.get(inputInteger - 1), input); 219 | }//出车 220 | if (temporaryParkingSpaces.get(inputInteger - 1).getParking_state() == 1) { 221 | System.out.println("输入花费"); 222 | parkingService.tempLeaving(temporaryParkingSpaces.get(inputInteger - 1), (float) Integer.parseInt(Input())); 223 | } 224 | break; 225 | } 226 | } 227 | if (input.equals("2")) { 228 | //2.2 229 | /*List<> 230 | *1-> 231 | *2-> 232 | * 打印剩余车位 233 | * */ 234 | while (true) { 235 | List leasedParkingSpaces = parkingService.getAllLeasedParkingSpaces(community); 236 | System.out.println("车位编号 " + "描述" + "状态"); 237 | for (int i = 0; i < leasedParkingSpaces.size(); i++) { 238 | System.out.println((i + 1) + " " + leasedParkingSpaces.get(i).getDescription() + " " + leasedParkingSpaces.get(i).getParking_state()); 239 | } 240 | 241 | System.out.println("租用车位请选择编号"); 242 | int inputInteger = Integer.parseInt(Input()); 243 | if (!(inputInteger > 0 && inputInteger <= leasedParkingSpaces.size())) {//编号不在0-size之间 244 | break; 245 | } 246 | System.out.println("输入租车位者ID(此处可以为0)"); 247 | int inputInteger2 = Integer.parseInt(Input()); 248 | /*查询ID, break;*/ 249 | ResidentService residentService = new ResidentService(); 250 | if (residentService.getResidentByResidentId(inputInteger2) == null) { 251 | System.out.println("ID无效"); 252 | break; 253 | } 254 | System.out.println("输入租车月数"); 255 | int inputInteger3 = Integer.parseInt(Input()); 256 | if (inputInteger3 <= 0) {//编号不在0-size之间 257 | break; 258 | } 259 | Date dateOne = new Date(); 260 | Date dateTwo = new Date(); 261 | dateTwo.setMonth(dateTwo.getMonth() + inputInteger3); 262 | int x = parkingService.rentParkingSpace(residentService.getResidentByResidentId(inputInteger2), leasedParkingSpaces.get(inputInteger - 1), dateOne, dateTwo); 263 | if (x == 1) { 264 | System.out.println("正有人使用,租不了"); 265 | } 266 | /**插入 267 | * 租车位信息 插入 268 | * 租车起始时间,结束时间 269 | */ 270 | break; 271 | } 272 | } 273 | if (input.equals("3")) { 274 | //2.3 275 | /*List<> 276 | *1-> 277 | *2-> 278 | * 打印剩余车位 279 | * */ 280 | while (true) { 281 | List ownedParkingSpaces = parkingService.getEmptyOwnedParkingSpaces(community); 282 | System.out.println("车位编号 " + "描述" + "空余车位如下"); 283 | for (int i = 0; i < ownedParkingSpaces.size(); i++) { 284 | System.out.println((i + 1) + " " + ownedParkingSpaces.get(i).getDescription() + " "); 285 | } 286 | ; 287 | System.out.println("购买车位请选择编号"); 288 | int inputInteger = Integer.parseInt(Input()); 289 | if (!(inputInteger > 0 && inputInteger <= ownedParkingSpaces.size())) {//编号不在0-size之间 290 | break; 291 | } 292 | System.out.println("输入买车位者ID(此处可以为0)"); 293 | int inputInteger2 = Integer.parseInt(Input()); 294 | /*查询ID, break;*/ 295 | ResidentService residentService = new ResidentService(); 296 | if (residentService.getResidentByResidentId(inputInteger2) == null) { 297 | System.out.println("ID无效"); 298 | break; 299 | } 300 | /**插入 301 | * 买车位信息 插入 (并记录车位管理费用 302 | * 303 | */ 304 | parkingService.purchaseParkingSpace(residentService.getResidentByResidentId(inputInteger2), ownedParkingSpaces.get(inputInteger - 1), 50000); 305 | break; 306 | } 307 | } 308 | } 309 | } 310 | if (input.equals("3")) { 311 | //3 312 | 313 | while (true) { 314 | floor_4(); 315 | input = Input(); 316 | if (!(input.equals("1") || input.equals("2") || input.equals("3") || input.equals("4"))) { 317 | System.out.println("已返回,请重新输入"); 318 | break; 319 | } 320 | HouseService houseService = new HouseService(); 321 | EquipmentService equipmentService = new EquipmentService(); 322 | List communities = houseService.getCommunitys(); 323 | for (int i = 0; i < communities.size(); i++) { 324 | System.out.println("小区编号:" + (i + 1) + "小区名称:" + communities.get(i).getName() + " "); 325 | } 326 | System.out.println("输入小区号"); 327 | int inputIN = Integer.parseInt(Input()); 328 | if (inputIN == 0) 329 | break; 330 | Community community = communities.get(inputIN - 1); 331 | if (input.equals("1")) { 332 | //3.1 333 | /*List<>搜有设备目前信息,好坏,(维修中待定) 334 | * 1-> 335 | * 2-> 336 | * */ 337 | List outdoorEquipments = equipmentService.getAllOutdoorEquipByCommunity(community); 338 | System.out.println("设备编号 " + "设备类型 " + "描述 " + "状态 "); 339 | for (int i = 0; i < outdoorEquipments.size(); i++) { 340 | System.out.println((i + 1) + " " + 341 | outdoorEquipments.get(i).getType() + " " + 342 | outdoorEquipments.get(i).getDescription() + " " + outdoorEquipments.get(i).getState()); 343 | } 344 | System.out.println("具体设备情况,输入设备编号"); 345 | int inputInteger = Integer.parseInt(Input()); 346 | if (!(inputInteger > 0 && inputInteger <= outdoorEquipments.size())) {//编号不在0-size之间 347 | break; 348 | } 349 | System.out.println("1.查询"); 350 | System.out.println("2.修理"); 351 | int inputInteger2 = Integer.parseInt(Input()); 352 | if (!(inputInteger2 == 1 || inputInteger2 == 2)) { 353 | } 354 | if (inputInteger2 == 1) { 355 | List outdoorEquipChecks = equipmentService.getOutEquipCheck(outdoorEquipments.get(inputInteger - 1)); 356 | System.out.println("编号" + " 状态" + " 时间"); 357 | for (int i = 0; i < outdoorEquipChecks.size(); i++) { 358 | System.out.println((i + 1) + " " + 359 | outdoorEquipChecks.get(i).getState() + " " + 360 | outdoorEquipChecks.get(i).getTime()); 361 | } 362 | System.out.println("输入1开始检查设备,其他返回上层"); 363 | int center = Integer.parseInt(Input()); 364 | if (center == 1) { 365 | System.out.println("输入状态,0好,1坏"); 366 | center = Integer.parseInt(Input()); 367 | equipmentService.addOutEquipCheck(outdoorEquipments.get(inputInteger - 1), center); 368 | } 369 | } 370 | if (inputInteger2 == 2) { 371 | List outdoorEquipRepairs = equipmentService.getOutEquipRepair(outdoorEquipments.get(inputInteger - 1)); 372 | System.out.println("编号" + " 状态" + " 花费" + " 时间"); 373 | for (int i = 0; i < outdoorEquipRepairs.size(); i++) { 374 | System.out.println((i + 1) + " " + 375 | outdoorEquipRepairs.get(i).getState() + " " + 376 | outdoorEquipRepairs.get(i).getCost() + " " + 377 | outdoorEquipRepairs.get(i).getTime()); 378 | } 379 | System.out.println("输入设备编号使其修好,输入0新建维修,输入其他无变化"); 380 | int center = Integer.parseInt(Input()); 381 | if (center == 0) { 382 | equipmentService.addOutEquipRepair(outdoorEquipments.get(inputInteger - 1), 10); 383 | } else { 384 | equipmentService.modifyOutEquipRepairState(outdoorEquipRepairs.get(center - 1), 0); 385 | } 386 | } 387 | /** 388 | *根据Id返回维修记录 389 | * 根据ID返回检查记录 390 | */ 391 | } 392 | if (input.equals("2")) { 393 | //3.2 394 | List buildings = houseService.getBuildings(community); 395 | for (int i = 0; i < buildings.size(); i++) { 396 | System.out.println("楼编号:" + (i + 1) + "楼名称:" + buildings.get(i).getName() + " "); 397 | } 398 | System.out.println("输入楼号"); 399 | inputIN = Integer.parseInt(Input()); 400 | Building building = buildings.get(inputIN - 1); 401 | List indoorEquipments = equipmentService.getAllIndoorEquipByBuilding(building); 402 | System.out.println("设备编号 " + "设备类型 " + "描述 " + "状态 "); 403 | for (int i = 0; i < indoorEquipments.size(); i++) { 404 | System.out.println((i + 1) + " " + 405 | indoorEquipments.get(i).getType() + " " + 406 | indoorEquipments.get(i).getDescription() + " " + indoorEquipments.get(i).getState()); 407 | } 408 | System.out.println("具体设备情况,输入设备编号"); 409 | int inputInteger = Integer.parseInt(Input()); 410 | if (!(inputInteger > 0 && inputInteger <= indoorEquipments.size())) {//编号不在0-size之间 411 | break; 412 | } 413 | System.out.println("1.查询"); 414 | System.out.println("2.修理"); 415 | int inputInteger2 = Integer.parseInt(Input()); 416 | if (!(inputInteger2 == 1 || inputInteger2 == 2)) { 417 | } 418 | if (inputInteger2 == 1) { 419 | List indoorEquipChecks = equipmentService.getInEquipCheck(indoorEquipments.get(inputInteger - 1)); 420 | System.out.println("编号" + " 状态" + " 时间"); 421 | for (int i = 0; i < indoorEquipChecks.size(); i++) { 422 | System.out.println((i + 1) + " " + 423 | indoorEquipChecks.get(i).getState() + " " + 424 | indoorEquipChecks.get(i).getTime()); 425 | } 426 | System.out.print("输入1开始检查设备,其他返回上层"); 427 | int center = Integer.parseInt(Input()); 428 | if (center == 1) { 429 | System.out.println("输入状态,0好,1坏"); 430 | center = Integer.parseInt(Input()); 431 | System.out.print(equipmentService.addInEquipCheck(indoorEquipments.get(inputInteger - 1), center)); //equipmentService.addInEquipCheck(indoorEquipments.get(inputInteger-1),center); 432 | } 433 | } 434 | if (inputInteger2 == 2) { 435 | List indoorEquipRepairs = equipmentService.getInEquipRepair(indoorEquipments.get(inputInteger - 1)); 436 | System.out.println("编号" + " 状态" + " 花费" + " 时间"); 437 | for (int i = 0; i < indoorEquipRepairs.size(); i++) { 438 | System.out.println((i + 1) + " " + 439 | indoorEquipRepairs.get(i).getState() + " " + 440 | indoorEquipRepairs.get(i).getCost() + " " + 441 | indoorEquipRepairs.get(i).getTime()); 442 | } 443 | System.out.print("输入设备编号使其修好,输入0新建维修,输入其他无变化"); 444 | int center = Integer.parseInt(Input()); 445 | 446 | if (center == 0) { 447 | equipmentService.addInEquipRepair(indoorEquipments.get(inputInteger - 1), 100); 448 | } else { 449 | equipmentService.modifyInEquipRepairState(indoorEquipRepairs.get(center - 1), 0); 450 | } 451 | } 452 | } 453 | FeedbackService feedbackService = new FeedbackService(); 454 | if (input.equals("3")) { 455 | //3.3 456 | List buildings = houseService.getBuildings(community); 457 | for (int i = 0; i < buildings.size(); i++) { 458 | System.out.println("楼编号:" + (i + 1) + "楼名称:" + buildings.get(i).getName() + " "); 459 | } 460 | System.out.println("输入楼号"); 461 | inputIN = Integer.parseInt(Input()); 462 | Building building = buildings.get(inputIN - 1); 463 | 464 | /** 465 | * list<> 3个 466 | *待分配 467 | 已分配未解决 468 | 已解决 469 | */ 470 | System.out.println("======================================"); 471 | System.out.println("1.待分配问题"); 472 | System.out.println("2.已分配未解决问题"); 473 | System.out.println("3.已解决问题"); 474 | System.out.println("4.添加问题"); 475 | int issue = Integer.parseInt(Input()); 476 | if (issue == 1) { 477 | List equipmentIssues = feedbackService.getNotSolvedIssues(building); 478 | System.out.println("房屋ID,设备ID,类型ID,描述,时间"); 479 | for (int i = 0; i < equipmentIssues.size(); i++) { 480 | System.out.println("第" + (i + 1) + ": " + equipmentIssues.get(i).getHouse_id() + " " + 481 | equipmentIssues.get(i).getEquipment_id() + " " + 482 | equipmentIssues.get(i).getType() + " " + 483 | equipmentIssues.get(i).getDescription() + " " + 484 | equipmentIssues.get(i).getTime()); 485 | 486 | } 487 | System.out.print("为问题添加相应修理。" + 488 | "输入编号:"); 489 | /*/////////////////////////////////////////////////////////////////////////////////////////*/ 490 | int e = Integer.parseInt(Input()); 491 | if (e == 0) 492 | break; 493 | System.out.print("输入修理ID:"); 494 | int c = Integer.parseInt(Input()); 495 | if (c == 0) 496 | break; 497 | feedbackService.modifyIssueRepairId(equipmentIssues.get(e - 1), c); 498 | } 499 | if (issue == 2) { 500 | List equipmentIssues = feedbackService.getSolvingIssues(building); 501 | System.out.println("房屋ID,设备ID,修理ID,类型ID,描述,时间"); 502 | for (int i = 0; i < equipmentIssues.size(); i++) { 503 | System.out.println("第" + (i + 1) + ": " + equipmentIssues.get(i).getHouse_id() + " " + 504 | equipmentIssues.get(i).getEquipment_id() + " " + 505 | equipmentIssues.get(i).getRepair_id() + " " + 506 | equipmentIssues.get(i).getType() + " " + 507 | equipmentIssues.get(i).getDescription() + " " + 508 | equipmentIssues.get(i).getTime()); 509 | } 510 | } 511 | if (issue == 3) { 512 | List equipmentIssues = feedbackService.getSolvedIssues(building); 513 | System.out.println("房屋ID,设备ID,修理ID,类型ID,描述,时间"); 514 | for (int i = 0; i < equipmentIssues.size(); i++) { 515 | System.out.println("第" + (i + 1) + ": " + equipmentIssues.get(i).getHouse_id() + " " + 516 | equipmentIssues.get(i).getEquipment_id() + " " + 517 | equipmentIssues.get(i).getRepair_id() + " " + 518 | equipmentIssues.get(i).getType() + " " + 519 | equipmentIssues.get(i).getDescription() + " " + 520 | equipmentIssues.get(i).getTime()); 521 | } 522 | } 523 | 524 | if (issue == 4) { 525 | System.out.println("输入室内机器ID"); 526 | int e_id = Integer.parseInt(Input()); 527 | EquipmentService equipmentService1 = new EquipmentService(); 528 | IndoorEquipment indoorEquipment = equipmentService1.getIE(e_id); 529 | System.out.println("输入房子ID"); 530 | int h_id = Integer.parseInt(Input()); 531 | System.out.println("输入类型(1-5)"); 532 | int t_id = Integer.parseInt(Input()); 533 | System.out.println("输入描述"); 534 | String desc = Input(); 535 | feedbackService.addInEquipIssue(indoorEquipment, h_id, t_id, desc); 536 | 537 | } 538 | } 539 | if (input.equals("4")) { 540 | //3.4 541 | while (true) { 542 | /*list<> 543 | * 解决,未解决 544 | * */ 545 | System.out.println("==========================="); 546 | System.out.println("1.查看投诉"); 547 | System.out.println("2.发起投诉"); 548 | System.out.println("3.更新投诉"); 549 | 550 | int inputInteger = Integer.parseInt(Input()); 551 | if (inputInteger == 1) { 552 | for (int i = 0; i < 5; i++) { 553 | List complaints = feedbackService.getComplaintByType(i); 554 | System.out.println("投诉类型:" + (i + 1) + " 投诉房ID 投诉描述 日期 解决意见(没有既没有解决)"); 555 | for (int j = 0; j < complaints.size(); j++) { 556 | System.out.println(complaints.get(j).getHouse_id() + " " + complaints.get(j).getDescription() + " " + complaints.get(j).getDate() + " " + complaints.get(j).getProcess()); 557 | } 558 | } 559 | } 560 | if (inputInteger == 2) { 561 | System.out.println("请输入信息:"); 562 | System.out.print("house_id:"); 563 | int house_id = Integer.parseInt(Input()); 564 | System.out.print("type:(1-5)"); 565 | int type = Integer.parseInt(Input()); 566 | System.out.print("description:"); 567 | String description = Input(); 568 | feedbackService.addComplaint(house_id, type, description); 569 | } 570 | if (inputInteger == 3) { 571 | List complaints = feedbackService.getNotSolvedComplaint(); 572 | System.out.println("未解决问题: 投诉房ID 投诉描述 日期 投诉类型"); 573 | for (int j = 0; j < complaints.size(); j++) { 574 | System.out.println("第" + (j + 1) + "个:" + complaints.get(j).getHouse_id() + " " + complaints.get(j).getDescription() + " " + complaints.get(j).getDate() + " " + complaints.get(j).getType()); 575 | } 576 | System.out.print("输入编号:"); 577 | int id = Integer.parseInt(Input()); 578 | if (!(id > 0 && id <= complaints.size())) 579 | break; 580 | System.out.print("输入解决方案:"); 581 | String process = Input(); 582 | feedbackService.modifyComplaintProcess(complaints.get(id - 1), process); 583 | } 584 | } 585 | 586 | } 587 | } 588 | } 589 | if (input.equals("4")) { 590 | //4 591 | /** 592 | * List<> 4个记录 593 | 临时车费 594 | 用户缴纳 595 | 维修费用 596 | 其他费用 597 | *打印目前总收支 598 | * 599 | */ 600 | while (true) { 601 | PaymentService paymentService = new PaymentService(); 602 | floor_5(); 603 | input = Input(); 604 | if (!(input.equals("1") || input.equals("2") || input.equals("3") || input.equals("4") || input.equals("5"))) { 605 | System.out.println("已返回,请重新输入"); 606 | break; 607 | } 608 | if (input.equals("1")) { 609 | //打印临时车费缴纳记录,时间由最近到之前 610 | List temporaryParkingRecords = paymentService.getTemParkingRecordCost(); 611 | System.out.println("停车位ID " + "车牌号 " + "起始时间 " + "结束时间 " + "钱 "); 612 | for (int i = 0; i < temporaryParkingRecords.size(); i++) { 613 | System.out.println(temporaryParkingRecords.get(i).getParking_space_id() + " " + 614 | temporaryParkingRecords.get(i).getCar_id() + " " + 615 | temporaryParkingRecords.get(i).getStart_time() + " " + 616 | temporaryParkingRecords.get(i).getEnd_time() + " " + 617 | temporaryParkingRecords.get(i).getCost() + " "); 618 | } 619 | } 620 | if (input.equals("2")) { 621 | //打印用户缴纳记录,时间由最近到之前 622 | List residentCosts = paymentService.getResidentCost(); 623 | System.out.println("花费ID " + "用户ID " + "描述 " + "时间 " + "钱 " + " 状态(0已缴费,1未交费)"); 624 | for (int i = 0; i < residentCosts.size(); i++) { 625 | System.out.println(residentCosts.get(i).getCost_id() + " " + 626 | residentCosts.get(i).getResident_id() + " " + 627 | residentCosts.get(i).getDescription() + " " + 628 | residentCosts.get(i).getTime() + " " + 629 | residentCosts.get(i).getCost() + " " + 630 | residentCosts.get(i).getState()); 631 | } 632 | } 633 | if (input.equals("3")) { 634 | //打印维修记录,时间由最近到之前 635 | } 636 | if (input.equals("4")) { 637 | //打印其他记录,时间由最近到之前 638 | List propertyRecords = paymentService 639 | .getPropertyRecordCost(); 640 | System.out.println("ID " + "收入或支出 " + "钱 " + "描述 " + " 时间"); 641 | for (int i = 0; i < propertyRecords.size(); i++) { 642 | System.out.println(propertyRecords.get(i).getOrder_id() + " " + 643 | propertyRecords.get(i).getType() + " " + 644 | propertyRecords.get(i).getAmount() + " " + 645 | propertyRecords.get(i).getDescription() + " " + 646 | propertyRecords.get(i).getTime() + " "); 647 | } 648 | } 649 | if (input.equals("5")) { 650 | //月初,更新物业收费和车位收费 651 | try { 652 | ProperMonthRecord properMonthRecord=paymentService.monthProperty(); 653 | System.out.println("年 月 收支 金钱"); 654 | System.out.println(properMonthRecord.getYear()+" "+properMonthRecord.getMonth()+" "+properMonthRecord.getType()+" "+properMonthRecord.getAmount()+" "); 655 | } catch (ParseException e) { 656 | e.printStackTrace(); 657 | } 658 | } 659 | } 660 | } 661 | } 662 | } 663 | } 664 | 665 | public static String Input() { 666 | System.out.println("请输入要选择的数字,返回上一层用 0 (不合法的输入作用和0相同)"); 667 | Scanner scanner = new Scanner(System.in); 668 | String input = scanner.nextLine(); 669 | if (input.equals("")) { 670 | input = "0"; 671 | } 672 | return input; 673 | } 674 | 675 | public static void floor_1() { 676 | System.out.println("===================================="); 677 | System.out.println("1.房屋信息管理"); 678 | System.out.println("2.车位信息管理"); 679 | System.out.println("3.设备信息管理"); 680 | System.out.println("4.集团收支管理"); 681 | } 682 | 683 | public static void floor_2() { 684 | System.out.println("===================================="); 685 | System.out.println("1.闲置房查询"); 686 | System.out.println("2.住户信息查询"); 687 | } 688 | 689 | public static void floor_3() { 690 | System.out.println("===================================="); 691 | System.out.println("1.临时车位信息"); 692 | System.out.println("2.租用车位信息"); 693 | System.out.println("3.购买车位信息"); 694 | } 695 | 696 | public static void floor_4() { 697 | System.out.println("===================================="); 698 | System.out.println("1.室外设备记录"); 699 | System.out.println("2.室内设备记录"); 700 | System.out.println("3.用户提出设备问题记录"); 701 | System.out.println("4.投诉"); 702 | } 703 | 704 | public static void floor_5() { 705 | System.out.println("===================================="); 706 | System.out.println("1.临时车费缴纳"); 707 | System.out.println("2.用户缴纳"); 708 | System.out.println("3.维修费用"); 709 | System.out.println("4.其他费用"); 710 | System.out.println("5.每月收费一键更新"); 711 | } 712 | } 713 | --------------------------------------------------------------------------------