1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-07-03 11:26:46 +08:00

merge codes

This commit is contained in:
Hai Liang Wang 2019-11-27 18:29:27 +08:00
commit a66f06ff2e
5 changed files with 21 additions and 10 deletions

View File

@ -136,7 +136,7 @@ public class ApiWlContactsController extends Handler {
final String uid = j.get("uid").getAsString();
final String sid = j.get("sid").getAsString();
final String cid = j.get("cid").getAsString();
Contacts record = contactsRes.findOneByWluidAndWlsidAndWlcid(uid, sid, cid);
Contacts record = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
boolean isNew = false;
if (record == null) {
// create new obj

View File

@ -307,7 +307,7 @@ public class IMController extends Handler {
final String company_name,
final String system_name) {
if (StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(cid)) {
Contacts data = contactsRes.findOneByWluidAndWlsidAndWlcid(uid, sid, cid);
Contacts data = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
if (data == null) {
data = new Contacts();
data.setCreater(gid);
@ -367,7 +367,7 @@ public class IMController extends Handler {
onlineUserRes.save(onlineUser);
}
Contacts usc = contactsRes.findOneByWluidAndWlsidAndWlcid(uid, sid, cid);
Contacts usc = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
if (usc != null) {
return "usc";
} else {
@ -766,7 +766,7 @@ public class IMController extends Handler {
String cid = (String) request.getSession().getAttribute("Sessioncid");
if (StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(cid)) {
Contacts contacts1 = contactsRes.findOneByWluidAndWlsidAndWlcid(uid, sid, cid);
Contacts contacts1 = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
if (contacts1 != null) {
agentUserRepository.findOneByUseridAndOrgi(userid, orgi).ifPresent(p -> {
// 关联AgentService的联系人

View File

@ -29,7 +29,7 @@ public interface ContactsRepository extends ElasticsearchRepository<Contacts, St
List<Contacts> findOneByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
Contacts findOneByWluidAndWlsidAndWlcid(String wluid, String wlsid, String wlcid);
Contacts findOneByWluidAndWlsidAndWlcidAndDatastatus(String wluid, String wlsid, String wlcid, Boolean datastatus);
List<Contacts> findByskypeidAndDatastatus(String skypeid, Boolean datastatus);

View File

@ -12,8 +12,6 @@ CONTACT_CENTER_DB=`parse_dbname ${SPRING_DATASOURCE_URL}`
CONTACT_CENTER_WAR=/opt/chatopera/contact-center.war
MYSQL_SCRIPT_NAME=cosinee-MySQL-slim.sql
println "[setup] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
# functions
function import_db(){
if [ ! -f $1 ]; then exit 1; fi
@ -57,6 +55,14 @@ function init_db(){
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
println "[setup] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
## wait for database connection ...
while ! mysqladmin --user=${SPRING_DATASOURCE_USERNAME} --password=${SPRING_DATASOURCE_PASSWORD} --host=${MYSQL_WRITEMODE_IP} --port=${MYSQL_WRITEMODE_PORT} ping --silent &> /dev/null ; do
echo "Waiting for database connection..."
sleep 2
done
# check if database exist, if not, create it.
mysqlshow -h ${MYSQL_WRITEMODE_IP} \
-P ${MYSQL_WRITEMODE_PORT} \

View File

@ -13,8 +13,6 @@ CONTACT_CENTER_WAR=/opt/chatopera/contact-center.war
APP_WAR_EXTRACTED=/tmp/ROOT
UPGRADE_DB_SCRIPT_DIR=$APP_WAR_EXTRACTED/upgrade
println "[upgrade] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
# functions
function upgrade_db(){
if [ ! -f $1 ]; then exit 1; fi
@ -46,12 +44,19 @@ function extract_war(){
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
println "[upgrade] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
## check upgrade footprint
if [ -f /opt/chatopera/upgrade.his ]; then
echo "[upgrade] upgrade has been done with previous start."
exit 0
fi
## wait for database connection ...
while ! mysqladmin --user=${SPRING_DATASOURCE_USERNAME} --password=${SPRING_DATASOURCE_PASSWORD} --host=${MYSQL_WRITEMODE_IP} --port=${MYSQL_WRITEMODE_PORT} ping --silent &> /dev/null ; do
echo "Waiting for database connection..."
sleep 2
done
## check root dir
if [ ! -d $APP_WAR_EXTRACTED ]; then
extract_war
@ -73,4 +78,4 @@ fi
## touch upgrade footprint
if [ ! -f /opt/chatopera/upgrade.his ]; then
touch /opt/chatopera/upgrade.his
fi
fi