TASK:模块化;
This commit is contained in:
@@ -21,6 +21,7 @@ import com.ai.da.model.enums.AutoApproved;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -57,6 +58,8 @@ import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -1649,16 +1652,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> a = new ArrayList<>();
|
||||
a.add("1023316923@qq.com");
|
||||
a.add("Malinyuquan@gmail.com");
|
||||
|
||||
if (a.contains("malinyuquan@gmail.com")) {
|
||||
log.info("aaaaaaaaaaaaaaaaaaaaa");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String QUERY_PAID_CUSTOMER_EMAIL = "SELECT distinct c.email " +
|
||||
"FROM `pmr_wc_order_stats` o " +
|
||||
"inner join `pmr_wc_customer_lookup` c " +
|
||||
@@ -2944,7 +2937,65 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
@Override
|
||||
public Boolean subAccountImport(MultipartFile file) {
|
||||
return null;
|
||||
AuthPrincipalVo vo = UserContext.getUserHolder();
|
||||
Account parent = accountMapper.selectById(vo.getId());
|
||||
try {
|
||||
List<SubAccountImportDTO> importList = EasyExcel.read(
|
||||
file.getInputStream(),
|
||||
SubAccountImportDTO.class,
|
||||
null
|
||||
).sheet().doReadSync();
|
||||
|
||||
// 示例:打印或保存
|
||||
for (SubAccountImportDTO dto : importList) {
|
||||
|
||||
Account account = new Account();
|
||||
account.setUserName(dto.getName());
|
||||
account.setUserEmail(dto.getEmail());
|
||||
account.setUserPassword(md5(dto.getPassword() + "abc"));
|
||||
account.setCreditsUsageLimit(BigDecimal.valueOf(dto.getCredisUsageLimit()));
|
||||
account.setParentId(vo.getId());
|
||||
account.setValidStartTime(parent.getValidStartTime());
|
||||
account.setValidEndTime(parent.getValidEndTime());
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsTrial(0);
|
||||
account.setIsBeginner(1);
|
||||
account.setCredits(BigDecimal.valueOf(0));
|
||||
if (parent.getSystemUser() == 5) {
|
||||
account.setSystemUser(6);
|
||||
}
|
||||
if (parent.getSystemUser() == 7) {
|
||||
account.setSystemUser(8);
|
||||
}
|
||||
account.setOrganizationName(parent.getOrganizationName());
|
||||
account.setParentId(parent.getId());
|
||||
accountMapper.insert(account);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String md5(String input) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] messageDigest = md.digest(input.getBytes());
|
||||
|
||||
// 转为16进制字符串
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : messageDigest) {
|
||||
String hex = Integer.toHexString(0xff & b);
|
||||
if (hex.length() == 1) sb.append('0'); // 补0
|
||||
sb.append(hex);
|
||||
}
|
||||
return sb.append("abc").toString();
|
||||
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("MD5算法不可用", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user