品类错误修改
This commit is contained in:
@ -12,4 +12,8 @@ public interface ErrorMessageConstant {
|
||||
* "已启用禁用模板不能进行修改"
|
||||
*/
|
||||
public static final String ENABLE_DISABLE_TEMPLATE_NOT_MODIFY = "已启用禁用模板不能进行修改";
|
||||
/**
|
||||
* "请选择上级品类"
|
||||
*/
|
||||
public static final String PLEASE_SELECT_SUPERIOR_CATEGORY = "请选择上级品类";
|
||||
}
|
||||
|
@ -30,18 +30,19 @@ public class FileController {
|
||||
public Map<String, Object> upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
|
||||
String oldName= file.getOriginalFilename();
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
if(!file.isEmpty()){
|
||||
String filename = fileStorageService.storeFile(file);
|
||||
String fileUrl = baseUrl+"/files/" + filename;
|
||||
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("fileName", oldName);
|
||||
response.put("fileType", file.getContentType());
|
||||
response.put("fileSize", file.getSize());
|
||||
response.put("url", fileUrl);
|
||||
response.put("filePath", uploadDir + "/"+filename);
|
||||
|
||||
}
|
||||
return response;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.controller;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.chinaunicom.mall.ebtp.common.base.controller.BaseController;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.ErrorMessageConstant;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.ICoscoCategoryService;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.CoscoCategoryVO;
|
||||
@ -70,6 +71,9 @@ public class CoscoCategoryController extends BaseController {
|
||||
*/
|
||||
@PostMapping
|
||||
public BaseResponse<Integer> add(@RequestBody CoscoCategory coscoCategory) {
|
||||
if(coscoCategory.getParentId()==null){
|
||||
BaseResponse.fail(ErrorMessageConstant.PLEASE_SELECT_SUPERIOR_CATEGORY);
|
||||
}
|
||||
return BaseResponse.success(coscoCategoryService.insertCoscoCategory(coscoCategory));
|
||||
}
|
||||
|
||||
|
@ -63,13 +63,13 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
@Override
|
||||
public int insertCoscoCategory(CoscoCategory coscoCategory) {
|
||||
coscoCategory.setId(PropertyUtils.getSnowflakeId());
|
||||
if(coscoCategory.getParentId()!=null && !coscoCategory.getParentId().equals("0")){
|
||||
if (!coscoCategory.getParentId().equals("0")) {
|
||||
CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId());
|
||||
if(coscoCategory1.getType().equals(1L)){
|
||||
if (coscoCategory1.getType().equals(1L)) {
|
||||
throw new RuntimeException("请选择正确的父级分类");
|
||||
}
|
||||
coscoCategory.setAncestors(coscoCategory1.getAncestors()+","+coscoCategory.getId());
|
||||
}else{
|
||||
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
|
||||
} else {
|
||||
coscoCategory.setAncestors("0");
|
||||
}
|
||||
coscoCategory.setCreateTime(new Date());
|
||||
@ -117,13 +117,13 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
public IPage<CoscoCategoryVO> getPage(CoscoCategoryVO coscoCategory) {
|
||||
IPage<CoscoCategoryVO> p = new Page<>(coscoCategory.getBasePageRequest().getPageNo(),
|
||||
coscoCategory.getBasePageRequest().getPageSize());
|
||||
return coscoCategoryMapper.selectMyPage(p,coscoCategory);
|
||||
return coscoCategoryMapper.selectMyPage(p, coscoCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoscoCategoryVO> selectCategoryTree(CoscoCategory coscoCategory) {
|
||||
List<CoscoCategory> coscoCategories = coscoCategoryMapper.selectCoscoCategoryList(coscoCategory);
|
||||
List<CoscoCategoryVO> cosco=new ArrayList<>();
|
||||
List<CoscoCategoryVO> cosco = new ArrayList<>();
|
||||
for (CoscoCategory co : coscoCategories) {
|
||||
cosco.add(BeanUtil.toBean(co, CoscoCategoryVO.class));
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
/**
|
||||
* 获取全部上级部门id
|
||||
*/
|
||||
List<String> deptIds=new ArrayList<>();
|
||||
List<String> deptIds = new ArrayList<>();
|
||||
deptIds.add("dep01");
|
||||
coscoCategory.setDeptIds(deptIds);
|
||||
return selectCategoryTree(coscoCategory);
|
||||
@ -172,5 +172,4 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user