Merge branch 'dev/dev_xp' into dev/dev
This commit is contained in:
@@ -130,6 +130,7 @@ public interface AccountService extends IService<Account> {
|
||||
void moveLibraryDate();
|
||||
|
||||
void updateCredits(Long accountId, String value);
|
||||
void updateCreditsAndEndTime(Long accountId, String value, Long endTime);
|
||||
|
||||
Boolean designWorksRegister(AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO);
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -960,6 +961,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setCredits(new BigDecimal(value));
|
||||
accountMapper.updateById(account);
|
||||
}
|
||||
// todo 将其与上一个合并
|
||||
public void updateCreditsAndEndTime(Long accountId, String value, Long endTime) {
|
||||
Account account = new Account();
|
||||
account.setId(accountId);
|
||||
account.setCredits(new BigDecimal(value));
|
||||
account.setValidEndTime(endTime);
|
||||
accountMapper.updateById(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean designWorksRegister(AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
||||
@@ -1034,6 +1043,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
config.addDataSourceProperty("maxLifetime", 300000);
|
||||
dataSource = new HikariDataSource(config);
|
||||
}
|
||||
|
||||
@@ -1057,7 +1067,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String email = "";
|
||||
String userName = "";
|
||||
// 为什么一般没有值
|
||||
String country = "";
|
||||
String country = "English";
|
||||
// 1、查pmr_wc_customer_lookup表;确认当前订单对应的用户邮箱
|
||||
PreparedStatement preparedQueryEmail = connection.prepareStatement(QUERY_CUSTOMER_EMAIL);
|
||||
preparedQueryEmail.setInt(1, customerId);
|
||||
@@ -1091,10 +1101,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// 2、获取当前续费费用能延长多长时间
|
||||
Account account = extendValidity(validEndTime, totalSales);
|
||||
|
||||
int systemUserType = 0;
|
||||
if (flag) {
|
||||
// 是新用户 => 新增一条数据
|
||||
String credits = "0";
|
||||
int systemUserType = 0;
|
||||
if (totalSales == 5000.0){
|
||||
log.info("年付用户,初始积分6000");
|
||||
credits = CreditsEventsEnum.INIT_MONTHLY.getValue();
|
||||
@@ -1117,14 +1127,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if (b) log.info("付费新用户新增成功!");
|
||||
} else {
|
||||
userInfo.setValidEndTime(account.getValidEndTime());
|
||||
baseMapper.updateById(account);
|
||||
baseMapper.updateById(userInfo);
|
||||
log.info("付费用户续订成功");
|
||||
}
|
||||
|
||||
// 3、todo 邮件通知
|
||||
// 3.1 判断用户语言
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String format = simpleDateFormat.format(account.getValidEndTime());
|
||||
|
||||
// 3.2 将用户信息填到邮件中
|
||||
// 3、邮件通知
|
||||
SendEmailUtil.notificationForPaidUser(email, flag ? 1 : 2, country,
|
||||
StringUtil.isNullOrEmpty(userName) ? email.substring(0, email.indexOf("@")) : userName, format);
|
||||
|
||||
// 4、更新订单状态和日期
|
||||
PreparedStatement preparedUpdateOrder = connection.prepareStatement(UPDATE_ORDER_STATUS);
|
||||
@@ -1222,7 +1234,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
creditsService.save(creditsDetail);
|
||||
|
||||
// 3.3、更新 t_account 表
|
||||
updateCredits(account.getId(), added.toString());
|
||||
if (account.getValidEndTime() < 1720972799000L){
|
||||
updateCreditsAndEndTime(account.getId(), added.toString(), 1720972799000L);
|
||||
}
|
||||
}
|
||||
|
||||
// 4、发邮件 区分中英文
|
||||
|
||||
Reference in New Issue
Block a user