Răsfoiți Sursa

user 处理

huangxingxing 3 luni în urmă
părinte
comite
019adbd857

+ 37 - 4
adi-admin/src/main/java/com/adi/airopt/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.adi.airopt.controller;
 
+import com.adi.airopt.vo.AiroptUser;
 import com.adi.common.core.controller.BaseController;
 import com.adi.common.core.domain.AjaxResult;
 import com.adi.common.core.page.PageDomain;
@@ -11,10 +12,8 @@ import com.alibaba.fastjson2.JSONObject;
 import org.apache.http.HttpResponse;
 import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.*;
@@ -141,6 +140,40 @@ public class UserController extends BaseController {
         }
 
     }
+    /**
+     * 用户信息修改
+     */
+    @RequestMapping("update")
+    public AjaxResult update(@Validated @RequestBody AiroptUser user) throws IOException
+    {
+        String host =airConfig.getUrl();
+        Map<String, String> bodys =new HashMap<>();
+        bodys.put("channelNo",airConfig.getChannelNo());
+        bodys.put("clientToken",airConfig.getClientToken());
+        bodys.put("transCode","B00033");
+        bodys.put("userId",airConfig.getUserId());
+        bodys.put("uid",user.getUid());
+        bodys.put("nickName",user.getNickName());
+        bodys.put("username",user.getUsername());
+        bodys.put("mobileNo",user.getMobileNo());
+        bodys.put("headProfile",user.getHeadProfile());
+        bodys.put("company",user.getCompany());
+        bodys.put("email",user.getEmail());
+        try {
+            HttpResponse response= HttpUtils.doPost(host,bodys);
+            int stat = response.getStatusLine().getStatusCode();
+            if (stat != 200) {
+                return AjaxResult.error("业务服务链接失败");
+            }
+            String res = EntityUtils.toString(response.getEntity());
+            JSONObject res_obj = JSONObject.parseObject(res);
+            return AjaxResult.success(res_obj);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error("业务服务链接失败");
+        }
+
+    }
 }
 
 

+ 81 - 0
adi-admin/src/main/java/com/adi/airopt/vo/AiroptUser.java

@@ -0,0 +1,81 @@
+package com.adi.airopt.vo;
+
+import com.adi.common.xss.Xss;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+
+/**
+ *
+ */
+public class AiroptUser {
+
+    private String uid;
+    private String nickName;
+    private String username;
+    private String mobileNo;
+    private String headProfile;
+    private String company;
+    private String email;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+    @Xss(message = "用户昵称不能包含脚本字符")
+    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
+    public String getNickName() {
+        return nickName;
+    }
+
+    public void setNickName(String nickName) {
+        this.nickName = nickName;
+    }
+    @Xss(message = "用户账号不能包含脚本字符")
+    @NotBlank(message = "用户账号不能为空")
+    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
+    public String getMobileNo() {
+        return mobileNo;
+    }
+
+    public void setMobileNo(String mobileNo) {
+        this.mobileNo = mobileNo;
+    }
+
+    public String getHeadProfile() {
+        return headProfile;
+    }
+
+    public void setHeadProfile(String headProfile) {
+        this.headProfile = headProfile;
+    }
+
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+    @Email(message = "邮箱格式不正确")
+    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}

+ 1 - 3
adi-ui/package.json

@@ -1,5 +1,5 @@
 {
-  "name": "ruoyi",
+  "name": "adi",
   "version": "3.8.9",
   "description": "后端管理系统",
   "author": "后端",
@@ -32,8 +32,6 @@
     "management-system"
   ],
   "repository": {
-    "type": "git",
-    "url": "https://gitee.com/y_project/RuoYi-Vue.git"
   },
   "dependencies": {
     "@riophae/vue-treeselect": "0.4.0",