项目设计书
快递分拣系统
一、 项目设计分析:该快递自动分拣系统主要用于快递管理员对快递包裹信息进行录入,删除,修改,查询,对快递内容的检测等操作,和客户对于快递包裹信息,快递物流信息的查询以及对当地快递拣货点的查询,方便人们寄领快递,保证人们身份信息及个人隐私的安全性。
二、 程序功能简介:该系统共有以下十一个功能
1登录注册功能:用户可以用用户账号登录系统,管理员可以用管理员账号登录系统。
2查询用户信息:用户可查询用户的所有信息,管理员可查询所有用户信息。
3修改用户信息:用户可以对用户账号进行用户名修改,密码修改和密保修改,管理员可以对管理员账号进行密码修改和密保修改。
4增加快递订单:用户可填写快递单号,选择快递公司及邮费,系统自动生成订单创建时间,订单删除时间,订单修改时间,订单保存时间。
5删除订单:用户和管理员可以删除订单信息,登录后按照主菜单提示,选择订单信息,之后进入菜单选择删除订单信息,再之后系统提示按照所需条件删除订单信息系统自动生成订单创建时间,订单删除时间,订单修改时间,订单保存时间
6更改订单:用户和管理员可更改订单信息,登录后按照主菜单提示,选择订单信息,之后进入菜单选择更改快递订单信息,再之后根据系统提示按照所要更改的条件更改相应的订单信息,系统自动生成订单创建时间,订单删除时间,订单修改时间,订单保存时间。
7 查询订单信息:用户和管理员可查询增加的快递订单信息,系统自动生成订单创建时间,订单删除时间,订单修改时间,订单保存时间。管理员能查看所有订单信息。
8 增加详细快递信息:用户根据系统提示可填写快递详细信息。
9查询详细快递信息:用户和管理员都可以查看分快递包裹详细信息,登录后按照主菜单提示,选择包裹信息,之后进入菜单选择查询包裹信息,再之后根据系统提示按照所有查询的条件查询特定信息,管理员能查看所有详细快递信息,管理员可查看所有详细快递信息。
10删除详细快递信息:用户和管理员时可对已存在快递详细信息进行取消功能,登录后按照主菜单提示,查询快递包裹信息后若存在则可按照系统提示进行取消订单的操作。
11更改订单;用户和管理员可对已存在详细快递信息进行更改功能,登录后按照主菜单提示,查询快递包裹信息后若存在则可按照系统提示进行个更改订单的操作。
entity
package org.dxj.expresssortingsystem.entity; public class User { /** * 用户名 */ private String name; /** * id */ private String id; /** * 密码 */ private String password; /** * 密保问题 */ private String question; /** * 密保答案 */ private String answer; /** * User空参构造器 */ public User(){}; /** *User有参构造器初始化所有参数 */ public User (String Name,String Id,String Number,String Question,String Answer){ this.name=Name; this.id=Id; this.password=Number; this.question=Question; this.answer=Answer; } /** * get set方法设置得到所有变量 */ public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setNumber(String number) { this.password = number; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public String getAnswer() { return answer; } public void setAnwser(String anwser) { this.answer = anwser; } /** * toString方法输出所有变量 * @return */ @Override public String toString() { return "User{" + "name='" + name + '\'' + ", id='" + id + '\'' + ", number='" + password + '\'' + ", question='" + question + '\'' + ", anwser='" + answer + '\'' + '}'; } } package org.dxj.expresssortingsystem.entity; import com.sun.javaws.exceptions.BadMimeTypeResponseException; import com.sun.xml.internal.bind.v2.model.core.ID; import javax.sound.midi.Receiver; import java.util.Date; public class Order { /** * 用户id */ private String id; /** * 邮费 */ private String payment; /** * 订单创建时间 */ private String creatTime; /** * 订单更新时间 */ private String updateTime; /** * 订单删除时间 */ private String deleteTime; /** * 订单关闭时间 */ private String closeTime; /** * Order空参构造器 */ public Order(){}; /** * Order有参构造器初始化所有参数 */ public Order(String Id,String Payment,String Creattime,String Updatetime,String Deletetime,String Closetime){ this.id=Id; this.payment=Payment; this.creatTime=Creattime; this.updateTime=Updatetime; this.deleteTime=Deletetime; this.closeTime=Closetime; } /** * get set方法得到所有参数 */ public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPayment() { return payment; } public void setPayment(String payment) { this.payment = payment; } public String getCreatTime() { return creatTime; } public void setCreatTime(String creatTime) { this.creatTime = creatTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } public String getDeleteTime() { return deleteTime; } public void setDelelateTime(String deleteTime) { this.deleteTime = deleteTime; } public String getCloseTime() { return closeTime; } public void setCloseTime(String closeTime) { this.closeTime = closeTime; } /** * toString方法输出所有参数 */ @Override public String toString() { return "Order{" + "id='" + id + '\'' + ", payment='" + payment + '\'' + ", creatTime='" + creatTime + '\'' + ", updateTime='" + updateTime + '\'' + ", delelateTime='" + deleteTime + '\'' + ", closeTime='" + closeTime + '\'' + '}'; } } package org.dxj.expresssortingsystem.entity; import org.omg.CORBA.WStringSeqHelper; public class Deliver { /** * 快递公司 */ private String expresscompany; /** * 快递单号 */ String expressId; /** * 寄货人名字 */ private String sendName; /** * 寄货人手机号 */ private String sendNumber; /** * 收货地址 */ private String receiveAdress; /** * 收货人姓名 */ private String receiveName; /** * 收货人手机号 */ private String receiveNumber; /** * Deliver空参构造方法 */ public Deliver(){}; /** * Deliver有参构造方法初始化所有变量 */ public Deliver(String id, String expresscompany ,String sendName,String sendNubmer,String receiveAdress,String receiveName,String receiveNumber){ this.expresscompany=expresscompany; this.expressId=id; this.receiveAdress=expresscompany; this.receiveName=receiveName; this.receiveNumber=receiveNumber; this.receiveAdress=receiveAdress; this.sendName=sendName; this.sendNumber=sendNubmer; } /** * get set方法设置获取所有变量 */ public String getExpresscompany() { return expresscompany; } public void setExpresscompany(String expresscompany) { this.expresscompany = expresscompany; } public String getExpressId() { return expressId; } public void setExpressId(String id) { this.expressId = id; } public String getSendName() { return sendName; } public void setSendName(String sendName) { this.sendName = sendName; } public String getSendNumber() { return sendNumber; } public void setSendNumber(String sendNumer) { this.sendNumber = sendNumer; } public String getReceiveAdress() { return receiveAdress; } public void setReceiveAdress(String receiveAdress) { this.receiveAdress = receiveAdress; } public String getReceiveName() { return receiveName; } public void setReceiveName(String receiveName) { this.receiveName = receiveName; } public String getReceiveNumber() { return receiveNumber; } public void setReceiveNumber(String receiveNumber) { this.receiveNumber = receiveNumber; } /** * toString方法得到所有变量 */ @Override public String toString() { return "Deliver{" + "expresscompany='" + expresscompany + '\'' + ", id='" + expressId + '\'' + ", sendName='" + sendName + '\'' + ", sendNumer='" + sendNumber + '\'' + ", receiveAdress='" + receiveAdress + '\'' + ", receiveName='" + receiveName + '\'' + ", receiveNumber='" + receiveNumber + '\'' + '}'; } }
Dao
package org.dxj.expresssortingsystem.dao; import org.dxj.expresssortingsystem.entity.User; import java.io.*; import java.util.List; public interface IUserDao { /** * 增加用户IUserDao * @param user * @return boolean * @throws IOException */ boolean insertUserDao(User user) throws IOException; /** * 根据用户id删除用户IUserDao * @param id * @throws IOException */ boolean deleteUserDao(String id) throws IOException; /** * 根据用户id更改用户信息IUserDao * @param id * @return boolean * @throws IOException */ boolean updateUserDao(User user,String id) throws IOException; /** * 根据用户id查询用户信息IUserDao * @param id * @return List<User> * @throws IOException */ List<User> selectUserByIdDao(String id) throws IOException; /** * 查询所有用户信息IUserDao * @return List<User> * @throws IOException */ List<User> selectUserDao()throws IOException; } package org.dxj.expresssortingsystem.dao; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.Order; import java.util.List; import java.io.IOException; import java.util.ArrayList; import java.io.FileNotFoundException; /** * 开始 */ public interface IOrderDao { /** * 增加快递信息OrderD * * @param order * @return boolean * @throws IOException */ boolean insertOrderDao(Order order) throws IOException; /** * 根据用户id删除快递信息OrderDao * * @param id * @return boolean * @throws IOException */ boolean deleteOrderDao(String id) throws IOException; /** * 根据用户id更改快递信息OrderDao * * @param id * @param order * @return boolean * @throws IOException */ boolean updateOrderDao(String id, Order order) throws IOException; /** * 根据id查询快递信息OrderDao * * @param id * @return */ List<Order> selectOrderByIdDao(String id) throws IOException; /** * 查询所有快递信息OrderDao * @return List<Order> * @throws IOException */ List<Order> selectOrderDao() throws IOException; } package org.dxj.expresssortingsystem.dao; import java.io.IOException; import java.util.List; import org.dxj.expresssortingsystem.entity.Deliver; public interface IDeliverDao { /** * 填写详细快递信息 */ boolean insertDeliverlDao (Deliver deliver) throws IOException; /** * 根据用户id删除详细快递信息 */ boolean deleteDeliverDao(String id)throws IOException; /** * 根据用户信息修改详细快递信息 */ boolean updateDeliverDao(Deliver deliver,String id)throws IOException; /** * 根据用户id查询详细快递信息 */ List<Deliver> selectDeliverDao(String id)throws IOException; /** * 查询所有用户信息 */ List<Deliver> selectAllDeliverDao()throws IOException; } package org.dxj.expresssortingsystem.dao.impl; import com.sun.org.apache.xpath.internal.objects.XBoolean; import org.dxj.expresssortingsystem.dao.*; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.User; import sun.nio.cs.US_ASCII; import java.io.*; import java.util.List; import java.util.ArrayList; public class UserDaoImpl implements IUserDao { /** * 创建用户UserDao * @param user * @return boolean * @throws IOException */ public boolean insertUserDao(User user) { try { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\User.txt", true)); bufferedWriter.write(user.getName()+","+user.getId()+","+user.getPassword()+","+user.getAnswer()+","+user.getQuestion()); bufferedWriter.newLine(); bufferedWriter.close(); } catch (IOException e) { return false; } return true; } /** * 根据用户id删除用户信息 * * @throws IOException * @pram id */ public boolean deleteUserDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\User.txt")); List<User> userList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); User user1 = new User(dates[0], dates[1], dates[2], dates[3], dates[4]); userList.add(user1); } for (int i = 0; i < userList.size(); i++) { User user2 = userList.get(i); if (user2.getId().equals(id)) { userList.remove(i); } } BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\User.txt")); for (int i = 0; i < userList.size(); i++) { User user1 = userList.get(i); String returnString = String.format("%s,%s,%s,%s,%s", user1.getName(),user1.getId(),user1.getPassword(),user1.getQuestion(),user1.getAnswer()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } catch (IOException e) { System.out.println("删除失败"); } return true; } /** * 根据用户id更改用户信息UserDao */ public boolean updateUserDao(User user, String id) { try{ BufferedReader bufferedReader=new BufferedReader(new FileReader("Express Sorting System\\User.txt")); List<User> userList=new ArrayList<>(); String string; while ((string=bufferedReader.readLine())!=null){ String[] dates=string.split(","); User user1=new User(dates[0], dates[1],dates[2],dates[3],dates[4]); userList.add(user1); } for (int i = 0; i < userList.size(); i++) { User user1= userList.get(i); if (user1.getId().equals(id)){ userList.set(i,user); } } BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("Express Sorting System\\User.txt")); for (int i = 0; i < userList.size(); i++) { User user1=userList.get(i); String returnString=String.format("%s,%s,%s,%s,%s",user1.getName(),user1.getId(),user1.getPassword(),user1.getQuestion(),user1.getAnswer()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); }catch (IOException e){ System.out.println("修改用户信息失败"); } return true; } /** * 根据用户id查询用户信息IUserDao * @param id * @return List<User> * @throws IOException */ public List<User> selectUserByIdDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\User.txt")); List<User> userList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); User user = new User(dates[0], dates[1], dates[2], dates[3], dates[4]); userList.add(user); for (int i = 0; i < userList.size(); i++) { User user1 = userList.get(i); if (user1.getId().equals(id)) { List<User>userList1=new ArrayList<>(); userList1.add(user1); return userList1; } } } bufferedReader.close(); } catch (IOException e) { System.out.println("查询失败!"); } return null; } /** * 查询所有用户信息UserDao * * @return List<User> * @throws IOException */ @Override public List<User> selectUserDao(){ try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\User.txt")); List<User> userList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); User user = new User(dates[0], dates[1], dates[2], dates[3], dates[4]); userList.add(user); } bufferedReader.close(); return userList; } catch (IOException e) { System.out.println("查询失败!"); } return null; } } package org.dxj.expresssortingsystem.dao.impl; import com.sun.org.apache.xpath.internal.operations.Or; import org.dxj.expresssortingsystem.dao.IOrderDao; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.Order; import org.dxj.expresssortingsystem.entity.User; import sun.nio.cs.US_ASCII; import java.io.*; import java.nio.channels.FileLockInterruptionException; import java.util.ArrayList; import java.util.List; public class OrderDaoImpl implements IOrderDao { /** * 添加基础快递信息 * * @param order * @return * @throws IOException */ @Override public boolean insertOrderDao(Order order) { try { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\Order.txt", true)); bufferedWriter.write(order.getId() + "," + order.getPayment()+","+order.getCreatTime()+","+order.getUpdateTime()+","+order.getDeleteTime()+","+order.getCloseTime()); bufferedWriter.newLine(); bufferedWriter.close(); } catch (IOException e) { return false; } return true; } /** * 根据客户id删除基础快递信息 * * @param id * @return * @throws IOException */ @Override public boolean deleteOrderDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Order.txt")); List<Order> orderList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Order order = new Order(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5]); orderList.add(order); } for (int i = 0; i < orderList.size(); i++) { Order order = orderList.get(i); if (order.getId().equals(id)) { orderList.remove(i); } } BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\Order.txt")); for (int i = 0; i < orderList.size(); i++) { Order order = orderList.get(i); String returnString = String.format("%s,%s,%s,%s,%s,%s",order.getId(),order.getPayment(),order.getCreatTime(),order.getUpdateTime(),order.getDeleteTime(),order.getCloseTime()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } catch (IOException e) { System.out.println("删除失败"); } return true; } /** * 根据客户id更改基础快递信息 * @param id * @param order * @return * @throws IOException */ @Override public boolean updateOrderDao(String id, Order order) throws IOException { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Order.txt")); List<Order> orderList=new ArrayList<>(); String string; while ((string=bufferedReader.readLine())!=null){ String[] dates=string.split(","); Order returnOrder=new Order(dates[0],dates[1],dates[2],dates[3],dates[4],dates[5]); orderList.add(returnOrder); } for (int a = 0; a <=orderList.size()-1 ; a++) { Order returnOrder=orderList.get(a); if (returnOrder.getId().equals(id)){ orderList.set(a,order); } } BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\Order.txt")); for (int i = 0; i <orderList.size() ; i++) { Order returnOrder=orderList.get(i); String returnString=String.format("%s,%s,%s,%s,%s,%s",returnOrder.getId(),returnOrder.getPayment(),returnOrder.getCreatTime(),returnOrder.getUpdateTime(),returnOrder.getDeleteTime(),returnOrder.getCloseTime()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); return true; } /** * 根据订单id查询基础快递信息 * @param id * @return * @throws IOException */ @Override public List<Order> selectOrderByIdDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Order.txt")); List<Order> orderList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Order order = new Order(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5]); orderList.add(order); for (int i = 0; i < orderList.size(); i++) { Order order1 = orderList.get(i); if (order1.getId().equals(id)) { List<Order>orderList1=new ArrayList<>(); orderList1.add(order1); return orderList1; } } }bufferedReader.close(); } catch (IOException e) { System.out.println("查询失败!"); } return null; } /** * 查询所有基础快递信息 * * @return * @throws IOException */ @Override public List<Order> selectOrderDao() throws IOException { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Order.txt")); List<Order> orderList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Order order = new Order(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5]); orderList.add(order); } bufferedReader.close(); return orderList; } catch (IOException e) { System.out.println("查询失败!"); } return null; } } package org.dxj.expresssortingsystem.dao.impl; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.dao.IDeliverDao; import java.io.*; import java.util.ArrayList; import java.util.List; public class DeliverDaoImpl implements IDeliverDao { /** * 增加详细快递信息 * @param deliver * @return * @throws IOException */ @Override public boolean insertDeliverlDao(Deliver deliver) { try { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\Deliver.txt", true)); bufferedWriter.write(deliver.getExpressId() + "," + deliver.getExpresscompany() + "," + deliver.getSendName() + "," + deliver.getSendNumber() + "," + deliver.getReceiveAdress() + "," + deliver.getReceiveName() + "," + deliver.getReceiveNumber()); bufferedWriter.newLine(); bufferedWriter.close(); } catch (IOException e) { return false; } return true; } /** * 根据快递订单号删除详细快递信息 * * @param id * @return * @throws IOException */ @Override public boolean deleteDeliverDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Deliver.txt")); List<Deliver> deliverList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Deliver deliver = new Deliver(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5], dates[6]); deliverList.add(deliver); } for (int i = 0; i < deliverList.size(); i++) { Deliver deliver = deliverList.get(i); if (deliver.getExpressId().equals(id)) { deliverList.remove(i); } } BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("Express Sorting System\\Deliver.txt")); for (int i = 0; i < deliverList.size(); i++) { Deliver deliver = deliverList.get(i); String returnString = String.format("%s,%s,%s,%s,%s,%s,%s", deliver.getExpressId(), deliver.getExpresscompany(), deliver.getSendName(), deliver.getSendNumber(), deliver.getReceiveAdress(), deliver.getReceiveName(), deliver.getReceiveNumber()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } catch (IOException e) { System.out.println("删除失败"); } return true; } /** * 根据快递订单号更改详细快递信息 * * @param id * @return * @throws IOException */ @Override public boolean updateDeliverDao(Deliver deliver, String id) throws IOException { try{ BufferedReader bufferedReader=new BufferedReader(new FileReader("Express Sorting System\\Deliver.txt")); List<Deliver> deliverList=new ArrayList<>(); String string; while ((string=bufferedReader.readLine())!=null){ String[] dates=string.split(","); Deliver deliver1=new Deliver(dates[0], dates[1],dates[2],dates[3],dates[4],dates[5],dates[6]); deliverList.add(deliver1); } for (int i = 0; i < deliverList.size(); i++) { Deliver deliver1= deliverList.get(i); if (deliver1.getExpressId().equals(id)){ deliverList.set(i,deliver); } } BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("Express Sorting System\\Deliver.txt")); for (int i = 0; i < deliverList.size(); i++) { Deliver deliver1=deliverList.get(i); String returnString=String.format("%s,%s,%s,%s,%s,%s,%s",deliver1.getExpressId(),deliver1.getExpresscompany(),deliver1.getSendName(),deliver1.getSendNumber(),deliver1.getReceiveAdress(),deliver1.getReceiveName(),deliver1.getReceiveNumber()); bufferedWriter.write(returnString); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); }catch (IOException e){ System.out.println("修改用户信息失败"); } return true; } /** * 根据快递订单号查询快递详细信息 * * @param id * @return * @throws IOException */ @Override public List<Deliver> selectDeliverDao(String id) { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Deliver.txt")); List<Deliver> deliverList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Deliver deliver = new Deliver(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5], dates[6]); deliverList.add(deliver); for (int i = 0; i < deliverList.size(); i++) { Deliver deliver1 = deliverList.get(i); if (deliver1.getExpressId().equals(id)) { List<Deliver>deliverList1=new ArrayList<>(); deliverList1.add(deliver1); return deliverList1; } } } bufferedReader.close(); } catch (IOException e) { System.out.println("查询失败!"); } return null; } /** * 查询所有快递详细信息 * * @return * @throws IOException */ @Override public List<Deliver> selectAllDeliverDao() throws IOException { try { BufferedReader bufferedReader = new BufferedReader(new FileReader("Express Sorting System\\Deliver.txt")); List<Deliver> deliverList = new ArrayList<>(); String string; while ((string = bufferedReader.readLine()) != null) { String[] dates = string.split(","); Deliver deliver = new Deliver(dates[0], dates[1], dates[2], dates[3], dates[4], dates[5], dates[6]); deliverList.add(deliver); } bufferedReader.close(); return deliverList; } catch (IOException e) { System.out.println("查询失败!"); } return null; } }
Service
package org.dxj.expresssortingsystem.service; import org.dxj.expresssortingsystem.entity.User; import java.io.IOException; import java.util.List; public interface IUserService { /** * 用户根据id和密码登录 * @param id * @param password * @return * @throws IOException */ boolean loginService(String id,String password) throws IOException; /** * 增加用户IService * @param user * @return boolean * @throws IOException */ boolean insertUserService(User user) throws IOException; /** * 根据用户id删除用户信息IService * @param id * @return boolean * @throws IOException */ boolean deleteUserService(String id) throws IOException; /** * 根据用户id更改用户IService * @param user * @param id * @return boolean * @throws IOException */ boolean updateUserService(User user,String id) throws IOException; /** * 根据用户id查询用户信息IService * @param id * @return List<User> * @throws IOException */ List<User> selectUserByIdService(String id) throws IOException; /** *查询所有用户信息IService * @return List<User> * @throws IOException */ List<User> selectUserService() throws IOException; } package org.dxj.expresssortingsystem.service; import org.dxj.expresssortingsystem.dao.IOrderDao; import org.dxj.expresssortingsystem.entity.Order; import org.dxj.expresssortingsystem.service.IUserService; import org.dxj.expresssortingsystem.dao.IOrderDao; import java.util.List; import java.io.IOException; public interface IOrderService { /** * 增加快递订单 */ boolean insertOrderService(Order order) throws IOException; /** * 根据用户id删除快递订单信息 */ boolean deleteOrderService(String id) throws IOException; /** * 根用户id更改快递订单信息 */ boolean updateOrderService(Order order,String id) throws IOException; /** * 根据用户id查询订单信息 */ List<Order> selectOrderByIdService(String id) throws IOException; /** * 查询所有快递订单信息 */ List<Order> selectOrderService()throws IOException; } package org.dxj.expresssortingsystem.service; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.dao.IDeliverDao; import java.io.IOException; import java.util.List; import org.dxj.expresssortingsystem.entity.User; public interface IDeliverService { /** *增加快递详细信息 */ boolean insertDeliverService(Deliver deliver) throws IOException; /** * 根据用户id删除详细快递信息 */ boolean deleteDeliverService(String id) throws IOException; /** * 根据用户id更改详细快递信息 */ boolean updateDeliverService(Deliver deliver,String id) throws IOException; /** * 根据用户id查询详细快递信息 */ List<Deliver> selectDeliverService(String id) throws IOException; /** * 查询所有快递详细信息 */ List<Deliver> selectAllDeliverService() throws IOException; } package org.dxj.expresssortingsystem.service.impl; import org.dxj.expresssortingsystem.dao.IUserDao; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.User; import org.dxj.expresssortingsystem.service.IUserService; import org.dxj.expresssortingsystem.dao.impl.UserDaoImpl; import java.io.BufferedWriter; import java.io.FileWriter; import java.sql.ClientInfoStatus; import java.util.List; import java.io.IOException; public class UserServiceImpl implements IUserService { /** * 创建IUserDao对象 */ IUserDao iUserDao = new UserDaoImpl(); /** * 用户登录 * @param id * @param password * @return * @throws IOException */ @Override public boolean loginService(String id, String password) throws IOException { List<User> list = iUserDao.selectUserByIdDao(id); if (list == null) { System.out.println("查无此用户,登录失败"); return false; } for (int i = 0; i < list.size(); i++) { User user = list.get(i); if (user.getId().equals(id) && user.getPassword().equals(password)) { System.out.println("登录成功"); return true; } } return false; } /** * 增加用户Service * * @param user * @return * @throws IOException */ @Override public boolean insertUserService(User user) throws IOException { List<User> list = iUserDao.selectUserByIdDao(user.getId()); if (list==null) { iUserDao.insertUserDao(user); System.out.println("增加成功"); return true; } System.out.println("用户已存在,增加失败"); return false; } /** * 根据用户id删除用户信息 * * @param id * @return * @throws IOException */ @Override public boolean deleteUserService(String id) throws IOException { List<User> list = iUserDao.selectUserByIdDao(id); if (list!=null) { iUserDao.deleteUserDao(id); System.out.println("该用户存在,可删除"); return true; } System.out.println("用户不存在,不可删除"); return false; } /** * 根据用户id修改快递信息 * * @param user * @param id * @return * @throws IOException */ @Override public boolean updateUserService(User user, String id) throws IOException { List<User> list = iUserDao.selectUserByIdDao(id); if (list!=null) { iUserDao.updateUserDao(user, id); System.out.println("该用户存在,修改成功"); return true; } System.out.println("该用户不存在,无法修改"); return false; } /** * 根据用户id查询快递信息 * @param id * @return * @throws IOException */ @Override public List<User> selectUserByIdService(String id) throws IOException { List<User>list=iUserDao.selectUserByIdDao(id); if (list!=null){ iUserDao.selectUserByIdDao(id); System.out.println("查询成功"); return list; } System.out.println("无该用户信息,操作失败"); return null; } /** * 查询所有用户快递信息 * * @return * @throws IOException */ @Override public List<User> selectUserService() throws IOException { List<User> list = iUserDao.selectUserDao(); return list; } } package org.dxj.expresssortingsystem.service.impl; import com.sun.corba.se.impl.resolver.ORBDefaultInitRefResolverImpl; import com.sun.org.apache.xpath.internal.operations.Or; import org.dxj.expresssortingsystem.dao.IOrderDao; import org.dxj.expresssortingsystem.dao.impl.OrderDaoImpl; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.Order; import org.dxj.expresssortingsystem.service.IOrderService; import java.io.IOException; import java.sql.ClientInfoStatus; import java.util.List; public class OrderServiceImpl implements IOrderService { /** * 创建一个IorderDao对象 */ IOrderDao iOrderDao=new OrderDaoImpl(); /** * 增加快递订单信息 * @param order * @return * @throws IOException */ @Override public boolean insertOrderService(Order order) throws IOException { List<Order>list=iOrderDao.selectOrderByIdDao(order.getId()); if (list==null){ iOrderDao.insertOrderDao(order); System.out.println("增加成功"); return true; } System.out.println("订单已存在,无法再次创建"); return false; } /** * 根据用户id删除快递订单信息 * @param id * @return * @throws IOException */ @Override public boolean deleteOrderService(String id) throws IOException { List<Order>list=iOrderDao.selectOrderByIdDao(id); if (list!=null){ iOrderDao.deleteOrderDao(id); System.out.println("订单信息已删除"); return true; } System.out.println("订单信息不存在,无法删除"); return false; } /** * 根据用户id更改快递订单信息 * @param order * @param id * @return * @throws IOException */ @Override public boolean updateOrderService(Order order, String id) throws IOException { List<Order> list=iOrderDao.selectOrderByIdDao(id); if (list!=null){ iOrderDao.updateOrderDao(id,order); System.out.println("订单存在,可以更改!"); return true; } System.out.println("订单不存在,更改失败!"); return false; } /** * 根据用户id查询快递信息 * @param id * @return * @throws IOException */ @Override public List<Order> selectOrderByIdService(String id) throws IOException { List<Order>list=iOrderDao.selectOrderByIdDao(id); if (list!=null){ iOrderDao.selectOrderByIdDao(id); System.out.println("订单存在,可查询"); return list; } System.out.println("订单不存在,无法查询信息"); return null; } /** * 查询所有快递信息 * @return * @throws IOException */ @Override public List<Order> selectOrderService() throws IOException { List<Order>list=iOrderDao.selectOrderDao(); return list; } } package org.dxj.expresssortingsystem.service.impl; import org.dxj.expresssortingsystem.dao.impl.DeliverDaoImpl; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.dao.IDeliverDao; import org.dxj.expresssortingsystem.service.IDeliverService; import java.util.List; import java.io.IOException; public class DeliverServiceImpl implements IDeliverService { /** * 创建一个IDeliverDao对象 */ IDeliverDao iDeliverDao=new DeliverDaoImpl(); /** * 增加详细快递信息 * @param deliver * @return * @throws IOException */ @Override public boolean insertDeliverService(Deliver deliver) throws IOException { List<Deliver>list=iDeliverDao.selectDeliverDao(deliver.getExpressId()); if (list==null){ iDeliverDao.insertDeliverlDao(deliver); System.out.println("快递详细信息添加成功"); return true; } return false; } /** * 根据快递单号删除快递详细信息 * @param id * @return * @throws IOException */ @Override public boolean deleteDeliverService(String id) throws IOException { List<Deliver>list=iDeliverDao.selectDeliverDao(id); if (list!=null){ iDeliverDao.deleteDeliverDao(id); System.out.println("快递详细信息已删除"); return true; } System.out.println("快递详细信息不存在,无法删除"); return false; } /** * 根据快递单号更改详细快递信息 * @param id * @return * @throws IOException */ @Override public boolean updateDeliverService(Deliver deliver, String id) throws IOException { List<Deliver> list=iDeliverDao.selectDeliverDao(id); if (list!=null){ iDeliverDao.updateDeliverDao(deliver,id); System.out.println("快递详细信息存在,可以更改!"); return true; } System.out.println("快递详细信息不存在,更改失败!"); return false; } /** * 根据快递单号查询快递详细信息 * @param id * @return * @throws IOException */ @Override public List<Deliver> selectDeliverService(String id) throws IOException { List<Deliver>list=iDeliverDao.selectDeliverDao(id); if (list!=null){ iDeliverDao.selectDeliverDao(id); System.out.println("快递详细信息查询成功"); return list; } System.out.println("无该快递详细信息,查询失败"); return null; } /** * 查询所有用户信息 * @return * @throws IOException */ @Override public List<Deliver> selectAllDeliverService() throws IOException { List<Deliver>list=iDeliverDao.selectAllDeliverDao(); return list; } }
Controller
package org.dxj.expresssortingsystem.controller; import org.dxj.expresssortingsystem.entity.User; import org.dxj.expresssortingsystem.service.IUserService; import org.dxj.expresssortingsystem.service.impl.UserServiceImpl; import java.io.IOException; import java.util.List; public class UserController { /** * 创建UserService对象 */ IUserService iUserService=new UserServiceImpl(); /** * 已注册用户使用账号密码登录 * @param id * @param password * @return * @throws IOException */ public boolean loginController(String id,String password) throws IOException { return iUserService.loginService(id,password); } /** * 增加用户信息Controller * @param user * @return boolean * @throws IOException */ public boolean insertUserController(User user) throws IOException { return iUserService.insertUserService(user); } /** * 根据用户id删除用户信息Controller * @param id * @return boolean * @throws IOException */ public boolean deleteUserController(String id) throws IOException { return iUserService.deleteUserService(id); } /** * 根据用户id更改用户信息Controller * @param user * @param id * @return boolean * @throws IOException */ public boolean updateUserController(User user,String id) throws IOException { return iUserService.updateUserService(user,id); } /** * 根据id查询用户信息Controller * @param id * @return List<User> * @throws IOException */ public List<User> selectUserByIdController(String id) throws IOException { return iUserService.selectUserByIdService(id); } /** * 查询所有用户信息Controller * @return List<User> * @throws IOException */ public List<User> selectUserController() throws IOException { return iUserService.selectUserService(); } } package org.dxj.expresssortingsystem.controller; import org.dxj.expresssortingsystem.entity.Order; import org.dxj.expresssortingsystem.service.IOrderService; import org.dxj.expresssortingsystem.service.IUserService; import org.dxj.expresssortingsystem.service.impl.OrderServiceImpl; import org.dxj.expresssortingsystem.service.impl.UserServiceImpl; import java.io.IOException; import java.util.List; public class OrderController { /** * 创建OrderService对象 */ IOrderService iOrderService=new OrderServiceImpl(); /** * 增加快递信息Controller * @param order * @return boolean * @throws IOException */ public boolean insertController(Order order) throws IOException { return iOrderService.insertOrderService(order); } /** * 根据用户id删除快递信息Controller * @param id * @return boolean * @throws IOException */ public boolean deleteController(String id) throws IOException { return iOrderService.deleteOrderService(id); } /** * 根据用户id更改快递信息Controller * @param id * @param order * @return boolean * @throws IOException */ public boolean updateController(String id, Order order) throws IOException { return iOrderService.updateOrderService(order,id); } /** * 根据id查询快递信息Controller * @param id * @return List<Order> * @throws IOException */ public List<Order> selectController(String id) throws IOException { return iOrderService. selectOrderByIdService(id); } /** * 查询所有快递信息Controller * @return List<Order> * @throws IOException */ public List<Order> selectController() throws IOException { return iOrderService. selectOrderService(); } } package org.dxj.expresssortingsystem.controller; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.User; import org.dxj.expresssortingsystem.service.IDeliverService; import org.dxj.expresssortingsystem.service.IUserService; import org.dxj.expresssortingsystem.service.impl.DeliverServiceImpl; import org.dxj.expresssortingsystem.service.impl.UserServiceImpl; import java.io.IOException; import java.util.List; public class DeliverController { /** * 创建DeliverService对象 */ IDeliverService iDeliverService = new DeliverServiceImpl(); /** * 增加快递详细信息Controller * @param deliver * @return * @throws IOException */ public boolean InsertController(Deliver deliver) throws IOException { iDeliverService.insertDeliverService(deliver); return true; } /** * 根据用户id删除快递详细信息Controller * @param id * @return * @throws IOException */ public boolean deleteController(String id) throws IOException { return iDeliverService.deleteDeliverService(id); } /** * 根据用户id更改快递详细信息Controller * @param deliver * @param id * @return * @throws IOException */ public boolean updateController(Deliver deliver, String id) throws IOException { return iDeliverService.updateDeliverService(deliver,id); } /** * 根据id查询快洗详细信息Controller * @param id * @return List<Deliver> * @throws IOException */ public List<Deliver> selectController(String id) throws IOException { return iDeliverService.selectDeliverService(id); } /** * 查询所有快递详细信息Controller * @return List<Deliver> * @throws IOException */ public List<Deliver> selectAllController() throws IOException { List<Deliver> list= iDeliverService.selectAllDeliverService(); return list ; } }
Util
package org.dxj.expresssortingsystem.utils; import java.io.IOException; public class Create { public static void main(String[] args) throws Exception { CreateFileName createfilename=new CreateFileName(); CreatePathName createpathname=new CreatePathName(); createpathname.create("Express Sorting System"); createfilename.create("Express Sorting System//Administrator.txt"); createfilename.create("Express Sorting System//User.txt"); createfilename.create("Express Sorting System//Order.txt"); } } package org.dxj.expresssortingsystem.utils; import java.io.File; import java.io.IOException; public class CreateFileName { /** * 创建文件 */ public boolean create(String filename) throws IOException { File file = new File(filename); file.createNewFile(); if (file.exists()) { return false; } if (file.createNewFile()) { return true; } else { return false; } } } package org.dxj.expresssortingsystem.utils; import java.io.IOException; import java.io.File; public class CreatePathName { /** * 创建目录 */ public boolean create(String Filename) throws IOException { File file = new File(Filename); if (file.exists()) { return false; } if (!Filename.endsWith(File.separator)) { Filename = Filename + File.separator; } if (file.mkdir()) { return true; } else { return false; } } }
Views
package org.dxj.expresssortingsystem.views; import org.dxj.expresssortingsystem.controller.UserController; import org.dxj.expresssortingsystem.entity.User; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import java.util.Scanner; public class UserViews { protected UserController userController=new UserController(); public boolean loginView() throws IOException { Scanner scanner=new Scanner(System.in); System.out.println("欢迎进入登录界面:"); System.out.println("请输入用户id"); String userName=scanner.next(); System.out.println("请输入密码"); String password=scanner.next(); return userController.loginController(userName,password); } public boolean insertUserView() throws IOException { Scanner scanner=new Scanner(System.in); System.out.println("欢迎进入注册界面:"); System.out.println("请输入用户名:"); String userName=scanner.next(); System.out.println("请输入用户id:"); String id=scanner.next(); System.out.println("请输入密码:"); String password=scanner.next(); System.out.println("请输入密保问题:"); String question=scanner.next(); System.out.println("请输入密保答案:"); String answer=scanner.next(); User user=new User(userName,id,password,question,answer); return userController.insertUserController(user); } public boolean deleteView() throws IOException { Scanner scanner=new Scanner(System.in); System.out.println("欢迎进入删除界面"); System.out.println("请输入删除的id:"); String id=scanner.next(); return userController.deleteUserController(id); } public boolean updateView() throws IOException { Scanner scanner=new Scanner(System.in); System.out.println("欢迎进入更改界面:"); System.out.println("请输入你要更改的id:"); String id=scanner.next(); System.out.println("请输入要修改的用户名:"); String userName=scanner.next(); System.out.println("请输入要修改的密码:"); String password=scanner.next(); System.out.println("请输入要修改的密保问题:"); String question=scanner.next(); System.out.println("请输入要修改的密保答案:"); String answer=scanner.next(); User user=new User(userName,id,password,question,answer); return userController.updateUserController(user,id); } public void selectUserView() throws IOException { BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入查询界面:"); System.out.println("请选择查询方式:"); System.out.println("1.查所有,2.根据id查询"); Scanner scanner=new Scanner(System.in); switch (scanner.nextInt()){ case 1: System.out.println("请输入管理员id"); String idd=bufferedReader.readLine(); if (idd.equals("10086")) { List<User> userList = userController.selectUserController(); for (int i = 0; i < userList.size(); i++) { System.out.print("查询的结果为:"); System.out.println(userList.get(i)); } } else{ System.out.println("无权限,查询失败");} break; case 2: System.out.println("请输入你要查询的id"); String id=scanner.next(); List<User> userIdList=userController.selectUserByIdController(id); if (userIdList!=null) { for (int i = 0; i < userIdList.size(); i++) { System.out.println(userIdList.get(i)); } } break; default: System.out.println("您输入的数字有误,请重新输入"); break; } } } package org.dxj.expresssortingsystem.views; import com.sun.corba.se.impl.resolver.ORBDefaultInitRefResolverImpl; import com.sun.org.apache.xpath.internal.operations.Or; import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; import org.dxj.expresssortingsystem.controller.OrderController; import org.dxj.expresssortingsystem.controller.UserController; import org.dxj.expresssortingsystem.entity.Order; import org.dxj.expresssortingsystem.entity.User; import java.util.Date; import java.io.*; import java.util.List; import java.util.Scanner; public class OrderViews { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); Date date=new Date(); OrderController orderController = new OrderController(); public void insertOrder()throws IOException { System.out.println("欢迎进入填写界面"); System.out.println("请填入您的id"); String id = bufferedReader.readLine(); System.out.println("请通过填写快递公司前序号选择快递公司及相应邮费"); System.out.println("快递公司及邮费"); System.out.println("1顺丰快递¥10"); System.out.println("2韵达快递¥9"); System.out.println("3邮政快递¥8"); System.out.println("4中通快递¥7"); System.out.println("5圆通快递¥5"); String payment=null; switch (bufferedReader.readLine()) { case "1": payment = "10"; break; case "2": payment = "9"; break; case "3": payment = "8"; break; case "4": payment = "7"; break; case "5": payment = "5"; break; } String creattime=date.toString(); String updatetime="无修改时间"; String deletetime="无删除时间"; String closetime=date.toString(); Order order=new Order(id,payment,creattime,updatetime,deletetime,closetime); orderController.insertController(order); } public void updateOrder()throws Exception{ System.out.println("欢迎进入修改订单界面"); System.out.println("请输入id"); String id= bufferedReader.readLine(); if (orderController.selectController(id)!=null){ System.out.println("请修改快递公司及其对应邮费"); System.out.println("快递公司及邮费"); System.out.println("1顺丰快递¥10"); System.out.println("2韵达快递¥9"); System.out.println("3邮政快递¥8"); System.out.println("4中通快递¥7"); System.out.println("5圆通快递¥5"); String payment=null; switch (bufferedReader.readLine()) { case "1": payment = "10"; break; case "2": payment = "9"; break; case "3": payment = "8"; break; case "4": payment = "7"; break; case "5": payment = "5"; break; } String creattime=date.toString(); String deletetime="无删除时间"; String updatetime=date.toString(); String closetime=date.toString(); Order order=new Order(id,payment,creattime,updatetime,deletetime,closetime); orderController.updateController(id,order); } else { System.out.println("订单信息不存在,无法修改"); } } public void deleteorder() throws Exception{ System.out.println("欢迎来到删除订单信息页面"); System.out.println("请输入要删除快递订单的id"); String id= bufferedReader.readLine(); orderController.deleteController(id); } public void selectorder() throws Exception{ BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入查询页面"); System.out.println("请选择查询方式:"); System.out.println("1.查所有,2.根据id查询"); Scanner scanner=new Scanner(System.in); switch (scanner.nextInt()){ case 1: System.out.println("请输入管理员id"); String idd=bufferedReader.readLine(); if (idd.equals("10086")){ List<Order> orderList=orderController.selectController(); for (int i = 0; i < orderList.size(); i++) { System.out.print("查询的结果为:"); System.out.println(orderList.get(i)); } }else { System.out.println("无权限,查询失败"); } break; case 2: System.out.println("请输入你要查询的id"); String id=scanner.next(); List<Order> orderList1=orderController.selectController(id); if (orderList1!=null) { for (int i = 0; i < orderList1.size(); i++) { System.out.println(orderList1.get(i)); } } break; default: System.out.println("您输入的数字有误,请重新输入"); break; } } } package org.dxj.expresssortingsystem.views; import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; import org.dxj.expresssortingsystem.controller.DeliverController; import org.dxj.expresssortingsystem.controller.UserController; import org.dxj.expresssortingsystem.entity.Deliver; import org.dxj.expresssortingsystem.entity.User; import java.io.*; import java.util.List; public class DeliverViews { DeliverController deliverController=new DeliverController(); public void insertViews() throws IOException { DeliverController deliverController=new DeliverController(); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入填写详细快递信息页面"); System.out.println("请输入您的快递单号"); String expressId=bufferedReader.readLine(); System.out.println("请输入所选择的快递公司"); String expresscompany=bufferedReader.readLine(); System.out.println("请输入寄货人姓名"); String sendName=bufferedReader.readLine(); System.out.println("请输入寄货人手机号"); String sendNumber=bufferedReader.readLine(); System.out.println("请输入收货地址"); String receiveAdress=bufferedReader.readLine(); System.out.println("请输入收货人姓名"); String receiveName=bufferedReader.readLine(); System.out.println("请输入收货人手机号"); String receiveNumber=bufferedReader.readLine(); Deliver deliver=new Deliver(expressId,expresscompany,sendName,sendNumber,receiveAdress,receiveName,receiveNumber); deliverController.InsertController(deliver); } public void deleteViews() throws IOException{ DeliverController deliverController=new DeliverController(); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入删除详细快递信息页面"); System.out.println("请输入要删除的id"); String id=bufferedReader.readLine(); deliverController.deleteController(id); } public void updateViews()throws IOException{ DeliverController deliverController=new DeliverController(); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入修改快递详细信息页面"); System.out.println("请输入要修改的快递单号"); String expressId=bufferedReader.readLine(); System.out.println("请输入修改后的快递公司"); String expresscompany=bufferedReader.readLine(); System.out.println("请输入修改后的寄货人姓名"); String sendName=bufferedReader.readLine(); System.out.println("请输入修改后的寄货人手机号"); String sendNumber=bufferedReader.readLine(); System.out.println("请输入修改后的收货地址"); String receiveAdress=bufferedReader.readLine(); System.out.println("请输入修改后的收货人姓名"); String receiveName=bufferedReader.readLine(); System.out.println("请输入修改后的收货人手机号"); String receiveNumber=bufferedReader.readLine(); Deliver deliver=new Deliver(expressId,expresscompany,sendName,sendNumber,receiveAdress,receiveName,receiveNumber); deliverController.updateController(deliver,expressId); } public void selectUserView() throws IOException { BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in)); System.out.println("欢迎进入查询界面:"); System.out.println("请选择你要选择的查询方式:"); System.out.println("1.查所有,2.根据id查询"); switch (bufferedReader.readLine()){ case "1": System.out.println("请输入管理员id"); String idd=bufferedReader.readLine(); if (idd.equals("10086")) { List<Deliver> deliverList = deliverController.selectAllController(); for (int i = 0; i < deliverList.size(); i++) { System.out.print("查询的结果为:"); System.out.println(deliverList.get(i)); } }else { System.out.println("无权限,查询失败"); } break; case "2": System.out.println("请输入您要查询的id"); String id=bufferedReader.readLine(); List<Deliver> list=deliverController.selectController(id); if(list!=null){ for (int a = 0; a < list.size(); a++) { System.out.print("查询的结果为:"); System.out.println(list.get(a)); } } break; default: System.out.println("您输入的数字有误,操作失败"); break; } } }
TextAll
import org.dxj.expresssortingsystem.views.DeliverViews; import org.dxj.expresssortingsystem.views.OrderViews; import org.dxj.expresssortingsystem.views.UserViews; import java.io.BufferedReader; import java.io.InputStreamReader; public class TextAll { public static void main(String[] args) throws Exception { String an; BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("是否进入快递分拣系统?"); an=bufferedReader.readLine(); while(an.equals("是")) { System.out.println("欢迎进入快递分拣系统"); System.out.println("~~~~~~~~~~~~~~~~~~~~~~"); System.out.println("请根据提示完成各项操作"); System.out.println("输入不同数字完成不同操作"); System.out.println("1用户注册 " + "2用户登录 " + "3用户修改信息 " + "4用户注销 " + "5查询用户信息 "); System.out.println("6增加快递订单 " + "7修改快递订单 " + "8删除快递订单 " + "9查询快递订单信息 "); System.out.println("10填写详细快递信息 " + "11修改详细快递信息 " + "12删除详细快递信息 " + "13查询详细快递信息 " + "14用户注册,登录,增加快递订单,填写快递详细信息 " ); UserViews a = new UserViews(); OrderViews b = new OrderViews(); DeliverViews c = new DeliverViews(); switch (bufferedReader.readLine()) { case "1": a.insertUserView(); break; case "2": a.loginView(); break; case "3": a.updateView(); break; case "4": a.deleteView(); break; case "5": a.selectUserView(); break; case "6": b.insertOrder(); break; case "7": b.updateOrder(); break; case "8": b.deleteorder(); break; case "9": b.selectorder(); break; case "10": c.insertViews(); break; case "11": c.updateViews(); break; case "12": c.deleteViews(); break; case "13": c.selectUserView(); break; case "14": a.insertUserView(); a.loginView(); b.insertOrder(); c.insertViews(); break; } System.out.println("是否重新进入该系统"); an= bufferedReader.readLine(); } System.out.println("本次操作结束,欢迎下次光临"); } }