diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index d57bb6b3..ac8e0071 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -1078,6 +1078,7 @@ public class AccountServiceImpl extends ServiceImpl impl int orderId = queryOrderResultSet.getInt("order_id"); int customerId = queryOrderResultSet.getInt("customer_id"); double totalSales = queryOrderResultSet.getDouble("total_sales"); + log.info("Code-Create 订单:{}, 顾客id:{}, 付款金额:{}",orderId, customerId, totalSales); String email = ""; String userName = ""; // 为什么一般没有值 @@ -1116,23 +1117,24 @@ public class AccountServiceImpl extends ServiceImpl impl Account account = extendValidity(validEndTime, totalSales); int systemUserType = 0; + + // 不管是不是新用户 都要更新用户角色和积分 + String credits = "0"; + if (totalSales == 5000.0){ + log.info("年付用户,初始积分6000"); + credits = CreditsEventsEnum.INIT_MONTHLY.getValue(); + systemUserType = 1; + }else if (totalSales == 500.0){ + log.info("月付用户,初始积分5000"); + credits = CreditsEventsEnum.INIT_MONTHLY.getValue(); + systemUserType = 2; + }else if (totalSales == 0.0){ + log.info("测试用户,初始积分10"); + credits = "10"; + systemUserType = 3; + } if (flag) { // 是新用户 => 新增一条数据 - String credits = "0"; - if (totalSales == 5000.0){ - log.info("年付用户,初始积分6000"); - credits = CreditsEventsEnum.INIT_MONTHLY.getValue(); - systemUserType = 1; - }else if (totalSales == 500.0){ - log.info("月付用户,初始积分5000"); - credits = CreditsEventsEnum.INIT_MONTHLY.getValue(); - systemUserType = 2; - }else if (totalSales == 0.0){ - log.info("测试用户,初始积分10"); - credits = "10"; - systemUserType = 3; - } - Boolean b = addUser(new AccountAddDTO(email, StringUtil.isNullOrEmpty(userName) ? email.substring(0, email.indexOf("@")) : userName, country, @@ -1141,6 +1143,8 @@ public class AccountServiceImpl extends ServiceImpl impl if (b) log.info("付费新用户 {} 新增成功!", email); } else { userInfo.setValidEndTime(toDayEnd(account.getValidEndTime())); + userInfo.setCredits(new BigDecimal(credits)); + userInfo.setSystemUser(systemUserType); baseMapper.updateById(userInfo); log.info("付费用户 {} 续订成功", email); }