From b698526a6d8e3abb2f1c2e13ee0cb6d86a9346a4 Mon Sep 17 00:00:00 2001 From: Hai Liang Wang Date: Thu, 6 Sep 2018 19:48:38 +0800 Subject: [PATCH] #59 fix identifier error in contact model --- .../api/rest/ApiContactNotesController.java | 36 +++++++++++++++++++ .../cc/webim/web/model/ContactNotes.java | 12 ++++--- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 contact-center/app/src/main/java/com/chatopera/cc/webim/web/handler/api/rest/ApiContactNotesController.java diff --git a/contact-center/app/src/main/java/com/chatopera/cc/webim/web/handler/api/rest/ApiContactNotesController.java b/contact-center/app/src/main/java/com/chatopera/cc/webim/web/handler/api/rest/ApiContactNotesController.java new file mode 100644 index 00000000..1f833aa0 --- /dev/null +++ b/contact-center/app/src/main/java/com/chatopera/cc/webim/web/handler/api/rest/ApiContactNotesController.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2018 Chatopera Inc, + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.chatopera.cc.webim.web.handler.api.rest; + +import com.chatopera.cc.webim.service.es.ContactNotesRepository; +import com.chatopera.cc.webim.web.handler.Handler; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 联系人笔记 + */ +@RestController +@RequestMapping("/api/contactnotes") +@Api(value = "联系人笔记", description = "管理联系人笔记") +public class ApiContactNotesController extends Handler { + + @Autowired + private ContactNotesRepository contactNotesRes; + +} diff --git a/contact-center/app/src/main/java/com/chatopera/cc/webim/web/model/ContactNotes.java b/contact-center/app/src/main/java/com/chatopera/cc/webim/web/model/ContactNotes.java index a0da0721..08d3a36e 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/webim/web/model/ContactNotes.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/webim/web/model/ContactNotes.java @@ -16,10 +16,11 @@ package com.chatopera.cc.webim.web.model; +import com.chatopera.cc.util.UKTools; +import org.hibernate.annotations.GenericGenerator; import org.springframework.data.elasticsearch.annotations.Document; -import javax.persistence.Entity; -import javax.persistence.Table; +import javax.persistence.*; import java.util.Date; @Document(indexName = "cskefu", type = "contact_notes") @@ -28,7 +29,7 @@ import java.util.Date; @org.hibernate.annotations.Proxy(lazy = false) public class ContactNotes { - private String id; + private String id = UKTools.getUUID(); private String contactid; private Date createtime; private Date updatetime; @@ -40,7 +41,10 @@ public class ContactNotes { private String onlineuser; private String orgi; - + @Id + @Column(length = 32) + @GeneratedValue(generator = "system-uuid") + @GenericGenerator(name = "system-uuid", strategy = "assigned") public String getId() { return id; }