| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | import com.xzx.gc.common.utils.MqUtil; |
| | | import com.xzx.gc.entity.*; |
| | | import com.xzx.gc.model.admin.GoodsCategoryModel; |
| | | import com.xzx.gc.model.order.OrderInfoVo; |
| | | import com.xzx.gc.shop.dto.*; |
| | | import com.xzx.gc.shop.mapper.*; |
| | | import com.xzx.gc.shop.vo.*; |
| | |
| | | import tk.mybatis.mapper.entity.Example; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | public Map<String, Object> queryGoodsList(QueryGoodsListDto model) { |
| | | String name = model.getName(); |
| | | int delFlag = model.getDelFlag(); |
| | | ScoreGoods scoreGoods = new ScoreGoods(); |
| | | scoreGoods.setName(name); |
| | | scoreGoods.setDelFlag(Convert.toShort(delFlag)); |
| | | String name = model.getName() == null ? "":model.getName(); |
| | | int delFlag = model.getDelFlag() == null ? 2:model.getDelFlag(); |
| | | PageHelper.startPage(model.getPage(), model.getLimit()); |
| | | |
| | | List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(scoreGoods); |
| | | List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(name,delFlag); |
| | | PageInfo pageInfo = new PageInfo(maps); |
| | | int count = Convert.toInt(pageInfo.getTotal()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | scoreGoodsMapper.updateByExampleSelective(scoreGoods,exampleGoods); |
| | | } |
| | | } |
| | | |
| | | public List<ViewGoodsCategoryListVo> viewGoodsCategoryList(ViewGoodsCategoryListDto viewGoodsCategoryListDto) { |
| | | List<ViewGoodsCategoryListVo> maps = new ArrayList<>(); |
| | | if(viewGoodsCategoryListDto.getParentId() == 0L){ |
| | | maps = scoreGoodsCategoryMapper.viewGoodsCategoryOneList(viewGoodsCategoryListDto.getParentId()); |
| | | }else{ |
| | | maps = scoreGoodsCategoryMapper.viewGoodsCategoryList(); |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | public List<GoodsCategoryVo> findCategoryWithChildren() { |
| | | return scoreGoodsCategoryMapper.selectCategoryWithChildren(); |
| | | } |
| | | |
| | | public PageInfo<XcxGoodsListVo> findGoodsListInPage(XcxGoodsListDto xcxGoodsListDto) { |
| | | |
| | | PageHelper.startPage(xcxGoodsListDto.getPageNo(), xcxGoodsListDto.getPageSize()); |
| | | List<XcxGoodsListVo> data = scoreGoodsMapper.selectXcxGoodsList(xcxGoodsListDto); |
| | | |
| | | return new PageInfo<>(data); |
| | | } |
| | | |
| | | public XcxGoodsDetailVo findGoodsDetails(Long id) { |
| | | XcxGoodsDetailVo data = scoreGoodsMapper.selectGoodsDetailsById(id); |
| | | XcxGoodsListDto dto = new XcxGoodsListDto(); |
| | | dto.setId(id); |
| | | List<XcxGoodsListVo> list = scoreGoodsMapper.selectXcxGoodsList(dto); |
| | | |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | data.setQuantity(list.get(0).getQuantity()); |
| | | data.setStock(list.get(0).getStock()); |
| | | } |
| | | |
| | | if (ScoreGoods.ISQG_YES.equals(data.getIsQg())) { |
| | | Long remain = DateUtil.between(new Date(), data.getQgEndTime(), DateUnit.SECOND, false); |
| | | data.setRemainTime(remain); |
| | | } |
| | | return data; |
| | | } |
| | | } |