没有合适的资源?快使用搜索试试~ 我知道了~
需求 本月从一号开始到今天 上月全天 where 里面的时间都是传的 @Override public Output getMothCount(String accountId) { try { String[] Moth= {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}; int y,newm,d,oldm
资源推荐
资源详情
资源评论
java分天查询本月上月记录分天查询本月上月记录
需求
本月从一号开始到今天
上月全天 where 里面的时间都是传的
@Override
public Output getMothCount(String accountId) {
try {
String[] Moth= {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
int y,newm,d,oldm;
Calendar cal=Calendar.getInstance();
y=cal.get(Calendar.YEAR); //今年
oldm=cal.get(Calendar.MONTH);//上月
d=cal.get(Calendar.DATE);//查询本月多少天
cal.set(Calendar.YEAR,y);
cal.set(Calendar.MONTH,oldm-1);//Java月份才0开始算
int dateOfMonth = cal.getActualMaximum(Calendar.DATE);//查询上月多少天
newm=oldm+1;//查询本月天数
List<Map> mothList;
List<Map> oldMothList;
if(newm<10) {
mothList=smartsiteCarManagerMapper.getMothCount(""+y+"0"+""+newm+""+"0"+1, ""+y+"0"+""+newm+""+d);//查询时间
}else {
mothList=smartsiteCarManagerMapper.getMothCount(""+y+""+newm+""+"0"+1, ""+y+""+newm+""+d);
}
oldMothList=smartsiteCarManagerMapper.getMothCount(""+y+""+oldm+""+"0"+1, ""+y+"0"+""+oldm+""+dateOfMonth);//查询时间
boolean flag;
Map mp;
for (int i = 0; i < d; i++) {
flag=true;
for (int j = 0; j 6?mothList.get(j).get("createTime").toString().substring(6, 8):mothList.get(j).get("createTime").toString())) {
mothList.get(j).put("createTime", mothList.get(j).get("createTime").toString().substring(6,8));
flag=false;//数据有日期不新增
break;
}
}
if(flag) {
mp=new HashMap();
mp.put("count", 0);
mp.put("createTime", Moth[i]);
mothList.add(mp);
}
}
for (int i = 0; i < dateOfMonth; i++) {
flag=true;
for (int j = 0; j 6?oldMothList.get(j).get("createTime").toString().substring(6, 8):oldMothList.get(j).get("createTime").toString())) {
资源评论
weixin_38524246
- 粉丝: 6
- 资源: 920
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功