Merge branch 'master' of https://gitee.com/renjianbo0118/HouseProperty
This commit is contained in:
@@ -5,6 +5,7 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.RadioGroup;
|
||||
@@ -27,6 +28,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -48,7 +50,7 @@ import utils.Md5;
|
||||
public class ShareCodeActivity extends BaseActivity<com.sl.house_property.databinding.ActivityEntranceguardControl2Binding> {
|
||||
|
||||
private String user_home_id;
|
||||
private String fangchan,time;
|
||||
private String fangchan,time,timetwo;
|
||||
private CommentDao commentDao;
|
||||
private List<CommentBeanData> statuses;
|
||||
private RecyclerView mRecyclerView;
|
||||
@@ -95,7 +97,6 @@ public class ShareCodeActivity extends BaseActivity<com.sl.house_property.databi
|
||||
statuses = new ArrayList<>();
|
||||
if (commentBeanDatas1.size() == 0) {
|
||||
} else {
|
||||
|
||||
statuses.addAll(commentBeanDatas1);
|
||||
}
|
||||
initAdapter();
|
||||
@@ -321,6 +322,9 @@ public class ShareCodeActivity extends BaseActivity<com.sl.house_property.databi
|
||||
// map.put("validity_time", mDataBinding.daytiems.getText().toString().trim());
|
||||
map.put("user_home_id", user_home_id);
|
||||
Subscription subscribe = mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
|
||||
private Date beforeAfterDate;
|
||||
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
@@ -338,15 +342,37 @@ public class ShareCodeActivity extends BaseActivity<com.sl.house_property.databi
|
||||
|
||||
// time= DateUtilss.getDate();
|
||||
time= DateUtilss.getDateTime();
|
||||
|
||||
ArrayList<CommentBeanData> commentBeanData1 = commentDao.queryAll();
|
||||
if(commentBeanData1.size()>10){
|
||||
setToast("最多只能申请10条秘钥");
|
||||
Log.e("数据",commentBeanData1.size()+"");
|
||||
if(commentBeanData1.size()>=5){
|
||||
setToast("最多只能申请5条秘钥");
|
||||
return;
|
||||
}else {
|
||||
CommentBeanData commentBeanData = new CommentBeanData();
|
||||
commentBeanData.setId(new Random().nextInt(10000)+"");
|
||||
commentBeanData.setComment(fangchan);
|
||||
commentBeanData.setType(time);
|
||||
|
||||
switch (timeday){
|
||||
case 1:
|
||||
timetwo= DateUtilss.gettime();
|
||||
beforeAfterDate = DateUtilss.getBeforeAfterDate(timetwo, 1);
|
||||
break;
|
||||
case 7:
|
||||
timetwo= DateUtilss.gettime();
|
||||
beforeAfterDate =DateUtilss.getBeforeAfterDate(timetwo,7);
|
||||
break;
|
||||
case 30:
|
||||
timetwo= DateUtilss.gettime();
|
||||
beforeAfterDate =DateUtilss.getBeforeAfterDate(timetwo,30);
|
||||
break;
|
||||
case 90:
|
||||
timetwo= DateUtilss.gettime();
|
||||
beforeAfterDate = DateUtilss.getBeforeAfterDate(timetwo,90);
|
||||
break;
|
||||
}
|
||||
String jietime=time.split(" ")[1];
|
||||
commentBeanData.setType(beforeAfterDate+""+" "+ jietime);
|
||||
commentBeanData.setCode(code);
|
||||
commentBeanData.setPwd(pwd);
|
||||
if (null != commentDao.queryByCustom("Id", commentBeanData.getId()) && commentDao.queryByCustom("Id", commentBeanData.getId()).size() > 0) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -571,4 +572,29 @@ public class DateUtilss {
|
||||
|
||||
}
|
||||
|
||||
public static java.sql.Date getBeforeAfterDate(String datestr, int day) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
java.sql.Date olddate = null;
|
||||
try {
|
||||
df.setLenient(false);
|
||||
olddate = new java.sql.Date(df.parse(datestr).getTime());
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException("日期转换错误");
|
||||
}
|
||||
Calendar cal = new GregorianCalendar();
|
||||
cal.setTime(olddate);
|
||||
|
||||
int Year = cal.get(Calendar.YEAR);
|
||||
int Month = cal.get(Calendar.MONTH);
|
||||
int Day = cal.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
int NewDay = Day + day;
|
||||
|
||||
cal.set(Calendar.YEAR, Year);
|
||||
cal.set(Calendar.MONTH, Month);
|
||||
cal.set(Calendar.DAY_OF_MONTH, NewDay);
|
||||
|
||||
return new java.sql.Date(cal.getTimeInMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user