|
@@ -1,11 +1,14 @@
|
|
|
package com.ruoyi.portal.controller;
|
|
|
|
|
|
+import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.utils.file.FileTypeUtils;
|
|
|
import com.ruoyi.common.core.web.controller.BaseController;
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
-import com.ruoyi.system.api.domain.SysObjDictType;
|
|
|
+import com.ruoyi.system.api.RemoteFileService;
|
|
|
+import com.ruoyi.system.api.domain.SysFile;import com.ruoyi.system.api.domain.SysObjDictType;
|
|
|
import com.ruoyi.system.db.DBExecResult;
|
|
|
import com.ruoyi.system.db.DBFactory;
|
|
|
import com.ruoyi.system.db.DBImpl;
|
|
@@ -16,8 +19,10 @@ import com.ruoyi.system.utils.SubCodeUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -35,6 +40,9 @@ public class PortalSysDeptJlController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysDeptJlService sysDeptJlService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteFileService remoteFileService;
|
|
|
+
|
|
|
/** 根据登陆人查前三级地区信息 */
|
|
|
@GetMapping("/getLevel")
|
|
|
public TableDataInfo getLevelList()
|
|
@@ -49,7 +57,7 @@ public class PortalSysDeptJlController extends BaseController
|
|
|
public AjaxResult getList(SysDeptJl sysDeptJl)
|
|
|
{
|
|
|
if(StringUtils.isEmpty(sysDeptJl.getParentId()) && StringUtils.isEmpty(sysDeptJl.getId())){
|
|
|
- sysDeptJl.setId(OtherConstants.DEPT_ID_JL);
|
|
|
+ sysDeptJl.setId(OtherConstants.DEPT_CODE_JL);
|
|
|
}
|
|
|
List<SysDeptJl> list = sysDeptJlService.selectSysDeptJlList(sysDeptJl);
|
|
|
return AjaxResult.success(list);
|
|
@@ -89,4 +97,23 @@ public class PortalSysDeptJlController extends BaseController
|
|
|
else
|
|
|
return AjaxResult.error("数据获取失败");
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/uploadFile")
|
|
|
+ public AjaxResult uploadFile(MultipartFile file)
|
|
|
+ {
|
|
|
+ if (!file.isEmpty()) {
|
|
|
+ String extension = FileTypeUtils.getExtension(file);
|
|
|
+ R<SysFile> fileResult = remoteFileService.upload(file);
|
|
|
+ if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("文件服务异常,请联系管理员");
|
|
|
+ }
|
|
|
+ String url = fileResult.getData().getUrl();
|
|
|
+ AjaxResult ajax = AjaxResult.success();
|
|
|
+ ajax.put("imgUrl", url);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ return AjaxResult.error("上传图片异常,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
}
|