#E10-21# 群聊数量接口优化

main
shilei 1 year ago
parent 71060ebaca
commit 92fcd45b2a

@ -1273,7 +1273,7 @@ public class HrmSelfHelpController {
public WeaResult<Object> testSapi8(HttpServletRequest request){ public WeaResult<Object> testSapi8(HttpServletRequest request){
//com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData
log.error("testSapi8");
String groupId = "weaver-ebuilder-form-service"; String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC"; String sourceType = "LOGIC";
SimpleEmployee employee = UserContext.getCurrentUser(); SimpleEmployee employee = UserContext.getCurrentUser();
@ -1289,6 +1289,7 @@ public class HrmSelfHelpController {
JSONObject actionMsg = dataJson.getJSONObject("actionMsg"); JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
if(actionMsg.containsKey("code")){ if(actionMsg.containsKey("code")){
String code = actionMsg.getString("code"); String code = actionMsg.getString("code");
log.error("code:"+code);
if("0".equals(code)){ if("0".equals(code)){
JSONObject dataObject = dataJson.getJSONObject("data"); JSONObject dataObject = dataJson.getJSONObject("data");
if(dataObject.containsKey("data")){ if(dataObject.containsKey("data")){
@ -1297,27 +1298,29 @@ public class HrmSelfHelpController {
JSONObject dataInfo = dataArray.getJSONObject(i); JSONObject dataInfo = dataArray.getJSONObject(i);
String userid = dataInfo.getString("userid"); String userid = dataInfo.getString("userid");
String amount = dataInfo.getString("amount"); String amount = dataInfo.getString("amount");
if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(amount)){
String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 "; String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 ";
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>(); List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity(); SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR); sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(userid+""); sqlParamEntity.setValue(userid+"");
sqlparam.add(sqlParamEntity); sqlparam.add(sqlParamEntity);
sqlParamEntity = new SqlParamEntity(); sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR); sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(tenant_key+""); sqlParamEntity.setValue(tenant_key+"");
sqlparam.add(sqlParamEntity); sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){ if(!recordList.isEmpty()){
jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); log.error("!recordList.isEmpty()");
}else{ jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename); }else{
log.error("recordList.isEmpty()");
jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename);
}
} }
} }
} }
} }
@ -1335,6 +1338,7 @@ public class HrmSelfHelpController {
//com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData
log.error("testSapi9");
String groupId = "weaver-ebuilder-form-service"; String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC"; String sourceType = "LOGIC";
SimpleEmployee employee = UserContext.getCurrentUser(); SimpleEmployee employee = UserContext.getCurrentUser();
@ -1350,6 +1354,7 @@ public class HrmSelfHelpController {
JSONObject actionMsg = dataJson.getJSONObject("actionMsg"); JSONObject actionMsg = dataJson.getJSONObject("actionMsg");
if(actionMsg.containsKey("code")){ if(actionMsg.containsKey("code")){
String code = actionMsg.getString("code"); String code = actionMsg.getString("code");
log.error("testSapi9-code:"+code);
if("0".equals(code)){ if("0".equals(code)){
JSONObject dataObject = dataJson.getJSONObject("data"); JSONObject dataObject = dataJson.getJSONObject("data");
if(dataObject.containsKey("data")){ if(dataObject.containsKey("data")){
@ -1358,26 +1363,22 @@ public class HrmSelfHelpController {
JSONObject dataInfo = dataArray.getJSONObject(i); JSONObject dataInfo = dataArray.getJSONObject(i);
String userid = dataInfo.getString("userid"); String userid = dataInfo.getString("userid");
String amount = dataInfo.getString("amount"); String amount = dataInfo.getString("amount");
log.error("userid:"+userid);
String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 "; log.error("amount:"+amount);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity(); if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(amount)){
sqlParamEntity.setParamType(SqlParamType.VARCHAR); String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+tenant_key+"' and delete_type=0 ";
sqlParamEntity.setValue(userid+""); log.error("sql:"+sql);
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
sqlParamEntity = new SqlParamEntity(); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
sqlParamEntity.setParamType(SqlParamType.VARCHAR); if(!recordList.isEmpty()){
sqlParamEntity.setValue(tenant_key+""); jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
sqlparam.add(sqlParamEntity); }else{
jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql); }
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){
jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
}else{
jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename);
} }
} }
} }
} }

@ -230,7 +230,7 @@ public class JucailinPortalUtils {
sqlParamEntity.setValue(tenant_key+""); sqlParamEntity.setValue(tenant_key+"");
sqlparam.add(sqlParamEntity); sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){ if(!recordList.isEmpty()){
updateChatGroupDate(userid,amount,sourceType,groupId,tenant_key,tablename); updateChatGroupDate(userid,amount,sourceType,groupId,tenant_key,tablename);
@ -473,7 +473,7 @@ public class JucailinPortalUtils {
sqlParamEntity.setValue(tenant_key+""); sqlParamEntity.setValue(tenant_key+"");
sqlparam.add(sqlParamEntity); sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){ if(!recordList.isEmpty()){
updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
@ -508,6 +508,7 @@ public class JucailinPortalUtils {
long generate = IdGenerator.generate(); long generate = IdGenerator.generate();
String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type) " + String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type) " +
" values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"'," + Character.MIN_VALUE + "," + employeeId + "," + Character.MIN_VALUE + ")"; " values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"'," + Character.MIN_VALUE + "," + employeeId + "," + Character.MIN_VALUE + ")";
log.error("insertChatDayDate-sql:"+sql);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql); Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator(); Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
@ -540,6 +541,8 @@ public class JucailinPortalUtils {
public void updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){ public void updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){
try { try {
String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 "; String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 ";
log.error("updateChatDayDate-sql:"+sql);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>(); List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity(); SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR); sqlParamEntity.setParamType(SqlParamType.VARCHAR);

Loading…
Cancel
Save