You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.2 KiB
72 lines
2.2 KiB
package com.community.pocket.data.main.garbage;
|
|
|
|
import com.community.pocket.R;
|
|
import com.community.pocket.data.model.GarbageWaste;
|
|
import com.community.pocket.data.model.GarbageWasteManage;
|
|
import com.community.pocket.data.model.GarbageWastePrice;
|
|
import com.community.pocket.ui.main.ui.garbage.waste.GarbageWasteResponse;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
|
|
/**
|
|
* 废品回收接口
|
|
* TODO 完善逻辑
|
|
*/
|
|
public class GarbageWasteRequest {
|
|
private static volatile GarbageWasteRequest instance;
|
|
|
|
private GarbageWasteRequest() {
|
|
}
|
|
|
|
public static GarbageWasteRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new GarbageWasteRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
//检索默认废品信息
|
|
public GarbageWasteResponse searchDefault() {
|
|
GarbageWasteManage manage = new GarbageWasteManage();
|
|
manage.setMobie("10086");
|
|
manage.setName("Test");
|
|
|
|
List<GarbageWastePrice> priceList = new ArrayList<>();
|
|
for (int i = 0; i < 30; i++) {
|
|
GarbageWastePrice price = new GarbageWastePrice();
|
|
price.setName("waste" + i);
|
|
price.setPrice(new Random().nextInt(10) * 1F);
|
|
priceList.add(price);
|
|
}
|
|
|
|
GarbageWaste waste = new GarbageWaste();
|
|
waste.setDefaultList(priceList);
|
|
waste.setGarbageWasteManage(manage);
|
|
|
|
GarbageWasteResponse response = new GarbageWasteResponse();
|
|
response.setSuccess(R.string.garbage_waste_search_ok);
|
|
response.setBody(waste);
|
|
return response;
|
|
}
|
|
|
|
//检索废品
|
|
public GarbageWasteResponse search(String name) {
|
|
List<GarbageWastePrice> priceList = new ArrayList<>();
|
|
for (int i = 0; i < 5; i++) {
|
|
GarbageWastePrice price = new GarbageWastePrice();
|
|
price.setName("waste" + i);
|
|
price.setPrice(new Random().nextInt(10) * 1F);
|
|
priceList.add(price);
|
|
}
|
|
|
|
GarbageWaste waste = new GarbageWaste();
|
|
waste.setSearchList(priceList);
|
|
GarbageWasteResponse response = new GarbageWasteResponse();
|
|
response.setSuccess(R.string.garbage_waste_search_ok);
|
|
response.setBody(waste);
|
|
return response;
|
|
}
|
|
|
|
}
|
|
|