浏览代码

超级管理员修改公司名

cs 2 年之前
父节点
当前提交
9c6db0172c

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/CompanyController.java

@@ -14,6 +14,7 @@ import com.management.platform.service.ExpenseTypeService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import com.taobao.api.ApiException;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -213,5 +214,25 @@ public class CompanyController {
         return httpRespMsg;
     }
 
+    @RequestMapping("/editCompanyName")
+    public HttpRespMsg editCompanyName(String name,HttpServletRequest request){
+        HttpRespMsg msg = new HttpRespMsg();
+        String token = request.getHeader("token");
+        User user = userMapper.selectById(token);
+        if (StringUtils.isBlank(name)){
+            msg.setError("公司名称不可为空");
+            return msg;
+        }
+        if ("超级管理员".equals(user.getRoleName())){
+            Company company = companyMapper.selectById(user.getCompanyId());
+            company.setCompanyName(name);
+            companyMapper.updateById(company);
+            msg.msg = "修改成功";
+        }else {
+            msg.setError("无权修改");
+        }
+        return msg;
+    }
+
 }
 

+ 0 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -278,7 +278,6 @@ public class UserController {
      */
     @RequestMapping("/areaData")
     public HttpRespMsg areaData(HttpServletRequest request){
-        HttpRespMsg httpRespMsg=new HttpRespMsg();
         String token = request.getHeader("token");
         return userService.areaData(token);
     }