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