Java——io项目(快递分拣系统)

简介: 该快递自动分拣系统主要用于快递管理员对快递包裹信息进行录入,删除,修改,查询,对快递内容的检测等操作,和客户对于快递包裹信息,快递物流信息的查询以及对当地快递拣货点的查询,方便人们寄领快递,保证人们身份信息及个人隐私的安全性。

项目设计书

快递分拣系统

一、 项目设计分析:该快递自动分拣系统主要用于快递管理员对快递包裹信息进行录入,删除,修改,查询,对快递内容的检测等操作,和客户对于快递包裹信息,快递物流信息的查询以及对当地快递拣货点的查询,方便人们寄领快递,保证人们身份信息及个人隐私的安全性。

二、 程序功能简介:该系统共有以下十一个功能

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("本次操作结束,欢迎下次光临");
    }
}
目录
相关文章
|
2天前
|
SQL Java 数据库连接
从理论到实践:Hibernate与JPA在Java项目中的实际应用
本文介绍了Java持久层框架Hibernate和JPA的基本概念及其在具体项目中的应用。通过一个在线书店系统的实例,展示了如何使用@Entity注解定义实体类、通过Spring Data JPA定义仓库接口、在服务层调用方法进行数据库操作,以及使用JPQL编写自定义查询和管理事务。这些技术不仅简化了数据库操作,还显著提升了开发效率。
12 3
|
6天前
|
运维 自然语言处理 供应链
Java云HIS医院管理系统源码 病案管理、医保业务、门诊、住院、电子病历编辑器
通过门诊的申请,或者直接住院登记,通过”护士工作站“分配患者,完成后,进入医生患者列表,医生对应开具”长期医嘱“和”临时医嘱“,并在电子病历中,记录病情。病人出院时,停止长期医嘱,开具出院医嘱。进入出院审核,审核医嘱与住院通过后,病人结清缴费,完成出院。
27 3
|
4天前
|
前端开发 Java 数据库
如何实现一个项目,小白做项目-java
本教程涵盖了从数据库到AJAX的多个知识点,并详细介绍了项目实现过程,包括静态页面分析、数据库创建、项目结构搭建、JSP转换及各层代码编写。最后,通过通用分页和优化Servlet来提升代码质量。
15 1
|
10天前
|
Java 数据库连接 数据库
深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能
在Java应用开发中,数据库操作常成为性能瓶颈。本文通过问题解答形式,深入探讨Java连接池技术如何通过复用数据库连接、减少连接建立和断开的开销,从而显著提升系统性能。文章介绍了连接池的优势、选择和使用方法,以及优化配置的技巧。
13 1
|
11天前
|
JavaScript Java 项目管理
Java毕设学习 基于SpringBoot + Vue 的医院管理系统 持续给大家寻找Java毕设学习项目(附源码)
基于SpringBoot + Vue的医院管理系统,涵盖医院、患者、挂号、药物、检查、病床、排班管理和数据分析等功能。开发工具为IDEA和HBuilder X,环境需配置jdk8、Node.js14、MySQL8。文末提供源码下载链接。
|
15天前
|
移动开发 前端开发 JavaScript
java家政系统成品源码的关键特点和技术应用
家政系统成品源码是已开发完成的家政服务管理软件,支持用户注册、登录、管理个人资料,家政人员信息管理,服务项目分类,订单与预约管理,支付集成,评价与反馈,地图定位等功能。适用于各种规模的家政服务公司,采用uniapp、SpringBoot、MySQL等技术栈,确保高效管理和优质用户体验。
|
17天前
|
XML JSON 监控
告别简陋:Java日志系统的最佳实践
【10月更文挑战第19天】 在Java开发中,`System.out.println()` 是最基本的输出方法,但它在实际项目中往往被认为是不专业和不足够的。本文将探讨为什么在现代Java应用中应该避免使用 `System.out.println()`,并介绍几种更先进的日志解决方案。
42 1
|
21天前
|
Java 关系型数据库 API
介绍一款Java开发的企业接口管理系统和开放平台
YesApi接口管理平台Java版,基于Spring Boot、Vue.js等技术,提供API接口的快速研发、管理、开放及收费等功能,支持多数据库、Docker部署,适用于企业级PaaS和SaaS平台的二次开发与搭建。
|
25天前
|
Java Apache Maven
Java/Spring项目的包开头为什么是com?
本文介绍了 Maven 项目的初始结构,并详细解释了 Java 包命名惯例中的域名反转规则。通过域名反转(如 `com.example`),可以确保包名的唯一性,避免命名冲突,提高代码的可读性和逻辑分层。文章还讨论了域名反转的好处,包括避免命名冲突、全球唯一性、提高代码可读性和逻辑分层。最后,作者提出了一个关于包名的问题,引发读者思考。
Java/Spring项目的包开头为什么是com?
|
22天前
|
Java
Java 中 IO 流的分类详解
【10月更文挑战第10天】不同类型的 IO 流具有不同的特点和适用场景,我们可以根据具体的需求选择合适的流来进行数据的输入和输出操作。在实际应用中,还可以通过组合使用多种流来实现更复杂的功能。
39 0
下一篇
无影云桌面