| | |
| | | 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; |
| | |
| | | |
| | | Date target = null; |
| | | Date buyValidDate = null; |
| | | if (type == 1) { |
| | | buyValidDate = DateUtil.calDate(shoppingGoods.getBuyDateNum(), shoppingGoods.getBuyDateUnit()); |
| | | if (type == 1 && StrUtil.isNotBlank(shoppingGoods.getBuyValid())) { |
| | | buyValidDate = DateUtil.stringToDate(shoppingGoods.getBuyValid(), "yyyy-MM-dd"); |
| | | } 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 (type == 2 && StrUtil.isNotBlank(shoppingGoods.getUseValid())) { |
| | | useValidDate = DateUtil.stringToDate(shoppingGoods.getUseValid(), "yyyy-MM-dd"); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | } |