|
@@ -1,5 +1,6 @@
|
|
|
package com.bosshand.virgo.core.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bosshand.virgo.core.model.Customer;
|
|
|
import com.bosshand.virgo.core.response.Response;
|
|
|
import com.bosshand.virgo.core.service.CustomerService;
|
|
@@ -54,11 +55,20 @@ public class CustomerController {
|
|
|
@ApiOperation("更新")
|
|
|
@RequestMapping(value = "", method = RequestMethod.PUT)
|
|
|
public Response update(@RequestBody Customer customer) {
|
|
|
- Customer c = customerService.getOrganizationId(customer.getOrganizationId(), customer.getUserId());
|
|
|
- if(c != null){
|
|
|
- return Response.fail(20000, "组织下已经指定过该用户为客服了");
|
|
|
+ JSONObject js = new JSONObject();
|
|
|
+ if (customer.getNickName() != null) {
|
|
|
+ js.put("nickname", customer.getNickName());
|
|
|
}
|
|
|
- customerService.update(customer);
|
|
|
+ if (customer.getAvatarUrl() != null) {
|
|
|
+ js.put("avatarUrl", customer.getAvatarUrl());
|
|
|
+ }
|
|
|
+ if (js.size() == 0) {
|
|
|
+ Customer c = customerService.getOrganizationId(customer.getOrganizationId(), customer.getUserId());
|
|
|
+ if (c != null) {
|
|
|
+ return Response.fail(20000, "组织下已经指定过该用户为客服了");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ customerService.update(customer, js);
|
|
|
return Response.ok();
|
|
|
}
|
|
|
|