【Android】Final homework of Pick Up App

1. Final homework questions

        "Campus Lost and Found APP"

2. Implementation purpose

        Through this practical training, trainees can have an in-depth understanding of Android-related technologies and apply the knowledge they have learned to actual medium-scale program design. At the same time, through this practical training, trainees can expand their Android-related knowledge and improve their abilities.

3. Implementation requirements 

3.1 . Scenes of campus lost/found items APP

Campus is a small social environment where everyone lives. We often find that we forget things in the classroom, such as your USB flash drive, or we often forget things in the cafeteria, such as your books, backpacks, etc. What's more? Or, I lost my wallet somewhere that we don’t even remember, so we’re so worried... School is a pure place: someone may pick up something you forgot, and he/she also wants to be able to return it to you as soon as possible...

But now we lack such a place that can publish found or lost items as soon as possible. We will develop such an APP: campus lost/found items APP. Through this APP, people who have lost or found items can quickly achieve their urgent wishes.

3.2 . Basic program requirements

This is a campus lost/found items APP. Therefore, our APP should have the following basic functions:

1. Release of found items information

Object pickers can use the APP to conveniently publish information about the items found, including: the name of the item picker, the person's phone number, the person's WeChat ID, the person's contact address, the location where the item was picked up, the time when the item was picked up, the picture of the item, etc.

2. Release of lost property information

Lost property owners can use the APP to conveniently publish lost property information, including: name of the property, possible location of the lost property, name of the lost property owner, phone number of the lost property owner, WeChat ID of the lost property owner, description of the lost property, etc.

3. Browse, query and claim found items information

Through this APP, people who have lost items can conveniently browse all the found information posted by finders, and can query according to certain conditions, including: query by time of finding, name of found, status of found, description of found, etc. Lost property owners can use this APP to claim a lost property that may belong to them. The person who lost the property must register and log in to the system before it can be claimed.

4. Lost property information browsing, inquiry and warm reminders

Through this APP, the finder can conveniently browse all the found item information posted by the lost item, and can query according to certain conditions, including: query by time of lost object, query of lost object name, query of lost object status, query of lost object description, etc. The person who found the lost property can use this APP to send a warm reminder to the publisher of the lost property information.

5. Registration and login

Those who need to claim their lost property can only claim their lost property after registering and logging in to the APP. Registration information includes: name, practice phone number, WeChat ID, mailing address, etc. You can log in after registering.

3.3 . Practical training environment

The mobile terminal uses Android technology and the server side uses JavaEE (the database uses MySQL and the web server uses Tomcat). The project is completed in the Eclipse or Android Studio development environment.

Publish the Java Web part to the Alibaba Cloud server (apply for a free Alibaba Cloud server for project testing) or your own server.

3.4 . Analysis of difficulties

In addition to the "Android Basic Programming" course content learned this semester, this practical training project also includes the content of the "Java Web Project Development" course learned this semester.

4. Work display

1. Directory structure

 

2. Log in to the registration interface

 

 

 3. Home page interface

 4. Release of lost and found items

 

 5. Lost and Found Plaza

 

 

 6. Details of lost and found items

 

 

7. User interface

 

 

 

end: server test code 

package com.http.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.http.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.DatatypeConverter;
import java.io.*;

@Controller
public class LoginController {
    private String data;
    private Object userService;

    @RequestMapping(value = "/androidLogin",method = RequestMethod.POST)
    @ResponseBody
    public  void  androidLogin(HttpServletResponse response, HttpServletRequest request) throws IOException, IOException {

        response.setContentType("text/html;charset=utf-8");
//
        String userName = request.getParameter("username").trim();
        String passWord = request.getParameter("password").trim();
//        String upsw = request.getParameter("password").trim();
        System.out.println("=======安卓客户端连接服务器成功=============");
        User user_android = this.userService.findAndroidLogin(unname,upsw);
//

        PrintWriter out=response.getWriter();
        if(userName.equals("zsan")&&passWord.equals("123")) {
//            out.println("200");
            BufferedInputStream ins=new BufferedInputStream(new FileInputStream(
                    new File("E:\\Test\\pic\\cat.jpg")));
            byte[] bit=new byte[ins.available()];
            try{
                ins.read(bit);
                ins.close();
            }catch (Exception e){
                e.printStackTrace();
            }
            //byte[]转base64    bit数据库传过来的值
            String base64Str = DatatypeConverter.printBase64Binary(bit);
            ObjectMapper json=new ObjectMapper();
            String jsonStr=json.writeValueAsString(
                    new User
            ("张三","zsan","18576073196","广东中山",
                    "123",base64Str));
            out.println(jsonStr);
            System.err.println(jsonStr);
            System.out.println("android端用户登陆成功");
        }
        else {
            out.println("300");
            System.out.println("登录失败");
        }
    }
    
}

Guess you like

Origin blog.csdn.net/m0_56233309/article/details/131018621