Commit 1955d118 by Wyh

7.02 打印接口改目錄名,默認打印機跟賬號(還有BUG),營業報表加餐盒費和送貨費,外賣接單加上已讀

parent 5aa7a1cc
...@@ -29,7 +29,7 @@ public interface Api { ...@@ -29,7 +29,7 @@ public interface Api {
//獲取餐廳擴展表數據 //獲取餐廳擴展表數據
String expand_info = "restaurant/ext/list"; String expand_info = "restaurant/ext/list";
//獲取餐廳打印機列表 //獲取餐廳打印機列表
String printerDevice_list = "PrinterDevice/list"; String printerDevice_list = "printerDevice/list";
//日誌上傳 //日誌上傳
String upload_app_log = "public/cloud/gsa/upload"; String upload_app_log = "public/cloud/gsa/upload";
......
...@@ -15,7 +15,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -15,7 +15,7 @@ public class PrinterDeviceBean implements Serializable {
private static final long serialVersionUID = 4583366043598445115L; private static final long serialVersionUID = 4583366043598445115L;
private int id; private Long id;
@Property(nameInDb = "_id") @Property(nameInDb = "_id")
@Id(autoincrement = true) @Id(autoincrement = true)
...@@ -24,7 +24,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -24,7 +24,7 @@ public class PrinterDeviceBean implements Serializable {
private String name; private String name;
private Integer restaurantId; private Integer restaurantId;
private String ip;//ip private String ip;//ip
private int uid; private Long uid;
private Integer port;//端口 private Integer port;//端口
// private int type;//打印機紙張類型 為1時是58mm,否則是88mm // private int type;//打印機紙張類型 為1時是58mm,否則是88mm
...@@ -48,7 +48,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -48,7 +48,7 @@ public class PrinterDeviceBean implements Serializable {
public PrinterDeviceBean() { public PrinterDeviceBean() {
} }
public PrinterDeviceBean(String name, int id, Integer restaurantId, String ip, Integer port, int type) { public PrinterDeviceBean(String name, Long id, Integer restaurantId, String ip, Integer port, int type) {
this.name = name; this.name = name;
this.id = id; this.id = id;
this.restaurantId = restaurantId; this.restaurantId = restaurantId;
...@@ -63,8 +63,8 @@ public class PrinterDeviceBean implements Serializable { ...@@ -63,8 +63,8 @@ public class PrinterDeviceBean implements Serializable {
this.port = port; this.port = port;
} }
@Generated(hash = 815182145) @Generated(hash = 1626972301)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, int uid, Integer port, Integer status, int printerModelId, String paperSpecification, String printerName, String model, Long printerDeviceId, Long defaultPrinterDeviceId) { public PrinterDeviceBean(Long id, Long dbid, String name, Integer restaurantId, String ip, Long uid, Integer port, Integer status, int printerModelId, String paperSpecification, String printerName, String model, Long printerDeviceId, Long defaultPrinterDeviceId) {
this.id = id; this.id = id;
this.dbid = dbid; this.dbid = dbid;
this.name = name; this.name = name;
...@@ -89,11 +89,11 @@ public class PrinterDeviceBean implements Serializable { ...@@ -89,11 +89,11 @@ public class PrinterDeviceBean implements Serializable {
this.name = name; this.name = name;
} }
public int getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(int id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
...@@ -194,11 +194,11 @@ public class PrinterDeviceBean implements Serializable { ...@@ -194,11 +194,11 @@ public class PrinterDeviceBean implements Serializable {
} }
public int getUid() { public Long getUid() {
return uid; return uid;
} }
public void setUid(int uid) { public void setUid(Long uid) {
this.uid = uid; this.uid = uid;
} }
} }
...@@ -24,12 +24,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -24,12 +24,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
* Can be used for QueryBuilder and for referencing column names. * Can be used for QueryBuilder and for referencing column names.
*/ */
public static class Properties { public static class Properties {
public final static Property Id = new Property(0, int.class, "id", false, "ID"); public final static Property Id = new Property(0, Long.class, "id", false, "ID");
public final static Property Dbid = new Property(1, Long.class, "dbid", true, "_id"); public final static Property Dbid = new Property(1, Long.class, "dbid", true, "_id");
public final static Property Name = new Property(2, String.class, "name", false, "NAME"); public final static Property Name = new Property(2, String.class, "name", false, "NAME");
public final static Property RestaurantId = new Property(3, Integer.class, "restaurantId", false, "RESTAURANT_ID"); public final static Property RestaurantId = new Property(3, Integer.class, "restaurantId", false, "RESTAURANT_ID");
public final static Property Ip = new Property(4, String.class, "ip", false, "IP"); public final static Property Ip = new Property(4, String.class, "ip", false, "IP");
public final static Property Uid = new Property(5, int.class, "uid", false, "UID"); public final static Property Uid = new Property(5, Long.class, "uid", false, "UID");
public final static Property Port = new Property(6, Integer.class, "port", false, "PORT"); public final static Property Port = new Property(6, Integer.class, "port", false, "PORT");
public final static Property Status = new Property(7, Integer.class, "status", false, "STATUS"); public final static Property Status = new Property(7, Integer.class, "status", false, "STATUS");
public final static Property PrinterModelId = new Property(8, int.class, "printerModelId", false, "PRINTER_MODEL_ID"); public final static Property PrinterModelId = new Property(8, int.class, "printerModelId", false, "PRINTER_MODEL_ID");
...@@ -53,12 +53,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -53,12 +53,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
public static void createTable(Database db, boolean ifNotExists) { public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": ""; String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"PRINTER_DEVICE_BEAN\" (" + // db.execSQL("CREATE TABLE " + constraint + "\"PRINTER_DEVICE_BEAN\" (" + //
"\"ID\" INTEGER NOT NULL ," + // 0: id "\"ID\" INTEGER," + // 0: id
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 1: dbid "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 1: dbid
"\"NAME\" TEXT," + // 2: name "\"NAME\" TEXT," + // 2: name
"\"RESTAURANT_ID\" INTEGER," + // 3: restaurantId "\"RESTAURANT_ID\" INTEGER," + // 3: restaurantId
"\"IP\" TEXT," + // 4: ip "\"IP\" TEXT," + // 4: ip
"\"UID\" INTEGER NOT NULL ," + // 5: uid "\"UID\" INTEGER," + // 5: uid
"\"PORT\" INTEGER," + // 6: port "\"PORT\" INTEGER," + // 6: port
"\"STATUS\" INTEGER," + // 7: status "\"STATUS\" INTEGER," + // 7: status
"\"PRINTER_MODEL_ID\" INTEGER NOT NULL ," + // 8: printerModelId "\"PRINTER_MODEL_ID\" INTEGER NOT NULL ," + // 8: printerModelId
...@@ -78,7 +78,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -78,7 +78,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
@Override @Override
protected final void bindValues(DatabaseStatement stmt, PrinterDeviceBean entity) { protected final void bindValues(DatabaseStatement stmt, PrinterDeviceBean entity) {
stmt.clearBindings(); stmt.clearBindings();
stmt.bindLong(1, entity.getId());
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
Long dbid = entity.getDbid(); Long dbid = entity.getDbid();
if (dbid != null) { if (dbid != null) {
...@@ -99,7 +103,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -99,7 +103,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (ip != null) { if (ip != null) {
stmt.bindString(5, ip); stmt.bindString(5, ip);
} }
stmt.bindLong(6, entity.getUid());
Long uid = entity.getUid();
if (uid != null) {
stmt.bindLong(6, uid);
}
Integer port = entity.getPort(); Integer port = entity.getPort();
if (port != null) { if (port != null) {
...@@ -141,7 +149,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -141,7 +149,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
@Override @Override
protected final void bindValues(SQLiteStatement stmt, PrinterDeviceBean entity) { protected final void bindValues(SQLiteStatement stmt, PrinterDeviceBean entity) {
stmt.clearBindings(); stmt.clearBindings();
stmt.bindLong(1, entity.getId());
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
Long dbid = entity.getDbid(); Long dbid = entity.getDbid();
if (dbid != null) { if (dbid != null) {
...@@ -162,7 +174,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -162,7 +174,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (ip != null) { if (ip != null) {
stmt.bindString(5, ip); stmt.bindString(5, ip);
} }
stmt.bindLong(6, entity.getUid());
Long uid = entity.getUid();
if (uid != null) {
stmt.bindLong(6, uid);
}
Integer port = entity.getPort(); Integer port = entity.getPort();
if (port != null) { if (port != null) {
...@@ -209,12 +225,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -209,12 +225,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
@Override @Override
public PrinterDeviceBean readEntity(Cursor cursor, int offset) { public PrinterDeviceBean readEntity(Cursor cursor, int offset) {
PrinterDeviceBean entity = new PrinterDeviceBean( // PrinterDeviceBean entity = new PrinterDeviceBean( //
cursor.getInt(offset + 0), // id cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // dbid cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // dbid
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name
cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // restaurantId cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // restaurantId
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ip cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ip
cursor.getInt(offset + 5), // uid cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5), // uid
cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // port cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // port
cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // status cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // status
cursor.getInt(offset + 8), // printerModelId cursor.getInt(offset + 8), // printerModelId
...@@ -229,12 +245,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> { ...@@ -229,12 +245,12 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
@Override @Override
public void readEntity(Cursor cursor, PrinterDeviceBean entity, int offset) { public void readEntity(Cursor cursor, PrinterDeviceBean entity, int offset) {
entity.setId(cursor.getInt(offset + 0)); entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setDbid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1)); entity.setDbid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setRestaurantId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3)); entity.setRestaurantId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
entity.setIp(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setIp(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setUid(cursor.getInt(offset + 5)); entity.setUid(cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5));
entity.setPort(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6)); entity.setPort(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
entity.setStatus(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7)); entity.setStatus(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
entity.setPrinterModelId(cursor.getInt(offset + 8)); entity.setPrinterModelId(cursor.getInt(offset + 8));
......
...@@ -118,7 +118,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -118,7 +118,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
}); });
} }
private String[] itemNames = new String[]{"項目銷售總金額", "折扣", "服務費", "賬單小數", "簽單", "營業金額淨值", "貼士", "堂食總數", "外賣總數", "單數", "平均每單", "人數", "平均每人"}; private String[] itemNames = new String[]{"項目銷售總金額($)", "折扣($)", "服務費($)", "賬單小數($)", "簽單($)", "營業金額淨值($)", "貼士($)", "堂食總金額數($)", "外賣總金額數($)", "單數", "平均每單($)", "人數", "平均每人($)","送貨費($)","餐盒費($)"};
private void loadAdapterInfo(BusinessDetailsBean.DataBean dataBean) { private void loadAdapterInfo(BusinessDetailsBean.DataBean dataBean) {
//底部信息默認顯示今天的數據 //底部信息默認顯示今天的數據
...@@ -152,8 +152,8 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -152,8 +152,8 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
businessBeans.add(new BusinessBean(itemNames[12], String.valueOf(averageConsumption)));//平均每人 businessBeans.add(new BusinessBean(itemNames[12], String.valueOf(averageConsumption)));//平均每人
} else { } else {
//為空,全部顯示0 //為空,全部顯示0
for (int i = 0; i < itemNames.length; i++) { for (String itemName : itemNames) {
businessBeans.add(new BusinessBean(itemNames[i], String.valueOf(0))); businessBeans.add(new BusinessBean(itemName, String.valueOf(0)));
} }
} }
mRootView.loadAdapter(businessBeans); mRootView.loadAdapter(businessBeans);
......
...@@ -82,7 +82,6 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -82,7 +82,6 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
@BindView(R2.id.iv_end_time_triangle) @BindView(R2.id.iv_end_time_triangle)
TriangleView endTimeTriangleView; TriangleView endTimeTriangleView;
private BusinessInfoAdapter businessInfoAdapter; private BusinessInfoAdapter businessInfoAdapter;
//查詢多少天的數據 //查詢多少天的數據
private int manyDay = 7; private int manyDay = 7;
...@@ -296,7 +295,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -296,7 +295,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
businessInfoAdapter = new BusinessInfoAdapter(businessBeans); businessInfoAdapter = new BusinessInfoAdapter(businessBeans);
mBusinessDetails.setAdapter(businessInfoAdapter); mBusinessDetails.setAdapter(businessInfoAdapter);
} else { } else {
businessInfoAdapter.setNewData(businessBeans); businessInfoAdapter.setNewInstance(businessBeans);
} }
} }
......
...@@ -94,6 +94,11 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -94,6 +94,11 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.gsUpdateOrderStatus(requestBody) network.gsUpdateOrderStatus(requestBody)
} }
suspend fun updateIsRead(orderId: String) = withContext(Dispatchers.IO){
network.updateIsRead(getBody("id" to orderId))
}
suspend fun thirdDelivery(orderId: String, thirdItem: ThirdItem) = withContext(Dispatchers.IO) { suspend fun thirdDelivery(orderId: String, thirdItem: ThirdItem) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("orderId", orderId) .add("orderId", orderId)
......
...@@ -72,7 +72,7 @@ class OrderList { ...@@ -72,7 +72,7 @@ class OrderList {
var orderPayType: Int = 0 var orderPayType: Int = 0
var ORDER_NO: String? = null var ORDER_NO: String? = null
var sendTime: String? = null var sendTime: String? = null
var waimaiSendTime:String? = null var waimaiSendTime: String? = null
var Id: Int = 0 var Id: Int = 0
var CREATE_TIME: String? = null var CREATE_TIME: String? = null
var takeFoodCode: String? = null var takeFoodCode: String? = null
...@@ -87,6 +87,7 @@ class OrderList { ...@@ -87,6 +87,7 @@ class OrderList {
var Open_Status: String? = null//0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單 var Open_Status: String? = null//0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單
var orderType_2: OrderType? = null var orderType_2: OrderType? = null
var orderType_7: OrderType? = null var orderType_7: OrderType? = null
var isRead: Int = 0 //0未讀,1已讀
class OrderType { class OrderType {
var typeTotalAmount: Double = 0.toDouble() var typeTotalAmount: Double = 0.toDouble()
......
...@@ -42,6 +42,8 @@ class CoolWeatherNetwork { ...@@ -42,6 +42,8 @@ class CoolWeatherNetwork {
//第三方配送接口 //第三方配送接口
suspend fun thirdDelivery(requestBody: RequestBody) = gsposService.thirdDelivery(requestBody).await() suspend fun thirdDelivery(requestBody: RequestBody) = gsposService.thirdDelivery(requestBody).await()
suspend fun updateIsRead(requestBody: RequestBody) = service.updateIsRead(requestBody).await()
//修改自取訂單狀態 //修改自取訂單狀態
suspend fun updateSelfOrderStatus(requestBody: RequestBody) = orderService.updateSelfOrderStatus(requestBody).await() suspend fun updateSelfOrderStatus(requestBody: RequestBody) = orderService.updateSelfOrderStatus(requestBody).await()
......
...@@ -33,6 +33,9 @@ interface WeatherService { ...@@ -33,6 +33,9 @@ interface WeatherService {
@POST("gsa/shipAnyOrdersNew") @POST("gsa/shipAnyOrdersNew")
fun thirdDelivery(@Body requestBody: RequestBody): Call<ThirdSend> fun thirdDelivery(@Body requestBody: RequestBody): Call<ThirdSend>
@POST("order/updateOrderInfoIsRead")
fun updateIsRead(@Body requestBody: RequestBody):Call<String>
@POST("wechat/updateSelfOrderStatus") @POST("wechat/updateSelfOrderStatus")
fun updateSelfOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean> fun updateSelfOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
......
...@@ -256,6 +256,15 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -256,6 +256,15 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
//設置為已讀
fun updateIsRead(orderId: String) {
launch({
repository.updateIsRead(orderId)
}, {
})
}
fun updateOrderStatusByBtn(btnId: Int, dataBean: OrderDetails.DataBean, restaurantId: String, listener: (Int, Boolean) -> Unit) { fun updateOrderStatusByBtn(btnId: Int, dataBean: OrderDetails.DataBean, restaurantId: String, listener: (Int, Boolean) -> Unit) {
launch({ launch({
......
...@@ -59,6 +59,9 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -59,6 +59,9 @@ class OrderDetailsActivity : BaseActivity() {
orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式 orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式
pageViewModel = ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply { pageViewModel = ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply {
//設為已讀
updateIsRead(orderId)
//獲取訂單詳情
getOrderDetails(orderId, binding) getOrderDetails(orderId, binding)
} }
initTopBar(qm_order_details_bar) initTopBar(qm_order_details_bar)
......
...@@ -66,16 +66,28 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -66,16 +66,28 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
data.STATUS == 0 -> { data.STATUS == 0 -> {
state = "待確認" state = "待確認"
bg.setColor(getColor(R.color.order_state0_color)) bg.setColor(getColor(R.color.order_state0_color))
holder.flBorder.visibility = View.VISIBLE//顯示邊框
//執行動畫 //執行動畫
if (data.isRead == 0) {
holder.flBorder.visibility = View.VISIBLE//顯示邊框
alphaAnimator(holder.flBorder) alphaAnimator(holder.flBorder)
} else {
holder.flBorder.visibility = View.GONE
holder.flBorder.clearAnimation()
}
} }
data.STATUS == 1 -> { data.STATUS == 1 -> {
state = "待確認" state = "待確認"
bg.setColor(getColor(R.color.order_state0_color)) bg.setColor(getColor(R.color.order_state0_color))
holder.flBorder.visibility = View.VISIBLE//顯示邊框 holder.flBorder.visibility = View.VISIBLE//顯示邊框
//執行動畫 //執行動畫
if (data.isRead == 0) {
holder.flBorder.visibility = View.VISIBLE//顯示邊框
alphaAnimator(holder.flBorder) alphaAnimator(holder.flBorder)
} else {
holder.flBorder.visibility = View.GONE
holder.flBorder.clearAnimation()
}
} }
data.STATUS == 2 -> { data.STATUS == 2 -> {
state = "製作中" state = "製作中"
......
...@@ -17,18 +17,18 @@ import retrofit2.http.Query; ...@@ -17,18 +17,18 @@ import retrofit2.http.Query;
*/ */
public interface PrintInfoService { public interface PrintInfoService {
// @Headers({"Domain-Name: yc_location"}) // @Headers({"Domain-Name: yc_location"})
@POST("PrinterDevice/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("printerDevice/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addPrinter(@Body RequestBody requestBody); Observable<BaseResult> addPrinter(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"}) // @Headers({"Domain-Name: yc_location"})
@GET("PrinterDevice/list?" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("printerDevice/list?" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getPrinterList(@Query("restaurantId") int restaurantId); Observable<BaseResult> getPrinterList(@Query("restaurantId") int restaurantId);
@POST("PrinterDevice/deletes" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("printerDevice/deletes" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deletePrinterList(@Body RequestBody requestBody); Observable<BaseResult> deletePrinterList(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"}) // @Headers({"Domain-Name: yc_location"})
@POST("PrinterDevice/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("printerDevice/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updatePrinter(@Body RequestBody requestBody); Observable<BaseResult> updatePrinter(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"}) // @Headers({"Domain-Name: yc_location"})
......
...@@ -349,8 +349,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -349,8 +349,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
} else { } else {
deviceBean = new PrinterDeviceBean(); deviceBean = new PrinterDeviceBean();
} }
deviceBean.setPrinterName(mEdPrintName.getText().toString().trim()); deviceBean.setName(mEdPrintName.getText().toString().trim());
deviceBean.setId(0);
deviceBean.setRestaurantId(GsaCloudApplication.getRestaurantId(mContext)); deviceBean.setRestaurantId(GsaCloudApplication.getRestaurantId(mContext));
deviceBean.setIp(ipAddress.substring(0, ipAddress.lastIndexOf("."))); deviceBean.setIp(ipAddress.substring(0, ipAddress.lastIndexOf(".")));
...@@ -361,10 +360,10 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -361,10 +360,10 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
} }
//飛單打印機 //飛單打印機
if (oneFailPosition != -1) { if (oneFailPosition != -1) {
deviceBean.setPrinterDeviceId((long) devicess.get(oneFailPosition).getId()); deviceBean.setPrinterDeviceId(devicess.get(oneFailPosition).getId());
} }
if (twoFailPosition != -1) { if (twoFailPosition != -1) {
deviceBean.setDefaultPrinterDeviceId((long) devicess.get(twoFailPosition).getId()); deviceBean.setDefaultPrinterDeviceId(devicess.get(twoFailPosition).getId());
} }
//是否默認 //是否默認
deviceBean.setStatus(mSwitchDefalute.isChecked() ? 2 : 1); deviceBean.setStatus(mSwitchDefalute.isChecked() ? 2 : 1);
...@@ -386,8 +385,10 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -386,8 +385,10 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
if (isEditPrinter && printerDeviceBean != null) { if (isEditPrinter && printerDeviceBean != null) {
deviceBean.setId(printerDeviceBean.getId()); deviceBean.setId(printerDeviceBean.getId());
deviceBean.setRestaurantId(null); deviceBean.setRestaurantId(null);
deviceBean.setUid((long) GsaCloudApplication.getMemberId(mContext));
mPresenter.updatePrinterInfo(deviceBean); mPresenter.updatePrinterInfo(deviceBean);
} else { } else {
deviceBean.setUid(null);
mPresenter.addPrinter(deviceBean); mPresenter.addPrinter(deviceBean);
} }
} else if (v.getId() == R.id.print_test) { } else if (v.getId() == R.id.print_test) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment