Map<String, Object> params = new HashMap<String, Object>();
int count=1;
int day=0;
try{
//判断用户是否是连续签到
com.soft.bc.integral.turnover.vo.QueryBean queryBean = new com.soft.bc.integral.turnover.vo.QueryBean();
queryBean.setWhereStr("order by turnoverDate desc");
queryBean.setCmemberCode(getUserSession().getCmemberCode());
queryBean.setOpBillno(getUserSession().getMemberCode());
queryBean.setMemberCode(getUserSession().getMemberCode());
queryBean.setRuleCode("QDSJF00001");
//查询签到前七条数据
PageTools pageTools=new PageTools();
pageTools.setPageSize(7);
queryBean.setPageTools(pageTools);
params.put("queryBean", queryBean);
TurnoverRe turnoverRe = this.getServiceInvoker().callAsObject("turnoverService.query", params,TurnoverRe.class);
if(null!=turnoverRe&& null!=turnoverRe.getList() && turnoverRe.getList().size()>0){
//得到当前时间
Date nowDate = this.getServiceInvoker().callAsObject("scontractService.getSystemDate", null,Date.class);
for(int i=0;i<turnoverRe.getList().size();i++){
Date endDate = turnoverRe.getList().get(i).getTurnoverDate();
//得到数据库签到的时间
long endtime = DateUtil.getDateOfLong(DateUtil.getDateString(endDate,"yyyy-MM-dd"), "yyyy-MM-dd");
if(i==0){
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
//当前时间
long nowTime = DateUtil.getDateOfLong(DateUtil.getDateString(cal.getTime(),"yyyy-MM-dd"), "yyyy-MM-dd");
cal.add(Calendar.DATE, -1);
//昨天的时间
long yesterdayTime = DateUtil.getDateOfLong(DateUtil.getDateString(cal.getTime(),"yyyy-MM-dd"), "yyyy-MM-dd");
//判断最后一次签到时间和当前时间是否为同一天
if(endtime==nowTime){
count++;
}else if(endtime==yesterdayTime){
day = 1;
count++;
}else{
break;
}
}else{
int flag=day+i;
Calendar calendar = Calendar.getInstance();
calendar.setTime(nowDate);
calendar.add(Calendar.DATE, -flag);
//当前时间前几天时间
long time = DateUtil.getDateOfLong(DateUtil.getDateString(calendar.getTime(),"yyyy-MM-dd"), "yyyy-MM-dd");
if(endtime == time){
count++;
}else{
break;
}
}
}
}else{
params.put("css", "cc");
return new JsonResult(true,params );
}
}catch (Exception e) {
// TODO: handle exception
}
String str="tree0"+count;
params.put("css", "tree_box "+str);
return new JsonResult(true,params );