Commit 6c4562f5 by 王宇航

三張報表數據

parent 3f8eda10
package com.gingersoft.gsa.cloud.main.mvp.contract; package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -19,11 +25,11 @@ import com.jess.arms.mvp.IModel; ...@@ -19,11 +25,11 @@ import com.jess.arms.mvp.IModel;
public interface PaymentMethodReportContract { public interface PaymentMethodReportContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadPaymentInfo(List<PaymentMethodBean.DataBean> data);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<PaymentMethodBean> getPaymentInfo(RequestBody requestBody);
} }
} }
package com.gingersoft.gsa.cloud.main.mvp.contract; package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -19,11 +25,11 @@ import com.jess.arms.mvp.IModel; ...@@ -19,11 +25,11 @@ import com.jess.arms.mvp.IModel;
public interface SalesContract { public interface SalesContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadInfo(List<SalesFoodsBean.DataBean> info);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<SalesFoodsBean> getSalesReportInfo(RequestBody requestBody);
} }
} }
...@@ -4,7 +4,7 @@ import android.app.Application; ...@@ -4,7 +4,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.BusinessReportContract; import com.gingersoft.gsa.cloud.main.mvp.contract.BusinessReportContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.HomeService; import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
...@@ -51,7 +51,7 @@ public class BusinessReportModel extends BaseModel implements BusinessReportCont ...@@ -51,7 +51,7 @@ public class BusinessReportModel extends BaseModel implements BusinessReportCont
@Override @Override
public Observable<HomeTurnoverBean> getRestaurantBusinessInfo(RequestBody requestBody) { public Observable<HomeTurnoverBean> getRestaurantBusinessInfo(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/"); RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/");
return mRepositoryManager.obtainRetrofitService(HomeService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getRestaurantReport(requestBody); .getRestaurantReport(requestBody);
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.HomeService; import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
...@@ -53,13 +53,13 @@ public class HomeModel extends BaseModel implements HomeContract.Model { ...@@ -53,13 +53,13 @@ public class HomeModel extends BaseModel implements HomeContract.Model {
@Override @Override
public Observable<HomeTurnoverBean> getRestaurantReport(RequestBody requestBody) { public Observable<HomeTurnoverBean> getRestaurantReport(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "https://m.ricepon.com/member-web/api/"); RetrofitUrlManager.getInstance().putDomain("common", "https://m.ricepon.com/member-web/api/");
return mRepositoryManager.obtainRetrofitService(HomeService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getRestaurantReport(requestBody); .getRestaurantReport(requestBody);
} }
@Override @Override
public Observable<String> getRestaurantFunList(String restaurantId) { public Observable<String> getRestaurantFunList(String restaurantId) {
return mRepositoryManager.obtainRetrofitService(HomeService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getRestaurantFunList(restaurantId); .getRestaurantFunList(restaurantId);
} }
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ import android.app.Application; ...@@ -5,7 +5,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.MainTopContract; import com.gingersoft.gsa.cloud.main.mvp.contract.MainTopContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.HomeService; import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
...@@ -52,14 +52,14 @@ public class MainTopModel extends BaseModel implements MainTopContract.Model { ...@@ -52,14 +52,14 @@ public class MainTopModel extends BaseModel implements MainTopContract.Model {
@Override @Override
public Observable<HomeTurnoverBean> getRestaurantReport(RequestBody requestBody) { public Observable<HomeTurnoverBean> getRestaurantReport(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/"); RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/");
return mRepositoryManager.obtainRetrofitService(HomeService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getRestaurantReport(requestBody); .getRestaurantReport(requestBody);
} }
@Override @Override
public Observable<MainOrderInfoChartBean> getOrderInfoChart(RequestBody requestBody) { public Observable<MainOrderInfoChartBean> getOrderInfoChart(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/"); RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/");
return mRepositoryManager.obtainRetrofitService(HomeService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getOrderInfoChart(requestBody); .getOrderInfoChart(requestBody);
} }
} }
\ No newline at end of file
...@@ -2,15 +2,19 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -2,15 +2,19 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.PaymentMethodReportContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.main.mvp.contract.PaymentMethodReportContract; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
/** /**
...@@ -43,4 +47,11 @@ public class PaymentMethodReportModel extends BaseModel implements PaymentMethod ...@@ -43,4 +47,11 @@ public class PaymentMethodReportModel extends BaseModel implements PaymentMethod
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<PaymentMethodBean> getPaymentInfo(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/");
return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getPaymentInfo(requestBody);
}
} }
\ No newline at end of file
...@@ -2,15 +2,19 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -2,15 +2,19 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
/** /**
...@@ -43,4 +47,11 @@ public class SalesModel extends BaseModel implements SalesContract.Model { ...@@ -43,4 +47,11 @@ public class SalesModel extends BaseModel implements SalesContract.Model {
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<SalesFoodsBean> getSalesReportInfo(RequestBody requestBody) {
RetrofitUrlManager.getInstance().putDomain("common", "http://a.ricepon.com:61177/member-web/api/");
return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getSalesReportInfo(requestBody);
}
} }
\ No newline at end of file
...@@ -46,9 +46,9 @@ public class HomeTurnoverBean { ...@@ -46,9 +46,9 @@ public class HomeTurnoverBean {
public static class DataBean { public static class DataBean {
/** /**
* Business_amount : 2734.00 營業總金額 * Business_amount : 2734.00 營業總金額
* Bill_decimal : 0.00 * Bill_decimal : 0.00 賬單小數
* discount : -23.00 折扣 * discount : -23.00 折扣
* TipsAmount : 0.00 * TipsAmount : 0.00 貼士
* CreditCardAmount : 0.00 * CreditCardAmount : 0.00
* people : 62.00 消費人數 營業總金額除以賬單數量=平均值 * people : 62.00 消費人數 營業總金額除以賬單數量=平均值
* sales : 2685.00 項目總金額 * sales : 2685.00 項目總金額
...@@ -64,19 +64,20 @@ public class HomeTurnoverBean { ...@@ -64,19 +64,20 @@ public class HomeTurnoverBean {
* servicecharge : 72.00 服務費 * servicecharge : 72.00 服務費
*/ */
private String Business_amount; //營業總金額 private String Business_amount; //營業總金額
private String Bill_decimal; private String Bill_decimal; //賬單小數
private String discount; private String discount; //折扣
private String TipsAmount; private String TipsAmount;//貼士
private String CreditCardAmount; private String CreditCardAmount;
private String people; //消費人數 private String people; //消費人數
private String sales; //項目總金額 private String sales; //項目總金額
private String number_bill; //賬單數量 private String number_bill; //賬單數量
private String billNum_skyOder; private String billNum_skyOder;//skyOrder 賬單數
private String billPrice_table; private String billPrice_table;//堂食總金額
private String billPrice_skyOder; private String billPrice_skyOder;//skyOrder總金額
private String billNum_table; private String billNum_table;//堂食賬單數
private String servicecharge; private String servicecharge;//服務費
private String billNum_Takeout; private String billNum_Takeout;//外賣賬單數
private String billPrice_Takeout;//外賣總金額
public String getBusiness_amount() { public String getBusiness_amount() {
return Business_amount; return Business_amount;
...@@ -189,5 +190,13 @@ public class HomeTurnoverBean { ...@@ -189,5 +190,13 @@ public class HomeTurnoverBean {
public void setBillNum_Takeout(String billNum_Takeout) { public void setBillNum_Takeout(String billNum_Takeout) {
this.billNum_Takeout = billNum_Takeout; this.billNum_Takeout = billNum_Takeout;
} }
public String getBillPrice_Takeout() {
return billPrice_Takeout;
}
public void setBillPrice_Takeout(String billPrice_Takeout) {
this.billPrice_Takeout = billPrice_Takeout;
}
} }
} }
package com.gingersoft.gsa.cloud.main.mvp.model.bean; package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.util.List;
/** /**
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/24.
* 支付方式 * 支付方式
*/ */
public class PaymentMethodBean { public class PaymentMethodBean {
private int color;
private String payMentName; /**
* success : true
* sysTime : 1582688262337
* data : [{"payName":"OpenRice支付","amount":0.5,"percentage":"0%"},{"payName":"信用卡","amount":3496.75,"percentage":"1.8%"},{"payName":"八達通","amount":169,"percentage":"0%"},{"payName":"員工福食","amount":13,"percentage":"0%"},{"payName":"微信HK","amount":1.1,"percentage":"0%"},{"payName":"支付寶","amount":0.1,"percentage":"0%"},{"payName":"支付寶HK","amount":0.2,"percentage":"0%"},{"payName":"現金","amount":187111.51,"percentage":"98%"},{"payName":"現金券","amount":0,"percentage":"0%"},{"payName":"簽單","amount":0,"percentage":"0%"}]
*/
private float percentage; private boolean success;
private long sysTime;
private List<DataBean> data;
private float amount; public boolean isSuccess() {
return success;
}
public PaymentMethodBean() { public void setSuccess(boolean success) {
this.success = success;
} }
public PaymentMethodBean(int color, String payMentName, float percentage, float amount) { public long getSysTime() {
this.color = color; return sysTime;
this.payMentName = payMentName; }
this.percentage = percentage;
this.amount = amount; public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public List<DataBean> getData() {
return data;
} }
public int getColor() { public void setData(List<DataBean> data) {
return color; this.data = data;
} }
public void setColor(int color) { public static class DataBean {
this.color = color; /**
* payName : OpenRice支付
* amount : 0.5
* percentage : 0%
*
*/
private String payName;
private double amount;
private String percentage;
private int num;
public String getPayName() {
return payName;
} }
public String getPayMentName() { public void setPayName(String payName) {
return payMentName; this.payName = payName;
} }
public void setPayMentName(String payMentName) { public double getAmount() {
this.payMentName = payMentName; return amount;
} }
public float getPercentage() { public void setAmount(double amount) {
this.amount = amount;
}
public String getPercentage() {
return percentage; return percentage;
} }
public void setPercentage(float percentage) { public void setPercentage(String percentage) {
this.percentage = percentage; this.percentage = percentage;
} }
public float getAmount() { public int getNum() {
return amount; return num;
} }
public void setAmount(float amount) { public void setNum(int num) {
this.amount = amount; this.num = num;
}
} }
} }
...@@ -3,44 +3,34 @@ package com.gingersoft.gsa.cloud.main.mvp.model.bean; ...@@ -3,44 +3,34 @@ package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.util.List; import java.util.List;
/** /**
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/26.
* 銷售報表-食品分析-食品排行榜數據對象 * 销售分析——食品top10
*/ */
public class SalesReportBean { public class SalesFoodsBean {
/** /**
* code : 1 * success : true
* errorMsg : 操作成功 * sysTime : 1582703198491
* data : [{"PercentageTotal":"24.4%","foodName":"冲绳黑糖奶盖茶冲绳黑糖奶盖茶","PercentageNum":"0.6%","averageTotal":3.38,"sumNum":77,"sumTotal":260},{"PercentageTotal":"14%","foodName":"柠檬红茶","PercentageNum":"0.2%","averageTotal":6,"sumNum":25,"sumTotal":150},{"PercentageTotal":"9.2%","foodName":"[午]海南雞飯","PercentageNum":"0%","averageTotal":49,"sumNum":2,"sumTotal":98},{"PercentageTotal":"6.3%","foodName":"米紙脆春卷","PercentageNum":"0%","averageTotal":68,"sumNum":1,"sumTotal":68},{"PercentageTotal":"9.2%","foodName":"粒粒有戏火鸡比萨","PercentageNum":"0%","averageTotal":98,"sumNum":1,"sumTotal":98},{"PercentageTotal":"6.3%","foodName":"胡椒雞翼","PercentageNum":"0%","averageTotal":68,"sumNum":1,"sumTotal":68},{"PercentageTotal":"7.3%","foodName":"蠔煎(大)","PercentageNum":"0%","averageTotal":78,"sumNum":1,"sumTotal":78},{"PercentageTotal":"6.3%","foodName":"蠔煎(小)","PercentageNum":"0%","averageTotal":68,"sumNum":1,"sumTotal":68},{"PercentageTotal":"10.1%","foodName":"[午]咖喱海鮮叻沙","PercentageNum":"0%","averageTotal":108,"sumNum":1,"sumTotal":108},{"PercentageTotal":"6.3%","foodName":"香茅煎豬頸肉","PercentageNum":"0%","averageTotal":68,"sumNum":1,"sumTotal":68}] * data : [{"sumTotal":596990.68,"sumNum":11629,"foodName":"冲绳黑糖奶盖茶","averageTotal":51.34,"percentageTotal":"100%","percentageNum":"100%"}]
* page : null
*/ */
private String code; private boolean success;
private String errorMsg; private long sysTime;
private Object page;
private List<DataBean> data; private List<DataBean> data;
public String getCode() { public boolean isSuccess() {
return code; return success;
} }
public void setCode(String code) { public void setSuccess(boolean success) {
this.code = code; this.success = success;
} }
public String getErrorMsg() { public long getSysTime() {
return errorMsg; return sysTime;
} }
public void setErrorMsg(String errorMsg) { public void setSysTime(long sysTime) {
this.errorMsg = errorMsg; this.sysTime = sysTime;
}
public Object getPage() {
return page;
}
public void setPage(Object page) {
this.page = page;
} }
public List<DataBean> getData() { public List<DataBean> getData() {
...@@ -53,39 +43,35 @@ public class SalesReportBean { ...@@ -53,39 +43,35 @@ public class SalesReportBean {
public static class DataBean { public static class DataBean {
/** /**
* PercentageTotal : 24.4% * sumTotal : 596990.68
* foodName : 冲绳黑糖奶盖茶冲绳黑糖奶盖茶 * sumNum : 11629
* PercentageNum : 0.6% * foodName : 冲绳黑糖奶盖茶
* averageTotal : 3.38 * averageTotal : 51.34
* sumNum : 77 * percentageTotal : 100%
* sumTotal : 260 * percentageNum : 100%
*/ */
private String PercentageTotal; private double sumTotal;
private int sumNum;
private String foodName; private String foodName;
private String PercentageNum;
private double averageTotal; private double averageTotal;
private int sumNum; private String percentageTotal;
private int sumTotal; private String percentageNum;
public DataBean() { public double getSumTotal() {
return sumTotal;
} }
public DataBean(String percentageTotal, String foodName, String percentageNum, double averageTotal, int sumNum, int sumTotal) { public void setSumTotal(double sumTotal) {
PercentageTotal = percentageTotal;
this.foodName = foodName;
PercentageNum = percentageNum;
this.averageTotal = averageTotal;
this.sumNum = sumNum;
this.sumTotal = sumTotal; this.sumTotal = sumTotal;
} }
public String getPercentageTotal() { public int getSumNum() {
return PercentageTotal; return sumNum;
} }
public void setPercentageTotal(String PercentageTotal) { public void setSumNum(int sumNum) {
this.PercentageTotal = PercentageTotal; this.sumNum = sumNum;
} }
public String getFoodName() { public String getFoodName() {
...@@ -96,14 +82,6 @@ public class SalesReportBean { ...@@ -96,14 +82,6 @@ public class SalesReportBean {
this.foodName = foodName; this.foodName = foodName;
} }
public String getPercentageNum() {
return PercentageNum;
}
public void setPercentageNum(String PercentageNum) {
this.PercentageNum = PercentageNum;
}
public double getAverageTotal() { public double getAverageTotal() {
return averageTotal; return averageTotal;
} }
...@@ -112,21 +90,20 @@ public class SalesReportBean { ...@@ -112,21 +90,20 @@ public class SalesReportBean {
this.averageTotal = averageTotal; this.averageTotal = averageTotal;
} }
public int getSumNum() { public String getPercentageTotal() {
return sumNum; return percentageTotal;
} }
public void setSumNum(int sumNum) { public void setPercentageTotal(String percentageTotal) {
this.sumNum = sumNum; this.percentageTotal = percentageTotal;
} }
public int getSumTotal() { public String getPercentageNum() {
return sumTotal; return percentageNum;
} }
public void setSumTotal(int sumTotal) { public void setPercentageNum(String percentageNum) {
this.sumTotal = sumTotal; this.percentageNum = percentageNum;
} }
} }
} }
...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model.service; ...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model.service;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import io.reactivex.Observable; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
...@@ -13,17 +15,22 @@ import retrofit2.http.Query; ...@@ -13,17 +15,22 @@ import retrofit2.http.Query;
/** /**
* Created by Wyh on 2020/1/10. * Created by Wyh on 2020/1/10.
* 首頁和報表
*/ */
public interface HomeService { public interface MainReportService {
// @GET("wx/findTransactionSummaryChartLine" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) //支付分析報表
@POST("wx/findPayMode" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PaymentMethodBean> getPaymentInfo(@Body RequestBody requestBody);
//銷售分析報表
@POST("wx/findFoodTop" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<SalesFoodsBean> getSalesReportInfo(@Body RequestBody requestBody);
//營業信息
@POST("wx/doBusiness" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("wx/doBusiness" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<HomeTurnoverBean> getRestaurantReport(@Body RequestBody requestBody); Observable<HomeTurnoverBean> getRestaurantReport(@Body RequestBody requestBody);
//
@POST("wx/findOrderInfoChart" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("wx/findOrderInfoChart" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<MainOrderInfoChartBean> getOrderInfoChart(@Body RequestBody requestBody); Observable<MainOrderInfoChartBean> getOrderInfoChart(@Body RequestBody requestBody);
//獲取首頁功能列表
@GET("user/resource/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("user/resource/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<String> getRestaurantFunList(@Query("restaurantId") String restaurantId); Observable<String> getRestaurantFunList(@Query("restaurantId") String restaurantId);
} }
...@@ -107,7 +107,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -107,7 +107,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
}); });
} }
private String[] itemNames = new String[]{"項目銷售總金額", "折扣", "服務費", "賬單數", "簽單", "營業金額淨值", "貼士", "堂食總數", "外賣總數", "單數", "平均每單", "人數", "平均每人"}; private String[] itemNames = new String[]{"項目銷售總金額", "折扣", "服務費", "賬單數", "簽單", "營業金額淨值", "貼士", "堂食總數", "外賣總數", "單數", "平均每單", "人數", "平均每人"};
private void loadAdapterInfo(Map<String, HomeTurnoverBean.DataBean> data) { private void loadAdapterInfo(Map<String, HomeTurnoverBean.DataBean> data) {
HomeTurnoverBean.DataBean dataBean = data.get(TimeUtils.getOldDate(0)); HomeTurnoverBean.DataBean dataBean = data.get(TimeUtils.getOldDate(0));
...@@ -117,13 +117,13 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -117,13 +117,13 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
businessBeans.add(new BusinessBean(itemNames[0], dataBean.getBusiness_amount())); businessBeans.add(new BusinessBean(itemNames[0], dataBean.getBusiness_amount()));
businessBeans.add(new BusinessBean(itemNames[1], dataBean.getDiscount())); businessBeans.add(new BusinessBean(itemNames[1], dataBean.getDiscount()));
businessBeans.add(new BusinessBean(itemNames[2], dataBean.getServicecharge())); businessBeans.add(new BusinessBean(itemNames[2], dataBean.getServicecharge()));
businessBeans.add(new BusinessBean(itemNames[3], dataBean.getNumber_bill())); businessBeans.add(new BusinessBean(itemNames[3], dataBean.getBill_decimal()));
businessBeans.add(new BusinessBean(itemNames[4], "簽單")); businessBeans.add(new BusinessBean(itemNames[4], "簽單"));
businessBeans.add(new BusinessBean(itemNames[5], "營業金額淨值")); businessBeans.add(new BusinessBean(itemNames[5], "營業金額淨值"));
businessBeans.add(new BusinessBean(itemNames[6], "貼士")); businessBeans.add(new BusinessBean(itemNames[6], dataBean.getTipsAmount()));
businessBeans.add(new BusinessBean(itemNames[7], dataBean.getBillNum_table())); businessBeans.add(new BusinessBean(itemNames[7], dataBean.getBillNum_table()));
businessBeans.add(new BusinessBean(itemNames[8], dataBean.getBillNum_Takeout())); businessBeans.add(new BusinessBean(itemNames[8], dataBean.getBillNum_Takeout()));
businessBeans.add(new BusinessBean(itemNames[9], "單數")); businessBeans.add(new BusinessBean(itemNames[9], dataBean.getNumber_bill()));
float averageBill = Float.parseFloat(dataBean.getBusiness_amount()) / Float.parseFloat(dataBean.getNumber_bill()); float averageBill = Float.parseFloat(dataBean.getBusiness_amount()) / Float.parseFloat(dataBean.getNumber_bill());
businessBeans.add(new BusinessBean(itemNames[10], averageBill + ""));//"平均每單" businessBeans.add(new BusinessBean(itemNames[10], averageBill + ""));//"平均每單"
businessBeans.add(new BusinessBean(itemNames[11], dataBean.getPeople()));//人數 businessBeans.add(new BusinessBean(itemNames[11], dataBean.getPeople()));//人數
......
...@@ -122,7 +122,6 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac ...@@ -122,7 +122,6 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac
.subscribe(new ErrorHandleSubscriber<String>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<String>(mErrorHandler) {
@Override @Override
public void onNext(@NonNull String info) { public void onNext(@NonNull String info) {
Log.e("aaa", "功能列表" + info);
} }
}); });
} }
......
...@@ -2,15 +2,26 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter; ...@@ -2,15 +2,26 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.utils.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.mvp.contract.PaymentMethodReportContract; import com.gingersoft.gsa.cloud.main.mvp.contract.PaymentMethodReportContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.RequestBody;
/** /**
...@@ -49,4 +60,46 @@ public class PaymentMethodReportPresenter extends BasePresenter<PaymentMethodRep ...@@ -49,4 +60,46 @@ public class PaymentMethodReportPresenter extends BasePresenter<PaymentMethodRep
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void getPaymentInfo() {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", "26")
.add("startTime", TimeUtils.getYear(-1))//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", TimeUtils.getYear(0))//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.build();
mModel.getPaymentInfo(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<PaymentMethodBean>(mErrorHandler) {
@Override
public void onNext(@NonNull PaymentMethodBean info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
mRootView.loadPaymentInfo(info.getData());
}
} else {
mRootView.showMessage("支付方式信息獲取失敗");
}
}
@Override
public void onComplete() {
super.onComplete();
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
@Override
public void onError(Throwable t) {
super.onError(t);
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
});
}
} }
...@@ -2,15 +2,26 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter; ...@@ -2,15 +2,26 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.utils.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract; import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.RequestBody;
/** /**
...@@ -49,4 +60,44 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont ...@@ -49,4 +60,44 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void getSalesReportInfo() {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", "26")
.add("startTime", TimeUtils.getYear(-1))//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", TimeUtils.getYear(0))//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.build();
mModel.getSalesReportInfo(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SalesFoodsBean>(mErrorHandler) {
@Override
public void onNext(@NonNull SalesFoodsBean info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
mRootView.loadInfo(info.getData());
}
} else {
mRootView.showMessage("銷售信息獲取失敗");
}
}
@Override
public void onComplete() {
super.onComplete();
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
@Override
public void onError(Throwable t) {
super.onError(t);
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
});
}
} }
...@@ -20,7 +20,8 @@ public class BusinessInfoAdapter extends BaseQuickAdapter<BusinessBean, BaseView ...@@ -20,7 +20,8 @@ public class BusinessInfoAdapter extends BaseQuickAdapter<BusinessBean, BaseView
@Override @Override
protected void convert(BaseViewHolder helper, BusinessBean item) { protected void convert(BaseViewHolder helper, BusinessBean item) {
helper.setText(R.id.tv_business_info_amount, item.getAmount() + "");
helper.setText(R.id.tv_business_info_name, item.getProjectName());
} }
} }
...@@ -5,7 +5,7 @@ import android.content.Context; ...@@ -5,7 +5,7 @@ import android.content.Context;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesReportBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import java.util.List; import java.util.List;
...@@ -14,17 +14,17 @@ import androidx.annotation.Nullable; ...@@ -14,17 +14,17 @@ import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/24.
*/ */
public class FoodRankingAdapter extends BaseQuickAdapter<SalesReportBean.DataBean, BaseViewHolder> { public class FoodRankingAdapter extends BaseQuickAdapter<SalesFoodsBean.DataBean, BaseViewHolder> {
private Context mContext; private Context mContext;
public FoodRankingAdapter(Context mContext, @Nullable List<SalesReportBean.DataBean> data) { public FoodRankingAdapter(Context mContext, @Nullable List<SalesFoodsBean.DataBean> data) {
super(R.layout.item_food_ranking, data); super(R.layout.item_food_ranking, data);
this.mContext = mContext; this.mContext = mContext;
} }
@Override @Override
protected void convert(BaseViewHolder helper, SalesReportBean.DataBean item) { protected void convert(BaseViewHolder helper, SalesFoodsBean.DataBean item) {
if (helper.getAdapterPosition() == 0) { if (helper.getAdapterPosition() == 0) {
helper.setTextColor(R.id.tv_ranking_foodname, mContext.getResources().getColor(R.color.theme_hint_color)); helper.setTextColor(R.id.tv_ranking_foodname, mContext.getResources().getColor(R.color.theme_hint_color));
helper.setTextColor(R.id.tv_ranking_food_sales_num, mContext.getResources().getColor(R.color.theme_hint_color)); helper.setTextColor(R.id.tv_ranking_food_sales_num, mContext.getResources().getColor(R.color.theme_hint_color));
...@@ -33,10 +33,10 @@ public class FoodRankingAdapter extends BaseQuickAdapter<SalesReportBean.DataBea ...@@ -33,10 +33,10 @@ public class FoodRankingAdapter extends BaseQuickAdapter<SalesReportBean.DataBea
helper.setTextColor(R.id.tv_ranking_proportion_quantity, mContext.getResources().getColor(R.color.theme_hint_color)); helper.setTextColor(R.id.tv_ranking_proportion_quantity, mContext.getResources().getColor(R.color.theme_hint_color));
helper.setTextColor(R.id.tv_ranking_ratio_amount, mContext.getResources().getColor(R.color.theme_hint_color)); helper.setTextColor(R.id.tv_ranking_ratio_amount, mContext.getResources().getColor(R.color.theme_hint_color));
helper.setText(R.id.tv_ranking_food_unit_price, "食品名稱"); helper.setText(R.id.tv_ranking_foodname, "食品名稱");
helper.setText(R.id.tv_ranking_foodname, "銷售數量"); helper.setText(R.id.tv_ranking_food_sales_num, "銷售數量");
helper.setText(R.id.tv_ranking_food_sales_num, "銷售金額"); helper.setText(R.id.tv_ranking_food_sales_amount, "銷售金額");
helper.setText(R.id.tv_ranking_food_sales_amount, "單價"); helper.setText(R.id.tv_ranking_food_unit_price, "單價");
helper.setText(R.id.tv_ranking_proportion_quantity, "數量佔比"); helper.setText(R.id.tv_ranking_proportion_quantity, "數量佔比");
helper.setText(R.id.tv_ranking_ratio_amount, "金額佔比"); helper.setText(R.id.tv_ranking_ratio_amount, "金額佔比");
} else { } else {
......
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter; package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import android.content.Context;
import android.os.Build;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.gingersoft.gsa.cloud.main.mvp.ui.view.MyProgressBar;
import java.util.List; import java.util.List;
...@@ -12,13 +16,33 @@ import androidx.annotation.Nullable; ...@@ -12,13 +16,33 @@ import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/24.
*/ */
public class PaymentMethodAdapter extends BaseQuickAdapter<PaymentMethodBean, BaseViewHolder> { public class PaymentMethodAdapter extends BaseQuickAdapter<PaymentMethodBean.DataBean, BaseViewHolder> {
public PaymentMethodAdapter(@Nullable List<PaymentMethodBean> data) {
private int[] colors = new int[]{R.color.payment_method_color1,
R.color.payment_method_color2, R.color.payment_method_color3,
R.color.payment_method_color4, R.color.payment_method_color5,
R.color.payment_method_color6, R.color.payment_method_color7,
R.color.payment_method_color8};
private Context context;
public PaymentMethodAdapter(Context context, @Nullable List<PaymentMethodBean.DataBean> data) {
super(R.layout.item_payment_method, data); super(R.layout.item_payment_method, data);
this.context = context;
} }
@Override @Override
protected void convert(BaseViewHolder helper, PaymentMethodBean item) { protected void convert(BaseViewHolder helper, PaymentMethodBean.DataBean item) {
helper.setText(R.id.tv_payment_method_name, item.getPayName());
MyProgressBar progressBar = helper.getView(R.id.pb_payment_percentage);
float progress = Float.parseFloat(item.getPercentage().replace("%", ""));
progressBar.setMax(100);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
progressBar.setProgress((int) progress, true);
} else {
progressBar.setProgress((int) progress);
}
progressBar.setmReachedColor(context.getResources().getColor(colors[helper.getAdapterPosition() % colors.length]));
helper.setText(R.id.tv_payment_num, "數量:" + item.getNum());
helper.setText(R.id.tv_payment_amount, "$" + item.getAmount());
} }
} }
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter; package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
...@@ -12,17 +15,25 @@ import androidx.annotation.Nullable; ...@@ -12,17 +15,25 @@ import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/24.
*/ */
public class PaymentMethodColorAdapter extends BaseQuickAdapter<PaymentMethodBean, BaseViewHolder> { public class PaymentMethodColorAdapter extends BaseQuickAdapter<PaymentMethodBean.DataBean, BaseViewHolder> {
private int[] colors = new int[]{R.color.payment_method_color1,
public PaymentMethodColorAdapter(@Nullable List<PaymentMethodBean> data) { R.color.payment_method_color2, R.color.payment_method_color3,
R.color.payment_method_color4, R.color.payment_method_color5,
R.color.payment_method_color6, R.color.payment_method_color7,
R.color.payment_method_color8};
private Context context;
public PaymentMethodColorAdapter(Context context, @Nullable List<PaymentMethodBean.DataBean> data) {
super(R.layout.item_payment_color, data); super(R.layout.item_payment_color, data);
this.context = context;
} }
@Override @Override
protected void convert(BaseViewHolder helper, PaymentMethodBean item) { protected void convert(BaseViewHolder helper, PaymentMethodBean.DataBean item) {
// helper.setBackgroundColor(R.id.circle_color, item.getColor()); GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.OVAL);
helper.setText(R.id.tv_payment_method, item.getPayMentName()); drawable.setColor(context.getResources().getColor(colors[helper.getAdapterPosition() % colors.length]));
helper.getView(R.id.circle_color).setBackground(drawable);
helper.setText(R.id.tv_payment_method, item.getPayName());
} }
} }
...@@ -6,6 +6,7 @@ import android.view.View; ...@@ -6,6 +6,7 @@ import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import java.util.List; import java.util.List;
...@@ -15,16 +16,16 @@ import androidx.annotation.Nullable; ...@@ -15,16 +16,16 @@ import androidx.annotation.Nullable;
* Created by Wyh on 2020/2/24. * Created by Wyh on 2020/2/24.
* 排序編號adapter * 排序編號adapter
*/ */
public class SortNumberingAdapter extends BaseQuickAdapter<String, BaseViewHolder> { public class SortNumberingAdapter extends BaseQuickAdapter<SalesFoodsBean.DataBean, BaseViewHolder> {
private Context mContext; private Context mContext;
public SortNumberingAdapter(Context mContext, @Nullable List<String> data) { public SortNumberingAdapter(Context mContext, @Nullable List<SalesFoodsBean.DataBean> data) {
super(R.layout.item_ranking_numbering, data); super(R.layout.item_ranking_numbering, data);
this.mContext = mContext; this.mContext = mContext;
} }
@Override @Override
protected void convert(BaseViewHolder helper, String item) { protected void convert(BaseViewHolder helper, SalesFoodsBean.DataBean item) {
helper.getView(R.id.iv_ranking_numbering).setVisibility(View.GONE); helper.getView(R.id.iv_ranking_numbering).setVisibility(View.GONE);
if (helper.getAdapterPosition() == 0) { if (helper.getAdapterPosition() == 0) {
helper.setText(R.id.tv_ranking_numbering, "排序"); helper.setText(R.id.tv_ranking_numbering, "排序");
......
package com.gingersoft.gsa.cloud.main.mvp.ui.fragment; package com.gingersoft.gsa.cloud.main.mvp.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.R2; import com.gingersoft.gsa.cloud.main.R2;
...@@ -16,6 +19,15 @@ import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean; ...@@ -16,6 +19,15 @@ import com.gingersoft.gsa.cloud.main.mvp.model.bean.PaymentMethodBean;
import com.gingersoft.gsa.cloud.main.mvp.presenter.PaymentMethodReportPresenter; import com.gingersoft.gsa.cloud.main.mvp.presenter.PaymentMethodReportPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.PaymentMethodAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.PaymentMethodAdapter;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.PaymentMethodColorAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.PaymentMethodColorAdapter;
import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.MPPointF;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
...@@ -29,6 +41,7 @@ import androidx.fragment.app.Fragment; ...@@ -29,6 +41,7 @@ import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -46,12 +59,18 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -46,12 +59,18 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* ================================================ * ================================================
* 支付方式分析報表 * 支付方式分析報表
*/ */
public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodReportPresenter> implements PaymentMethodReportContract.View { public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodReportPresenter> implements PaymentMethodReportContract.View, View.OnClickListener {
@BindView(R2.id.rv_payment_color) @BindView(R2.id.rv_payment_color)
RecyclerView rvPaymentColor; RecyclerView rvPaymentColor;
@BindView(R2.id.rv_payment_proportion) @BindView(R2.id.rv_payment_proportion)
RecyclerView rvPaymentProportion; RecyclerView rvPaymentProportion;
@BindView(R2.id.report_payment_method_chart)
PieChart chart;
@BindView(R2.id.tv_start_time)
TextView mTvStartTime;
@BindView(R2.id.tv_end_time)
TextView mTvEndTime;
public static PaymentMethodReportFragment newInstance() { public static PaymentMethodReportFragment newInstance() {
PaymentMethodReportFragment fragment = new PaymentMethodReportFragment(); PaymentMethodReportFragment fragment = new PaymentMethodReportFragment();
...@@ -75,25 +94,10 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor ...@@ -75,25 +94,10 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
List<PaymentMethodBean> paymentMethodBeans = new ArrayList<>(); mPresenter.getPaymentInfo();
for (int i = 0; i < 8; i++) {
paymentMethodBeans.add(new PaymentMethodBean(R.color.theme_color, "支付寶", 25.3f, 3000f));
}
rvPaymentColor.setLayoutManager(new GridLayoutManager(mContext, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
});
rvPaymentColor.setAdapter(new PaymentMethodColorAdapter(paymentMethodBeans));
rvPaymentProportion.setLayoutManager(new GridLayoutManager(mContext, 4) { mTvStartTime.setText(TimeUtils.getOldDate(-6));
@Override mTvEndTime.setText(TimeUtils.getOldDate(0));
public boolean canScrollVertically() {
return false;
}
});
rvPaymentProportion.setAdapter(new PaymentMethodAdapter(paymentMethodBeans));
} }
/** /**
...@@ -164,4 +168,135 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor ...@@ -164,4 +168,135 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
public void killMyself() { public void killMyself() {
} }
@Override
public void loadPaymentInfo(List<PaymentMethodBean.DataBean> data) {
rvPaymentColor.setLayoutManager(new GridLayoutManager(mContext, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
});
rvPaymentColor.setAdapter(new PaymentMethodColorAdapter(mContext, data));
rvPaymentProportion.setLayoutManager(new GridLayoutManager(mContext, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
});
rvPaymentProportion.setAdapter(new PaymentMethodAdapter(mContext, data));
initChart();
setData(data);
}
private void initChart() {
//不顯示右側底部小字
chart.setUsePercentValues(true);
chart.getDescription().setEnabled(false);
chart.setExtraOffsets(0, 0, 0, 0);
chart.setDragDecelerationFrictionCoef(0.95f);
chart.setDrawHoleEnabled(true);
chart.setHoleColor(Color.WHITE);
chart.setTransparentCircleColor(Color.WHITE);
chart.setTransparentCircleAlpha(110);
chart.setHoleRadius(28f);
chart.setTransparentCircleRadius(0f);
chart.setDrawCenterText(false);
chart.setRotationAngle(0);
// enable rotation of the chart by touch
chart.setRotationEnabled(true);
chart.setHighlightPerTapEnabled(true);
// chart.setUnit(" €");
// chart.setDrawUnitsInChart(true);
// add a selection listener
// chart.setOnChartValueSelectedListener(this);
chart.animateY(1400, Easing.EaseInOutQuad);
// chart.spin(2000, 0, 360);
Legend l = chart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(false);
l.setEnabled(false);
// entry label styling
chart.setEntryLabelColor(mContext.getResources().getColor(R.color.theme_color));
chart.setEntryLabelTextSize(12f);
}
private void setData(List<PaymentMethodBean.DataBean> dataBeans) {
ArrayList<PieEntry> entries = new ArrayList<>();
// NOTE: The order of the entries when being added to the entries array determines their position around the center of
// the chart.
for (int i = 0; i < dataBeans.size(); i++) {
float percentage = Float.parseFloat(dataBeans.get(i).getPercentage().replace("%", ""));
if (percentage > 0) {//比例大於0才添加
entries.add(new PieEntry(percentage,
dataBeans.get(i).getPayName()));
}
}
PieDataSet dataSet = new PieDataSet(entries, "Election Results");
dataSet.setDrawIcons(false);
dataSet.setSliceSpace(3f);
dataSet.setIconsOffset(new MPPointF(0, 40));
dataSet.setSelectionShift(5f);
// add a lot of colors
ArrayList<Integer> colors = new ArrayList<>();
for (int c : ColorTemplate.VORDIPLOM_COLORS)
colors.add(c);
for (int c : ColorTemplate.JOYFUL_COLORS)
colors.add(c);
for (int c : ColorTemplate.COLORFUL_COLORS)
colors.add(c);
for (int c : ColorTemplate.LIBERTY_COLORS)
colors.add(c);
for (int c : ColorTemplate.PASTEL_COLORS)
colors.add(c);
colors.add(ColorTemplate.getHoloBlue());
dataSet.setColors(colors);
//dataSet.setSelectionShift(0f);
PieData data = new PieData(dataSet);
data.setValueFormatter(new PercentFormatter(chart));
data.setValueTextSize(12f);
data.setValueTextColor(mContext.getResources().getColor(R.color.theme_color));
chart.setData(data);
// undo all highlights
chart.highlightValues(null);
chart.invalidate();
}
@OnClick({R2.id.tv_start_time})
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time) {
//打開時間選擇器
}
}
} }
...@@ -273,6 +273,15 @@ public class MyProgressBar extends ProgressBar { ...@@ -273,6 +273,15 @@ public class MyProgressBar extends ProgressBar {
canvas.restore(); canvas.restore();
} }
public int getmReachedColor() {
return mReachedColor;
}
public void setmReachedColor(int mReachedColor) {
this.mReachedColor = mReachedColor;
this.invalidate();
}
private void calculateTextWidthAndHeight() { private void calculateTextWidthAndHeight() {
//fix by Michael 修改参数溢出问题。 //fix by Michael 修改参数溢出问题。
//mText = String.format("%d", getProgress() * 100 / getMax()) + "%"; //mText = String.format("%d", getProgress() * 100 / getMax()) + "%";
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2020-02-14"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
<TextView <TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7" android:layout_marginLeft="@dimen/dp_7"
...@@ -109,25 +110,28 @@ ...@@ -109,25 +110,28 @@
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_restaurant_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:text="餐廳名稱" android:text="餐廳名稱"
android:textColor="#3c3c3c" android:textColor="#3c3c3c"
android:textSize="@dimen/dp_16" /> android:textSize="@dimen/dp_16" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_business_details" android:id="@+id/rv_business_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent" />
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file \ No newline at end of file
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2020-02-14"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
...@@ -62,10 +62,10 @@ ...@@ -62,10 +62,10 @@
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
<TextView <TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7" android:layout_marginLeft="@dimen/dp_7"
android:text="2020-02-20"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<com.github.mikephil.charting.charts.PieChart <com.github.mikephil.charting.charts.PieChart
android:id="@+id/report_payment_method_chart" android:id="@+id/report_payment_method_chart"
android:layout_width="@dimen/dp_170" android:layout_width="match_parent"
android:layout_height="@dimen/dp_170" android:layout_height="@dimen/dp_170"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:visibility="visible" android:visibility="visible"
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
android:maxLines="1" android:maxLines="1"
android:text="--------------------------------------------------------------------------------------------------" android:text="--------------------------------------------------------------------------------------------------"
android:textColor="#FF3F4E" android:textColor="#FF3F4E"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/report_payment_method_chart" app:layout_constraintBottom_toBottomOf="@id/report_payment_method_chart"
app:layout_constraintLeft_toRightOf="@id/report_payment_method_chart" app:layout_constraintLeft_toRightOf="@id/report_payment_method_chart"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
android:text="支付方式1" android:text="支付方式1"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_13"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@id/tv_chart_line" app:layout_constraintLeft_toLeftOf="@id/tv_chart_line"
app:layout_constraintRight_toRightOf="@id/tv_chart_line" app:layout_constraintRight_toRightOf="@id/tv_chart_line"
app:layout_constraintTop_toBottomOf="@id/tv_chart_line" /> app:layout_constraintTop_toBottomOf="@id/tv_chart_line" />
...@@ -114,6 +116,7 @@ ...@@ -114,6 +116,7 @@
android:text="$10000" android:text="$10000"
android:textColor="#ff3f4e" android:textColor="#ff3f4e"
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@id/tv_chart_line" app:layout_constraintLeft_toLeftOf="@id/tv_chart_line"
app:layout_constraintRight_toRightOf="@id/tv_chart_line" app:layout_constraintRight_toRightOf="@id/tv_chart_line"
app:layout_constraintTop_toBottomOf="@id/tv_payment_method" /> app:layout_constraintTop_toBottomOf="@id/tv_payment_method" />
...@@ -129,6 +132,7 @@ ...@@ -129,6 +132,7 @@
android:text="30%" android:text="30%"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_13"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@id/tv_chart_line" app:layout_constraintLeft_toLeftOf="@id/tv_chart_line"
app:layout_constraintRight_toRightOf="@id/tv_chart_line" app:layout_constraintRight_toRightOf="@id/tv_chart_line"
app:layout_constraintTop_toBottomOf="@id/tv_amount" /> app:layout_constraintTop_toBottomOf="@id/tv_amount" />
...@@ -137,7 +141,9 @@ ...@@ -137,7 +141,9 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_payment_color" android:id="@+id/rv_payment_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10" />
</LinearLayout> </LinearLayout>
...@@ -155,10 +161,10 @@ ...@@ -155,10 +161,10 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_payment_proportion" android:id="@+id/rv_payment_proportion"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_19" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_18" android:layout_marginTop="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_19" /> android:layout_marginRight="@dimen/dp_15" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2020-02-14"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
<TextView <TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7" android:layout_marginLeft="@dimen/dp_7"
android:text="2020-02-20"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center_vertical|left"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingLeft="@dimen/dp_5"
android:paddingBottom="@dimen/dp_10">
<View <View
android:id="@+id/circle_color" android:id="@+id/circle_color"
android:layout_width="@dimen/dp_9" android:layout_width="@dimen/dp_9"
android:layout_height="@dimen/dp_9" android:layout_height="@dimen/dp_9" />
/>
<TextView <TextView
android:id="@+id/tv_payment_method" android:id="@+id/tv_payment_method"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4" android:layout_marginLeft="@dimen/dp_4"
android:singleLine="true"
android:text="支付方式1" android:text="支付方式1"
android:textColor="#3d455e" android:textColor="#3d455e"
android:textSize="@dimen/sp_13" /> android:textSize="@dimen/sp_13" />
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_5"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:gravity="center" android:gravity="center"
...@@ -24,11 +25,11 @@ ...@@ -24,11 +25,11 @@
android:textSize="@dimen/sp_13" /> android:textSize="@dimen/sp_13" />
<com.gingersoft.gsa.cloud.main.mvp.ui.view.MyProgressBar <com.gingersoft.gsa.cloud.main.mvp.ui.view.MyProgressBar
android:id="@+id/pb_payment_percentage"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="@dimen/dp_50" android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50" android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:progress="50"
android:scrollbarStyle="insideOverlay" android:scrollbarStyle="insideOverlay"
app:bga_pb_isCapRounded="true" app:bga_pb_isCapRounded="true"
app:bga_pb_mode="circle" app:bga_pb_mode="circle"
...@@ -40,6 +41,16 @@ ...@@ -40,6 +41,16 @@
app:bga_pb_unReachedHeight="@dimen/dp_4" /> app:bga_pb_unReachedHeight="@dimen/dp_4" />
<TextView <TextView
android:id="@+id/tv_payment_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:singleLine="true"
android:text="數量:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_13" />
<TextView
android:id="@+id/tv_payment_amount" android:id="@+id/tv_payment_amount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -9,30 +9,29 @@ ...@@ -9,30 +9,29 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical">
android:paddingBottom="@dimen/dp_20">
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<TextView <TextView
android:id="@+id/tv_business_info_amount" android:id="@+id/tv_business_info_amount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:text="10000.0"
android:textColor="@color/theme_color" android:textColor="@color/theme_color"
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_business_info_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="項目銷售總金額" android:layout_weight="1"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:layout_marginBottom="@dimen/dp_20"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> <include layout="@layout/include_horizontal_color_ccc_dividing_line" />
</LinearLayout>
<include layout="@layout/include_vertical_color_ccc_dividing_line" /> <include layout="@layout/include_vertical_color_ccc_dividing_line" />
......
...@@ -8,4 +8,13 @@ ...@@ -8,4 +8,13 @@
<color name="report_left_scale">#018EF2</color> <color name="report_left_scale">#018EF2</color>
<!-- 報表“昨日”線條顏色--> <!-- 報表“昨日”線條顏色-->
<color name="today_line">#FFCC8F</color> <color name="today_line">#FFCC8F</color>
<color name="payment_method_color1">#FF3F4E</color>
<color name="payment_method_color2">#8FC31F</color>
<color name="payment_method_color3">#F19EC2</color>
<color name="payment_method_color4">#EB6100</color>
<color name="payment_method_color5">#AA89BD</color>
<color name="payment_method_color6">#00A0E9</color>
<color name="payment_method_color7">#EFE75E</color>
<color name="payment_method_color8">#5358F1</color>
</resources> </resources>
...@@ -99,7 +99,6 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt ...@@ -99,7 +99,6 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt
@Override @Override
public void onResult(int errorCode) { public void onResult(int errorCode) {
Log.e("ccc", "錯誤碼:" + errorCode);
String msg = ""; String msg = "";
switch (errorCode) { switch (errorCode) {
case PrintSocketHolder.ERROR_0: case PrintSocketHolder.ERROR_0:
...@@ -133,7 +132,6 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt ...@@ -133,7 +132,6 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt
@Override @Override
public void onStateChanged(int state) { public void onStateChanged(int state) {
Log.e("ccc", "onStateChanged:" + state);
String msg = ""; String msg = "";
switch (state) { switch (state) {
case PrintSocketHolder.STATE_0: case PrintSocketHolder.STATE_0:
......
...@@ -14,10 +14,10 @@ import java.util.Locale; ...@@ -14,10 +14,10 @@ import java.util.Locale;
public class TimeUtils { public class TimeUtils {
public static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//, Locale.CHINESE public static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//, Locale.CHINESE
public static final SimpleDateFormat DATE_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd"); public static final SimpleDateFormat DATE_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd");
public static final SimpleDateFormat DATE_FORMAT_DATE1 = new SimpleDateFormat( public static final SimpleDateFormat DATE_FORMAT_DATE1 = new SimpleDateFormat("HH:mm");
"HH:mm");
public static final SimpleDateFormat DEFAULT_DATE_MDHM = new SimpleDateFormat("MM-dd HH:mm");//, Locale.CHINESE public static final SimpleDateFormat DEFAULT_DATE_MDHM = new SimpleDateFormat("MM-dd HH:mm");//, Locale.CHINESE
public static final SimpleDateFormat DEFAULT_DATE_MD = new SimpleDateFormat("MM-dd");
public static final SimpleDateFormat DEFAULT_DATE_Y = new SimpleDateFormat("yyyy-");
/** /**
* 时间日期格式化到年月日. * 时间日期格式化到年月日.
...@@ -92,26 +92,57 @@ public class TimeUtils { ...@@ -92,26 +92,57 @@ public class TimeUtils {
return getTime(getCurrentTimeInLong(), dateFormat); return getTime(getCurrentTimeInLong(), dateFormat);
} }
/** /**
* 获取前n天日期、后n天日期
* *
* @param distanceDay 前几天 如获取前7天日期则传-7即可;如果后7天则传7 * @param distance 差距: 昨天天傳負一,今天傳零,明天傳一
* @param type 類型: 1、天 Calendar.DATE 2、年Calendar.YEAR 3、月Calendar.MONTH
* @param sf {@link #DEFAULT_DATE_MD}
* @return * @return
*/ */
public static String getOldDate(int distanceDay) { public static String getDistanceDate(int distance, int type, SimpleDateFormat sf) {
Date beginDate = new Date(); Date beginDate = new Date();
Calendar date = Calendar.getInstance(); Calendar date = Calendar.getInstance();
date.setTime(beginDate); date.setTime(beginDate);
date.set(Calendar.DATE, date.get(Calendar.DATE) + distanceDay); date.set(type, date.get(type) + distance);
Date endDate = null; Date endDate = null;
try { try {
endDate = DATE_FORMAT_DATE.parse(DATE_FORMAT_DATE.format(date.getTime())); endDate = sf.parse(sf.format(date.getTime()));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
return DATE_FORMAT_DATE.format(endDate); return sf.format(endDate);
} }
/**
* 获取前n天日期、后n天日期
*
* @param distanceDay 前几天 如获取前7天日期则传-7即可;如果后7天则传7
* @return
*/
public static String getOldDate(int distanceDay) {
return getDistanceDate(distanceDay, Calendar.DATE, DATE_FORMAT_DATE);
}
/**
* 获取前n年日期、后n年日期
*
* @param distanceYear 前几年 如获取前7年日期则传-7即可;如果后7年则传7
* @return
*/
public static String getYear(int distanceYear) {
return getDistanceDate(distanceYear, Calendar.YEAR, DATE_FORMAT_DATE);
}
/**
* 获取前n月日期、后n月日期
*
* @param distanceMonth 前几月 如获取前7月日期则传-7即可;如果后7月则传7
* @return
*/
public static String getDistanceMonth(int distanceMonth) {
return getDistanceDate(distanceMonth, Calendar.YEAR, DATE_FORMAT_DATE);
}
/** /**
* 把日期型字符串转换为数字型字符串 * 把日期型字符串转换为数字型字符串
......
...@@ -21,7 +21,6 @@ public class LoggingInterceptor implements Interceptor { ...@@ -21,7 +21,6 @@ public class LoggingInterceptor implements Interceptor {
long t1 = System.nanoTime();//请求发起的时间 long t1 = System.nanoTime();//请求发起的时间
String method = request.method(); String method = request.method();
Log.e("aaa", "intercept");
if ("POST".equals(method)) { if ("POST".equals(method)) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (request.body() instanceof FormBody) { if (request.body() instanceof FormBody) {
......
...@@ -407,7 +407,6 @@ ...@@ -407,7 +407,6 @@
<color name="color_f4">#F4F4F4</color> <color name="color_f4">#F4F4F4</color>
<color name="color_ccc">#CCC</color> <color name="color_ccc">#CCC</color>
<color name="line_color">#CCC</color> <color name="line_color">#CCC</color>
<color name="line_color2">#F0F0F0</color> <color name="line_color2">#F0F0F0</color>
<color name="scroll_bar_color">#CACACA</color> <color name="scroll_bar_color">#CACACA</color>
......
...@@ -122,7 +122,6 @@ public class LoginPresenter extends BasePresenter<LoginContract.Model, LoginCont ...@@ -122,7 +122,6 @@ public class LoginPresenter extends BasePresenter<LoginContract.Model, LoginCont
.subscribe(new ErrorHandleSubscriber<Object>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<Object>(mErrorHandler) {
@Override @Override
public void onNext(@NonNull Object info) { public void onNext(@NonNull Object info) {
Log.e("login", "" + info);
GsaCloudApplication.isLogin = false; GsaCloudApplication.isLogin = false;
mRootView.loginOut(); mRootView.loginOut();
} }
......
...@@ -302,7 +302,6 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login ...@@ -302,7 +302,6 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
.url("http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/gsa/login") .url("http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/gsa/login")
.post(requestBody) .post(requestBody)
.build(); .build();
Log.e("aaa", "登錄");
okHttpClient.newCall(request).enqueue(new Callback() { okHttpClient.newCall(request).enqueue(new Callback() {
@Override @Override
public void onFailure(Call call, IOException e) { public void onFailure(Call call, IOException e) {
......
...@@ -43,11 +43,9 @@ public class LoginOutActivity extends Activity { ...@@ -43,11 +43,9 @@ public class LoginOutActivity extends Activity {
OkHttpClient okHttpClient = new OkHttpClient(); OkHttpClient okHttpClient = new OkHttpClient();
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.build(); .build();
Log.e("aaa", "加密前:" + loginBean.getData().getUser().getId() + "_" + System.currentTimeMillis() + "_" + loginBean.getData().getToken());
// 加密token apptype_id_time_token // 加密token apptype_id_time_token
// app類型_用戶id_時間戳_登陸token // app類型_用戶id_時間戳_登陸token
String head = Aes.aesEncrypt("9_" + loginBean.getData().getUser().getId() + "_" + System.currentTimeMillis() + "_" + loginBean.getData().getToken()).replaceAll("\r|\n", ""); String head = Aes.aesEncrypt("9_" + loginBean.getData().getUser().getId() + "_" + System.currentTimeMillis() + "_" + loginBean.getData().getToken()).replaceAll("\r|\n", "");
Log.e("aaa", "加密頭部:" + head);
Request request = new Request.Builder() Request request = new Request.Builder()
.addHeader("mobileId", "1") .addHeader("mobileId", "1")
.addHeader("mobielModel", "") .addHeader("mobielModel", "")
...@@ -59,13 +57,11 @@ public class LoginOutActivity extends Activity { ...@@ -59,13 +57,11 @@ public class LoginOutActivity extends Activity {
okHttpClient.newCall(request).enqueue(new Callback() { okHttpClient.newCall(request).enqueue(new Callback() {
@Override @Override
public void onFailure(Call call, IOException e) { public void onFailure(Call call, IOException e) {
Log.e("aaa", "onFailure: " + e.getMessage());
} }
@Override @Override
public void onResponse(Call call, Response response) throws IOException { public void onResponse(Call call, Response response) throws IOException {
String json = response.body().string(); String json = response.body().string();
Log.e("aaa", "退出登錄:" + json);
ToastUtils.show(LoginOutActivity.this, "登出"); ToastUtils.show(LoginOutActivity.this, "登出");
Intent intent = new Intent(LoginOutActivity.this, LoginActivity.class); Intent intent = new Intent(LoginOutActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
......
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