소스 검색

时间优化2

wangfeng 5 년 전
부모
커밋
89e6bfe55a
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 4
      mrman-service/src/main/java/com/diagbot/facade/StdBehospitalInfoFacade.java

+ 10 - 4
mrman-service/src/main/java/com/diagbot/facade/StdBehospitalInfoFacade.java

@@ -52,10 +52,16 @@ public class StdBehospitalInfoFacade extends StdBehospitalInfoServiceImpl {
     BehospitalInfoHystrixClient behospitalInfoHystrixClient;
 
     public IPage<SthospitalInfoPageDTO> getSthospitalInfoPages(SthospitalInfoPageVO sthospitalInfoPageVO) {
-       Date startDate = sthospitalInfoPageVO.getLeaveHosDateStart();
-        Date endDate = sthospitalInfoPageVO.getLeaveHosDateEnd();
-        if (endDate.getTime() < startDate.getTime()) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateStart()) {
+            sthospitalInfoPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(sthospitalInfoPageVO.getLeaveHosDateStart()));
+        }
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateEnd()) {
+            sthospitalInfoPageVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(sthospitalInfoPageVO.getLeaveHosDateEnd(), 1)));
+        }
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateStart() && null != sthospitalInfoPageVO.getLeaveHosDateEnd()) {
+            if (DateUtil.after(sthospitalInfoPageVO.getLeaveHosDateStart(), sthospitalInfoPageVO.getLeaveHosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
+            }
         }
         return stdBehospitalInfoService.getStdPage(sthospitalInfoPageVO);
     }