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

main
shilei 1 year ago
parent 71060ebaca
commit 92fcd45b2a

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

@ -230,7 +230,7 @@ public class JucailinPortalUtils {
sqlParamEntity.setValue(tenant_key+"");
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);
if(!recordList.isEmpty()){
updateChatGroupDate(userid,amount,sourceType,groupId,tenant_key,tablename);
@ -473,7 +473,7 @@ public class JucailinPortalUtils {
sqlParamEntity.setValue(tenant_key+"");
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);
if(!recordList.isEmpty()){
updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename);
@ -508,6 +508,7 @@ public class JucailinPortalUtils {
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) " +
" 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);
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){
try {
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>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);

Loading…
Cancel
Save