mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix ContactsRepository related class
This commit is contained in:
parent
ad6946e859
commit
ce30bca698
@ -30,56 +30,55 @@ import com.chatopera.cc.proxy.AgentStatusProxy;
|
|||||||
import com.chatopera.cc.proxy.AgentUserProxy;
|
import com.chatopera.cc.proxy.AgentUserProxy;
|
||||||
import com.chatopera.compose4j.Functional;
|
import com.chatopera.compose4j.Functional;
|
||||||
import com.chatopera.compose4j.Middleware;
|
import com.chatopera.compose4j.Middleware;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve AgentUser
|
* Resolve AgentUser
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ACDVisBodyParserMw.class);
|
private final static Logger logger = LoggerFactory.getLogger(ACDVisBodyParserMw.class);
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserContactsRepository agentUserContactsRes;
|
private final AgentUserContactsRepository agentUserContactsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes;
|
private final ContactsRepository contactsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentUserProxy agentUserProxy;
|
private final AgentUserProxy agentUserProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private AgentStatusProxy agentStatusProxy;
|
private final AgentStatusProxy agentStatusProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDQueueService acdQueueService;
|
private final ACDQueueService acdQueueService;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDMessageHelper acdMessageHelper;
|
private final ACDMessageHelper acdMessageHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置AgentUser基本信息
|
* 设置AgentUser基本信息
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param next
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void apply(final ACDComposeContext ctx, final Functional next) {
|
public void apply(final ACDComposeContext ctx, final Functional next) {
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* NOTE AgentUser代表一次会话记录,在上一个会话结束,并且由坐席人员点击"清除"后,会从数据库中删除
|
* NOTE AgentUser代表一次会话记录,在上一个会话结束,并且由坐席人员点击"清除"后,会从数据库中删除
|
||||||
* 此处查询到的,可能是之前的会话。其状态需要验证,所以不一定是由TA来服务本次会话。
|
* 此处查询到的,可能是之前的会话。其状态需要验证,所以不一定是由TA来服务本次会话。
|
||||||
*/
|
*/
|
||||||
AgentUser agentUser = cache.findOneAgentUserByUserIdAndOrgi(ctx.getOnlineUserId(), ctx.getOrgi()).orElseGet(
|
AgentUser agentUser = cache.findOneAgentUserByUserIdAndOrgi(ctx.getOnlineUserId(), ctx.getOrgi()).orElseGet(
|
||||||
() -> {
|
() -> {
|
||||||
/**
|
/*
|
||||||
* NOTE 新创建的AgentUser不需要设置Status和Agentno
|
* NOTE 新创建的AgentUser不需要设置Status和Agentno
|
||||||
* 因为两个值在后面会检查,如果存在则不会申请新的Agent
|
* 因为两个值在后面会检查,如果存在则不会申请新的Agent
|
||||||
*/
|
*/
|
||||||
@ -125,11 +124,11 @@ public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
|||||||
|
|
||||||
next.apply();
|
next.apply();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 发送通知
|
* 发送通知
|
||||||
*/
|
*/
|
||||||
if (ctx.getAgentService() != null && StringUtils.isNotBlank(ctx.getAgentService().getStatus())) {
|
if (ctx.getAgentService() != null && StringUtils.isNotBlank(ctx.getAgentService().getStatus())) {
|
||||||
/**
|
/*
|
||||||
* 找到空闲坐席,如果未找到坐席,则将该用户放入到 排队队列
|
* 找到空闲坐席,如果未找到坐席,则将该用户放入到 排队队列
|
||||||
*/
|
*/
|
||||||
switch (MainContext.AgentUserStatusEnum.toValue(ctx.getAgentService().getStatus())) {
|
switch (MainContext.AgentUserStatusEnum.toValue(ctx.getAgentService().getStatus())) {
|
||||||
@ -150,9 +149,7 @@ public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
|||||||
ctx.getAgentService().getQueneindex());
|
ctx.getAgentService().getQueneindex());
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(ctx.getAgentService().getAgentuserid())) {
|
if (StringUtils.isNotBlank(ctx.getAgentService().getAgentuserid())) {
|
||||||
agentUserProxy.findOne(ctx.getAgentService().getAgentuserid()).ifPresent(p -> {
|
agentUserProxy.findOne(ctx.getAgentService().getAgentuserid()).ifPresent(ctx::setAgentUser);
|
||||||
ctx.setAgentUser(p);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 如果是 INSERVICE 那么 agentService.getAgentuserid 就一定不能为空?
|
// TODO 如果是 INSERVICE 那么 agentService.getAgentuserid 就一定不能为空?
|
||||||
@ -219,10 +216,6 @@ public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
|||||||
* <p>
|
* <p>
|
||||||
* TODO 此处有一些问题:如果联系人更新了名字,那么么后面TA的会话用的还是旧的名字,
|
* TODO 此处有一些问题:如果联系人更新了名字,那么么后面TA的会话用的还是旧的名字,
|
||||||
* 所以,在更新联系人名字的时候,也应更新其对应的AgentUser里面的名字
|
* 所以,在更新联系人名字的时候,也应更新其对应的AgentUser里面的名字
|
||||||
*
|
|
||||||
* @param agentUser
|
|
||||||
* @param nickname
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private String resolveAgentUsername(final AgentUser agentUser, final String nickname) {
|
private String resolveAgentUsername(final AgentUser agentUser, final String nickname) {
|
||||||
if (!StringUtils.equals(agentUser.getUsername(), nickname)) {
|
if (!StringUtils.equals(agentUser.getUsername(), nickname)) {
|
||||||
@ -233,7 +226,7 @@ public class ACDVisBodyParserMw implements Middleware<ACDComposeContext> {
|
|||||||
AgentUserContacts agentUserContact = agentUserContactsRes.findOneByUseridAndOrgi(
|
AgentUserContacts agentUserContact = agentUserContactsRes.findOneByUseridAndOrgi(
|
||||||
agentUser.getUserid(), agentUser.getOrgi()).orElse(null);
|
agentUser.getUserid(), agentUser.getOrgi()).orElse(null);
|
||||||
if (agentUserContact != null) {
|
if (agentUserContact != null) {
|
||||||
Contacts contact = contactsRes.findOneById(agentUserContact.getContactsid()).orElseGet(null);
|
Contacts contact = contactsRes.findOneById(agentUserContact.getContactsid()).orElse(null);
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
return contact.getName();
|
return contact.getName();
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,15 @@ import com.chatopera.cc.util.RestResultType;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@ -56,40 +56,35 @@ import java.util.Optional;
|
|||||||
* 联系人服务
|
* 联系人服务
|
||||||
* 联系人管理功能
|
* 联系人管理功能
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/contacts")
|
@RequestMapping("/api/contacts")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class ApiContactsController extends Handler {
|
public class ApiContactsController extends Handler {
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ApiContactsController.class);
|
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRepository;
|
private final ContactsRepository contactsRepository;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes;
|
private final ContactsProxy contactsProxy;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsProxy contactsProxy;
|
private final AgentUserProxy agentUserProxy;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AgentUserProxy agentUserProxy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回用户列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
* 返回用户列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
public ResponseEntity<RestResult> list(HttpServletRequest request, @Valid String creater, @Valid String q) {
|
public ResponseEntity<RestResult> list(HttpServletRequest request, @Valid String creater, @Valid String q) {
|
||||||
Page<Contacts> contactsList = null;
|
Page<Contacts> contactsList;
|
||||||
if (!StringUtils.isBlank(creater)) {
|
if (!StringUtils.isBlank(creater)) {
|
||||||
User user = super.getUser(request);
|
User user = super.getUser(request);
|
||||||
contactsList = contactsRepository.findByCreaterAndSharesAndOrgi(user.getId(), user.getId(),
|
contactsList = contactsRepository.findByCreaterAndSharesAndOrgi(user.getId(), user.getId(),
|
||||||
super.getOrgi(request), false, q,
|
super.getOrgi(request), false, q,
|
||||||
PageRequest.of(
|
PageRequest.of(
|
||||||
super.getP(request),
|
super.getP(request),
|
||||||
super.getPs(request)));
|
super.getPs(request)));
|
||||||
} else {
|
} else {
|
||||||
contactsList = contactsRepository.findByOrgi(super.getOrgi(request), false, q,
|
contactsList = contactsRepository.findByOrgi(super.getOrgi(request), false, q,
|
||||||
PageRequest.of(super.getP(request), super.getPs(request)));
|
PageRequest.of(super.getP(request), super.getPs(request)));
|
||||||
@ -99,9 +94,6 @@ public class ApiContactsController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改用户用户 ,在修改用户信息的时候,如果用户 密码未改变,请设置为 NULL
|
* 新增或修改用户用户 ,在修改用户信息的时候,如果用户 密码未改变,请设置为 NULL
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.PUT)
|
@RequestMapping(method = RequestMethod.PUT)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
@ -122,43 +114,34 @@ public class ApiContactsController extends Handler {
|
|||||||
/**
|
/**
|
||||||
* 删除用户,只提供 按照用户ID删除 , 并且,不能删除系统管理员
|
* 删除用户,只提供 按照用户ID删除 , 并且,不能删除系统管理员
|
||||||
* 删除联系人,联系人删除是逻辑删除,将 datastatus字段标记为 true,即已删除
|
* 删除联系人,联系人删除是逻辑删除,将 datastatus字段标记为 true,即已删除
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.DELETE)
|
@RequestMapping(method = RequestMethod.DELETE)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
public ResponseEntity<RestResult> delete(HttpServletRequest request, @Valid String id) {
|
public ResponseEntity<RestResult> delete(@Valid String id) {
|
||||||
RestResult result = new RestResult(RestResultType.OK);
|
RestResult result = new RestResult(RestResultType.OK);
|
||||||
if (!StringUtils.isBlank(id)) {
|
if (!StringUtils.isBlank(id)) {
|
||||||
Contacts contacts = contactsRepository.findOne(id);
|
contactsRepository.findById(id).ifPresent(contacts -> {
|
||||||
if (contacts != null) { //系统管理员, 不允许 使用 接口删除
|
//系统管理员, 不允许 使用 接口删除
|
||||||
contacts.setDatastatus(true);
|
contacts.setDatastatus(true);
|
||||||
contactsRepository.save(contacts);
|
contactsRepository.save(contacts);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联系人页面,客户点击页面时,判断是否有能触达的通道
|
* 联系人页面,客户点击页面时,判断是否有能触达的通道
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST)
|
@RequestMapping(method = RequestMethod.POST)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
public ResponseEntity<String> operations(
|
public ResponseEntity<String> operations(
|
||||||
final HttpServletRequest request,
|
final HttpServletRequest request,
|
||||||
@RequestBody final String body) {
|
@RequestBody final String body) {
|
||||||
final JsonObject j = (new JsonParser()).parse(body).getAsJsonObject();
|
final JsonObject j = JsonParser.parseString(body).getAsJsonObject();
|
||||||
logger.info("[chatbot] operations payload {}", j.toString());
|
log.info("[chatbot] operations payload {}", j.toString());
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
HttpHeaders headers = RestUtils.header();
|
HttpHeaders headers = RestUtils.header();
|
||||||
final User logined = super.getUser(request);
|
final User logined = super.getUser(request);
|
||||||
final String orgi = logined.getOrgi();
|
|
||||||
|
|
||||||
if (!j.has("ops")) {
|
if (!j.has("ops")) {
|
||||||
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
json.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
||||||
@ -179,15 +162,11 @@ public class ApiContactsController extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseEntity<String>(json.toString(), headers, HttpStatus.OK);
|
return new ResponseEntity<>(json.toString(), headers, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主动与联系人聊天
|
* 主动与联系人聊天
|
||||||
*
|
|
||||||
* @param payload
|
|
||||||
* @param logined
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private JsonObject proactive(final JsonObject payload, User logined) {
|
private JsonObject proactive(final JsonObject payload, User logined) {
|
||||||
JsonObject resp = new JsonObject();
|
JsonObject resp = new JsonObject();
|
||||||
@ -218,10 +197,6 @@ public class ApiContactsController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据联系人信息查找立即触达的渠道
|
* 根据联系人信息查找立即触达的渠道
|
||||||
*
|
|
||||||
* @param payload
|
|
||||||
* @param logined
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private JsonObject approach(final JsonObject payload, final User logined) {
|
private JsonObject approach(final JsonObject payload, final User logined) {
|
||||||
JsonObject resp = new JsonObject();
|
JsonObject resp = new JsonObject();
|
||||||
@ -233,7 +208,7 @@ public class ApiContactsController extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String contactsid = payload.get("contactsid").getAsString();
|
final String contactsid = payload.get("contactsid").getAsString();
|
||||||
Optional<Contacts> contactOpt = contactsRes.findOneById(contactsid).filter(
|
Optional<Contacts> contactOpt = contactsRepository.findOneById(contactsid).filter(
|
||||||
p -> !p.isDatastatus());
|
p -> !p.isDatastatus());
|
||||||
|
|
||||||
if (contactOpt.isPresent()) {
|
if (contactOpt.isPresent()) {
|
||||||
|
@ -28,15 +28,16 @@ import com.chatopera.cc.util.RestResult;
|
|||||||
import com.chatopera.cc.util.RestResultType;
|
import com.chatopera.cc.util.RestResultType;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@ -54,24 +55,20 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/wl/contacts")
|
@RequestMapping("/api/wl/contacts")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class ApiWlContactsController extends Handler {
|
public class ApiWlContactsController extends Handler {
|
||||||
final private static Logger logger = LoggerFactory.getLogger(ApiWlContactsController.class);
|
final private static Logger logger = LoggerFactory.getLogger(ApiWlContactsController.class);
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes;
|
private final ContactsRepository contactsRes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回联系人列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
* 返回联系人列表,支持分页,分页参数为 p=1&ps=50,默认分页尺寸为 20条每页
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param creater
|
|
||||||
* @param q
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
public ResponseEntity<RestResult> list(HttpServletRequest request, @Valid String creater, @Valid String q) {
|
public ResponseEntity<RestResult> list(HttpServletRequest request, @Valid String creater, @Valid String q) {
|
||||||
Page<Contacts> contactsList = null;
|
Page<Contacts> contactsList;
|
||||||
if (StringUtils.isNotBlank(creater)) {
|
if (StringUtils.isNotBlank(creater)) {
|
||||||
User user = super.getUser(request);
|
User user = super.getUser(request);
|
||||||
contactsList = contactsRes.findByCreaterAndSharesAndOrgi(
|
contactsList = contactsRes.findByCreaterAndSharesAndOrgi(
|
||||||
@ -88,15 +85,11 @@ public class ApiWlContactsController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 联系人
|
* 联系人
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST)
|
@RequestMapping(method = RequestMethod.POST)
|
||||||
@Menu(type = "apps", subtype = "contacts", access = true)
|
@Menu(type = "apps", subtype = "contacts", access = true)
|
||||||
public ResponseEntity<String> operations(HttpServletRequest request, @RequestBody final String body) {
|
public ResponseEntity<String> operations(HttpServletRequest request, @RequestBody final String body) {
|
||||||
final JsonObject j = (new JsonParser()).parse(body).getAsJsonObject();
|
final JsonObject j = JsonParser.parseString(body).getAsJsonObject();
|
||||||
logger.info("[wl/contacts api] operations payload {}", j.toString());
|
logger.info("[wl/contacts api] operations payload {}", j.toString());
|
||||||
JsonObject result = new JsonObject();
|
JsonObject result = new JsonObject();
|
||||||
HttpHeaders headers = RestUtils.header();
|
HttpHeaders headers = RestUtils.header();
|
||||||
@ -106,25 +99,18 @@ public class ApiWlContactsController extends Handler {
|
|||||||
result.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
result.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_FAIL_1);
|
||||||
result.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的请求参数。");
|
result.addProperty(RestUtils.RESP_KEY_ERROR, "不合法的请求参数。");
|
||||||
} else {
|
} else {
|
||||||
switch (StringUtils.lowerCase(j.get("ops").getAsString())) {
|
if ("create".equals(StringUtils.lowerCase(j.get("ops").getAsString()))) { // 增加联系人类型
|
||||||
case "create": // 增加联系人类型
|
result = createContact(logined.getId(), logined.getOrgi(), j);
|
||||||
result = createContact(logined.getId(), logined.getOrgi(), j);
|
} else {
|
||||||
break;
|
logger.info("[wl/contacts api] unknown operation {}", j.toString());
|
||||||
default:
|
|
||||||
logger.info("[wl/contacts api] unknown operation {}", j.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ResponseEntity<String>(result.toString(), headers, HttpStatus.OK);
|
return new ResponseEntity<>(result.toString(), headers, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建/更新联系人
|
* 创建/更新联系人
|
||||||
* 通过UID和SID和CID唯一确定一个联系人
|
* 通过UID和SID和CID唯一确定一个联系人
|
||||||
*
|
|
||||||
* @param creator
|
|
||||||
* @param orgi
|
|
||||||
* @param j
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private JsonObject createContact(
|
private JsonObject createContact(
|
||||||
final String creator,
|
final String creator,
|
||||||
|
@ -29,13 +29,13 @@ import com.chatopera.cc.persistence.repository.UserEventRepository;
|
|||||||
import com.chatopera.cc.persistence.repository.UserRepository;
|
import com.chatopera.cc.persistence.repository.UserRepository;
|
||||||
import com.chatopera.cc.proxy.UserProxy;
|
import com.chatopera.cc.proxy.UserProxy;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -46,34 +46,36 @@ import javax.validation.Valid;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Controller
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class AppsController extends Handler {
|
public class AppsController extends Handler {
|
||||||
private final static Logger logger = LoggerFactory.getLogger(AppsController.class);
|
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ACDWorkMonitor acdWorkMonitor;
|
private final ACDWorkMonitor acdWorkMonitor;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private UserRepository userRes;
|
private final UserRepository userRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private OnlineUserRepository onlineUserRes;
|
private final OnlineUserRepository onlineUserRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private UserEventRepository userEventRes;
|
private final UserEventRepository userEventRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes;
|
private final ContactsRepository contactsRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private OrgiSkillRelRepository orgiSkillRelService;
|
private final OrgiSkillRelRepository orgiSkillRelService;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private Cache cache;
|
private final Cache cache;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private UserProxy userProxy;
|
private final UserProxy userProxy;
|
||||||
|
|
||||||
@RequestMapping({"/apps/content"})
|
@RequestMapping({"/apps/content"})
|
||||||
@Menu(type = "apps", subtype = "content")
|
@Menu(type = "apps", subtype = "content")
|
||||||
@ -81,9 +83,9 @@ public class AppsController extends Handler {
|
|||||||
final User user = super.getUser(request);
|
final User user = super.getUser(request);
|
||||||
final String orgi = super.getOrgi(request);
|
final String orgi = super.getOrgi(request);
|
||||||
|
|
||||||
/****************************
|
// ****************************
|
||||||
* 获得在线访客列表
|
// * 获得在线访客列表
|
||||||
****************************/
|
// ****************************
|
||||||
|
|
||||||
// TODO 此处为从数据库加载
|
// TODO 此处为从数据库加载
|
||||||
final Page<OnlineUser> onlineUserList = onlineUserRes.findByOrgiAndStatus(
|
final Page<OnlineUser> onlineUserList = onlineUserRes.findByOrgiAndStatus(
|
||||||
@ -98,9 +100,9 @@ public class AppsController extends Handler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final long msec = System.currentTimeMillis();
|
final long msec = System.currentTimeMillis();
|
||||||
final List<String> contactIds = new ArrayList<String>();
|
final List<String> contactIds = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 设置访客状态
|
* 设置访客状态
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -111,11 +113,11 @@ public class AppsController extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 获得在线访客与联系人的关联信息
|
* 获得在线访客与联系人的关联信息
|
||||||
*/
|
*/
|
||||||
if (contactIds.size() > 0) {
|
if (contactIds.size() > 0) {
|
||||||
final Iterable<Contacts> contacts = contactsRes.findAll(contactIds);
|
final Iterable<Contacts> contacts = contactsRes.findAllById(contactIds);
|
||||||
for (final OnlineUser onlineUser : onlineUserList.getContent()) {
|
for (final OnlineUser onlineUser : onlineUserList.getContent()) {
|
||||||
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
||||||
for (final Contacts contact : contacts) {
|
for (final Contacts contact : contacts) {
|
||||||
@ -193,7 +195,7 @@ public class AppsController extends Handler {
|
|||||||
Page<OnlineUser> onlineUserList = this.onlineUserRes.findByOrgiAndStatus(
|
Page<OnlineUser> onlineUserList = this.onlineUserRes.findByOrgiAndStatus(
|
||||||
super.getOrgi(request), MainContext.OnlineUserStatusEnum.ONLINE.toString(),
|
super.getOrgi(request), MainContext.OnlineUserStatusEnum.ONLINE.toString(),
|
||||||
PageRequest.of(super.getP(request), super.getPs(request), Sort.Direction.DESC, "createtime"));
|
PageRequest.of(super.getP(request), super.getPs(request), Sort.Direction.DESC, "createtime"));
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<>();
|
||||||
for (OnlineUser onlineUser : onlineUserList.getContent()) {
|
for (OnlineUser onlineUser : onlineUserList.getContent()) {
|
||||||
onlineUser.setBetweentime((int) (System.currentTimeMillis() - onlineUser.getLogintime().getTime()));
|
onlineUser.setBetweentime((int) (System.currentTimeMillis() - onlineUser.getLogintime().getTime()));
|
||||||
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
||||||
@ -201,7 +203,7 @@ public class AppsController extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.size() > 0) {
|
if (ids.size() > 0) {
|
||||||
Iterable<Contacts> contactsList = contactsRes.findAll(ids);
|
Iterable<Contacts> contactsList = contactsRes.findAllById(ids);
|
||||||
for (OnlineUser onlineUser : onlineUserList.getContent()) {
|
for (OnlineUser onlineUser : onlineUserList.getContent()) {
|
||||||
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
if (StringUtils.isNotBlank(onlineUser.getContactsid())) {
|
||||||
for (Contacts contacts : contactsList) {
|
for (Contacts contacts : contactsList) {
|
||||||
@ -228,13 +230,14 @@ public class AppsController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping({"/apps/profile/save"})
|
@RequestMapping({"/apps/profile/save"})
|
||||||
@Menu(type = "apps", subtype = "content")
|
@Menu(type = "apps", subtype = "content")
|
||||||
public ModelAndView profile(ModelMap map, HttpServletRequest request, @Valid User user, @Valid String index) {
|
public ModelAndView profile(HttpServletRequest request, @Valid User user, @Valid String index) {
|
||||||
User tempUser = userRes.getOne(user.getId());
|
Optional<User> optional = userRes.findById(user.getId());
|
||||||
final User logined = super.getUser(request);
|
final User logined = super.getUser(request);
|
||||||
// 用户名不可修改
|
// 用户名不可修改
|
||||||
user.setUsername(logined.getUsername());
|
user.setUsername(logined.getUsername());
|
||||||
|
|
||||||
if (tempUser != null) {
|
if (optional.isPresent()) {
|
||||||
|
User tempUser = optional.get();
|
||||||
String msg = userProxy.validUserUpdate(user, tempUser);
|
String msg = userProxy.validUserUpdate(user, tempUser);
|
||||||
if (StringUtils.isNotBlank(msg) && (!StringUtils.equals(msg, "edit_user_success"))) {
|
if (StringUtils.isNotBlank(msg) && (!StringUtils.equals(msg, "edit_user_success"))) {
|
||||||
// 处理异常返回
|
// 处理异常返回
|
||||||
@ -268,9 +271,8 @@ public class AppsController extends Handler {
|
|||||||
tempUser.setRoleList(sessionUser.getRoleList());
|
tempUser.setRoleList(sessionUser.getRoleList());
|
||||||
tempUser.setRoleAuthMap(sessionUser.getRoleAuthMap());
|
tempUser.setRoleAuthMap(sessionUser.getRoleAuthMap());
|
||||||
tempUser.setAffiliates(sessionUser.getAffiliates());
|
tempUser.setAffiliates(sessionUser.getAffiliates());
|
||||||
User u = tempUser;
|
tempUser.setOrgi(super.getOrgi(request));
|
||||||
u.setOrgi(super.getOrgi(request));
|
super.setUser(request, tempUser);
|
||||||
super.setUser(request, u);
|
|
||||||
//切换成非坐席 判断是否坐席 以及 是否有对话
|
//切换成非坐席 判断是否坐席 以及 是否有对话
|
||||||
if (!user.isAgent()) {
|
if (!user.isAgent()) {
|
||||||
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(
|
AgentStatus agentStatus = cache.findOneAgentStatusByAgentnoAndOrig(
|
||||||
@ -294,9 +296,6 @@ public class AppsController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前产品下人员信息
|
* 获取当前产品下人员信息
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private List<User> getUsers(HttpServletRequest request) {
|
private List<User> getUsers(HttpServletRequest request) {
|
||||||
List<User> userList;
|
List<User> userList;
|
||||||
|
@ -19,8 +19,9 @@ package com.chatopera.cc.controller.resource;
|
|||||||
import com.chatopera.cc.controller.Handler;
|
import com.chatopera.cc.controller.Handler;
|
||||||
import com.chatopera.cc.persistence.es.ContactsRepository;
|
import com.chatopera.cc.persistence.es.ContactsRepository;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -30,14 +31,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class ContactsResourceController extends Handler{
|
@RequiredArgsConstructor
|
||||||
|
public class ContactsResourceController extends Handler {
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private ContactsRepository contactsRes ;
|
private final ContactsRepository contactsRes;
|
||||||
|
|
||||||
@RequestMapping("/res/contacts")
|
@RequestMapping("/res/contacts")
|
||||||
@Menu(type = "res" , subtype = "contacts")
|
@Menu(type = "res", subtype = "contacts")
|
||||||
public ModelAndView add(ModelMap map , HttpServletRequest request , @Valid String q) {
|
public ModelAndView add(ModelMap map, HttpServletRequest request, @Valid String q) {
|
||||||
if (q == null) {
|
if (q == null) {
|
||||||
q = "";
|
q = "";
|
||||||
}
|
}
|
||||||
|
@ -1,51 +1,52 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 优客服-多渠道客服系统
|
* Copyright (C) 2017 优客服-多渠道客服系统
|
||||||
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.chatopera.cc.persistence.es;
|
package com.chatopera.cc.persistence.es;
|
||||||
|
|
||||||
import com.chatopera.cc.model.Contacts;
|
import com.chatopera.cc.model.Contacts;
|
||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface ContactsRepository extends ElasticsearchRepository<Contacts, String>, ContactsEsCommonRepository {
|
@SuppressWarnings({"unused", "SqlResolve", "JpaQlInspection"})
|
||||||
|
public interface ContactsRepository extends ElasticsearchRepository<Contacts, String>, ContactsEsCommonRepository {
|
||||||
int countByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
|
|
||||||
|
int countByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
|
||||||
List<Contacts> findOneByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
|
|
||||||
|
List<Contacts> findOneByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
|
||||||
Contacts findOneByWluidAndWlsidAndWlcidAndDatastatus(String wluid, String wlsid, String wlcid, Boolean datastatus);
|
|
||||||
|
Contacts findOneByWluidAndWlsidAndWlcidAndDatastatus(String wluid, String wlsid, String wlcid, Boolean datastatus);
|
||||||
List<Contacts> findByskypeidAndDatastatus(String skypeid, Boolean datastatus);
|
|
||||||
|
List<Contacts> findByskypeidAndDatastatus(String skypeid, Boolean datastatus);
|
||||||
Contacts findByskypeidAndOrgiAndDatastatus(String skypeid, String orgi, Boolean datastatus);
|
|
||||||
|
Contacts findByskypeidAndOrgiAndDatastatus(String skypeid, String orgi, Boolean datastatus);
|
||||||
@Query(value = "SELECT * FROM uk_contacts WHERE skypeid = ?1 AND datastatus = ?2 LIMIT 1", nativeQuery = true)
|
|
||||||
Contacts findOneBySkypeidAndDatastatus(String skypeid, boolean datastatus);
|
@Query(value = "SELECT * FROM uk_contacts WHERE skypeid = ?1 AND datastatus = ?2 LIMIT 1", nativeQuery = true)
|
||||||
|
Contacts findOneBySkypeidAndDatastatus(String skypeid, boolean datastatus);
|
||||||
List<Contacts> findByidAndDatastatus(String id, Boolean datastatus);
|
|
||||||
|
List<Contacts> findByidAndDatastatus(String id, Boolean datastatus);
|
||||||
Contacts findByidAndOrgiAndDatastatus(String id, String orgi, Boolean datastatus);
|
|
||||||
|
Contacts findByidAndOrgiAndDatastatus(String id, String orgi, Boolean datastatus);
|
||||||
@Query(value = "select u from uk_contacts u where u.skypeid = ?1")
|
|
||||||
List<Contacts> findByskypeid(String skypeid);
|
@Query(value = "select u from uk_contacts u where u.skypeid = ?1")
|
||||||
|
List<Contacts> findByskypeid(String skypeid);
|
||||||
@Query(value = "SELECT * FROM uk_contacts WHERE id = ?1", nativeQuery = true)
|
|
||||||
Optional<Contacts> findOneById(final String id);
|
@Query(value = "SELECT * FROM uk_contacts WHERE id = ?1", nativeQuery = true)
|
||||||
|
Optional<Contacts> findOneById(final String id);
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -1,40 +1,39 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 优客服-多渠道客服系统
|
* Copyright (C) 2017 优客服-多渠道客服系统
|
||||||
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.chatopera.cc.util.dsdata.process;
|
package com.chatopera.cc.util.dsdata.process;
|
||||||
|
|
||||||
import com.chatopera.cc.model.Contacts;
|
import com.chatopera.cc.model.Contacts;
|
||||||
import com.chatopera.cc.persistence.es.ContactsRepository;
|
import com.chatopera.cc.persistence.es.ContactsRepository;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
public class ContactsProcess implements JPAProcess{
|
import org.springframework.lang.NonNull;
|
||||||
|
|
||||||
private ContactsRepository contactsRes ;
|
@RequiredArgsConstructor
|
||||||
|
public class ContactsProcess implements JPAProcess {
|
||||||
public ContactsProcess(ContactsRepository contactsRes){
|
@NonNull
|
||||||
this.contactsRes = contactsRes ;
|
private final ContactsRepository contactsRes;
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void process(Object data) {
|
||||||
public void process(Object data) {
|
contactsRes.save((Contacts) data);
|
||||||
contactsRes.save((Contacts)data) ;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void end() {
|
||||||
public void end() {
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user