ZhuDeKang 3 сар өмнө
parent
commit
a6c798118b
17 өөрчлөгдсөн 392 нэмэгдсэн , 6 устгасан
  1. 1 1
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java
  2. 19 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceLogStatisServiceController.java
  3. 2 2
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtService.java
  4. 80 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtServiceLogStatis.java
  5. 18 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/MdJobScheduleMapper.java
  6. 9 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceLogMapper.java
  7. 16 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceLogStatisMapper.java
  8. 2 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IPtServiceLogService.java
  9. 8 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IPtServiceLogStatisService.java
  10. 7 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceLogServiceImpl.java
  11. 32 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceLogStatisServiceImpl.java
  12. 71 0
      ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/snailJob/ServiceLogStatisJob.java
  13. 21 0
      ruoyi-api-patform/src/main/resources/mapper/interfaces/MdJobScheduleMapper.xml
  14. 11 0
      ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceLogMapper.xml
  15. 62 0
      ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceLogStatisMapper.xml
  16. 9 3
      ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceMapper.xml
  17. 24 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

+ 1 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceController.java

@@ -243,7 +243,7 @@ public class PtServiceController extends BaseController {
     @GetMapping("/publish")
     public AjaxResult publish(PtService service) {
         Date nowDate = DateUtils.getNowDate();
-        MdAudit srv = new MdAudit(null, service.getSrvId(), "PUBLISH", service.getAudit(), getUsername(), nowDate, service.getAuditRemark());
+        MdAudit srv = new MdAudit(null, service.getSrvId(), "PUBLISH", service.getPublish(), getUsername(), nowDate, service.getAuditRemark());
         int i = mdAuditService.insertMdAudit(srv);
         service.setPublishBy(getUsername());
         service.setPublishTime(DateUtils.getNowDate());

+ 19 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtServiceLogStatisServiceController.java

@@ -0,0 +1,19 @@
+package com.ruoyi.interfaces.controller;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.interfaces.service.IPtServiceLogStatisService;
+import org.omg.CORBA.BAD_POLICY;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/service/log/statis")
+public class PtServiceLogStatisServiceController extends BaseController {
+
+    @Autowired
+    private IPtServiceLogStatisService serviceLogStatisServices;
+
+
+
+}

+ 2 - 2
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtService.java

@@ -133,9 +133,9 @@ public class PtService implements Serializable {
     private String publishBy;
     private Date publishTime;
     /**
-     * 测试数量
+     * 测试状态
      */
-    private int testRunNum;
+    private Integer senState;
 
 
 }

+ 80 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtServiceLogStatis.java

@@ -0,0 +1,80 @@
+package com.ruoyi.interfaces.domain;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.Date;
+
+public class PtServiceLogStatis extends BaseEntity {
+
+    /**
+     * 日期 yyyyy-mm-dd,;
+     */
+    private Date statisTm;
+    /**
+     * 模型id,;
+     */
+    private String mdId;
+    /**
+     * 服务id,;
+     */
+    private String serId;
+    /**
+     * http调用状态码,;
+     */
+    private String statusCode;
+    /**
+     * 数量,;
+     */
+    private int statisNum;
+
+    public Date getStatisTm() {
+        return statisTm;
+    }
+
+    public void setStatisTm(Date statisTm) {
+        this.statisTm = statisTm;
+    }
+
+    public String getMdId() {
+        return mdId;
+    }
+
+    public void setMdId(String mdId) {
+        this.mdId = mdId;
+    }
+
+    public String getSerId() {
+        return serId;
+    }
+
+    public void setSerId(String serId) {
+        this.serId = serId;
+    }
+
+    public String getStatusCode() {
+        return statusCode;
+    }
+
+    public void setStatusCode(String statusCode) {
+        this.statusCode = statusCode;
+    }
+
+    public int getStatisNum() {
+        return statisNum;
+    }
+
+    public void setStatisNum(int statisNum) {
+        this.statisNum = statisNum;
+    }
+
+    public PtServiceLogStatis(Date statisTm, String mdId, String serId, String statusCode, int statisNum) {
+        this.statisTm = statisTm;
+        this.mdId = mdId;
+        this.serId = serId;
+        this.statusCode = statusCode;
+        this.statisNum = statisNum;
+    }
+
+    public PtServiceLogStatis() {
+    }
+}

+ 18 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/MdJobScheduleMapper.java

@@ -0,0 +1,18 @@
+package com.ruoyi.interfaces.mapper;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+
+@Mapper
+@DataSource(DataSourceType.SLAVE)
+public interface MdJobScheduleMapper {
+    Date selectScheduleByProCode(@Param("proCode") String proCode);
+
+    int updateScheduleByProCode(@Param("proCode")String proCode,@Param("scheduleTime") Date scheduleTime);
+
+    int insertScheduleByProCode(@Param("proCode")String proCode,@Param("scheduleTime") Date scheduleTime);
+}

+ 9 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceLogMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.interfaces.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.interfaces.domain.PtServiceLog;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
 
 import java.util.List;
 
@@ -60,4 +61,12 @@ public interface PtServiceLogMapper extends BaseMapper<PtServiceLog>
      * @return 结果
      */
     public int deletePtServiceLogByLogIds(Long[] logIds);
+
+
+    /**
+     * 定时计算时间段内的模型服务调用情况
+     * @param serviceLogStatis
+     * @return
+     */
+    List<PtServiceLogStatis> selectServiceLogStatis(PtServiceLogStatis serviceLogStatis);
 }

+ 16 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceLogStatisMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.interfaces.mapper;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+@DataSource(DataSourceType.SLAVE)
+public interface PtServiceLogStatisMapper {
+    PtServiceLogStatis selectPtServiceLogStatis(PtServiceLogStatis serviceLogStatis);
+
+    int insertPtServiceLogStatis(PtServiceLogStatis serviceLogStatis);
+
+    int updatePtServiceLogStatis(PtServiceLogStatis serviceLogStatis);
+}

+ 2 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IPtServiceLogService.java

@@ -2,6 +2,7 @@ package com.ruoyi.interfaces.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.interfaces.domain.PtServiceLog;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
 
 import java.util.List;
 
@@ -61,4 +62,5 @@ public interface IPtServiceLogService extends IService<PtServiceLog>
      */
     public int deletePtServiceLogByLogId(Long logId);
 
+    List<PtServiceLogStatis> selectServiceLogStatis(PtServiceLogStatis serviceLogStatis);
 }

+ 8 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IPtServiceLogStatisService.java

@@ -0,0 +1,8 @@
+package com.ruoyi.interfaces.service;
+
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
+
+public interface IPtServiceLogStatisService {
+
+    int insertPtServiceLogStatis(PtServiceLogStatis serviceLogStatis);
+}

+ 7 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceLogServiceImpl.java

@@ -2,11 +2,13 @@ package com.ruoyi.interfaces.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.interfaces.domain.PtServiceLog;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
 import com.ruoyi.interfaces.mapper.PtServiceLogMapper;
 import com.ruoyi.interfaces.service.IPtServiceLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -86,4 +88,9 @@ public class PtServiceLogServiceImpl extends ServiceImpl<PtServiceLogMapper, PtS
     public int deletePtServiceLogByLogId(Long logId) {
         return ptServiceLogMapper.deletePtServiceLogByLogId(logId);
     }
+
+    @Override
+    public List<PtServiceLogStatis> selectServiceLogStatis(PtServiceLogStatis serviceLogStatis) {
+        return ptServiceLogMapper.selectServiceLogStatis(serviceLogStatis);
+    }
 }

+ 32 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceLogStatisServiceImpl.java

@@ -0,0 +1,32 @@
+package com.ruoyi.interfaces.service.impl;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
+import com.ruoyi.interfaces.mapper.PtServiceLogStatisMapper;
+import com.ruoyi.interfaces.service.IPtServiceLogStatisService;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PtServiceLogStatisServiceImpl implements IPtServiceLogStatisService {
+
+    @Autowired
+    private PtServiceLogStatisMapper ptServiceLogStatisMapper;
+
+    @Override
+    public int insertPtServiceLogStatis(PtServiceLogStatis serviceLogStatis) {
+        if (StringUtils.isNotNull(serviceLogStatis.getMdId())
+                && StringUtils.isNotNull(serviceLogStatis.getSerId())
+                && StringUtils.isNotNull(serviceLogStatis.getStatisTm())
+                && StringUtils.isNotNull(serviceLogStatis.getStatusCode())
+        ) {
+            if (StringUtils.isNull(ptServiceLogStatisMapper.selectPtServiceLogStatis(serviceLogStatis))){
+                return ptServiceLogStatisMapper.insertPtServiceLogStatis(serviceLogStatis);
+            }else {
+                return ptServiceLogStatisMapper.updatePtServiceLogStatis(serviceLogStatis);
+            }
+        }
+        return 0;
+    }
+}

+ 71 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/snailJob/ServiceLogStatisJob.java

@@ -0,0 +1,71 @@
+package com.ruoyi.interfaces.snailJob;
+
+import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
+import com.aizuda.snailjob.client.job.core.dto.JobArgs;
+import com.aizuda.snailjob.model.dto.ExecuteResult;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.JsonUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.interfaces.domain.MdAppFlow;
+import com.ruoyi.interfaces.domain.PtServiceLog;
+import com.ruoyi.interfaces.domain.PtServiceLogStatis;
+import com.ruoyi.interfaces.mapper.MdJobScheduleMapper;
+import com.ruoyi.interfaces.mapper.PtServiceLogMapper;
+import com.ruoyi.interfaces.service.IPtServiceLogService;
+import com.ruoyi.interfaces.service.IPtServiceLogStatisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Component
+public class ServiceLogStatisJob {
+
+
+    public final static String PRO_CODE = "SERVICE_LOG_STATIS";
+
+    @Autowired
+    private IPtServiceLogService ptServiceLogService;
+
+    @Autowired
+    private IPtServiceLogStatisService serviceLogStatisService;
+
+    @Autowired
+    private MdJobScheduleMapper jobScheduleMapper;
+
+
+    @JobExecutor(name = "serviceLogStatisJob")
+    public ExecuteResult ServiceLogStatisJob(JobArgs jobArgs) {
+        HashMap<String, String> hashMap = null;
+        if (StringUtils.isNotEmpty(jobArgs.getJobParams().toString()))
+            hashMap = JsonUtils.jsonToPojo(jobArgs.getJobParams().toString(), HashMap.class);
+        Date schedule = null;
+        Date endTime = DateUtils.getNowDate();
+
+        if (StringUtils.isEmpty(hashMap)) {
+            schedule = jobScheduleMapper.selectScheduleByProCode(PRO_CODE);
+            if (StringUtils.isNull(schedule)) {
+                Date lastHourTime = DateUtils.getLastHourTime(new Date(), 24);
+                schedule = DateUtils.getDateDD(lastHourTime);
+                jobScheduleMapper.insertScheduleByProCode(PRO_CODE, schedule);
+            }
+        } else {
+            schedule = DateUtils.dateTime(DateUtils.YYYY_MM_DD, hashMap.get("beginTime").toString());
+            endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD, hashMap.get("endTime").toString());
+        }
+
+        for (long i = schedule.getTime(); i <= endTime.getTime(); ) {
+            PtServiceLogStatis serviceLogStatis = new PtServiceLogStatis();
+            serviceLogStatis.getParams().put("beginTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date(i)));
+            serviceLogStatis.getParams().put("endTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.getLastHourTime(new Date(i), -24)));
+            List<PtServiceLogStatis> ptServiceLogStatis = ptServiceLogService.selectServiceLogStatis(serviceLogStatis);
+            ptServiceLogStatis.forEach(serviceLogStatisService::insertPtServiceLogStatis);
+            i = DateUtils.getLastHourTime(new Date(i), -24).getTime();
+            if (StringUtils.isEmpty(hashMap))
+                jobScheduleMapper.updateScheduleByProCode(PRO_CODE, new Date(i));
+        }
+        return ExecuteResult.success("执行成功");
+    }
+}

+ 21 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdJobScheduleMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.interfaces.mapper.MdJobScheduleMapper">
+    <insert id="insertScheduleByProCode">
+        insert into MD_JOB_SCHEDULE (PRO_CODE, SCHEDULE_TIME, UPDATE_TIME)
+        values (#{proCode}, #{scheduleTime}, sysDate)
+    </insert>
+    <update id="updateScheduleByProCode">
+        update MD_JOB_SCHEDULE
+        set SCHEDULE_TIME = #{scheduleTime},
+            update_Time = sysDate
+        where PRO_CODE = #{proCode}
+    </update>
+    <select id="selectScheduleByProCode" resultType="java.util.Date">
+        select to_char(SCHEDULE_TIME, 'yyyy-mm-dd hh24:mi:ss')
+        from MD_JOB_SCHEDULE t
+        where PRO_CODE = #{proCode}
+    </select>
+</mapper>

+ 11 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceLogMapper.xml

@@ -52,6 +52,17 @@
         <include refid="selectPtServiceLogVo"/>
         where log_id = #{logId}
     </select>
+    <select id="selectServiceLogStatis" resultType="com.ruoyi.interfaces.domain.PtServiceLogStatis">
+        SELECT tm as statis_Tm, MD_ID, SER_ID, STATUS_CODE, count(1) statisNum
+        FROM (SELECT MD_ID, SER_ID, STATUS_CODE, to_char(tm, 'yyyy-mm-dd') tm from pt_Service_Log
+        <where>
+            tm &gt;= to_date(#{params.beginTime},'yyyy-mm-dd')
+            and tm &lt; to_date(#{params.endTime},'yyyy-mm-dd')
+        </where>
+        )
+        GROUP BY tm, MD_ID, SER_ID, STATUS_CODE
+
+    </select>
 
     <insert id="insertPtServiceLog" parameterType="com.ruoyi.interfaces.domain.PtServiceLog" useGeneratedKeys="true"
             keyProperty="logId">

+ 62 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceLogStatisMapper.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.interfaces.mapper.PtServiceLogStatisMapper">
+
+    <resultMap type="com.ruoyi.interfaces.domain.PtServiceLogStatis" id="PtServiceLogStatisMap">
+        <result property="statisTm" column="STATIS_TM" jdbcType="DATE"/>
+        <result property="mdId" column="MD_ID" jdbcType="VARCHAR"/>
+        <result property="serId" column="SER_ID" jdbcType="VARCHAR"/>
+        <result property="statusCode" column="STATUS_CODE" jdbcType="VARCHAR"/>
+        <result property="statisNum" column="STATIS_NUM" jdbcType="INTEGER"/>
+    </resultMap>
+    <sql id="selectPtServiceLogStatis">
+        select STATIS_TM,
+               MD_ID,
+               SER_ID,
+               STATUS_CODE,
+               STATIS_NUM
+        from PT_SERVICE_LOG_STATIS
+    </sql>
+    <insert id="insertPtServiceLogStatis">
+        insert into PT_SERVICE_LOG_STATIS
+        (STATIS_TM,
+         MD_ID,
+         SER_ID,
+         STATUS_CODE,
+         STATIS_NUM)
+        values (#{statisTm,jdbcType=DATE},
+                #{mdId,jdbcType=VARCHAR},
+                #{serId,jdbcType=VARCHAR},
+                #{statusCode,jdbcType=VARCHAR},
+                #{statisNum,jdbcType=INTEGER})
+    </insert>
+    <update id="updatePtServiceLogStatis">
+        update PT_SERVICE_LOG_STATIS
+            STATIS_NUM = #{statisNum,jdbcType=INTEGER},
+        where
+            STATIS_TM = #{statisTm,jdbcType=DATE}
+          and MD_ID = #{mdId,jdbcType=VARCHAR}
+          and SER_ID = #{serId,jdbcType=VARCHAR}
+          and STATUS_CODE = #{statusCode,jdbcType=VARCHAR}
+    </update>
+    <select id="selectPtServiceLogStatis" resultMap="PtServiceLogStatisMap">
+        <include refid="selectPtServiceLogStatis"/>
+        <where>
+            <if test="statisTm != null ">
+                and STATIS_TM = #{statisTm}
+            </if>
+            <if test="mdId != null and mdId != ''">
+                and MD_ID = #{mdId}
+            </if>
+            <if test="serId != null and serId != ''">
+                and SER_ID = #{serId}
+            </if>
+            <if test="statusCode != null and statusCode != ''">
+                and STATUS_CODE = #{statusCode}
+            </if>
+            <if test="statisNum != null ">
+                and STATIS_NUM = #{statisNum}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 9 - 3
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceMapper.xml

@@ -633,7 +633,7 @@ PUBLISH_TIME
         <result column="DATA_RANGE" property="dataRange" jdbcType="VARCHAR"/>
         <result column="APPLY_NUM" property="applyNum" jdbcType="INTEGER"/>
         <result column="DATA_NUM" property="dataNum" jdbcType="INTEGER"/>
-        <result column="TEST_RUN_NUM" property="testRunNum" jdbcType="INTEGER"/>
+        <result column="SEN_STATE" property="senState" jdbcType="INTEGER"/>
         <result column="S_AUDIT" property="audit" jdbcType="VARCHAR"/>
         <result column="S_AUDIT_BY" property="auditBy" jdbcType="VARCHAR"/>
         <result column="S_AUDIT_TIME" property="auditTime"/>
@@ -749,9 +749,15 @@ PUBLISH_TIME
         s.PUBLISH AS S_PUBLISH,
         s.PUBLISH_BY AS S_PUBLISH_BY,
         s.PUBLISH_TIME AS S_PUBLISH_TIME,
-        r.TEST_RUN_NUM
+        r.SEN_STATE
         from md_model_info m left join pt_service s on m.mdid = s.MDID
-        LEFT JOIN ( select ser_id,count(1) as TEST_RUN_NUM from pt_service_run_log group by ser_id ) r ON s.SRV_ID =
+        LEFT JOIN (
+        SELECT ser_id, sen_state FROM (
+        SELECT t.* ,
+        ROW_NUMBER () OVER (PARTITION BY ser_id ORDER BY run_tm DESC ) rn
+        FROM pt_service_run_log t
+        ) WHERE rn = 1
+        ) r ON s.SRV_ID =
         r.ser_id
         <where>
             <if test="mdid != null ">and m.mdid = #{mdid}</if>

+ 24 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -401,4 +401,28 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     }
 
 
+    /**
+     * 获取上n个小时时间
+     *
+     * @param date
+     * @return
+     */
+    public static Date getLastHourTime(Date date, int n) {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(date);
+        ca.add(Calendar.HOUR_OF_DAY, -n);
+        date = ca.getTime();
+        return date;
+    }
+    /**
+     * 获取数据天时间的0点
+     *
+     * @param date
+     * @return
+     */
+    public static Date getDateDD(Date date) {
+        String dateToStr = parseDateToStr(YYYY_MM_DD, date) + " 00:00:00";
+
+        return dateTime(YYYY_MM_DD_HH_MM_SS, dateToStr);
+    }
 }