|
|
|
@ -3,11 +3,14 @@ package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysFileService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDictionary;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysFile;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
@ -58,7 +61,9 @@ public class SysFileController extends CoreBaseController{
|
|
|
|
|
public ResultBean updateSysFile(SysFile sysFile){
|
|
|
|
|
try {
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(sysFile).notNull("name",sysFile.getName());
|
|
|
|
|
ValidatorBean.beginValid(sysFile)
|
|
|
|
|
.notNull("id",sysFile.getId())
|
|
|
|
|
.notNull("name",sysFile.getName());
|
|
|
|
|
|
|
|
|
|
sysFileService.updateSysFile(sysFile);
|
|
|
|
|
return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
@ -242,4 +247,39 @@ public class SysFileController extends CoreBaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/insert")
|
|
|
|
|
@ApiOperation(value = "新增文件资源",notes = "新增文件资源")
|
|
|
|
|
public ResultBean insertSysFile(@RequestBody SysFile sysFile){
|
|
|
|
|
try {
|
|
|
|
|
// 条件验证
|
|
|
|
|
ValidatorBean.beginValid(sysFile)
|
|
|
|
|
.notNull("dfsFileName",sysFile.getDfsFileName())
|
|
|
|
|
.notNull("dfsGroupName",sysFile.getDfsGroupName())
|
|
|
|
|
.notNull("fileOriginalName",sysFile.getFileOriginalName());
|
|
|
|
|
|
|
|
|
|
// 文件类型验证
|
|
|
|
|
SysDictionary dictionary = dictionaryService.getSysDictionaryByParentCodeAndCode(BaseConstWords.DICTIONARY_FILE_TYPE,
|
|
|
|
|
StringTool.getStringFileSuffix(sysFile.getFileOriginalName(),false));
|
|
|
|
|
if(dictionary == null){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_FORMAT.getCode())
|
|
|
|
|
.setErrorDetail("文件格式不支持")
|
|
|
|
|
.setErrorSolution("请到字典管理中添加文件类型")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化数据
|
|
|
|
|
sysFile.setFileTypeId(dictionary.getId());
|
|
|
|
|
sysFile.setFileTypeName(dictionary.getName());
|
|
|
|
|
|
|
|
|
|
sysFile = sysFileService.insertSysFile(sysFile);
|
|
|
|
|
return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(sysFile);
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|