#E10-24# 自主服务初始化接口优化

main
shilei 1 year ago
parent 151d5041ab
commit a76e0fbefc

@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.common.distribution.genid.IdGenerator;
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
import com.weaver.em.msg.api.entity.Request;
import com.weaver.em.msg.api.entity.Response;
import com.weaver.framework.rpc.annotation.RpcReference;
@ -99,19 +97,19 @@ public class ChatDayUtils {
String amount = dataInfo.getString("amount");
log.error("getChatDay--userid"+userid+" 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);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+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);
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
//
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){
log.error("getChatDay--!isEmpty");
@ -155,14 +153,19 @@ public class ChatDayUtils {
log.error("insertChatDayDate-sql:"+sql);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
if(result.containsKey("code")){
code = String.valueOf(result.get("code"));
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("code")){
code = String.valueOf(recordMap.get("code"));
}
}
}catch (Exception e){
e.printStackTrace();
log.error("insertChatDayDate:"+e);
code = "-100";
}
log.error("insertChatDayDate-code:"+code);
}
/***
@ -176,36 +179,41 @@ public class ChatDayUtils {
public String updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){
String code = "" ;
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("insertChatDayDate-sql:"+sql + " amount:"+amount+" userid:"+userid);
// List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
// SqlParamEntity sqlParamEntity = new SqlParamEntity();
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
// sqlParamEntity.setValue(amount+"");
// sqlparam.add(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);
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
String sql =" update "+tablename+" set amount='"+amount+"',update_time=now() where ry = "+userid+" and tenant_key= '"+tenant_key+"' and delete_type=0 ";
log.error("insertChatDayDate-sql:"+sql + " amount:"+amount+" userid:"+userid);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
sqlParamEntity.setValue(amount+"");
sqlparam.add(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);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
if(result.containsKey("code")){
code = String.valueOf(result.get("code"));
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("code")){
code = String.valueOf(recordMap.get("code"));
}
}
}catch (Exception e){
e.printStackTrace();
log.error("insertChatDayDate:"+e);
code = "-100";
}
return code;
}

@ -107,20 +107,19 @@ public class ChatGroupUtils {
String amount = dataInfo.getString("amount");
log.error("getChatGroup--userid"+userid+" 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);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+tenant_key+"' and delete_type=0 ";
log.error("getChatGroup--sql"+sql);
// 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);
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty()){
@ -172,8 +171,12 @@ public class ChatGroupUtils {
// log.error("insertChatGroupDate--key="+next.getKey()+" value="+String.valueOf(next.getValue()));
// }
if(result.containsKey("code")){
code = String.valueOf(result.get("code"));
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("code")){
code = String.valueOf(recordMap.get("code"));
}
}
}catch (Exception e){
@ -195,7 +198,7 @@ public class ChatGroupUtils {
String code = "";
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='"+amount+"',update_time=now() where ry="+userid+" and tenant_key='"+tenant_key+"' and delete_type=0 ";
log.error("updateChatGroupDate-sql:"+sql+" amount:"+amount+" userid:"+userid);
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -214,9 +217,14 @@ public class ChatGroupUtils {
sqlparam.add(sqlParamEntity);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
if(result.containsKey("code")){
code = String.valueOf(result.get("code"));
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(!recordList.isEmpty() && recordList.size()>0){
Map<String,Object> recordMap = recordList.get(0);
if(recordMap.containsKey("code")){
code = String.valueOf(recordMap.get("code"));
}
}
}catch (Exception e){
e.printStackTrace();
log.error("updateChatGroupDate:"+e);

Loading…
Cancel
Save