Commit f9adb6ba by sunxin

定时任务 oracle数据库版修改

parent b33ba283
...@@ -272,5 +272,5 @@ public interface ReportDao extends CrudDao<ReportEntity> { ...@@ -272,5 +272,5 @@ public interface ReportDao extends CrudDao<ReportEntity> {
* @param entity * @param entity
* @return * @return
*/ */
void updateReportByClueTime(ReportEntity entity); int updateReportByClueTime(ReportEntity entity);
} }
...@@ -80,6 +80,15 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -80,6 +80,15 @@ public class ReportEntity extends DataEntity<ReportEntity> {
private CtBbtcRegion supplementAreaNew; //被举报区域 private CtBbtcRegion supplementAreaNew; //被举报区域
private CtBbtcBusType supplementTypeNew;//业务类型 private CtBbtcBusType supplementTypeNew;//业务类型
private Date transTime; //转为线索的时间 private Date transTime; //转为线索的时间
private String cuurentTime; //转为线索的时间
public String getCuurentTime() {
return cuurentTime;
}
public void setCuurentTime(String cuurentTime) {
this.cuurentTime = cuurentTime;
}
private List regionList; //区域列表 private List regionList; //区域列表
......
...@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Lazy; ...@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
/** /**
...@@ -19,18 +20,21 @@ public class TimedTask { ...@@ -19,18 +20,21 @@ public class TimedTask {
@Autowired @Autowired
private ReportDao reportDao; private ReportDao reportDao;
@Scheduled(cron="0 0 12 * * ?") //cron表达式 每天中午12执行 @Scheduled(cron="0 23 15 * * ?") //cron表达式 每天中午12执行
public void job1() { public void job1() {
//获取所有转为线索的举报信息 //获取所有转为线索的举报信息
ReportEntity reportEntity=new ReportEntity(); ReportEntity reportEntity=new ReportEntity();
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -3); // 当前日期减三个月 生产环境 c.add(Calendar.MONTH, -3); // 当前日期减三个月 生产环境
/* c.add(Calendar.MINUTE, -25); // 当前日期减去25分钟 测试环境 */ /* c.add(Calendar.MINUTE, -25); // 当前日期减去25分钟 测试环境 */
reportEntity.setTransTime(c.getTime()); SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String formatDate = df.format(c.getTime());
reportEntity.setCuurentTime(formatDate);
try{ try{
/*跟据三个月前的过期时间查询并修改当天过期的举报信息*/ /*跟据三个月前的过期时间查询并修改当天过期的举报信息*/
reportDao.updateReportByClueTime(reportEntity); int i = reportDao.updateReportByClueTime(reportEntity);
System.out.println("线索状态改变成功+1"); System.out.println("线索状态改变成功+"+i);
}catch (Exception e){ }catch (Exception e){
System.out.println("线索状态改变异常"); System.out.println("线索状态改变异常");
} }
......
...@@ -1143,11 +1143,17 @@ ...@@ -1143,11 +1143,17 @@
where del_flag = 0 where del_flag = 0
</select> </select>
<update id="updateReportByClueTime" parameterType="ReportEntity" > <update id="updateReportByClueTime" parameterType="com.ejweb.modules.report.entity.ReportEntity" >
UPDATE ct_bbtc_report SET UPDATE ct_bbtc_report SET
report_status= '3', report_status= '3',
deal_result='2' deal_result='2'
WHERE where day(transTime) = day(#{transTime}) /* 比较日期数相同就行 */ where
report_status != '3' and
deal_result !='2'
<if test="dbName == 'oracle'"> and TRANSTIME >= to_date(#{cuurentTime}, 'yyyy-MM-dd') AND TRANSTIME &lt;= to_date( #{cuurentTime}|| ' 23:59:59', 'yyyy-MM-dd
hh24:mi:ss')
</if>
<if test="dbName == 'mysql'"> and DATE(TRANSTIME) >= #{cuurentTime} AND DATE(TRANSTIME) &lt;= #{cuurentTime}</if>
</update> </update>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment