Commit 1e4d7d2d6cd61b1c22f11c932bfd3a6357dff0f3

Authored by litao
1 parent ae080416ab

优惠券时间对比规则更改

Showing 4 changed files with 18 additions and 18 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java View file @ 1e4d7d2
... ... @@ -169,7 +169,7 @@
169 169 Object unitType = temp.get("unit_type");
170 170 if(actualStart != null && actualEnd != null && unitType != null && type != null) {
171 171 if(validateDate(userId, Integer.parseInt(actualStart.toString()), Integer.parseInt(actualEnd.toString()),
172   - Integer.parseInt(unitType.toString()), hospitalId, Integer.parseInt(type.toString()))) {
  172 + Integer.parseInt(unitType.toString()), hospitalId, Integer.parseInt(type.toString()), 1)) {
173 173 couponMapper.save(couponInfo);
174 174 }
175 175 }
... ... @@ -247,7 +247,7 @@
247 247  
248 248 /** 验证时间 */
249 249 if(!validateDate(couponInfo.getUserId(), Integer.parseInt(data.get("actual_start").toString()), Integer.parseInt(data.get("actual_end").toString()), Integer.parseInt(data.get("unit_type").toString()),
250   - data.get("create_hospital_id").toString(), Integer.parseInt(data.get("type").toString())))
  250 + data.get("create_hospital_id").toString(), Integer.parseInt(data.get("type").toString()), 2))
251 251 return RespBuilder.buildErro(ResponseCode.COUPON_TIME_OUT, patientsInfo);
252 252  
253 253 /** 验证区域 */
254 254  
... ... @@ -355,9 +355,10 @@
355 355 * @param unitType 时间单位 1=孕周 2=天数 3=月龄
356 356 * @param hospitalId 医院id
357 357 * @param couponType 产检券类型 1=孕妇 2=产妇 3=儿童
  358 + * @param validateType 验证类型 1=创建 2=使用
358 359 * @return
359 360 */
360   - private boolean validateDate(String userId, Integer start, Integer end, Integer unitType, String hospitalId, Integer couponType) {
  361 + private boolean validateDate(String userId, Integer start, Integer end, Integer unitType, String hospitalId, Integer couponType, Integer validateType) {
361 362 Date midDate = null;
362 363 Date startDate = null;
363 364 Date endDate = null;
... ... @@ -397,8 +398,12 @@
397 398 startDate = DateUtils.addMonths(midDate, start);
398 399 endDate = DateUtils.addMonths(midDate, end + 1);
399 400 }
400   - if(DateUtil.isBetween(new Date(), startDate, endDate)) {
401   - return true;
  401 + if(validateType == 2) { /**使用 */
  402 + if(DateUtil.isBetween(new Date(), startDate, endDate)) {
  403 + return true;
  404 + }
  405 + } else if(validateType == 1) {
  406 + return DateUtil.isLtOrEq(new Date(), startDate);
402 407 }
403 408 }
404 409 return false;
platform-common/src/main/java/com/lyms/platform/common/enums/AbortionEnums.java View file @ 1e4d7d2
1 1 package com.lyms.platform.common.enums;
2 2  
3 3 /**
  4 + * 流产方式
4 5 * @Author: litao
5 6 * @Date: 2017/5/15 0015 14:17
6 7 * @Version: V1.0
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 1e4d7d2
... ... @@ -863,16 +863,7 @@
863 863 * @return
864 864 */
865 865 public static boolean isLtOrEq(Date date1, Date date2) {
866   - try {
867   - date1 = ymd.parse(ymd.format(date1));
868   - date2 = ymd.parse(ymd.format(date2));
869   - if(org.apache.commons.lang3.time.DateUtils.isSameDay(date1, date2) || date1.before(date2)) {
870   - return true;
871   - }
872   - } catch (Exception e){
873   - e.printStackTrace();
874   - }
875   - return false;
  866 + return isGtOrEq(date2, date1);
876 867 }
877 868  
878 869 /**
... ... @@ -892,7 +883,7 @@
892 883  
893 884 public static void main(String[] arg) throws Exception {
894 885 Date now = new Date();
895   - Date start = y_m_d_h_m_s.parse("2017-01-31 11:11:11");
  886 + Date start = y_m_d_h_m_s.parse("2017-04-30 11:11:11");
896 887 Date end = y_m_d_h_m_s.parse("2017-04-30 11:11:11");
897 888 System.out.println(isBetween(now, start, end));
898 889  
... ... @@ -900,6 +891,9 @@
900 891 long startTime = 1483372800000l;
901 892 long endTime = end.getTime();
902 893 System.out.println();
  894 +
  895 + Date d2 = new Date();
  896 + System.out.println(isLtOrEq(start, end));
903 897 }
904 898 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EarController.java View file @ 1e4d7d2
... ... @@ -48,9 +48,9 @@
48 48 * 获取 添加儿童建档界面的 下拉列表数据
49 49 * @return
50 50 */
51   - @RequestMapping(value = "/config", method = RequestMethod.GET)
  51 + @RequestMapping(value = "/configs", method = RequestMethod.GET)
52 52 @ResponseBody
53   - public BaseObjectResponse config() {
  53 + public BaseObjectResponse configs() {
54 54 return babyPatientExtendEarService.getConfigs();
55 55 }
56 56