same-code nl-7 ol-7">
public class UploadContract {
interface View extends BaseView {
- void addNewSessionView(SessionBean bean);
void showBoxDisconnectedView();
void showBoxConnectedView();
void showEmptyView();
@@ -24,6 +20,7 @@ public class UploadContract {
interface Presenter extends BasePresenter{
SessionBean createNewSession();
+
}
}
@@ -1,8 +1,11 @@ |
||
| 1 | 1 |
package ai.pai.lensman.upload; |
| 2 | 2 |
|
| 3 |
+import java.text.SimpleDateFormat; |
|
| 3 | 4 |
import java.util.ArrayList; |
| 5 |
+import java.util.Date; |
|
| 4 | 6 |
|
| 5 | 7 |
import ai.pai.lensman.bean.SessionBean; |
| 8 |
+import ai.pai.lensman.db.DBService; |
|
| 6 | 9 |
|
| 7 | 10 |
public class UploadPresenter implements UploadContract.Presenter {
|
| 8 | 11 |
|
@@ -14,12 +17,12 @@ public class UploadPresenter implements UploadContract.Presenter {
|
||
| 14 | 17 |
public UploadPresenter(UploadContract.View view,String lensmanId){
|
| 15 | 18 |
this.uploadView = view; |
| 16 | 19 |
this.lensmanId = lensmanId; |
| 17 |
- sessionList = new ArrayList<>(); |
|
| 18 | 20 |
} |
| 19 | 21 |
|
| 20 | 22 |
|
| 21 | 23 |
@Override |
| 22 | 24 |
public void start() {
|
| 25 |
+ sessionList = DBService.getInstance().getSessionBeanListByDay(getSessionDateInLongFormat()); |
|
| 23 | 26 |
if(sessionList.size()==0){
|
| 24 | 27 |
uploadView.showEmptyView(); |
| 25 | 28 |
}else{
|
@@ -38,10 +41,16 @@ public class UploadPresenter implements UploadContract.Presenter {
|
||
| 38 | 41 |
public SessionBean createNewSession() {
|
| 39 | 42 |
SessionBean sessionBean = new SessionBean(); |
| 40 | 43 |
sessionBean.lensmanId = lensmanId; |
| 41 |
- sessionBean.sessionDate=20160813; |
|
| 44 |
+ sessionBean.sessionDate=getSessionDateInLongFormat(); |
|
| 42 | 45 |
sessionBean.sessionSeq = sessionSeq+1; |
| 43 | 46 |
sessionBean.sessionId ="chengzhenyu_test"+sessionBean.sessionSeq; |
| 44 | 47 |
sessionList.add(sessionBean); |
| 45 | 48 |
return sessionBean; |
| 46 | 49 |
} |
| 50 |
+ |
|
| 51 |
+ private long getSessionDateInLongFormat(){
|
|
| 52 |
+ SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
| 53 |
+ String dateStr = format.format(new Date()); |
|
| 54 |
+ return Long.parseLong(dateStr); |
|
| 55 |
+ } |
|
| 47 | 56 |
} |