记得上下班打卡 | git大法好,push需谨慎

Commit 00fe9274 authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/dev' into dev

parents 12a397e1 6c02b442
...@@ -30,10 +30,18 @@ public class RedisPayReceiver implements StreamListener<String, MapRecord<String ...@@ -30,10 +30,18 @@ public class RedisPayReceiver implements StreamListener<String, MapRecord<String
System.out.println("message id " + message.getId()); System.out.println("message id " + message.getId());
System.out.println("stream " + message.getStream()); System.out.println("stream " + message.getStream());
System.out.println("body " + message.getValue()); System.out.println("body " + message.getValue());
consumerSqlDaoHandler(message.getValue().get("message")); boolean result = consumerSqlDaoHandler(message.getValue().get("message"));
// 消费成功确认,消息删除和消息确认是一个事务
if(result){
stringRedisTemplate.multi();
stringRedisTemplate.opsForStream().delete(DragonConstant.MysqlRedisQueueEnum.DRAGON_PAY_KEY.getCode(), message.getId());
// stringRedisTemplate.opsForStream().acknowledge(DragonConstant.MysqlRedisQueueEnum.DRAGON_PAY_GROUP.getCode(), message);
stringRedisTemplate.exec();
}
} }
private void consumerSqlDaoHandler(String msg) { private boolean consumerSqlDaoHandler(String msg) {
try { try {
SqlMapping.SqlMessage sqlMessage = JsonUtils.fromJson(msg, SqlMapping.SqlMessage.class); SqlMapping.SqlMessage sqlMessage = JsonUtils.fromJson(msg, SqlMapping.SqlMessage.class);
log.debug("CONSUMER SQL ==> Preparing:{}", JsonUtils.toJson(sqlMessage.getSqls())); log.debug("CONSUMER SQL ==> Preparing:{}", JsonUtils.toJson(sqlMessage.getSqls()));
...@@ -41,11 +49,12 @@ public class RedisPayReceiver implements StreamListener<String, MapRecord<String ...@@ -41,11 +49,12 @@ public class RedisPayReceiver implements StreamListener<String, MapRecord<String
Boolean rstBatchSqls = baseDao.batchSqls(sqlMessage.getSqls(), sqlMessage.getArgs()); Boolean rstBatchSqls = baseDao.batchSqls(sqlMessage.getSqls(), sqlMessage.getArgs());
log.debug("CONSUMER SQL result of execution:{}", rstBatchSqls); log.debug("CONSUMER SQL result of execution:{}", rstBatchSqls);
if (rstBatchSqls) { if (rstBatchSqls) {
//应答 return true;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return false;
} }
/** /**
......
...@@ -444,21 +444,21 @@ public class DataImpl { ...@@ -444,21 +444,21 @@ public class DataImpl {
String driverClassName = "com.mysql.cj.jdbc.Driver"; //启动驱动 String driverClassName = "com.mysql.cj.jdbc.Driver"; //启动驱动
String url = "jdbc:mysql://pc-2ze6z2hxkug559q79.mysql.polardb.rds.aliyuncs.com:3306/mall"; //设置连接路径 String url = "jdbc:mysql://pc-2ze6z2hxkug559q79.mysql.polardb.rds.aliyuncs.com:3306/mall"; //设置连接路径
// String url = "jdbc:mysql://zhengzai.mysql.polardb.rds.aliyuncs.com:3306/mall";
String username = "readonly"; //数据库用户名 String username = "readonly"; //数据库用户名
String password = "ZWDsf8Fy"; //数据库连接密码 String password = "ZWDsf8Fy"; //数据库连接密码
Connection con = null; //连接 Connection con = null; //连接
PreparedStatement pstmt = null; //使用预编译语句 PreparedStatement pstmt = null; //使用预编译语句
ResultSet rs = null; //获取的结果集 ResultSet rs = null; //获取的结果集
KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo();
try { try {
int count = 1000; int count = 3000;
int page = 0; int page = 0;
Class.forName(driverClassName); //执行驱动 Class.forName(driverClassName); //执行驱动
con = DriverManager.getConnection(url, username, password); //获取连接 con = DriverManager.getConnection(url, username, password); //获取连接
String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id > 5721 and status != 2 and status != 1 and created_at like '2021-" + month + "%'"; //设置的预编译语句格式 String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id > 5721 and status != 2 and status != -1 and created_at like '2021-" + month + "%'"; //设置的预编译语句格式
// String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id = "+month + " and status != 2 and status !=-1"; //设置的预编译语句格式 // String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id = "+month + " and status != 2 and status !=-1"; //设置的预编译语句格式
System.out.println(" SQL COUNT = " + sqlAllCount); System.out.println(" SQL COUNT = " + sqlAllCount);
pstmt = con.prepareStatement(sqlAllCount); pstmt = con.prepareStatement(sqlAllCount);
...@@ -479,7 +479,7 @@ public class DataImpl { ...@@ -479,7 +479,7 @@ public class DataImpl {
ArrayList<KylinOrderTicketVo> orderListVo = new ArrayList(); ArrayList<KylinOrderTicketVo> orderListVo = new ArrayList();
ArrayList<KylinOrderTicketEntitiesVo> orderEntitiesListVo = new ArrayList(); ArrayList<KylinOrderTicketEntitiesVo> orderEntitiesListVo = new ArrayList();
//订单 //订单
String sql = "select * from order_tickets where performance_id > 5721 and status != 2 and and status != 1 created_at like '2021-" + month + "%' limit " + count * page + " ," + count; //设置的预编译语句格式 String sql = "select * from order_tickets where performance_id > 5721 and status != 2 and status != -1 and created_at like '2021-" + month + "%' limit " + count * page + " ," + count; //设置的预编译语句格式
// String sql = "select * from order_tickets where performance_id = "+month +" and status != 2 limit " + count * page + " ," + count; // String sql = "select * from order_tickets where performance_id = "+month +" and status != 2 limit " + count * page + " ," + count;
System.out.println(" SQL DATA = " + sql); System.out.println(" SQL DATA = " + sql);
pstmt = con.prepareStatement(sql); pstmt = con.prepareStatement(sql);
...@@ -490,6 +490,7 @@ public class DataImpl { ...@@ -490,6 +490,7 @@ public class DataImpl {
KylinOrderTicketStatus orderTicketStatus = new KylinOrderTicketStatus(); KylinOrderTicketStatus orderTicketStatus = new KylinOrderTicketStatus();
KylinOrderTicketRelations orderTicketRelations = new KylinOrderTicketRelations(); KylinOrderTicketRelations orderTicketRelations = new KylinOrderTicketRelations();
KylinOrderTicketEntities orderTicketEntities = new KylinOrderTicketEntities(); KylinOrderTicketEntities orderTicketEntities = new KylinOrderTicketEntities();
KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo();
ArrayList<KylinOrderTicketEntitiesVo> entitiesVosList = new ArrayList<>(); ArrayList<KylinOrderTicketEntitiesVo> entitiesVosList = new ArrayList<>();
String ticketSql = "select student,use_end,use_start,title,type from tickets where id = " + orderData.getInt("ticket_id"); //设置的预编译语句格式 String ticketSql = "select student,use_end,use_start,title,type from tickets where id = " + orderData.getInt("ticket_id"); //设置的预编译语句格式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment