提交 | 用户 | age
|
739bf5
|
1 |
package com.hx.phip.his.task; |
C |
2 |
|
|
3 |
import com.hx.phip.model.SyncExecutionRecord; |
|
4 |
import com.hx.phip.his.service.SyncExecutionRecordService; |
|
5 |
import com.hx.util.DateUtil; |
|
6 |
import net.sf.json.JSONObject; |
|
7 |
import org.slf4j.Logger; |
|
8 |
import org.slf4j.LoggerFactory; |
|
9 |
import org.springframework.scheduling.annotation.Scheduled; |
|
10 |
import org.springframework.stereotype.Component; |
|
11 |
|
|
12 |
import javax.annotation.Resource; |
|
13 |
import java.util.Calendar; |
|
14 |
import java.util.Date; |
|
15 |
|
|
16 |
/** |
|
17 |
* his 同步已划扣数据定时器 |
|
18 |
*/ |
|
19 |
//@Component |
|
20 |
public class HisExecutedRecordSyncTask { |
|
21 |
|
|
22 |
private static Logger logger = LoggerFactory.getLogger(HisExecutedRecordSyncTask.class); |
|
23 |
|
|
24 |
@Resource |
|
25 |
private SyncExecutionRecordService syncExecutionRecordService; |
|
26 |
|
|
27 |
// @Scheduled(cron="0 0/30 * * * ?") |
|
28 |
public void syncSalesOrderTask() { |
|
29 |
Calendar c = Calendar.getInstance(); |
|
30 |
c.setTime(new Date()); |
|
31 |
Date end = c.getTime(); |
|
32 |
String endTime=DateUtil.formatDate_3(end);//当前日期 |
|
33 |
|
|
34 |
c.add(Calendar.DATE, -1); |
|
35 |
Date start = c.getTime(); |
|
36 |
String startTime=DateUtil.formatDate_3(start);//前一天 |
|
37 |
|
|
38 |
logger.info("开始执行同步已划扣数据定时器,开始时间:{},结束时间:{}",startTime,endTime); |
|
39 |
JSONObject jsonObject=new JSONObject(); |
|
40 |
jsonObject.put("startTime",startTime); |
|
41 |
jsonObject.put("endTime",endTime); |
|
42 |
SyncExecutionRecord syncExecutionRecord=new SyncExecutionRecord(jsonObject.toString(),null,2,3,0,0,new Date()); |
|
43 |
|
|
44 |
syncExecutionRecordService.obtain(jsonObject,syncExecutionRecord); |
|
45 |
logger.info("定时器同步已划扣数据执行完成"); |
|
46 |
} |
|
47 |
|
|
48 |
|
|
49 |
} |