|
|
@@ -5,12 +5,16 @@ import com.uas.erp.schedular.core.Status;
|
|
|
import com.uas.erp.schedular.task.support.Method;
|
|
|
import com.uas.erp.schedular.task.support.Role;
|
|
|
import com.uas.erp.schedular.task.support.TaskMapping;
|
|
|
+import com.uas.erp.schedular.util.ArrayUtil;
|
|
|
import com.uas.erp.schedular.util.CollectionUtil;
|
|
|
import com.uas.erp.schedular.util.ContextHolder;
|
|
|
+import com.uas.erp.schedular.util.DateUtil;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -203,4 +207,32 @@ public class PurchaseNotifyTask extends AbstractTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 从8点到18点,每一小时检查一次
|
|
|
+ */
|
|
|
+ @TaskMapping(title = "校验结案提醒", cron = "0 0 8,9,10,11,12,13,14,15,16,17,18 * * ? ")
|
|
|
+ public void uploadEndNotify() {
|
|
|
+ // 每次最多传输数据
|
|
|
+ int maxNum = 100;
|
|
|
+ // 筛选当天的数据
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ // 数据库时间格式
|
|
|
+ String format = "yyyy-MM-dd HH:mm:ss";
|
|
|
+ // 最近1小时的操作记录
|
|
|
+ Long time = System.currentTimeMillis() - 1 * 60 * 60 * 1000;
|
|
|
+ String startTime = DateUtil.parseDateToOracleString(format, new Date(time));
|
|
|
+ String endTime = DateUtil.parseDateToOracleString(format, new Date(System.currentTimeMillis()));
|
|
|
+ String sql = "select pn_id,pn_b2bid,pn_cmdRemark pn_remark from purchaseNotify "
|
|
|
+ + "where pn_b2bid is not null and pn_cmdRemark like '%勾选取消 " + dateFormat.format(new Date()) + "%' "
|
|
|
+ + "and to_date(subStr(pn_cmdRemark, -20), 'yyyy-MM-dd hh24:mi:ss') between " + startTime + " and " + endTime;
|
|
|
+ List<PurchaseNotify> notifyList = jdbcTemplate.queryForBeanList(sql, PurchaseNotify.class);
|
|
|
+ if (!CollectionUtils.isEmpty(notifyList)) {
|
|
|
+ List<List<PurchaseNotify>> notifyLists = ArrayUtil.splitAry(notifyList, maxNum);
|
|
|
+ for (List<PurchaseNotify> notifies : notifyLists) {
|
|
|
+ ContextHolder.setDataSize(notifies.size());
|
|
|
+ post("/erp/purchase/notice/endCheck", dataWrap(notifies));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|