| | |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.MultifileMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Multifile; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.CategoryService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | private CategoryMapper categoryMapper; |
| | | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Override |
| | |
| | | if(Objects.isNull(category) |
| | | || Objects.isNull(category.getType()) |
| | | || Objects.isNull(category.getName()) |
| | | || (!Constants.equalsInteger(category.getType(),Constants.ZERO)&& CollectionUtils.isEmpty(category.getDetailList())) |
| | | || (Constants.equalsInteger(category.getType(),Constants.ONE) && (Objects.isNull(category.getIcon())||Objects.isNull(category.getIsFixed())) ) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | |
| | | category.setCreateUser(loginUserInfo.getId()); |
| | | category.setUpdateTime(new Date()); |
| | | category.setUpdateUser(loginUserInfo.getId()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(category.getDetailList()) |
| | | && !Constants.equalsInteger(category.getType(),Constants.THREE)){ |
| | | category.setDetail(category.getDetailList().toJSONString()); |
| | | } |
| | | if(!Constants.equalsInteger(category.getType(),Constants.ONE)){ |
| | | category.setIsFixed(Constants.ZERO); |
| | | } |
| | |
| | | || Objects.isNull(category.getId()) |
| | | || Objects.isNull(category.getType()) |
| | | || Objects.isNull(category.getName()) |
| | | || (!Constants.equalsInteger(category.getType(),Constants.ZERO)&& CollectionUtils.isEmpty(category.getDetailList())) |
| | | || (Constants.equalsInteger(category.getType(),Constants.ONE) && (Objects.isNull(category.getIcon())||Objects.isNull(category.getIsFixed())) ) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | |
| | | category.setUpdateTime(new Date()); |
| | | category.setIsFixed(null); |
| | | category.setUpdateUser(loginUserInfo.getId()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(category.getDetailList()) |
| | | && !Constants.equalsInteger(category.getType(),Constants.THREE)){ |
| | | category.setDetail(category.getDetailList().toJSONString()); |
| | | } |
| | | categoryMapper.updateById(category); |
| | | } |
| | | @Override |
| | |
| | | category.setUpdateTime(new Date()); |
| | | category.setIsFixed(null); |
| | | category.setUpdateUser(loginUserInfo.getId()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(category.getDetailList())){ |
| | | category.setDetail(category.getDetailList().toJSONString()); |
| | | } |
| | | categoryMapper.updateById(category); |
| | | } |
| | | |
| | |
| | | Category category = categoryMapper.selectById(id); |
| | | if(Objects.isNull(category)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(StringUtils.isNotBlank(category.getDetail())){ |
| | | category.setDetailList(JSONArray.parseArray(category.getDetail())); |
| | | } |
| | | if(StringUtils.isNotBlank(category.getIcon())){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RESOURCE_PATH).getCode() |
| | |
| | | +systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.CATEGORY_FILES).getCode(); |
| | | for(Category cate : result.getRecords()){ |
| | | try { |
| | | if(StringUtils.isNotBlank(cate.getDetail())){ |
| | | cate.setDetailList(JSONArray.parseArray(cate.getDetail())); |
| | | } |
| | | if(StringUtils.isNotBlank(cate.getIcon())){ |
| | | cate.setIconFull(path + cate.getIcon()); |
| | | } |
| | |
| | | .orderByAsc(Category::getSortnum) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryList)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.CATEGORY_FILES).getCode(); |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RESOURCE_PATH).getCode(); |
| | | String categoryFile = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.CATEGORY_FILES).getCode(); |
| | | for (Category category:categoryList) { |
| | | if(StringUtils.isNotBlank(category.getDetail())){ |
| | | category.setDetailList(JSONArray.parseArray(category.getDetail())); |
| | | } |
| | | if(StringUtils.isNotBlank(category.getIcon())){ |
| | | category.setIconFull(path + category.getIcon()); |
| | | category.setIconFull(path + categoryFile + category.getIcon()); |
| | | } |
| | | //商业化排行榜图片 |
| | | if(Constants.equalsInteger(type,Constants.ONE)){ |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .eq(Multifile::getObjType,Constants.ONE) |
| | | .eq(Multifile::getObjId,category.getId()) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | String muFile = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.MEMBER_FILES).getCode(); |
| | | multifileList.forEach(m->{ |
| | | m.setFileurlFull(path + muFile + m.getFileurl()); |
| | | }); |
| | | } |
| | | category.setMultifileList(multifileList); |
| | | } |
| | | } |
| | | } |