|
@@ -65,90 +65,90 @@ public class InsOrderScheduler {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 每天23点触发定时任务
|
|
|
|
|
- * 自动关闭当日订单
|
|
|
|
|
- */
|
|
|
|
|
- @Scheduled(cron = "0 0 23 * * ?")
|
|
|
|
|
- public void orderTask() {
|
|
|
|
|
- logger.info("定时任务执行开始时间:" + dateFormat.format(new Date()) + "");
|
|
|
|
|
-
|
|
|
|
|
- int num = autoCloseOrder();
|
|
|
|
|
-
|
|
|
|
|
- logger.info("定时任务执行结束时间:" + dateFormat.format(new Date()) + " 更新订单合计 " + num);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public int autoCloseOrder() {
|
|
|
|
|
- //1、查询订单列表
|
|
|
|
|
- StringBuffer whereStr = new StringBuffer(" where 1=1");
|
|
|
|
|
- ArrayList array = new ArrayList();
|
|
|
|
|
- whereStr.append(" and orderstatus in ('0','1','2','3','4','5')");
|
|
|
|
|
-
|
|
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
- String date = format.format(new Date());
|
|
|
|
|
-// String date = "2021-04-13";
|
|
|
|
|
- whereStr.append(" and DATE_FORMAT(createtime, '%Y-%m-%d') between date'" + date + "' and date'" + date + "'");
|
|
|
|
|
-
|
|
|
|
|
- //0报价中 1待核保 2已核保 3核保退回 4核保不通过 5已核保待缴费 6已缴费 7已承保 99已关闭
|
|
|
|
|
- List<InsOrder> orderList = insOrderService.selectList(whereStr.toString(), array.toArray());
|
|
|
|
|
-
|
|
|
|
|
- huanongService.login();
|
|
|
|
|
- huanongService.querySales();
|
|
|
|
|
-
|
|
|
|
|
- hengbangService.login();
|
|
|
|
|
- hengbangService.querySales();
|
|
|
|
|
-
|
|
|
|
|
- for (InsOrder order : orderList) {
|
|
|
|
|
- String licenseno = order.getLicenseNo();
|
|
|
|
|
- String carowner = order.getInsuredname();
|
|
|
|
|
- String orderno = order.getOrderno();
|
|
|
|
|
- String jqapplyno = order.getJqapplyno();
|
|
|
|
|
- String syapplyno = order.getSyapplyno();
|
|
|
|
|
- HttpResult httpResult = null;
|
|
|
|
|
-
|
|
|
|
|
- if ("5".equals(order.getOrderstatus()) && "华农财险".equals(order.getInscompany())) {
|
|
|
|
|
- httpResult = huanongService.queryPayStatus(licenseno, date, jqapplyno, syapplyno);
|
|
|
|
|
- } else if ("5".equals(order.getOrderstatus()) && "恒邦财险".equals(order.getInscompany())) {
|
|
|
|
|
- httpResult = hengbangService.queryPayStatus(licenseno, carowner, date, jqapplyno, syapplyno);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (httpResult != null && httpResult.getCode() == 200) {
|
|
|
|
|
- //更新订单状态
|
|
|
|
|
- order.setOrderstatus("6");
|
|
|
|
|
- String auditname = order.getAuditname();
|
|
|
|
|
- String auditid = order.getAuditid();
|
|
|
|
|
- //匹配任务接收人
|
|
|
|
|
- String license = order.getLicenseNo().substring(0, 2);
|
|
|
|
|
- List<InsOrderTask> taskList = insOrderTaskService.selectList(" where t.status='1' and t.insname=? and t.licenseno=? and t.orderstatus=?", new Object[]{order.getInscompany(), license, "7"});
|
|
|
|
|
- if (taskList.size() > 0) {
|
|
|
|
|
- order.setAuditid(taskList.get(0).getAuditid());
|
|
|
|
|
- order.setAuditname(taskList.get(0).getAuditname());
|
|
|
|
|
- } else {
|
|
|
|
|
- order.setAuditid("");
|
|
|
|
|
- order.setAuditname("");
|
|
|
|
|
- }
|
|
|
|
|
- insOrderService.update(order);
|
|
|
|
|
-
|
|
|
|
|
- //插入轨迹表
|
|
|
|
|
- InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
- history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
- history.setCompany(order.getInscompany());
|
|
|
|
|
- history.setTaskid(order.getOrderno());
|
|
|
|
|
- history.setOperatorid(auditid);
|
|
|
|
|
- history.setOperator(auditname);
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
- history.setStatus("6");
|
|
|
|
|
- history.setRemark("缴费确认");
|
|
|
|
|
- insTaskHistoryService.insert(history);
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- //关闭订单
|
|
|
|
|
- insOrderService.closeOrder(orderno, "99");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return orderList.size();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 每天23点触发定时任务
|
|
|
|
|
+// * 自动关闭当日订单
|
|
|
|
|
+// */
|
|
|
|
|
+// @Scheduled(cron = "0 0 23 * * ?")
|
|
|
|
|
+// public void orderTask() {
|
|
|
|
|
+// logger.info("定时任务执行开始时间:" + dateFormat.format(new Date()) + "");
|
|
|
|
|
+//
|
|
|
|
|
+// int num = autoCloseOrder();
|
|
|
|
|
+//
|
|
|
|
|
+// logger.info("定时任务执行结束时间:" + dateFormat.format(new Date()) + " 更新订单合计 " + num);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// public int autoCloseOrder() {
|
|
|
|
|
+// //1、查询订单列表
|
|
|
|
|
+// StringBuffer whereStr = new StringBuffer(" where 1=1");
|
|
|
|
|
+// ArrayList array = new ArrayList();
|
|
|
|
|
+// whereStr.append(" and orderstatus in ('0','1','2','3','4','5')");
|
|
|
|
|
+//
|
|
|
|
|
+// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
+// String date = format.format(new Date());
|
|
|
|
|
+//// String date = "2021-04-13";
|
|
|
|
|
+// whereStr.append(" and DATE_FORMAT(createtime, '%Y-%m-%d') between date'" + date + "' and date'" + date + "'");
|
|
|
|
|
+//
|
|
|
|
|
+// //0报价中 1待核保 2已核保 3核保退回 4核保不通过 5已核保待缴费 6已缴费 7已承保 99已关闭
|
|
|
|
|
+// List<InsOrder> orderList = insOrderService.selectList(whereStr.toString(), array.toArray());
|
|
|
|
|
+//
|
|
|
|
|
+// huanongService.login();
|
|
|
|
|
+// huanongService.querySales();
|
|
|
|
|
+//
|
|
|
|
|
+// hengbangService.login();
|
|
|
|
|
+// hengbangService.querySales();
|
|
|
|
|
+//
|
|
|
|
|
+// for (InsOrder order : orderList) {
|
|
|
|
|
+// String licenseno = order.getLicenseNo();
|
|
|
|
|
+// String carowner = order.getInsuredname();
|
|
|
|
|
+// String orderno = order.getOrderno();
|
|
|
|
|
+// String jqapplyno = order.getJqapplyno();
|
|
|
|
|
+// String syapplyno = order.getSyapplyno();
|
|
|
|
|
+// HttpResult httpResult = null;
|
|
|
|
|
+//
|
|
|
|
|
+// if ("5".equals(order.getOrderstatus()) && "华农财险".equals(order.getInscompany())) {
|
|
|
|
|
+// httpResult = huanongService.queryPayStatus(licenseno, date, jqapplyno, syapplyno);
|
|
|
|
|
+// } else if ("5".equals(order.getOrderstatus()) && "恒邦财险".equals(order.getInscompany())) {
|
|
|
|
|
+// httpResult = hengbangService.queryPayStatus(licenseno, carowner, date, jqapplyno, syapplyno);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if (httpResult != null && httpResult.getCode() == 200) {
|
|
|
|
|
+// //更新订单状态
|
|
|
|
|
+// order.setOrderstatus("6");
|
|
|
|
|
+// String auditname = order.getAuditname();
|
|
|
|
|
+// String auditid = order.getAuditid();
|
|
|
|
|
+// //匹配任务接收人
|
|
|
|
|
+// String license = order.getLicenseNo().substring(0, 2);
|
|
|
|
|
+// List<InsOrderTask> taskList = insOrderTaskService.selectList(" where t.status='1' and t.insname=? and t.licenseno=? and t.orderstatus=?", new Object[]{order.getInscompany(), license, "7"});
|
|
|
|
|
+// if (taskList.size() > 0) {
|
|
|
|
|
+// order.setAuditid(taskList.get(0).getAuditid());
|
|
|
|
|
+// order.setAuditname(taskList.get(0).getAuditname());
|
|
|
|
|
+// } else {
|
|
|
|
|
+// order.setAuditid("");
|
|
|
|
|
+// order.setAuditname("");
|
|
|
|
|
+// }
|
|
|
|
|
+// insOrderService.update(order);
|
|
|
|
|
+//
|
|
|
|
|
+// //插入轨迹表
|
|
|
|
|
+// InsTaskHistory history = new InsTaskHistory();
|
|
|
|
|
+// history.setId(String.valueOf(new Date().getTime()));
|
|
|
|
|
+// history.setCompany(order.getInscompany());
|
|
|
|
|
+// history.setTaskid(order.getOrderno());
|
|
|
|
|
+// history.setOperatorid(auditid);
|
|
|
|
|
+// history.setOperator(auditname);
|
|
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+// history.setCreatetime(sdf.format(new Date()));
|
|
|
|
|
+// history.setStatus("6");
|
|
|
|
|
+// history.setRemark("缴费确认");
|
|
|
|
|
+// insTaskHistoryService.insert(history);
|
|
|
|
|
+//
|
|
|
|
|
+// } else {
|
|
|
|
|
+// //关闭订单
|
|
|
|
|
+// insOrderService.closeOrder(orderno, "99");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// return orderList.size();
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|