zjxpcyc 6 anni fa
parent
commit
8eb477500f

+ 9
- 0
whole-estate/src/main/java/com/example/wholeestate/controller/WxUserController.java Vedi File

@@ -30,6 +30,15 @@ public class WxUserController extends BaseController {
30 30
         return responseBean;
31 31
     }
32 32
 
33
+    @RequestMapping(value = "/wx/user", method = RequestMethod.PUT)
34
+    @ApiOperation(value = "更新用户", notes = "更新用户")
35
+    @ApiImplicitParams({
36
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "customerId 用户ID;customerName用户姓名;name昵称;phone手机号;idNum证件号码;openid标记;uuid标记;avatar头像;")
37
+    })
38
+    public ResponseBean updateCustomer(@RequestBody String parameter) {
39
+        return iCustomerService.updateCustomer(parameter);
40
+    }
41
+
33 42
     @RequestMapping(value = "/wx/info/{openid}", method = RequestMethod.GET)
34 43
     @ApiOperation(value = "获取微信小程序用户信息", notes = "获取微信小程序用户信息")
35 44
     @ApiImplicitParams({

+ 2
- 0
whole-estate/src/main/java/com/example/wholeestate/service/ICustomerService.java Vedi File

@@ -42,4 +42,6 @@ public interface ICustomerService extends IService<Customer> {
42 42
      */
43 43
     ResponseBean getWXCustomer(String openid);
44 44
 
45
+
46
+    ResponseBean updateCustomer(String parameter);
45 47
 }

+ 23
- 1
whole-estate/src/main/java/com/example/wholeestate/service/impl/CustomerServiceImpl.java Vedi File

@@ -2,6 +2,7 @@ package com.example.wholeestate.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,9 +11,9 @@ import com.example.wholeestate.common.resp.ResponseBean;
10 11
 import com.example.wholeestate.common.uuid.IdGen;
11 12
 import com.example.wholeestate.dao.CustomerMapper;
12 13
 
13
-import com.example.wholeestate.model.Building;
14 14
 import com.example.wholeestate.model.Customer;
15 15
 import com.example.wholeestate.service.ICustomerService;
16
+import org.apache.http.HttpStatus;
16 17
 import org.springframework.beans.factory.annotation.Autowired;
17 18
 import org.springframework.stereotype.Service;
18 19
 
@@ -93,4 +94,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
93 94
         responseBean.addSuccess(customer);
94 95
         return responseBean;
95 96
     }
97
+
98
+    @Override
99
+    public ResponseBean updateCustomer(String parameter) {
100
+        ResponseBean responseBean = new ResponseBean();
101
+        Customer customer = JSONObject.parseObject(parameter, Customer.class);
102
+
103
+        UpdateWrapper<Customer> updateWrapper = new UpdateWrapper<>();
104
+        updateWrapper.set("customerName", customer.getCustomerName());
105
+        updateWrapper.set("name", customer.getName());
106
+        updateWrapper.set("phone", customer.getPhone());
107
+        updateWrapper.set("idNum", customer.getIdNum());
108
+        updateWrapper.set("remark", customer.getRemark());
109
+        updateWrapper.eq("customer_id", customer.getCustomerId());
110
+
111
+        int success = customerMapper.update(customer, updateWrapper);
112
+        if (success >= 0) {
113
+            responseBean.addError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "更新用户信息失败");
114
+        }
115
+
116
+        return responseBean;
117
+    }
96 118
 }