Commit a969996e by sunxin

定时任务,时间优化,精确到天数

parent 9d319e6a
...@@ -161,11 +161,11 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> { ...@@ -161,11 +161,11 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportEntity.setExchangeAfterUser(transferUser); reportEntity.setExchangeAfterUser(transferUser);
} }
/*判断处理结论是否为转为线索*/ /*判断处理结论是否为转为线索 记录转为线索时间*/
if(reportEntity.getDealResult().equals("7")){ if(reportEntity.getDealResult().equals("7")){
Date transTime =new Date(); /* transTime 转为线索的时间 */ Date transTime =new Date(); /* transTime 转为线索的时间 */
reportEntity.setTransTime(transTime); reportEntity.setTransTime(transTime);
System.out.println("转为线索时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(transTime)); System.out.println(reportEntity.getSupplementTitle()+"==转为线索时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(transTime));
} }
dao.addTrack(reportEntity); dao.addTrack(reportEntity);
......
package com.ejweb.modules.report.utils; package com.ejweb.modules.report.utils;
import com.ejweb.modules.front.report.dao.FrontReportDao;
import com.ejweb.modules.report.dao.ReportDao; import com.ejweb.modules.report.dao.ReportDao;
import com.ejweb.modules.report.entity.ReportEntity; import com.ejweb.modules.report.entity.ReportEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -8,9 +7,7 @@ import org.springframework.context.annotation.Lazy; ...@@ -8,9 +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;
import java.util.Date;
/** /**
* Created by haoqm on 2019/7/18. * Created by haoqm on 2019/7/18.
...@@ -27,15 +24,15 @@ public class TimedTask { ...@@ -27,15 +24,15 @@ public class TimedTask {
//获取所有转为线索的举报信息 //获取所有转为线索的举报信息
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()); reportEntity.setTransTime(c.getTime());
try{ try{
/*跟据三个月前的过期时间查询并修改举报信息*/ /*跟据三个月前的过期时间查询并修改当天过期的举报信息*/
reportDao.updateReportByClueTime(reportEntity); reportDao.updateReportByClueTime(reportEntity);
System.out.println("线索状态改变成功"); System.out.println("线索状态改变成功+1");
}catch (Exception e){ }catch (Exception e){
System.out.println("线索状态改变失败"); System.out.println("线索状态改变异常");
} }
......
...@@ -1110,7 +1110,7 @@ ...@@ -1110,7 +1110,7 @@
UPDATE ct_bbtc_report SET UPDATE ct_bbtc_report SET
report_status= '3', report_status= '3',
deal_result='2' deal_result='2'
WHERE DATE(transTime) &lt;= #{transTime} WHERE where day(transTime) = day(#{transTime}) /* 比较日期数相同就行 */
</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