没有合适的资源?快使用搜索试试~ 我知道了~
Spring定时器的实例.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 138 浏览量
2022-10-29
00:15:36
上传
评论
收藏 379KB PDF 举报
温馨提示
试读
13页
。。。
资源推荐
资源详情
资源评论
1)ScheduledTimer.java:
package com.strongit.zwjc.infopush.vo;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.strongit.zwjc.common.dao.BaseDAO;
import com.strongit.zwjc.infopush.po.Afficheinfo;
import com.strongit.zwjc.infopush.po.InfopushDocClass;
import com.strongit.zwjc.infopush.po.Performance;
import com.strongit.zwjc.util.TimeKit1;
/**
* 定一个定时查询的类
*/
public class ScheduledTimer {
/**
* 定时运行的方法
*/
private BaseDAO baseDaoImpl;
@SuppressWarnings({ "unchecked", "deprecation" })
public void startRun() throws Exception {
// 第一,查询类型表中的规则
Calendar now = Calendar.getInstance();
@SuppressWarnings("unused")
int nowDay = now.get(Calendar.DAY_OF_MONTH);
int nowMonth = now.get(Calendar.MONTH) + 1;
List<InfopushDocClass> InfopushClassList = this.baseDaoImpl
.findAll(InfopushDocClass.class);
String docPushRule = "monthly:15";
@SuppressWarnings("unused")
String monthly = "";
String strDay = "";
int intDay = 0;
String classId = "";
String className = "" ;
String orgId = "";
String orgName = "orgName" ;
//InfopushDoc infopushDoc = null;
List infopushDocList = null ;
Performance performance = null ;
Afficheinfo afficheinfo = null ;
String strSfficheinfo = "" ;
List<Performance> performanceList = null ;
Date performanceDate = TimeKit1.getDateByString(TimeKit1.now("short"));
for (InfopushDocClass infopushDocClass : InfopushClassList) {
docPushRule = infopushDocClass.getDocPushRule();
classId = infopushDocClass.getClassId();
orgId = infopushDocClass.getOrgId();
monthly = docPushRule.split(":")[0];
strDay = docPushRule.split(":")[1];
intDay = Integer.parseInt(strDay);
//此方法只能适应与 月报
if (nowDay == intDay) {
infopushDocList = this.baseDaoImpl
.findAll("FROM InfopushDoc idoc where idoc.infopushDocClass.classId='"
+ classId
+ "' and idoc.orgId = '"
+ orgId
+ "'");
int totalsize = infopushDocList.size() ;
performanceList = this.baseDaoImpl.findAll(Performance.class);
if(totalsize>0){
boolean flag = false ;
for(Performance performance2:performanceList){
int performanceMonth = performance2.getPerformanceDate().getMonth()+
1 ;
if(nowMonth==performanceMonth){
flag = true ;
break ;
}
}
if(flag){
}else{
// 有数据 加分
className = infopushDocClass.getClassName() ;
orgName = infopushDocClass.getOrgName() ;
performance = new Performance() ;
performance.setClassId(classId);
performance.setOrgId(orgId);
performance.setOrgName(orgName);
performance.setClassName(className);
performance.setPerformanceDate(performanceDate);
performance.setScore(Long.valueOf("1"));
this.baseDaoImpl.insert(performance);
}
}else{
boolean flag = false ;
for(Performance performance2:performanceList){
int performanceMonth = performance2.getPerformanceDate().getMonth()+
1 ;
if(nowMonth==performanceMonth){
flag = true ;
break ;
}
}
if(flag){
}else{
// 没有数据 为 0 分,并且通报
orgName = infopushDocClass.getOrgName() ;
className = infopushDocClass.getClassName() ;
performance = new Performance() ;
performance.setClassId(classId);
performance.setClassName(className);
performance.setOrgId(orgId);
performance.setOrgName(orgName);
performance.setPerformanceDate(performanceDate);
performance.setScore(Long.valueOf("0"));
this.baseDaoImpl.insert(performance);
className = infopushDocClass.getClassName() ;
afficheinfo = new Afficheinfo() ;
afficheinfo.setClassId(classId);
afficheinfo.setOrgId(orgId);
afficheinfo.setAfficheinfoDate(performanceDate);
strSfficheinfo = "【"+TimeKit1.getNowDate()+"】【"+orgName+"】未推送【"
+className+"】分类文献信息" ;
afficheinfo.setAfficheInfo(strSfficheinfo);
afficheinfo.setClassName(className);
afficheinfo.setOrgName(orgName);
this.baseDaoImpl.insert(afficheinfo);
}
}
}
}
System.out.println("成功插入!!");
剩余12页未读,继续阅读
资源评论
G11176593
- 粉丝: 6649
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 1_提高高温超导体的临界温度的方法_pdf_1629817510190_0.jpg
- Java实现计数排序算法(源代码)
- 这个 ide98 是适合老式机器上用到的一个补充文件,文件的过程代表过程的文件这个 ide98 是适合老式机器上用到的一个补充文
- 866164937784007CarLife3.0车机修改版支持无线和方控.apk
- 天津理工大学-操作系统实验3:磁盘调度算法的实现.doc
- 天津理工大学数据库期末复习试题一.doc
- 花农科技的驱动整合,ide98,这个工具可以用来修改计算机,修改后的计算机会更好用的,多合一,很好用,很实用
- 天猫电子商务案例分析-PPT.ppt
- ods.sql
- 如何做互联网市场调研.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功