@ -0,0 +1 @@
|
||||
OrangeSale_04
|
@ -1,68 +0,0 @@
|
||||
package com.example.orangesale_05.dataoperation;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class OrangeDatabase extends SQLiteOpenHelper {
|
||||
public OrangeDatabase(@Nullable Context context) {
|
||||
super(context, "orange.db3", null, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
//创建用户表
|
||||
String sql = "create table orange_user(id integer primary key autoincrement, username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
* @param sqLiteDatabase
|
||||
* @param username
|
||||
* @param password
|
||||
* @param sex
|
||||
* @param city
|
||||
*/
|
||||
public void insertUser(SQLiteDatabase sqLiteDatabase, String username, String password, String sex, String city) {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put("username", username);
|
||||
contentValues.put("password", password);
|
||||
contentValues.put("sex", sex);
|
||||
contentValues.put("city", city);
|
||||
sqLiteDatabase.insert("orange_user", null, contentValues);
|
||||
sqLiteDatabase.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param sqLiteDatabase
|
||||
* @param bundle
|
||||
* @return
|
||||
*/
|
||||
public Bundle queryUserInfo(SQLiteDatabase sqLiteDatabase, Bundle bundle) {
|
||||
String username = bundle.getString("username");
|
||||
Cursor cursor = sqLiteDatabase.rawQuery("select * from orange_user where username=?", new String[]{username});
|
||||
if (cursor != null) {
|
||||
while (cursor.moveToNext()) {
|
||||
bundle.putString("sex", cursor.getString(3));
|
||||
bundle.putString("city", cursor.getString(4));
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
sqLiteDatabase.close();
|
||||
return bundle;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.example.orangesale_05.fragment;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.example.orangesale_05.R;
|
||||
|
||||
public class ProductFragment extends Fragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_product, container, false);
|
||||
return view;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.example.orangesale_05.fragment;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.example.orangesale_05.R;
|
||||
|
||||
public class ShoppingCartFragment extends Fragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_shopping, container, false);
|
||||
return view;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.example.orangesale_end.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.orangesale_end.R;
|
||||
import com.example.orangesale_end.entity.Condition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ListViewAdapter extends BaseAdapter {
|
||||
private List<Condition> conditionList;
|
||||
private LayoutInflater layoutInflater;
|
||||
private int selectedPosition = -1;
|
||||
private int selectColor = Color.GRAY;
|
||||
|
||||
public ListViewAdapter(Context context, List<Condition> conditionList) {
|
||||
this.conditionList = conditionList;
|
||||
this.layoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return conditionList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return conditionList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder viewHolder;
|
||||
if (convertView == null) {
|
||||
convertView = layoutInflater.inflate(R.layout.product_condition_item, null);
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.imageView = convertView.findViewById(R.id.condition_icon);
|
||||
viewHolder.jiange = convertView.findViewById(R.id.image_jiange);
|
||||
viewHolder.textView = convertView.findViewById(R.id.condition_name);
|
||||
viewHolder.linearLayout = convertView.findViewById(R.id.item_bg);
|
||||
convertView.setTag(viewHolder);
|
||||
} else {
|
||||
viewHolder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
Condition condition = conditionList.get(position);
|
||||
if (condition != null) {
|
||||
viewHolder.imageView.setBackgroundResource(condition.getConditionIcon());
|
||||
viewHolder.textView.setText(condition.getConditionName());
|
||||
viewHolder.jiange.setBackgroundColor(Color.rgb(207, 207, 207));
|
||||
if (selectedPosition == position) {
|
||||
viewHolder.linearLayout.setBackgroundColor(selectColor);
|
||||
}
|
||||
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView imageView, jiange;
|
||||
TextView textView;
|
||||
LinearLayout linearLayout;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
public class Condition {
|
||||
private Integer conditionIcon;
|
||||
private String conditionName;
|
||||
|
||||
public Integer getConditionIcon() {
|
||||
return conditionIcon;
|
||||
}
|
||||
|
||||
public void setConditionIcon(Integer conditionIcon) {
|
||||
this.conditionIcon = conditionIcon;
|
||||
}
|
||||
|
||||
public String getConditionName() {
|
||||
return conditionName;
|
||||
}
|
||||
|
||||
public void setConditionName(String conditionName) {
|
||||
this.conditionName = conditionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Condition{" +
|
||||
"conditionIcon=" + conditionIcon +
|
||||
", conditionName='" + conditionName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class OrangeMessage {
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Timestamp getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(Timestamp sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public String getUsed() {
|
||||
return used;
|
||||
}
|
||||
|
||||
public void setUsed(String used) {
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
private Integer id;
|
||||
private String content;
|
||||
private Timestamp sendTime;
|
||||
private String used;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrangeMessage{" +
|
||||
"id=" + id +
|
||||
", content='" + content + '\'' +
|
||||
", sendTime=" + sendTime +
|
||||
", used='" + used + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class OrangeProduct {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private BigDecimal price;
|
||||
private String imgUrl;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrangeProduct{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", price=" + price +
|
||||
", imgUrl='" + imgUrl + '\'' +
|
||||
", addTime=" + addTime +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Timestamp getAddTime() {
|
||||
return addTime;
|
||||
}
|
||||
|
||||
public void setAddTime(Timestamp addTime) {
|
||||
this.addTime = addTime;
|
||||
}
|
||||
|
||||
private Timestamp addTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class OrangeProductPack {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Timestamp addTime;
|
||||
private Bitmap imgBitmap;
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrangeProductPack{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", addTime=" + addTime +
|
||||
", imgBitmap=" + imgBitmap +
|
||||
", price=" + price +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Timestamp getAddTime() {
|
||||
return addTime;
|
||||
}
|
||||
|
||||
public void setAddTime(Timestamp addTime) {
|
||||
this.addTime = addTime;
|
||||
}
|
||||
|
||||
public Bitmap getImgBitmap() {
|
||||
return imgBitmap;
|
||||
}
|
||||
|
||||
public void setImgBitmap(Bitmap imgBitmap) {
|
||||
this.imgBitmap = imgBitmap;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.example.orangesale_05.entity;
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
public class OrangeUser {
|
||||
private Integer id;
|
@ -1,4 +1,4 @@
|
||||
package com.example.orangesale_05.entity;
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
public class ShoppingCart {
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return ProductId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
ProductId = productId;
|
||||
}
|
||||
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(Integer number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer ProductId;
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer number;
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.example.orangesale_end.fragment;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.GridView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.example.orangesale_end.R;
|
||||
import com.example.orangesale_end.adapter.ListViewAdapter;
|
||||
import com.example.orangesale_end.adapter.ProductAdapter;
|
||||
import com.example.orangesale_end.entity.Condition;
|
||||
import com.example.orangesale_end.entity.OrangeProductPack;
|
||||
import com.example.orangesale_end.netrequest.OkHttpClientProduct;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ProductFragment extends Fragment {
|
||||
private Spinner conditonListSpinner;
|
||||
private ListViewAdapter listViewAdapter;
|
||||
private List<Condition> conditionList;
|
||||
private GridView productGridView;
|
||||
private List<OrangeProductPack> orangeProductList = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_product, container, false);
|
||||
init(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件初始化方法
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
private void init(View view) {
|
||||
conditonListSpinner = view.findViewById(R.id.product_select_condition);
|
||||
initCondList();
|
||||
listViewAdapter = new ListViewAdapter(getActivity(), conditionList);
|
||||
conditonListSpinner.setAdapter(listViewAdapter);
|
||||
productGridView = view.findViewById(R.id.product_list);
|
||||
new SearchProductTask().execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化conditionList
|
||||
*/
|
||||
private void initCondList() {
|
||||
conditionList = new ArrayList<>();
|
||||
Condition allCondition = new Condition();
|
||||
allCondition.setConditionIcon(R.drawable.all);
|
||||
allCondition.setConditionName("全部");
|
||||
Condition saleCondition = new Condition();
|
||||
saleCondition.setConditionIcon(R.drawable.salenum);
|
||||
saleCondition.setConditionName("按销量高低排序");
|
||||
Condition timeCondition = new Condition();
|
||||
timeCondition.setConditionIcon(R.drawable.time);
|
||||
timeCondition.setConditionName("按上市时间排序");
|
||||
Condition priceCondition = new Condition();
|
||||
priceCondition.setConditionIcon(R.drawable.price);
|
||||
priceCondition.setConditionName("按商品价格排序");
|
||||
conditionList.add(allCondition);
|
||||
conditionList.add(saleCondition);
|
||||
conditionList.add(timeCondition);
|
||||
conditionList.add(priceCondition);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送网络请求获取数据
|
||||
*/
|
||||
class SearchProductTask extends AsyncTask<Void, Void, List<OrangeProductPack>> {
|
||||
|
||||
@Override
|
||||
protected List<OrangeProductPack> doInBackground(Void... voids) {
|
||||
OkHttpClientProduct clientProduct = new OkHttpClientProduct();
|
||||
try {
|
||||
orangeProductList = clientProduct.getProductPack();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return orangeProductList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<OrangeProductPack> orangeProducts) {
|
||||
ProductAdapter productAdapter = new ProductAdapter(getActivity(), orangeProductList);
|
||||
productGridView.setAdapter(productAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.example.orangesale_end.netrequest;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.example.orangesale_end.entity.OrangeProduct;
|
||||
import com.example.orangesale_end.entity.OrangeProductPack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class OkHttpClientProduct {
|
||||
|
||||
/**
|
||||
* 查询商品信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<OrangeProduct> getProduct() throws IOException {
|
||||
OkHttpClient okHttpClient = new OkHttpClient();
|
||||
Request request = new Request.Builder()
|
||||
.url("http://10.21.221.183:8081/orange/product/search")
|
||||
.build();
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string());
|
||||
List<OrangeProduct> list = JSON.parseObject(jsonObject.getString("data"), new TypeReference<List<OrangeProduct>>() {
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
*
|
||||
* @param imgUrl
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public Bitmap getImageBitMap(String imgUrl) throws IOException {
|
||||
Bitmap bitmap;
|
||||
OkHttpClient okHttpClient = new OkHttpClient();
|
||||
Request request = new Request.Builder()
|
||||
.url(imgUrl)
|
||||
.build();
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
byte[] bytes = Objects.requireNonNull(response.body()).bytes();
|
||||
bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
|
||||
return bitmap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装信息
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public List<OrangeProductPack> getProductPack() throws IOException {
|
||||
List<OrangeProductPack> packList = new ArrayList<>();
|
||||
List<OrangeProduct> list = getProduct();
|
||||
for (OrangeProduct orangeProduct : list) {
|
||||
OrangeProductPack orangeProductPack = new OrangeProductPack();
|
||||
orangeProductPack.setId(orangeProduct.getId());
|
||||
orangeProductPack.setImgBitmap(getImageBitMap(orangeProduct.getImgUrl()));
|
||||
orangeProductPack.setAddTime(orangeProduct.getAddTime());
|
||||
orangeProductPack.setPrice(orangeProduct.getPrice());
|
||||
packList.add(orangeProductPack);
|
||||
}
|
||||
return packList;
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.example.orangesale_end.netrequest;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.orangesale_end.entity.OrangeUser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class OkHttpUser {
|
||||
/**
|
||||
* 用户登录验证
|
||||
*
|
||||
* @param orangeUser
|
||||
*/
|
||||
public OrangeUser userLogin(OrangeUser orangeUser) throws IOException {
|
||||
OkHttpClient okHttpClient= new OkHttpClient();
|
||||
//数据类型为json格式
|
||||
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
|
||||
//将对象转为JSON字符串
|
||||
String jsonStr = JSONObject.toJSONString(orangeUser);
|
||||
|
||||
RequestBody requestBody = RequestBody.create(jsonStr, mediaType);
|
||||
Request request = new Request.Builder()
|
||||
.url("http://10.21.221.183:8081/orange/user/login")
|
||||
.post(requestBody)
|
||||
.build();
|
||||
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
|
||||
String responseStr = response.body().string();
|
||||
System.out.println("responseStr = " + responseStr);
|
||||
JSONObject jsonObject = JSON.parseObject(responseStr);
|
||||
JSONObject jsonObject1 = jsonObject.getJSONObject("data");
|
||||
OrangeUser orangeUser1 = JSON.toJavaObject(jsonObject1, OrangeUser.class);
|
||||
return orangeUser1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*
|
||||
* @param orangeUser
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public boolean userRegister(OrangeUser orangeUser) throws IOException {
|
||||
OkHttpClient okHttpClient = new OkHttpClient();
|
||||
//数据类型为json格式
|
||||
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
|
||||
//将对象转为JSON字符串
|
||||
String jsonStr = JSONObject.toJSONString(orangeUser);
|
||||
RequestBody requestBody = RequestBody.create(jsonStr, mediaType);
|
||||
Request request = new Request.Builder()
|
||||
.url("http://10.21.221.183:8081/orange/user/register")
|
||||
.post(requestBody)
|
||||
.build();
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
Log.i("register", "userRegister: "+jsonObject);
|
||||
return jsonObject.getBoolean("flag");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 790 B |
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 109 KiB |
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 799 B |
Before Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 554 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/shoppingcart_title" />
|
||||
<!--有商品时的布局-->
|
||||
<GridView
|
||||
android:id="@+id/cart_productList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:numColumns="1" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F2F2F2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/shoppingcart_title" />
|
||||
<!--无商品时的布局-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="160dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/cart" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="Cart is Empty ~"
|
||||
android:textColor="#B5B5B5"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/random_search"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="25dp"
|
||||
android:background="@drawable/button_login"
|
||||
android:text="go shopping..."
|
||||
android:textColor="#fff"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,11 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
<include layout="@layout/content_product_title" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/product_select_condition"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingHorizontal="1dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/product_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="product" />
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#E8E8E8"
|
||||
android:horizontalSpacing="10dp"
|
||||
android:verticalSpacing="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:numColumns="2"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!--标题-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="#C6009688"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_return"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="商品"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="shop" />
|
||||
</LinearLayout>
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="#fff"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/condition_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/condition_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="销量"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_jiange"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:background="#CFCFCF" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F2F2F2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/shoppingcart_title" />
|
||||
|
||||
<include layout="@layout/cart_no_product" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!--标题-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#C6009688"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shopcart_return"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/arrow_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="shopping cart"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,4 +1,4 @@
|
||||
package com.example.orangesale_05;
|
||||
package com.example.orangesale_end;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : test
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50727
|
||||
Source Host : localhost:3306
|
||||
Source Schema : orange
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50727
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 11/01/2020 16:53:36
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for orange_message
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `orange_message`;
|
||||
CREATE TABLE `orange_message` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`send_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`used` enum('YES','NO') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'NO',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of orange_message
|
||||
-- ----------------------------
|
||||
INSERT INTO `orange_message` VALUES (1, '测试新消息', '2019-12-16 10:36:28', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (2, '添加一条新消息测试', '2019-12-17 15:33:27', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (3, '测试退出消息', '2019-12-17 15:34:32', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (4, '再次测试', '2019-12-17 15:35:38', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (5, '今天天气真好', '2019-12-17 15:39:20', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (6, '今天好热啊', '2019-12-17 17:24:13', 'YES');
|
||||
INSERT INTO `orange_message` VALUES (7, '今天出太阳了,天气很好', '2019-12-25 17:29:28', 'YES');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for orange_product
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `orange_product`;
|
||||
CREATE TABLE `orange_product` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键',
|
||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '商品名字',
|
||||
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '商品图片地址',
|
||||
`price` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品价格',
|
||||
`add_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '商品上市时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of orange_product
|
||||
-- ----------------------------
|
||||
INSERT INTO `orange_product` VALUES (1, '草莓蛋糕', 'http://10.21.221.183:8081/uploaded/caomeidangao.png', 59.9, '2019-12-16 15:58:05');
|
||||
INSERT INTO `orange_product` VALUES (2, '切片面包', 'http://10.21.221.183:8081/uploaded/qiepianmianbao.png', 9.9, '2019-12-16 18:19:09');
|
||||
INSERT INTO `orange_product` VALUES (3, '肉松面包', 'http://10.21.221.183:8081/uploaded/rousongxiaobei.png', 25.0, '2019-12-17 02:29:50');
|
||||
INSERT INTO `orange_product` VALUES (4, '酸奶泡芙', 'http://10.21.221.183:8081/uploaded/suannaipaofu.png', 10.0, '2019-12-17 02:38:29');
|
||||
INSERT INTO `orange_product` VALUES (5, '甜甜圈', 'http://10.21.221.183:8081/uploaded/ttq.png', 6.99, '2019-12-17 02:38:56');
|
||||
INSERT INTO `orange_product` VALUES (6, '手撕面包', 'http://10.21.221.183:8081/uploaded/shousimianbao.png', 12.0, '2019-12-17 02:38:48');
|
||||
INSERT INTO `orange_product` VALUES (7, '凤凰卷', 'http://10.21.221.183:8081/uploaded/fenghuangjuan.png', 7.99, '2019-12-17 02:38:56');
|
||||
INSERT INTO `orange_product` VALUES (8, '曲奇饼', 'http://10.21.221.183:8081/uploaded/quqibing.png', 20.0, '2019-12-17 02:38:48');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for orange_sale
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `orange_sale`;
|
||||
CREATE TABLE `orange_sale` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`product_id` int(11) NOT NULL DEFAULT 0,
|
||||
`sales_num` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for orange_shoppingcart
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `orange_shoppingcart`;
|
||||
CREATE TABLE `orange_shoppingcart` (
|
||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键',
|
||||
`user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户id',
|
||||
`product_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品id',
|
||||
`num` int(11) NOT NULL DEFAULT 0 COMMENT '数量',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for orange_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `orange_user`;
|
||||
CREATE TABLE `orange_user` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`password` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`sex` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`city` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of orange_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `orange_user` VALUES (1, '123', '123321', '男', '江西省 赣州市 章贡区');
|
||||
INSERT INTO `orange_user` VALUES (2, 'xiaoming', '123456', '女', '江西省 赣州市 章贡区');
|
||||
INSERT INTO `orange_user` VALUES (3, 'xiaoliang', '123456', '女', '江西省 赣州市 章贡区');
|
||||
INSERT INTO `orange_user` VALUES (4, 'zsss', '123456', '女', '江西省 赣州市 章贡区');
|
||||
INSERT INTO `orange_user` VALUES (5, 'xiaowang', '12345678', '男', '江西省 赣州市 章贡区');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@ -0,0 +1,31 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.5";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if (mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if (mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if (!outputFile.getParentFile().exists()) {
|
||||
if (!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|