| | |
| | | import com.mzl.flower.entity.customer.Collect; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.*; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.payment.Cart; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.entity.payment.OrderItem; |
| | |
| | | flowerMapper.updateFlowerSales(oi.getFlowerId(), oi.getNum()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Async |
| | | public synchronized void updateCategoryInfo(Long category){ |
| | | flowerMapper.updateFlowerCategoryInfo(category); |
| | | } |
| | | |
| | | /** |
| | |
| | | dto.setZoneName(String.join(",", zoneNameLs)); |
| | | } |
| | | |
| | | //TODO 合伙人加价列表 |
| | | |
| | | return dto; |
| | | } |
| | | |
| | |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> ls = flowerMapper.selectFlowerShowList(page, dto); |
| | | if(ls != null && ls.size() > 0){ |
| | | Long partnerId = getCurrentCustomerPartner(); |
| | | for(FlowerShowListDTO s : ls){ |
| | | BigDecimal price = getFinalPrice(partnerId, s.getCategory() |
| | | , s.getId(), s.getPrice(), s.getLevel()); |
| | | s.setPrice(price); |
| | | s.setCollection(s.getCollectCount() > 0); |
| | | s.setShopnum(s.getShopnum() == null ? 0 : s.getShopnum()); |
| | | |
| | | if(s.getSales() != null && s.getRealSales() != null){ |
| | | s.setSales(s.getSales() + s.getRealSales()); |
| | | } |
| | | } |
| | | } |
| | | prepareShowList(ls); |
| | | |
| | | page.setRecords(ls); |
| | | |
| | |
| | | if(pId == null){ |
| | | pId = getCurrentCustomerPartner(); |
| | | } |
| | | Customer p = getCurrentCustomerWithoutCheck(); |
| | | Long levelId = p == null ? null : p.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | BigDecimal price = getFinalPrice(pId, dto.getCategory() |
| | | , s.getId(), dto.getPrice(), dto.getLevel()); |
| | | dto.setPrice(price); |
| | | dto.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | String userId = SecurityUtils.getUserId(); |
| | | if(StringUtils.isNotEmpty(userId)) { |
| | |
| | | |
| | | public Page<FlowerShowListDTO> myCollect(Page page, FlowerShowQueryDTO dto) { |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | /*if (StringUtils.isNotEmpty(dto.getColumn())) { |
| | | List<OrderItem> orders = new ArrayList<>(); |
| | | OrderItem i = new OrderItem(); |
| | | i.setColumn(dto.getColumn()); |
| | | i.setAsc(dto.isAsc()); |
| | | page.setOrders(orders); |
| | | }*/ |
| | | if (StringUtils.isNotEmpty(dto.getColumn())) { |
| | | if(dto.getColumn().contains("sales") |
| | | || dto.getColumn().contains("stock")){ |
| | | dto.setColumn(dto.getColumn() + " desc"); |
| | | } |
| | | } |
| | | |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> flowerShowListDTOS = flowerMapper.myCollect(page, dto); |
| | | prepareShowList(flowerShowListDTOS); |
| | | |
| | | page.setRecords(flowerShowListDTOS); |
| | | return page; |
| | | } |
| | | |
| | | private void prepareShowList(List<FlowerShowListDTO> ls){ |
| | | if(ls != null && ls.size() > 0){ |
| | | Customer p = getCurrentCustomerWithoutCheck(); |
| | | Long partnerId = p == null ? null : p.getPartnerId(); |
| | | Long levelId = p == null ? null : p.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | for(FlowerShowListDTO s : ls){ |
| | | BigDecimal price = getFinalPrice(partnerId, s.getCategory() |
| | | , s.getId(), s.getPrice(), s.getLevel()); |
| | | s.setPrice(price); |
| | | s.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | s.setCollection(s.getCollectCount() > 0); |
| | | s.setShopnum(s.getShopnum() == null ? 0 : s.getShopnum()); |
| | | |
| | | if(s.getSales() != null && s.getRealSales() != null){ |
| | | s.setSales(s.getSales() + s.getRealSales()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Page<FlowerShowListDTO> myBrowseHistory(Page page, FlowerShowQueryDTO dto) { |
| | |
| | | }*/ |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> flowerShowListDTOS = flowerMapper.myBrowseHistory(page, dto); |
| | | prepareShowList(flowerShowListDTOS); |
| | | |
| | | page.setRecords(flowerShowListDTOS); |
| | | return page; |
| | | } |
| | |
| | | if(dto.getZoneId()!=null && dto.getZoneId().size()>0){//添加专区 |
| | | for (Long zoneId : dto.getZoneId()) { |
| | | for(Long flowerId : dto.getIds()) { |
| | | FlowerZoneMap fzp = flowerZoneMapMapper.selectOne(new QueryWrapper<FlowerZoneMap>().eq("flower_id", flowerId).eq("zone_id", zoneId)); |
| | | FlowerZoneMap fzp = flowerZoneMapMapper.selectOne(new QueryWrapper<FlowerZoneMap>() |
| | | .eq("flower_id", flowerId).eq("zone_id", zoneId)); |
| | | if(fzp==null){ |
| | | fzp = new FlowerZoneMap(); |
| | | fzp.setFlowerId(flowerId); |
| | |
| | | |
| | | return page; |
| | | } |
| | | |
| | | public void clearInvalidHistory(String userId) { |
| | | |
| | | List<Long> ids = flowerMapper.searchInvalidHistory(userId); |
| | | if(ids!=null && ids.size()>0){ |
| | | browseService.deleteBatchIds(ids); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |