mirror of
https://github.com/chatopera/cosin.git
synced 2025-07-03 11:26:46 +08:00
merge codes
This commit is contained in:
commit
a66f06ff2e
@ -136,7 +136,7 @@ public class ApiWlContactsController extends Handler {
|
|||||||
final String uid = j.get("uid").getAsString();
|
final String uid = j.get("uid").getAsString();
|
||||||
final String sid = j.get("sid").getAsString();
|
final String sid = j.get("sid").getAsString();
|
||||||
final String cid = j.get("cid").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;
|
boolean isNew = false;
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
// create new obj
|
// create new obj
|
||||||
|
@ -307,7 +307,7 @@ public class IMController extends Handler {
|
|||||||
final String company_name,
|
final String company_name,
|
||||||
final String system_name) {
|
final String system_name) {
|
||||||
if (StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(cid)) {
|
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) {
|
if (data == null) {
|
||||||
data = new Contacts();
|
data = new Contacts();
|
||||||
data.setCreater(gid);
|
data.setCreater(gid);
|
||||||
@ -367,7 +367,7 @@ public class IMController extends Handler {
|
|||||||
onlineUserRes.save(onlineUser);
|
onlineUserRes.save(onlineUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Contacts usc = contactsRes.findOneByWluidAndWlsidAndWlcid(uid, sid, cid);
|
Contacts usc = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
|
||||||
if (usc != null) {
|
if (usc != null) {
|
||||||
return "usc";
|
return "usc";
|
||||||
} else {
|
} else {
|
||||||
@ -766,7 +766,7 @@ public class IMController extends Handler {
|
|||||||
String cid = (String) request.getSession().getAttribute("Sessioncid");
|
String cid = (String) request.getSession().getAttribute("Sessioncid");
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(cid)) {
|
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) {
|
if (contacts1 != null) {
|
||||||
agentUserRepository.findOneByUseridAndOrgi(userid, orgi).ifPresent(p -> {
|
agentUserRepository.findOneByUseridAndOrgi(userid, orgi).ifPresent(p -> {
|
||||||
// 关联AgentService的联系人
|
// 关联AgentService的联系人
|
||||||
|
@ -29,7 +29,7 @@ public interface ContactsRepository extends ElasticsearchRepository<Contacts, St
|
|||||||
|
|
||||||
List<Contacts> findOneByDatastatusIsFalseAndPhoneAndOrgi(String phone, String orgi);
|
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);
|
List<Contacts> findByskypeidAndDatastatus(String skypeid, Boolean datastatus);
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ CONTACT_CENTER_DB=`parse_dbname ${SPRING_DATASOURCE_URL}`
|
|||||||
CONTACT_CENTER_WAR=/opt/chatopera/contact-center.war
|
CONTACT_CENTER_WAR=/opt/chatopera/contact-center.war
|
||||||
MYSQL_SCRIPT_NAME=cosinee-MySQL-slim.sql
|
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
|
# functions
|
||||||
function import_db(){
|
function import_db(){
|
||||||
if [ ! -f $1 ]; then exit 1; fi
|
if [ ! -f $1 ]; then exit 1; fi
|
||||||
@ -57,6 +55,14 @@ function init_db(){
|
|||||||
|
|
||||||
# main
|
# main
|
||||||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
|
[ -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.
|
# check if database exist, if not, create it.
|
||||||
mysqlshow -h ${MYSQL_WRITEMODE_IP} \
|
mysqlshow -h ${MYSQL_WRITEMODE_IP} \
|
||||||
-P ${MYSQL_WRITEMODE_PORT} \
|
-P ${MYSQL_WRITEMODE_PORT} \
|
||||||
|
@ -13,8 +13,6 @@ CONTACT_CENTER_WAR=/opt/chatopera/contact-center.war
|
|||||||
APP_WAR_EXTRACTED=/tmp/ROOT
|
APP_WAR_EXTRACTED=/tmp/ROOT
|
||||||
UPGRADE_DB_SCRIPT_DIR=$APP_WAR_EXTRACTED/upgrade
|
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
|
# functions
|
||||||
function upgrade_db(){
|
function upgrade_db(){
|
||||||
if [ ! -f $1 ]; then exit 1; fi
|
if [ ! -f $1 ]; then exit 1; fi
|
||||||
@ -46,12 +44,19 @@ function extract_war(){
|
|||||||
|
|
||||||
# main
|
# main
|
||||||
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
|
[ -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
|
## check upgrade footprint
|
||||||
if [ -f /opt/chatopera/upgrade.his ]; then
|
if [ -f /opt/chatopera/upgrade.his ]; then
|
||||||
echo "[upgrade] upgrade has been done with previous start."
|
echo "[upgrade] upgrade has been done with previous start."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
## check root dir
|
||||||
if [ ! -d $APP_WAR_EXTRACTED ]; then
|
if [ ! -d $APP_WAR_EXTRACTED ]; then
|
||||||
extract_war
|
extract_war
|
||||||
|
Loading…
x
Reference in New Issue
Block a user