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