| | |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.PricingRuleMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.PricingRule; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.CategoryService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | |
| | | @Autowired |
| | | private CategoryMapper categoryMapper; |
| | | |
| | | @Autowired |
| | | private PricingRuleMapper pricingRuleMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | |
| | | return categoryList; |
| | | } |
| | | |
| | | @Override |
| | | public List<Category> getCitySizeList(Integer cityId) { |
| | | // 1. 查询该城市已配置的异地寄送规则(pricing_rule type=1),获取fieldA(物品尺寸主键) |
| | | List<PricingRule> rules = pricingRuleMapper.selectList(new QueryWrapper<PricingRule>().lambda() |
| | | .eq(PricingRule::getDeleted, Constants.ZERO) |
| | | .eq(PricingRule::getType, Constants.ONE) |
| | | .eq(PricingRule::getCityId, cityId)); |
| | | if (CollectionUtils.isEmpty(rules)) { |
| | | return java.util.Collections.emptyList(); |
| | | } |
| | | List<Integer> sizeIds = new java.util.ArrayList<>(); |
| | | for (PricingRule rule : rules) { |
| | | if (StringUtils.isNotBlank(rule.getFieldA())) { |
| | | sizeIds.add(Integer.parseInt(rule.getFieldA())); |
| | | } |
| | | } |
| | | if (sizeIds.isEmpty()) { |
| | | return java.util.Collections.emptyList(); |
| | | } |
| | | // 2. 查询对应的物品尺寸(category type=4) |
| | | List<Category> sizeList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getDeleted, Constants.ZERO) |
| | | .eq(Category::getStatus, Constants.ZERO) |
| | | .eq(Category::getType, Constants.FOUR) |
| | | .in(Category::getId, sizeIds) |
| | | .orderByAsc(Category::getSortnum)); |
| | | // 3. 拼接图标全路径 |
| | | if (!CollectionUtils.isEmpty(sizeList)) { |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.CATEGORY_FILES).getCode(); |
| | | for (Category cate : sizeList) { |
| | | if (StringUtils.isNotBlank(cate.getIcon())) { |
| | | cate.setIconFull(path + cate.getIcon()); |
| | | } |
| | | } |
| | | } |
| | | return sizeList; |
| | | } |
| | | |
| | | private void validateByType(Category category) { |
| | | if (Constants.equalsInteger(category.getType(), Constants.ONE)) { |
| | | if (StringUtils.isBlank(category.getOtherField())) { |