| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | |
| | | return DateUtil.stringToDate("2099-12-31", DateUtil.DATE_FORMAT_DD); |
| | | } |
| | | |
| | | if (type == 2 && buyDate == null) { |
| | | throw new GlobleException("购买日期不能为空"); |
| | | } |
| | | // if (type == 2 && buyDate == null) { |
| | | // throw new GlobleException("购买日期不能为空"); |
| | | // } |
| | | |
| | | Date target = null; |
| | | Date buyValidDate = null; |
| | | Date buyValidDate = DateUtil.stringToDate("2099-12-31", DateUtil.DATE_FORMAT_DD);; |
| | | if (type == 1) { |
| | | buyValidDate = DateUtil.calDate(shoppingGoods.getBuyDateNum(), shoppingGoods.getBuyDateUnit()); |
| | | if (shoppingGoods.getBuyDateNum() != null && StrUtil.isNotBlank(shoppingGoods.getBuyDateUnit())) { |
| | | buyValidDate = DateUtil.calDate(shoppingGoods.getBuyDateNum(), shoppingGoods.getBuyDateUnit()); |
| | | } |
| | | } else { |
| | | buyValidDate = buyDate; |
| | | } |
| | | |
| | | Date useValidDate = DateUtil.stringToDate("2099-12-31", DateUtil.DATE_FORMAT_DD); |
| | | if (type == 2) { |
| | | useValidDate = DateUtil.calDate(shoppingGoods.getUseDateNum(), shoppingGoods.getUseDateUnit()); |
| | | if (shoppingGoods.getUseDateNum() != null && StrUtil.isNotBlank(shoppingGoods.getUseDateUnit())) { |
| | | useValidDate = DateUtil.calDate(shoppingGoods.getUseDateNum(), shoppingGoods.getUseDateUnit()); |
| | | } |
| | | } |
| | | |
| | | if (buyValidDate.after(useValidDate)) { |
| | | target = useValidDate; |
| | | } else { |
| | | target = buyValidDate; |
| | | if (buyValidDate != null) { |
| | | if (buyValidDate.after(useValidDate)) { |
| | | target = useValidDate; |
| | | } else { |
| | | target = buyValidDate; |
| | | } |
| | | } |
| | | |
| | | if (shoppingGoods.getInvalidTime() != null) { |
| | | if (target.after(shoppingGoods.getInvalidTime())) { |
| | | if (target != null) { |
| | | if (target.after(shoppingGoods.getInvalidTime())) { |
| | | target = shoppingGoods.getInvalidTime(); |
| | | } |
| | | } else { |
| | | target = shoppingGoods.getInvalidTime(); |
| | | } |
| | | } |