| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | * @param baseConditionVO |
| | | * @return |
| | | */ |
| | | public List<C3mOrderBo> orderList(BaseConditionVO baseConditionVO) { |
| | | public List<C3mOrderBo> orderList(BaseConditionVO baseConditionVO, String keyword, |
| | | Integer orderStatus, Integer timeType) { |
| | | if (orderStatus != null && (orderStatus > 5 || orderStatus < 0)) { |
| | | throw new BusinessException("订单状态不正确"); |
| | | } |
| | | Long userId = SecurityUtils.getClientId(); |
| | | //查询近一个月的订单 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startTime = null; |
| | | ; |
| | | Long startTimeStamp = null; |
| | | Long nowTimeStamp = null; |
| | | if (timeType != null) { |
| | | if (timeType == 1) { |
| | | //查询近一个月的订单 |
| | | startTime = now.minusMonths(1); |
| | | } else if (timeType == 2) { |
| | | //查询近三个月的订单 |
| | | startTime = now.minusMonths(3); |
| | | } else if (timeType == 3) { |
| | | //查询近半年的订单 |
| | | startTime = now.minusMonths(6); |
| | | } else { |
| | | throw new BusinessException("时间类型不正确"); |
| | | } |
| | | //startTime转换为时间戳 |
| | | startTimeStamp = startTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); |
| | | //endTime转换为时间戳 |
| | | nowTimeStamp = now.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<C3mOrderBo> list = baseMapper.orderList(userId); |
| | | List<C3mOrderBo> list = baseMapper.orderList(userId, keyword, orderStatus, startTimeStamp, nowTimeStamp); |
| | | return list; |
| | | } |
| | | |