|
@@ -0,0 +1,66 @@
|
|
|
+/**
|
|
|
+ * Copyright (C), 2022-08-02
|
|
|
+ * FileName: DiningStatements
|
|
|
+ * Author: wanglongda
|
|
|
+ * Date: 2022/8/2 15:10
|
|
|
+ * Description: 用餐报表
|
|
|
+ */
|
|
|
+package me.zhengjie.modules.quartz.task;/**
|
|
|
+ * Created Name: wanglongda
|
|
|
+ * Created Time: 2022/8/2 15:10
|
|
|
+ * Description: iot-zhcy
|
|
|
+ */
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import me.zhengjie.modules.dm.statement.repository.DmHaveDinnerRepository;
|
|
|
+import me.zhengjie.modules.dm.statement.service.mapstruct.DmHaveDinnerMapper;
|
|
|
+import me.zhengjie.utils.StringUtils;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Calendar;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <功能简要> <br>
|
|
|
+ * <用餐报表>
|
|
|
+ *
|
|
|
+ * @Author wanglongda
|
|
|
+ * @createTime 2022/8/2 15:10
|
|
|
+ * @Version 1.0.0
|
|
|
+ */
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class DiningStatementsTask {
|
|
|
+
|
|
|
+ private final DmHaveDinnerRepository dmHaveDinnerRepository;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 定时生成用餐日报 DAY_DINING_STATEMENTS
|
|
|
+ */
|
|
|
+ public void dayDiningStatements(){
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Calendar instance = Calendar.getInstance();
|
|
|
+ //当前时间
|
|
|
+ String nowTime = simpleDateFormat.format(instance.getTime()) + " 23:59:59";
|
|
|
+ String StartTime = simpleDateFormat.format(instance.getTime()) + " 00:00:00";
|
|
|
+ //第一步判断是否有Day_Dining_Statements视图
|
|
|
+ String viewName = dmHaveDinnerRepository.judgeView("DAY_DINING_STATEMENTS");
|
|
|
+ //由于是一天一生成 那就再新增之前就要删除之前的视图
|
|
|
+ if (!StringUtils.isEmpty(viewName)){
|
|
|
+ //删除视图
|
|
|
+ dmHaveDinnerRepository.dropDayView("DAY_DINING_STATEMENTS");
|
|
|
+ //创建视图
|
|
|
+ dmHaveDinnerRepository.createDayView(StartTime,nowTime,"DAY_DINING_STATEMENTS");
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //创建视图
|
|
|
+ dmHaveDinnerRepository.createDayView(StartTime,nowTime,"DAY_DINING_STATEMENTS");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|