|
@@ -1,10 +1,13 @@
|
|
|
package com.ruoyi.portal.controller;
|
|
|
|
|
|
+import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
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.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;
|
|
@@ -16,9 +19,12 @@ 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.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -35,6 +41,9 @@ public class PortalSysDeptJlController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysDeptJlService sysDeptJlService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteFileService remoteFileService;
|
|
|
+
|
|
|
/** 根据登陆人查前三级地区信息 */
|
|
|
@GetMapping("/getLevel")
|
|
|
public TableDataInfo getLevelList()
|
|
@@ -49,7 +58,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 +98,22 @@ public class PortalSysDeptJlController extends BaseController
|
|
|
else
|
|
|
return AjaxResult.error("数据获取失败");
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/uploadFile")
|
|
|
+ public AjaxResult uploadFile(MultipartFile file)
|
|
|
+ {
|
|
|
+ if (!file.isEmpty()) {
|
|
|
+ R<SysFile> fileResult = remoteFileService.upload(file);
|
|
|
+ if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("文件服务异常,请联系管理员");
|
|
|
+ }
|
|
|
+ Map<String, String> res = new HashMap<>();
|
|
|
+ res.put("url", fileResult.getData().getUrl());
|
|
|
+ res.put("name", fileResult.getData().getName());
|
|
|
+ return AjaxResult.success(res);
|
|
|
+ }
|
|
|
+ return AjaxResult.error("上传图片异常,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
}
|