Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx
This commit is contained in:
@@ -202,7 +202,7 @@ public class MyTaskScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void sendTrialOrderExcelToManagements() {
|
public void sendTrialOrderExcelToManagements() {
|
||||||
// 获取前一天日期
|
// 获取前一天日期
|
||||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ public class AccountTask {
|
|||||||
accountService.refreshCreditsMonthly();
|
accountService.refreshCreditsMonthly();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||||
public void getPaidUser() {
|
public void getPaidUser() {
|
||||||
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
||||||
accountService.extendValidityForCC();
|
accountService.extendValidityForCC();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每天凌晨0点执行一次
|
// 每天凌晨0点执行一次 目前已没有角色类型为4的用户
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
/*@Scheduled(cron = "0 0 0 * * ?")
|
||||||
public void cancelActivityBenefits() {
|
public void cancelActivityBenefits() {
|
||||||
// 1、查询当前所有参与了活动且过期的用户
|
// 1、查询当前所有参与了活动且过期的用户
|
||||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
||||||
@@ -51,7 +51,7 @@ public class AccountTask {
|
|||||||
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
||||||
accountService.toVisitor(account);
|
accountService.toVisitor(account);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 每天检测正式用户到期情况,每天凌晨0点执行
|
// 每天检测正式用户到期情况,每天凌晨0点执行
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class PaymentTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayPalCheckoutService payPalCheckoutService;
|
private PayPalCheckoutService payPalCheckoutService;
|
||||||
|
|
||||||
@Scheduled(cron = "0/30 * * * * ?")
|
// @Scheduled(cron = "0/30 * * * * ?")
|
||||||
public void orderConfirmForPaypal() throws SerializeException {
|
public void orderConfirmForPaypal() throws SerializeException {
|
||||||
|
|
||||||
// log.info("PayPal orderConfirm 被执行......");
|
// log.info("PayPal orderConfirm 被执行......");
|
||||||
@@ -109,7 +109,7 @@ public class PaymentTask {
|
|||||||
affiliateService.syncLinkViewCountToDB();
|
affiliateService.syncLinkViewCountToDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 8 28-31 * ?")
|
// @Scheduled(cron = "0 0 8 28-31 * ?")
|
||||||
public void commissionSummaryReminder(){
|
public void commissionSummaryReminder(){
|
||||||
// 每个月末的最后一天的早上八点执行
|
// 每个月末的最后一天的早上八点执行
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SubscriptionReminderTask {
|
|||||||
REMINDER_DAYS_CONFIG.put("year", 14);
|
REMINDER_DAYS_CONFIG.put("year", 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void subscriptionReminder() {
|
public void subscriptionReminder() {
|
||||||
// 获取所有需要通知的订阅
|
// 获取所有需要通知的订阅
|
||||||
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
|
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
|
||||||
@@ -97,7 +97,7 @@ public class SubscriptionReminderTask {
|
|||||||
return subscriptionInfoMapper.selectList(qw);
|
return subscriptionInfoMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void trialReminder() {
|
public void trialReminder() {
|
||||||
// 今天的 00:00:00 和 23:59:59
|
// 今天的 00:00:00 和 23:59:59
|
||||||
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ public class SendEmailUtil {
|
|||||||
try {
|
try {
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developer = "xupei3360@163.com";
|
String developer = "xupei3360@163.com";
|
||||||
String[] receiverEmail = {merchantEmail, developer};
|
String[] receiverEmail = {/*merchantEmail,*/ developer};
|
||||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||||
HttpProfile httpProfile = new HttpProfile();
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
@@ -968,7 +968,7 @@ public class SendEmailUtil {
|
|||||||
req.setFromEmailAddress(SEND_ADDRESS);
|
req.setFromEmailAddress(SEND_ADDRESS);
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developerEmail = "xupei@code-create.com.hk";
|
String developerEmail = "xupei@code-create.com.hk";
|
||||||
req.setDestination(new String[]{merchantEmail, developerEmail});
|
req.setDestination(new String[]{/*merchantEmail,*/ developerEmail});
|
||||||
Template template = new Template();
|
Template template = new Template();
|
||||||
req.setSubject("New Credit Purchase Order");
|
req.setSubject("New Credit Purchase Order");
|
||||||
template.setTemplateID(CREDITS_PURCHASE_MERCHANT);
|
template.setTemplateID(CREDITS_PURCHASE_MERCHANT);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface DesignMapper extends CommonMapper<Design> {
|
|||||||
Long insertDesign(Design design);
|
Long insertDesign(Design design);
|
||||||
|
|
||||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email,
|
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email,
|
||||||
String role, String organizationName);
|
String role, String organizationName, boolean filterBySecond);
|
||||||
|
|
||||||
List<Design> selectDeleteList();
|
List<Design> selectDeleteList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4309,7 +4309,7 @@ public class PythonService {
|
|||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("prompt", prompt);
|
map.put("prompt", prompt);
|
||||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||||
map.put("user_id", userHolder.getId());
|
map.put("user_id", userHolder.getId().toString());
|
||||||
log.info("brandDNAGenerate请求python 参数:####{}", map);
|
log.info("brandDNAGenerate请求python 参数:####{}", map);
|
||||||
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
||||||
log.info(param);
|
log.info(param);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
|||||||
// 邮件通知审批者
|
// 邮件通知审批者
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developer = "xupei3360@163.com";
|
String developer = "xupei3360@163.com";
|
||||||
String[] receiverEmail = {merchantEmail, developer};
|
String[] receiverEmail = {/*merchantEmail,*/ developer};
|
||||||
SendEmailUtil.affiliateEmailReminder(receiverEmail, new AffiliateEmailParamsDTO(userHolder.getUsername(), promotionMethod), "new");
|
SendEmailUtil.affiliateEmailReminder(receiverEmail, new AffiliateEmailParamsDTO(userHolder.getUsername(), promotionMethod), "new");
|
||||||
// emailService.affiliateEmailReminder(Arrays.asList(/*merchantEmail,*/ developer), new AffiliateEmailParamsDTO(userHolder.getUsername(), promotionMethod), "new");
|
// emailService.affiliateEmailReminder(Arrays.asList(/*merchantEmail,*/ developer), new AffiliateEmailParamsDTO(userHolder.getUsername(), promotionMethod), "new");
|
||||||
}else {
|
}else {
|
||||||
@@ -442,7 +442,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
|||||||
|
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developer = "xupei3360@163.com";
|
String developer = "xupei3360@163.com";
|
||||||
String[] receiverEmail = {merchantEmail, developer};
|
String[] receiverEmail = {/*merchantEmail,*/ developer};
|
||||||
// 邮件通知
|
// 邮件通知
|
||||||
SendEmailUtil.affiliateEmailReminder(receiverEmail, affiliateEmailParamsDTO, "summary");
|
SendEmailUtil.affiliateEmailReminder(receiverEmail, affiliateEmailParamsDTO, "summary");
|
||||||
// emailService.affiliateEmailReminder(Arrays.asList(/*merchantEmail,*/ developer), affiliateEmailParamsDTO, "summary");
|
// emailService.affiliateEmailReminder(Arrays.asList(/*merchantEmail,*/ developer), affiliateEmailParamsDTO, "summary");
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import io.netty.util.internal.StringUtil;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.xssf.usermodel.*;
|
import org.apache.poi.xssf.usermodel.*;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -149,7 +148,17 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
|| ADMIN_IDS.contains(account.getId())
|
|| ADMIN_IDS.contains(account.getId())
|
||||||
|| ADMIN_IDS_READ_ONLY.contains(account.getId())
|
|| ADMIN_IDS_READ_ONLY.contains(account.getId())
|
||||||
)) {
|
)) {
|
||||||
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
|
boolean filterBySecond ;
|
||||||
|
if (StringUtil.isNullOrEmpty(startTime)) {
|
||||||
|
startTime = "2024-02-01 00:00:00";
|
||||||
|
filterBySecond = true;
|
||||||
|
} else {
|
||||||
|
LocalDateTime thresholdTime = LocalDateTime.of(2024, 5, 1, 0, 0, 0);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime startDateTime = LocalDateTime.parse(startTime, formatter);
|
||||||
|
filterBySecond = startDateTime.isBefore(thresholdTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtil.isNullOrEmpty(endTime)) {
|
if (StringUtil.isNullOrEmpty(endTime)) {
|
||||||
// yyyy-MM-dd HH:mm:ss "HH"表示24小时制 "hh"表示12小时制
|
// yyyy-MM-dd HH:mm:ss "HH"表示24小时制 "hh"表示12小时制
|
||||||
endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
@@ -173,7 +182,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
default:
|
default:
|
||||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||||
}
|
}
|
||||||
return designMapper.getDesignStatistic(startTime, endTime, ids, email, role, account.getOrganizationName());
|
return designMapper.getDesignStatistic(startTime, endTime, ids, email, role, account.getOrganizationName(), filterBySecond);
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||||
}
|
}
|
||||||
@@ -695,14 +704,19 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
|
|
||||||
String username = UserContext.getUserHolder().getUsername();
|
String username = UserContext.getUserHolder().getUsername();
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
|
account.setId(accountId);
|
||||||
// 修改用户有效期截止日期、用户类型、积分
|
// 修改用户有效期截止日期、用户类型、积分
|
||||||
if (!Objects.isNull(validEndTime)) {
|
if (!Objects.isNull(validEndTime)) {
|
||||||
account.setValidEndTime(validEndTime);
|
account.setValidEndTime(validEndTime);
|
||||||
log.info("管理员:{},修改用户 {} 信息,将账号到期时间置为:{}", username, accountId, validEndTime);
|
log.info("管理员:{},修改用户 {} 信息,将账号到期时间置为:{}", username, accountId, validEndTime);
|
||||||
}
|
}
|
||||||
if (!Objects.isNull(systemUser)) {
|
if (!Objects.isNull(systemUser) && !systemUser.equals(0)) {
|
||||||
account.setSystemUser(systemUser);
|
account.setSystemUser(systemUser);
|
||||||
log.info("管理员:{},修改用户 {} 信息,将账号身份置为:{}", username, accountId, systemUser);
|
log.info("管理员:{},修改用户 {} 信息,将账号身份置为:{}", username, accountId, systemUser);
|
||||||
|
} else if (systemUser.equals(0)){
|
||||||
|
// 将用户身份设置为游客
|
||||||
|
accountService.toVisitor(account);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/*if (!StringUtils.isNullOrEmpty(systemUser)) {
|
/*if (!StringUtils.isNullOrEmpty(systemUser)) {
|
||||||
int systemUser = 0;
|
int systemUser = 0;
|
||||||
@@ -728,7 +742,6 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo 如果修改管理员账号的积分上限或子账号数量,则其所有子账号的积分上限需要重新计算
|
// todo 如果修改管理员账号的积分上限或子账号数量,则其所有子账号的积分上限需要重新计算
|
||||||
account.setId(accountId);
|
|
||||||
account.setUpdateDate(new Date());
|
account.setUpdateDate(new Date());
|
||||||
return accountMapper.updateById(account) == 1;
|
return accountMapper.updateById(account) == 1;
|
||||||
// accountService.update(account,null);
|
// accountService.update(account,null);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -1154,7 +1155,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.toLocalDateTime());
|
.toLocalDateTime());
|
||||||
userPreference.setDesignItemId(designItem.getId());
|
userPreference.setDesignItemId(designItem.getId());
|
||||||
userPreference.setProjectId(projectId);
|
userPreference.setProjectId(projectId);
|
||||||
if (workspaceRelStyles == null||workspaceRelStyles.size()==0) {
|
if (workspaceRelStyles == null||workspaceRelStyles.isEmpty()) {
|
||||||
//查不到记录,style应该是all
|
//查不到记录,style应该是all
|
||||||
userPreference.setWorkspaceRelStyleId(0L);
|
userPreference.setWorkspaceRelStyleId(0L);
|
||||||
} else {
|
} else {
|
||||||
@@ -1669,6 +1670,24 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.lt("create_date", endTime)
|
.lt("create_date", endTime)
|
||||||
.select("count(id) as count");
|
.select("count(id) as count");
|
||||||
|
|
||||||
|
// 如果startTime早于2024-05-01 00:00:00,添加额外的筛选条件
|
||||||
|
LocalDateTime thresholdTime = LocalDateTime.of(2024, 5, 1, 0, 0, 0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime startDateTime = LocalDateTime.parse(startTime, formatter);
|
||||||
|
|
||||||
|
if (startDateTime.isBefore(thresholdTime)) {
|
||||||
|
// 使用 notLike 来排除以 ":01" 或 ":02" 结尾的时间
|
||||||
|
// 方案2.1:使用 apply 方法执行数据库函数 (create_date 字段的实际存储格式(可能包含毫秒),所以取最后三个字符进行匹配)
|
||||||
|
queryWrapper.apply("DATE_FORMAT(create_date, '%s') NOT IN ('01', '02')");
|
||||||
|
/*queryWrapper.notLike("create_date", "%:01")
|
||||||
|
.notLike("create_date", "%:02");*/
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Failed to parse startTime: {}, skip time-based filtering", startTime, e);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Objects.isNull(accountIds) && !accountIds.isEmpty()) {
|
if (!Objects.isNull(accountIds) && !accountIds.isEmpty()) {
|
||||||
queryWrapper.in("account_id", accountIds);
|
queryWrapper.in("account_id", accountIds);
|
||||||
}
|
}
|
||||||
@@ -1676,7 +1695,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
List<Map<String, Object>> result = baseMapper.selectMaps(queryWrapper);
|
List<Map<String, Object>> result = baseMapper.selectMaps(queryWrapper);
|
||||||
if (result != null && !result.isEmpty()) {
|
if (result != null && !result.isEmpty()) {
|
||||||
Object countObj = result.get(0).get("count");
|
Object countObj = result.get(0).get("count");
|
||||||
return (Long) countObj;
|
return countObj != null ? ((Number) countObj).longValue() : 0L;
|
||||||
} else {
|
} else {
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ public class EmailServiceImpl implements EmailService {
|
|||||||
try {
|
try {
|
||||||
String merchantEmail = "kimwong@code-create.com.hk";
|
String merchantEmail = "kimwong@code-create.com.hk";
|
||||||
String developer = "xupei3360@163.com";
|
String developer = "xupei3360@163.com";
|
||||||
List<String> merchantReceiver = Arrays.asList(merchantEmail, developer);
|
List<String> merchantReceiver = Arrays.asList(/*merchantEmail,*/ developer);
|
||||||
|
|
||||||
String merchantSubject = null;
|
String merchantSubject = null;
|
||||||
String merchantTemplate = null;
|
String merchantTemplate = null;
|
||||||
@@ -731,7 +731,7 @@ public class EmailServiceImpl implements EmailService {
|
|||||||
jsonObject.put("quantity", quantity);
|
jsonObject.put("quantity", quantity);
|
||||||
jsonObject.put("totalFee", amount);
|
jsonObject.put("totalFee", amount);
|
||||||
|
|
||||||
sendEmail(Arrays.asList(merchantEmail, developerEmail), jsonObject, CREDITS_PURCHASE_MERCHANT, "New Credit Purchase Order", null, null);
|
sendEmail(Arrays.asList(/*merchantEmail,*/ developerEmail), jsonObject, CREDITS_PURCHASE_MERCHANT, "New Credit Purchase Order", null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static String COMMON_EXCEPTION_REMINDER = "135279_common-exception-reminder.html";
|
private final static String COMMON_EXCEPTION_REMINDER = "135279_common-exception-reminder.html";
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import io.netty.util.internal.StringUtil;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@@ -53,7 +54,11 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
|||||||
private final PythonTAllInfoService pythonTAllInfoService;
|
private final PythonTAllInfoService pythonTAllInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
||||||
|
// 参数校验
|
||||||
|
validateInputParams(libraryModelPointDTO);
|
||||||
|
|
||||||
LibraryModelPointVO libraryModelPointVO = CopyUtil.copyObject(libraryModelPointDTO, LibraryModelPointVO.class);
|
LibraryModelPointVO libraryModelPointVO = CopyUtil.copyObject(libraryModelPointDTO, LibraryModelPointVO.class);
|
||||||
|
|
||||||
// 不管是保存还是另存为,都需要传模特的libraryId
|
// 不管是保存还是另存为,都需要传模特的libraryId
|
||||||
@@ -71,7 +76,8 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
|||||||
// 更新模特图片
|
// 更新模特图片
|
||||||
if (flag) {
|
if (flag) {
|
||||||
libModel.setUrl(url);
|
libModel.setUrl(url);
|
||||||
libModel.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false));
|
String preSignedUrl = minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||||
|
libModel.setMd5(MD5Utils.encryptFile(preSignedUrl, false));
|
||||||
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(url);
|
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(url);
|
||||||
libModel.setWidth(imagesWidthAndHeight.get(0));
|
libModel.setWidth(imagesWidthAndHeight.get(0));
|
||||||
libModel.setHigh(imagesWidthAndHeight.get(1));
|
libModel.setHigh(imagesWidthAndHeight.get(1));
|
||||||
@@ -104,25 +110,10 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 不覆盖,即另存为
|
// 不覆盖,即另存为
|
||||||
// 新增模特library信息
|
Library saveAsModel = createNewLibraryCopy(libModel, libraryModelPointDTO);
|
||||||
Library saveAsModel = new Library();
|
|
||||||
saveAsModel.setAccountId(libModel.getAccountId());
|
|
||||||
saveAsModel.setLevel1Type(libModel.getLevel1Type());
|
|
||||||
saveAsModel.setLevel2Type(libModel.getLevel2Type());
|
|
||||||
String ageGroup = StringUtil.isNullOrEmpty(libModel.getLevel3Type()) ? "Adult" : libModel.getLevel3Type();
|
|
||||||
saveAsModel.setLevel3Type(ageGroup);
|
|
||||||
saveAsModel.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
|
|
||||||
saveAsModel.setUrl(url);
|
|
||||||
saveAsModel.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false));
|
|
||||||
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(url);
|
|
||||||
saveAsModel.setWidth(imagesWidthAndHeight.get(0));
|
|
||||||
saveAsModel.setHigh(imagesWidthAndHeight.get(1));
|
|
||||||
saveAsModel.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
|
||||||
libraryService.save(saveAsModel);
|
|
||||||
// 更新新的模特在library中的id,用于后面新建模特点位信息用
|
|
||||||
libraryModelPointDTO.setLibraryId(saveAsModel.getId());
|
|
||||||
|
|
||||||
// 新增模特点位信息
|
// 新增模特点位信息
|
||||||
|
libraryModelPointDTO.setLibraryId(saveAsModel.getId()); // 更新libraryId为新创建的模型ID
|
||||||
LibraryModelPoint libraryModelPoint = resolvePoint(libraryModelPointDTO);
|
LibraryModelPoint libraryModelPoint = resolvePoint(libraryModelPointDTO);
|
||||||
libraryModelPoint.setModelType("Library");
|
libraryModelPoint.setModelType("Library");
|
||||||
libraryModelPoint.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
libraryModelPoint.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||||
@@ -130,22 +121,50 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
|||||||
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
|
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
|
||||||
libraryModelPointVO.setRelationId(libraryModelPoint.getRelationId());
|
libraryModelPointVO.setRelationId(libraryModelPoint.getRelationId());
|
||||||
}
|
}
|
||||||
//编辑
|
|
||||||
/*if (!StringUtils.isEmpty(libraryModelPointDTO.getModelSex())) {
|
|
||||||
Library byId = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
|
||||||
if (!byId.getLevel2Type().equals(libraryModelPointDTO.getModelSex())) {
|
|
||||||
if (byId.getLevel2Type().equals(Sex.FEMALE.getValue())) {
|
|
||||||
libraryService.checkModel(Sex.FEMALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
|
||||||
}else {
|
|
||||||
libraryService.checkModel(Sex.MALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
|
||||||
}
|
|
||||||
byId.setLevel2Type(libraryModelPointDTO.getModelSex());
|
|
||||||
libraryService.updateById(byId);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
return libraryModelPointVO;
|
return libraryModelPointVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证输入参数
|
||||||
|
*/
|
||||||
|
private void validateInputParams(LibraryModelPointDTO libraryModelPointDTO) {
|
||||||
|
if (libraryModelPointDTO == null) {
|
||||||
|
throw new BusinessException("libraryModelPointDTO cannot be null");
|
||||||
|
}
|
||||||
|
if (libraryModelPointDTO.getLibraryId() == null || libraryModelPointDTO.getLibraryId() <= 0) {
|
||||||
|
throw new BusinessException("libraryId is required");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(libraryModelPointDTO.getModelPath())) {
|
||||||
|
throw new BusinessException("modelPath is required");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(libraryModelPointDTO.getTimeZone())) {
|
||||||
|
throw new BusinessException("timeZone is required");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的库模型副本
|
||||||
|
*/
|
||||||
|
private Library createNewLibraryCopy(Library originalModel, LibraryModelPointDTO libraryModelPointDTO) {
|
||||||
|
// 新增模特library信息
|
||||||
|
Library saveAsModel = new Library();
|
||||||
|
saveAsModel.setAccountId(originalModel.getAccountId());
|
||||||
|
saveAsModel.setLevel1Type(originalModel.getLevel1Type());
|
||||||
|
saveAsModel.setLevel2Type(originalModel.getLevel2Type());
|
||||||
|
String ageGroup = StringUtil.isNullOrEmpty(originalModel.getLevel3Type()) ? "Adult" : originalModel.getLevel3Type();
|
||||||
|
saveAsModel.setLevel3Type(ageGroup);
|
||||||
|
saveAsModel.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
|
||||||
|
saveAsModel.setUrl(libraryModelPointDTO.getModelPath());
|
||||||
|
String preSignedUrl = minioUtil.getPreSignedUrl(libraryModelPointDTO.getModelPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||||
|
saveAsModel.setMd5(MD5Utils.encryptFile(preSignedUrl, false));
|
||||||
|
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(libraryModelPointDTO.getModelPath());
|
||||||
|
saveAsModel.setWidth(imagesWidthAndHeight.get(0));
|
||||||
|
saveAsModel.setHigh(imagesWidthAndHeight.get(1));
|
||||||
|
saveAsModel.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||||
|
libraryService.save(saveAsModel);
|
||||||
|
return saveAsModel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LibraryModelPointVO saveOrEditTemplatePointOld(LibraryModelPointDTO libraryModelPointDTO) {
|
public LibraryModelPointVO saveOrEditTemplatePointOld(LibraryModelPointDTO libraryModelPointDTO) {
|
||||||
// Library library = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
// Library library = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ orderList.link=https://develop.aida.com.hk/home/homePage?order=
|
|||||||
# 0 不发送邮件通知 1 发送邮件通知
|
# 0 不发送邮件通知 1 发送邮件通知
|
||||||
stripe.webhook.fail.reminder=0
|
stripe.webhook.fail.reminder=0
|
||||||
# kim test
|
# kim test
|
||||||
stripe.paymentMethodConfiguration=pmc_1LywTWH7nPZ8bkrN6FvdCUWG
|
#stripe.paymentMethodConfiguration=pmc_1LywTWH7nPZ8bkrN6FvdCUWG
|
||||||
# developer test
|
# developer test
|
||||||
#stripe.paymentMethodConfiguration=pmc_1QIKyq02n1TEydyNKVEYvhW7
|
stripe.paymentMethodConfiguration=pmc_1QIKyq02n1TEydyNKVEYvhW7
|
||||||
#thymelea模板配置
|
#thymelea模板配置
|
||||||
#控制 Thymeleaf 是否启用模板缓存 生产环境用true,以提高性能
|
#控制 Thymeleaf 是否启用模板缓存 生产环境用true,以提高性能
|
||||||
spring.thymeleaf.cache=false
|
spring.thymeleaf.cache=false
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#spring.profiles.active=test
|
#spring.profiles.active=test
|
||||||
|
|
||||||
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
spring.profiles.active=prod
|
#spring.profiles.active=prod
|
||||||
|
|
||||||
#<23><><EFBFBD><EFBFBD>application-dev<65>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
#<23><><EFBFBD><EFBFBD>application-dev<65>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
#spring.profiles.active=dev
|
spring.profiles.active=dev
|
||||||
|
|||||||
@@ -61,10 +61,10 @@
|
|||||||
</if>
|
</if>
|
||||||
<!-- 添加时间区间查询条件 -->
|
<!-- 添加时间区间查询条件 -->
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND cd.create_time >= #{startTime}
|
AND create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="endTime != null and endTime != ''">
|
||||||
AND cd.create_time <= #{endTime}
|
AND create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
account_id
|
account_id
|
||||||
|
|||||||
@@ -52,8 +52,10 @@
|
|||||||
AND b.create_date between #{startTime} and #{endTime}
|
AND b.create_date between #{startTime} and #{endTime}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
and b.create_date not like '%:01'
|
<if test="filterBySecond">
|
||||||
and b.create_date not like '%:02'
|
and b.create_date not like '%:01'
|
||||||
|
and b.create_date not like '%:02'
|
||||||
|
</if>
|
||||||
<if test="ids != null and ids.size() > 0">
|
<if test="ids != null and ids.size() > 0">
|
||||||
and a.id in
|
and a.id in
|
||||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ paypal.webhook_id=1D107312EX592781K
|
|||||||
##### Stripe
|
##### Stripe
|
||||||
|
|
||||||
# developer
|
# developer
|
||||||
#stripe.private-key=sk_test_51P4ZZL02n1TEydyN8qQHjOA9imsFU7Oxs2HMHGy2urHnnQgSHnZuu5vVP6pKhEACwUpsKNyrbZpdcg5TJWJLRHcY008dEO1fn2
|
stripe.private-key=sk_test_51P4ZZL02n1TEydyN8qQHjOA9imsFU7Oxs2HMHGy2urHnnQgSHnZuu5vVP6pKhEACwUpsKNyrbZpdcg5TJWJLRHcY008dEO1fn2
|
||||||
# dev 端点
|
# dev 端点
|
||||||
#stripe.webhook-sign-secret=whsec_e0dBiJngx6qqgJj6yPyJ2A9ouh1Cjv5w
|
stripe.webhook-sign-secret=whsec_e0dBiJngx6qqgJj6yPyJ2A9ouh1Cjv5w
|
||||||
# local 端点
|
# local 端点
|
||||||
#stripe.webhook-sign-secret=whsec_TJcMSnAkh4uktrNY1M6Iy8XaVze4Rzqm
|
#stripe.webhook-sign-secret=whsec_TJcMSnAkh4uktrNY1M6Iy8XaVze4Rzqm
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ paypal.webhook_id=1D107312EX592781K
|
|||||||
#stripe.webhook-sign-secret=whsec_pX0pPMQm85PaUSWnFMEzoccb3MGNkjoL
|
#stripe.webhook-sign-secret=whsec_pX0pPMQm85PaUSWnFMEzoccb3MGNkjoL
|
||||||
|
|
||||||
# kim - live
|
# kim - live
|
||||||
stripe.private-key=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
|
#stripe.private-key=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
|
||||||
# prod 端点
|
# prod 端点
|
||||||
stripe.webhook-sign-secret=whsec_hhGDgdelQRHSg4LmChtQe41crj41eb11
|
#stripe.webhook-sign-secret=whsec_hhGDgdelQRHSg4LmChtQe41crj41eb11
|
||||||
# dev 端点
|
# dev 端点
|
||||||
#stripe.webhook-sign-secret=whsec_cFUtjUOo8wnrIKZmt4GNvt7ZY1bOfrYr
|
#stripe.webhook-sign-secret=whsec_cFUtjUOo8wnrIKZmt4GNvt7ZY1bOfrYr
|
||||||
|
|||||||
Reference in New Issue
Block a user