|
|
@ -11,6 +11,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
import org.springframework.boot.autoconfigure.security.SecurityProperties; |
|
|
|
import org.springframework.http.*; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -65,7 +66,7 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
logger.info("开始查询数据..."); |
|
|
|
// 从 SQL Server 查询数据 |
|
|
|
String querySql = "SELECT gtype,jwcode,free,core_jb,buy_jb,cz_time,cz_user,cz_bz,operation_platform,goods_name " + |
|
|
|
"FROM user_gold_records WHERE flag=1 and created_at > ?"; |
|
|
|
"FROM user_gold_records WHERE flag=1 and cz_time> ?"; |
|
|
|
|
|
|
|
try (PreparedStatement sqlServerStmt = sqlServerConn.prepareStatement(querySql)) { |
|
|
|
sqlServerStmt.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now().minusHours(1))); // 获取最近一小时的数据 |
|
|
@ -75,7 +76,7 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
//退款类型 61:ERP退款(退金币) |
|
|
|
String insertSql = "INSERT INTO user_gold_record (order_code,jwcode,sum_gold,permanent_gold,free_june,free_december," + |
|
|
|
"task_gold,pay_platform,goods_name,refund_type,refund_model,remark,type,admin_id," + |
|
|
|
"audit_status,create_time, VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE name = ?"; |
|
|
|
"audit_status,create_time) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; |
|
|
|
try (PreparedStatement mysqlStmt = mysqlConn.prepareStatement(insertSql)) { |
|
|
|
while (resultSet.next()) { |
|
|
|
int gtype = resultSet.getInt("gtype"); |
|
|
@ -124,8 +125,10 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
// 判断月份 |
|
|
|
if(currentMonth.getValue() >= 7){ |
|
|
|
mysqlStmt.setInt(5, free); |
|
|
|
mysqlStmt.setInt(6, 0); |
|
|
|
} |
|
|
|
if(currentMonth.getValue() < 7){ |
|
|
|
mysqlStmt.setInt(5, 0); |
|
|
|
mysqlStmt.setInt(6, free); |
|
|
|
} |
|
|
|
mysqlStmt.setInt(7, core_jb); |
|
|
@ -140,6 +143,11 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
} |
|
|
|
if(operation_platform.equals("4")){ |
|
|
|
continue; |
|
|
|
}if(operation_platform.equals("0")){ |
|
|
|
mysqlStmt.setString(8, "初始化金币"); |
|
|
|
} |
|
|
|
else { |
|
|
|
mysqlStmt.setString(8, "其他"); |
|
|
|
} |
|
|
|
mysqlStmt.setString(9, goods_name); |
|
|
|
mysqlStmt.setString(10,"退款商品"); |
|
|
@ -150,9 +158,11 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
|
|
|
|
// 更新时的值 |
|
|
|
mysqlStmt.addBatch(); |
|
|
|
|
|
|
|
logger.info("查询用户是否存在"); |
|
|
|
User user = userService.selectAllUser(String.valueOf(jwcode)); |
|
|
|
if(ObjectUtils.isEmpty(user)){ |
|
|
|
logger.info("用户不存在"); |
|
|
|
user = new User(); |
|
|
|
String country = null; |
|
|
|
BaseDES des = new BaseDES(); |
|
|
|
String desjwcode= des.encrypt(String.valueOf(jwcode)); |
|
|
@ -203,10 +213,14 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
// 设置默认的 country 值 |
|
|
|
country = "Unknown"; |
|
|
|
} |
|
|
|
|
|
|
|
user.setJwcode(jwcode); |
|
|
|
user.setName( name); |
|
|
|
user.setMarket(country); |
|
|
|
logger.info("新添用户"); |
|
|
|
userService.addUser(user); |
|
|
|
logger.info("用户添加成功"); |
|
|
|
user = userService.selectAllUser(String.valueOf(jwcode)); |
|
|
|
} |
|
|
|
user.setSumPermanentGold(user.getSumPermanentGold()+buy_jb); |
|
|
|
if(currentMonth.getValue() >= 7){ |
|
|
|