| | |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.dto.ShoppingGoodsListDto; |
| | | import com.matrix.system.app.vo.ShoppingGoodsListVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.UtilDao; |
| | | import com.matrix.system.common.tools.ServiceUtil; |
| | |
| | | shoppingGoods.setReferencePice(0D); |
| | | } |
| | | // 验证套餐卡卡必须填写最大使用次数 |
| | | if (Dictionary.FLAG_YES_Y.equals(shoppingGoods.getIsCourse())) { |
| | | if (Dictionary.FLAG_YES_Y.equals(shoppingGoods.getIsCourse()) && Dictionary.FLAG_NO_N.equals(shoppingGoods.getIsInfinite())) { |
| | | if (shoppingGoods.getCarUseCount() == null) { |
| | | shoppingGoods.setCarUseCount(0); |
| | | } |
| | |
| | | @Override |
| | | public Date calInvalidTime(ShoppingGoods shoppingGoods, @NotNull Integer type, Date buyDate) { |
| | | if (StringUtils.isBlank(shoppingGoods.getBuyValid()) && StringUtils.isBlank(shoppingGoods.getUseValid()) && shoppingGoods.getInvalidTime() == null) { |
| | | return null; |
| | | return DateUtil.stringToDate("9999-12-31", DateUtil.DATE_FORMAT_DD); |
| | | } |
| | | |
| | | if (type == 2 && buyDate == null) { |
| | |
| | | } |
| | | return target; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ShoppingGoodsListVo> findShoppingGoodsListForApi(ShoppingGoodsListDto shoppingGoodsListDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | shoppingGoodsListDto.setShopId(user.getShopId()); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | int offset = (shoppingGoodsListDto.getPageNum() - 1) + shoppingGoodsListDto.getPageSize(); |
| | | int limit = shoppingGoodsListDto.getPageSize(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | return shoppingGoodsDao.selectShoppingGoodsApiInPage(shoppingGoodsListDto, pageVo); |
| | | } |
| | | |
| | | @Override |
| | | public int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | shoppingGoodsListDto.setShopId(user.getShopId()); |
| | | return shoppingGoodsDao.selectShopppingGoodsAipTotal(shoppingGoodsListDto); |
| | | } |
| | | } |