Compare commits
23 Commits
b023a68f83
...
01e82b4c23
| Author | SHA1 | Date | |
|---|---|---|---|
| 01e82b4c23 | |||
|
|
e085275aee | ||
|
|
fa7271567e | ||
| 05049ae7a2 | |||
| 00c0a65547 | |||
| 77aab576de | |||
| 5b2c77f81b | |||
| 96040f2349 | |||
| 62bf538d96 | |||
| 456cb1ff19 | |||
| d622195f9d | |||
| 1917fd518d | |||
| 8f72686809 | |||
| 37ddf6f441 | |||
| dbf9b2d722 | |||
| a91f9ccdd4 | |||
| dac51afe73 | |||
| 3aa744895f | |||
| 9535d8ce59 | |||
| e366d5a2c5 | |||
|
|
b58b8df88f | ||
|
|
c09f734a30 | ||
| 1464689657 |
@@ -1,7 +0,0 @@
|
||||
FROM openjdk:8
|
||||
VOLUME /tmp
|
||||
#时区设置
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo 'Asia/Shanghai' > /etc/timezone
|
||||
ADD ./target/aida-0.0.1-SNAPSHOT.jar /app.jar
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
||||
@@ -132,7 +132,6 @@ public class MyTaskScheduler {
|
||||
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
|
||||
@@ -151,7 +150,6 @@ public class MyTaskScheduler {
|
||||
private ProjectMapper projectMapper;
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
|
||||
@@ -95,11 +95,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Resource
|
||||
private AccountLoginLogService accountLoginLogService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private ConvenientInquiryService convenientInquiryService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
|
||||
@@ -118,10 +113,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Resource
|
||||
private QuestionnaireMapper questionnaireMapper;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@@ -141,14 +132,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private StripeService stripeService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private AffiliateService affiliateService;
|
||||
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
|
||||
@@ -207,10 +190,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
return new AccountPreLoginVO(account.getId());
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AccountLoginVO login(AccountLoginDTO accountLoginDTO, HttpServletRequest request) {
|
||||
@@ -1641,6 +1620,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
log.warn("当前用户 {} 在AiDA中没有账号", email);
|
||||
throw new BusinessException("user.has.no.account", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
CreditsService creditsService = SpringUtils.getBean(CreditsService.class);
|
||||
// 2、先判断当前用户是否已经填写过问卷
|
||||
CreditsDetail record = creditsService.getByAccountIdAndChangeEvent(account.getId(), "Fill out the questionnaire", "+100");
|
||||
if (!Objects.isNull(record)) {
|
||||
@@ -2059,7 +2039,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String avatar = StringUtil.isNullOrEmpty(account.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : account.getAvatar();
|
||||
personalHomepageVO.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
|
||||
personalHomepageVO.setPortfolioCount(portfolioService.getPortfolioCount(accountId));
|
||||
personalHomepageVO.setPortfolioCount(SpringUtils.getBean(PortfolioService.class).getPortfolioCount(accountId));
|
||||
personalHomepageVO.setFolloweeCount(userFollowService.getFolloweeCount(accountId));
|
||||
personalHomepageVO.setFollowerCount(userFollowService.getFollowerCount(accountId));
|
||||
personalHomepageVO.setHomepageViewCount(viewPersonalHomepageCount(0L));
|
||||
@@ -3149,7 +3129,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
response.setAccountExtendList(accountExtends);
|
||||
}
|
||||
response.setLanguage(Language.valueOf(account.getLanguage()).name());
|
||||
SubscriptionInfo subscriptionInfo = stripeService.getLatestSubscriptionInfoByAccountId(accountId);
|
||||
SubscriptionInfo subscriptionInfo = SpringUtils.getBean(StripeService.class).getLatestSubscriptionInfoByAccountId(accountId);
|
||||
if (!Objects.isNull(subscriptionInfo)) {
|
||||
response.setSubscriptionId(subscriptionInfo.getSubscriptionId());
|
||||
response.setSubscriptionType(subscriptionInfo.getType());
|
||||
@@ -3158,7 +3138,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
response.setAutoRenewal(subscriptionInfo.getStatus().equals("active"));
|
||||
}
|
||||
|
||||
Affiliate affiliate = affiliateService.getByAccountId(accountId);
|
||||
Affiliate affiliate = SpringUtils.getBean(AffiliateService.class).getByAccountId(accountId);
|
||||
if (!Objects.isNull(affiliate) && affiliate.getStatus().equals("Active")) {
|
||||
response.setAffiliate(true);
|
||||
}
|
||||
@@ -3378,6 +3358,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
accountMapper.updateById(account);
|
||||
|
||||
CreditsService creditsService = SpringUtils.getBean(CreditsService.class);
|
||||
// 先判断是否已添加添加积分变更记录
|
||||
CreditsDetail creditsDetail = creditsService.queryDetailByTaskId(orderNo);
|
||||
if (Objects.isNull(creditsDetail)) {
|
||||
@@ -3670,14 +3651,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// todo 机构管理员再次订阅时,需要同步机构的激活状态
|
||||
private void setOrganizationStatus(Account adminAcc, boolean isActive) {
|
||||
Organization organization;
|
||||
ConvenientInquiryService convenientInquiryService = null;
|
||||
if (Objects.nonNull(adminAcc.getOrganizationId())) {
|
||||
organization = organizationMapper.selectById(adminAcc.getOrganizationId());
|
||||
} else if (!StringUtil.isNullOrEmpty(adminAcc.getOrganizationName())) {
|
||||
convenientInquiryService = SpringUtils.getBean(ConvenientInquiryService.class);
|
||||
organization = convenientInquiryService.checkOrganization(adminAcc.getSystemUser(), adminAcc.getOrganizationName());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (Objects.isNull(organization)) {
|
||||
if (Objects.isNull(convenientInquiryService)) {
|
||||
convenientInquiryService = SpringUtils.getBean(ConvenientInquiryService.class);
|
||||
}
|
||||
organization = convenientInquiryService.addOrganization(adminAcc.getOrganizationName(), getOrganizationTypeByRole(adminAcc.getSystemUser()));
|
||||
}
|
||||
if (isActive) {
|
||||
|
||||
@@ -54,9 +54,6 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
private PaymentInfoService paymentInfoService;
|
||||
@Resource
|
||||
private SubscriptionInfoMapper subscriptionInfoMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private ReferralService referralService;
|
||||
@Resource
|
||||
private ReferralMapper referralMapper;
|
||||
@Resource
|
||||
@@ -339,7 +336,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
referral.setCommissionPercent(affiliate.getCommissionPercent());
|
||||
referral.setStatus("Pending");
|
||||
referral.setCreateTime(LocalDateTime.now());
|
||||
int insert = referralService.getBaseMapper().insert(referral);
|
||||
int insert = referralMapper.insert(referral);
|
||||
log.info("向Referral中插入 {} 条数据", insert);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,8 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Lazy
|
||||
public class CloudTaskServiceImpl extends ServiceImpl<CloudTaskMapper, CloudTask> implements CloudTaskService {
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementMapper, CollectionElement> implements CollectionElementService {
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final EmailService emailService;
|
||||
// private final EmailService emailService;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateMapper generateMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
|
||||
@@ -61,7 +61,6 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
private GenerateMapper generateMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
|
||||
@@ -40,7 +40,6 @@ public class CreditsServiceImpl extends ServiceImpl<CreditsDetailMapper, Credits
|
||||
@Value("${redis.key.credits.pre-deduction}")
|
||||
private String creditsDeduction;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
|
||||
@@ -289,7 +289,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
response.setDesignItemUrl(url);
|
||||
//更新item
|
||||
updateById(designItem);
|
||||
|
||||
|
||||
// 查询现有的记录,用于 saveOrUpdate
|
||||
List<DesignItemDetail> existingDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||
// 创建 Map,以 priority 为 key,方便快速查找
|
||||
@@ -305,7 +305,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
return;
|
||||
}
|
||||
Integer priority = SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) ? 0 : detail.getPriority();
|
||||
|
||||
|
||||
DesignItemDetail designItemDetail = reuseDesignItemDetail(priority, detail.getType(),
|
||||
existingDetailMap, detailBuckets, reusedDetailIds);
|
||||
if (Objects.nonNull(designItemDetail)) {
|
||||
@@ -314,7 +314,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail = new DesignItemDetail();
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
}
|
||||
|
||||
|
||||
// 设置/更新字段
|
||||
designItemDetail.setAccountId(userInfo.getId());
|
||||
designItemDetail.setDesignId(designId);
|
||||
@@ -338,7 +338,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
|
||||
|
||||
// 逻辑删除未复用的旧记录
|
||||
existingDetails.stream()
|
||||
.filter(existingDetail -> Objects.nonNull(existingDetail.getId()) && !reusedDetailIds.contains(existingDetail.getId()))
|
||||
@@ -349,7 +349,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
updateWrapper.set("update_date", DateUtil.getByTimeZone(timeZone));
|
||||
designItemDetailService.update(null, updateWrapper);
|
||||
});
|
||||
|
||||
|
||||
designItemDetailService.saveOrUpdateBatch(designItemDetails);
|
||||
//封装item信息
|
||||
List<DesignCollectionItemVO> designCollectionItems = CopyUtil.copyList(getByDesignId(designId)
|
||||
@@ -379,7 +379,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 1、更新designItem
|
||||
// updateById(designItem);
|
||||
updateDesignItem(designItem);
|
||||
|
||||
|
||||
// 2、查询现有的记录,用于 saveOrUpdate
|
||||
List<DesignItemDetail> existingDetails = designItemDetailService.selectByDesignItemId(designItemId);
|
||||
// 创建 Map,以 priority 为 key,方便快速查找
|
||||
@@ -388,7 +388,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
.collect(Collectors.toMap(DesignItemDetail::getPriority, detail -> detail, (old, newVal) -> old));
|
||||
Map<String, Deque<DesignItemDetail>> detailBuckets = buildDetailTypeBuckets(existingDetails);
|
||||
Set<Long> reusedDetailIds = new HashSet<>();
|
||||
|
||||
|
||||
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
||||
// 3、保存新的designItemDetail(使用 saveOrUpdate 方式)
|
||||
pythonObjects.getObjects().get(0).getItems().forEach(detail -> {
|
||||
@@ -396,7 +396,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
return;
|
||||
}
|
||||
Integer priority = SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) ? 0 : detail.getPriority();
|
||||
|
||||
|
||||
DesignItemDetail designItemDetail = reuseDesignItemDetail(priority, detail.getType(),
|
||||
existingDetailMap, detailBuckets, reusedDetailIds);
|
||||
if (Objects.nonNull(designItemDetail)) {
|
||||
@@ -405,7 +405,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail = new DesignItemDetail();
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
}
|
||||
|
||||
|
||||
// 设置/更新字段
|
||||
designItemDetail.setAccountId(userId);
|
||||
designItemDetail.setDesignId(designId);
|
||||
@@ -427,12 +427,18 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (!detail.getType().equals("Body")) {
|
||||
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(0));
|
||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1));
|
||||
|
||||
}
|
||||
// 印花存储在design_item_detail_print表中 这里还要存吗?
|
||||
// DesignPythonItemPrint printObject = detail.getPrintToPython();
|
||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
// 当有多个印花后,返回的printObject太长,导致存储到数据库时报错
|
||||
// designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
||||
|
||||
designItemDetail.setPartialDesign(Objects.isNull(detail.getPrint()) ? null : detail.getPrint().getPartial());
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
|
||||
|
||||
// 逻辑删除未复用的旧记录
|
||||
existingDetails.stream()
|
||||
.filter(existingDetail -> Objects.nonNull(existingDetail.getId()) && !reusedDetailIds.contains(existingDetail.getId()))
|
||||
@@ -443,7 +449,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
updateWrapper.set("update_date", DateUtil.getByTimeZone(timeZone));
|
||||
designItemDetailService.update(null, updateWrapper);
|
||||
});
|
||||
|
||||
|
||||
// businessId 来自t_sys_file或者t_library
|
||||
designItemDetailService.saveOrUpdateBatch(designItemDetails);
|
||||
|
||||
@@ -479,7 +485,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
Integer priority = (Integer) jsonObject.get("priority");
|
||||
|
||||
|
||||
TDesignPythonOutfitDetail designPythonOutfitDetail = reuseOutfitDetail(priority,
|
||||
jsonObject.getString("image_category"), existingLayerMap, layerBuckets, reusedLayerIds);
|
||||
if (Objects.nonNull(designPythonOutfitDetail)) {
|
||||
@@ -488,7 +494,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designPythonOutfitDetail = new TDesignPythonOutfitDetail();
|
||||
designPythonOutfitDetail.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||
}
|
||||
|
||||
|
||||
// 设置/更新字段
|
||||
designPythonOutfitDetail.setDesignId(designId);
|
||||
designPythonOutfitDetail.setDesignPythonOutfitId(designPythonOutfit.getId());
|
||||
@@ -503,10 +509,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designPythonOutfitDetail.setOffset(String.valueOf(priorityOffset.get(Math.abs(priority))));
|
||||
}
|
||||
designPythonOutfitDetail.setPriority(priority);
|
||||
|
||||
|
||||
list.add(designPythonOutfitDetail);
|
||||
}
|
||||
|
||||
|
||||
// 逻辑删除未复用的旧记录
|
||||
existingLayers.stream()
|
||||
.filter(existingLayer -> Objects.nonNull(existingLayer.getId()) && !reusedLayerIds.contains(existingLayer.getId()))
|
||||
@@ -1154,7 +1160,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
|
||||
Long designItemDetailId = designItemDetailTypeIdMap.get(designSingleItem.getPriority());
|
||||
|
||||
|
||||
// 查询现有的记录,用于 saveOrUpdate
|
||||
List<DesignItemDetailPrint> existingPrints = designItemDetailPrintService.getByDesignItemDetailId(designItemDetailId, printType);
|
||||
// 创建 Map,以 priority 为 key,方便快速查找
|
||||
@@ -1168,10 +1174,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 处理新的印花列表
|
||||
printObject.getPrints().forEach(print -> {
|
||||
setUriToMinioPath(print);
|
||||
|
||||
|
||||
Integer priority = print.getPriority();
|
||||
newPrintPriorities.add(priority);
|
||||
|
||||
|
||||
DesignItemDetailPrint designItemDetailPrint;
|
||||
// 如果存在相同 priority 的记录,则更新;否则创建新记录
|
||||
if (existingPrintMap.containsKey(priority)) {
|
||||
@@ -1183,7 +1189,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetailPrint = new DesignItemDetailPrint();
|
||||
designItemDetailPrint.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||
}
|
||||
|
||||
|
||||
// 设置/更新字段
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailId);
|
||||
designItemDetailPrint.setPrintType(printType);
|
||||
@@ -1195,7 +1201,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||
designItemDetailPrint.setAngle(print.getAngle());
|
||||
designItemDetailPrint.setPriority(priority);
|
||||
|
||||
|
||||
designItemDetailPrints.add(designItemDetailPrint);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.MailUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.mapper.primary.AccountMapper;
|
||||
import com.ai.da.mapper.primary.EmailLogMapper;
|
||||
import com.ai.da.mapper.primary.EmailTemplateMapper;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.AffiliateEmailParamsDTO;
|
||||
import com.ai.da.model.dto.BasicEmailParamDTO;
|
||||
import com.ai.da.model.dto.SubscriptionEmailParamsDTO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.EmailService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -46,9 +46,8 @@ public class EmailServiceImpl implements EmailService {
|
||||
private EmailTemplateMapper emailTemplateMapper;
|
||||
@Resource
|
||||
private EmailLogMapper emailLogMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
private AccountMapper accountMapper;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
@@ -163,7 +162,7 @@ public class EmailServiceImpl implements EmailService {
|
||||
public void sendEmail(List<String> mailTo, JSONObject jsonObject, String templateName, String title, String fileName, InputStreamSource inputStreamSource) {
|
||||
if (mailTo.size() == 1){
|
||||
String receiver = mailTo.get(0);
|
||||
Account account = accountService.getBaseMapper().selectOne(new QueryWrapper<Account>().eq("user_email", receiver));
|
||||
Account account = accountMapper.selectOne(new QueryWrapper<Account>().eq("user_email", receiver));
|
||||
if (Objects.nonNull(account)){
|
||||
boolean b = redisUtil.allowSend(account.getId());
|
||||
if (!b){throw new BusinessException("email.count.limit", ResultEnum.PROMPT.getCode());}
|
||||
|
||||
@@ -89,7 +89,6 @@ import static com.ai.da.common.enums.WangXiangTaskStatusEnum.UNKNOWN_W;
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> implements GenerateService {
|
||||
|
||||
private final AccountService accountService;
|
||||
private final APIGenerateService apiGenerateService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final CollectionElementService collectionElementService;
|
||||
@@ -828,7 +827,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (finishMessage != null && finishMessage.contains("Try rephrasing the prompt")) {
|
||||
finishMessage = "Try rephrasing the prompt or modifying the model image. If you think this was an error, send feedback.";
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
Account account = accountService.getOne(select);
|
||||
Account account = getAccountService().getOne(select);
|
||||
if ("CHINESE_SIMPLIFIED".equals(account.getLanguage())) {
|
||||
finishMessage = "请尝试重新表述提示词,或修改模特图。若您认为这是误判,可提交反馈。";
|
||||
}
|
||||
@@ -1096,7 +1095,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (finishMessage != null && finishMessage.contains("Try rephrasing the prompt")) {
|
||||
finishMessage = "Try rephrasing the prompt or replacing the image. If you think this was an error, send feedback.";
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
Account account = accountService.getOne(select);
|
||||
Account account = getAccountService().getOne(select);
|
||||
if ("CHINESE_SIMPLIFIED".equals(account.getLanguage())) {
|
||||
finishMessage = "请尝试重新表述提示词,或更换图片。若您认为这是误判,可提交反馈。";
|
||||
}
|
||||
@@ -1117,7 +1116,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (raiFilteredReason != null && raiFilteredReason.contains("Try rephrasing the prompt")) {
|
||||
raiFilteredReason = "Input data may contain inappropriate content.";
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
Account account = accountService.getOne(select);
|
||||
Account account = getAccountService().getOne(select);
|
||||
if ("CHINESE_SIMPLIFIED".equals(account.getLanguage())) {
|
||||
raiFilteredReason = "输入数据可能包含不当内容。";
|
||||
}
|
||||
@@ -1381,7 +1380,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
exceptionMessage = jsonObj.getStr("message");
|
||||
if ("Input data may contain inappropriate content.".equals(exceptionMessage)) {
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
Account account = accountService.getOne(select);
|
||||
Account account = getAccountService().getOne(select);
|
||||
if ("CHINESE_SIMPLIFIED".equals(account.getLanguage())) {
|
||||
exceptionMessage = "输入数据可能包含不当内容。";
|
||||
}
|
||||
@@ -1478,7 +1477,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
} catch (Exception e) {
|
||||
log.error("Doubao image generation failed for taskId: {}", taskId, e);
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
Account account = accountService.getOne(select);
|
||||
Account account = getAccountService().getOne(select);
|
||||
|
||||
// 根据用户语言设置默认错误信息
|
||||
String errorMessage = "图像生成失败,请稍后重试"; // 默认中文
|
||||
@@ -2204,7 +2203,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
public void doCreditsSubtract(Long accountId, CreditsEventsEnum event) {
|
||||
Account account = accountService.getById(accountId);
|
||||
Account account = getAccountService().getById(accountId);
|
||||
BigDecimal existingCredits = account.getCredits();
|
||||
BigDecimal subtract = existingCredits.subtract(new BigDecimal(event.getValue()));
|
||||
BigDecimal creditsUsage = null;
|
||||
@@ -2212,10 +2211,14 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
creditsUsage = Objects.isNull(account.getCreditsUsage()) ? BigDecimal.ZERO : account.getCreditsUsage();
|
||||
creditsUsage = creditsUsage.add(new BigDecimal(event.getValue()));
|
||||
}
|
||||
accountService.updateCreditsAndEndTime(account, subtract.toString(), null, creditsUsage);
|
||||
getAccountService().updateCreditsAndEndTime(account, subtract.toString(), null, creditsUsage);
|
||||
creditsService.preInsert(accountId, event.getName(), null, Boolean.FALSE, event.getValue());
|
||||
}
|
||||
|
||||
private AccountService getAccountService() {
|
||||
return SpringUtils.getBean(AccountService.class);
|
||||
}
|
||||
|
||||
// 注入线程池(可在配置类中定义)
|
||||
@Resource
|
||||
private Executor asyncTaskExecutor;
|
||||
|
||||
@@ -83,8 +83,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
private final SysFileMapper sysFileMapper;
|
||||
private final SysFileExtraMapper sysFileExtraMapper;
|
||||
@Lazy
|
||||
private final WorkspaceService workspaceService;
|
||||
private final WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String users;
|
||||
@@ -730,7 +729,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
}
|
||||
// TODO:isDeleted设置
|
||||
qw.lambda().eq(Workspace::getIsDeleted, 0L);
|
||||
List<Workspace> workspaceList = workspaceService.list(qw);
|
||||
List<Workspace> workspaceList = workspaceMapper.selectList(qw);
|
||||
if (CollectionUtil.isNotEmpty(workspaceList)) {
|
||||
if (deleteModelConfirm.equals(0)) {
|
||||
throw new BusinessException("the.model.has.been.referenced.by.the.workspace", ResultEnum.WARNING.getCode());
|
||||
@@ -744,8 +743,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
for (Workspace workspace : workspaceList) {
|
||||
workspace.setMannequinFemaleId(sysFemaleFiles.get(0).getId());
|
||||
workspace.setMannequinFemaleType(MannequinType.SYSTEM.getValue());
|
||||
workspaceMapper.updateById(workspace);
|
||||
}
|
||||
workspaceService.updateBatchById(workspaceList);
|
||||
}
|
||||
}
|
||||
if (value.equals(Sex.MALE.getValue())) {
|
||||
@@ -757,8 +756,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
for (Workspace workspace : workspaceList) {
|
||||
workspace.setMannequinMaleId(sysMaleFiles.get(0).getId());
|
||||
workspace.setMannequinMaleType(MannequinType.SYSTEM.getValue());
|
||||
workspaceMapper.updateById(workspace);
|
||||
}
|
||||
workspaceService.updateBatchById(workspaceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,21 +402,27 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
notification.setType("system");
|
||||
notification.setReceiverId(userId);
|
||||
if (isSuccess) {
|
||||
if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification 系统通知");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!\n"
|
||||
+ "您在项目 " + projectName + " 中创建的视频生成任务已完成!");
|
||||
/*if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!");
|
||||
} else {
|
||||
sysNotificationDTO.setTitle("系统通知");
|
||||
sysNotificationDTO.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!");
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification 系统通知");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.\n"
|
||||
+ "您在项目 " + projectName + " 中创建的视频生成任务失败。");
|
||||
/*if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.");
|
||||
} else {
|
||||
sysNotificationDTO.setTitle("系统通知");
|
||||
sysNotificationDTO.setContent("视频生成任务失败。");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
notification.setContent(JSON.toJSONString(sysNotificationDTO));
|
||||
notification.setIsRead(0);
|
||||
|
||||
@@ -72,7 +72,6 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
|
||||
private PayPalClient payPalClient;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private PaymentInfoService paymentInfoService;
|
||||
@Resource
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ai.da.service.impl;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.PayTypeEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.utils.SpringUtils;
|
||||
import com.ai.da.mapper.primary.PaymentInfoMapper;
|
||||
import com.ai.da.mapper.primary.entity.OrderInfo;
|
||||
import com.ai.da.mapper.primary.entity.PaymentInfo;
|
||||
@@ -45,10 +46,6 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, PaymentInfo> implements PaymentInfoService {
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private StripeService stripeService;
|
||||
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
|
||||
@@ -230,6 +227,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PaymentInfo createOrUpdatePaymentInfoForStripe(Invoice invoice){
|
||||
Stripe.apiKey = privateKey;
|
||||
StripeService stripeService = SpringUtils.getBean(StripeService.class);
|
||||
// 获取transactionId,从sessionId更改为invoiceId
|
||||
String invoiceId = invoice.getId();
|
||||
|
||||
|
||||
@@ -60,13 +60,10 @@ public class StripeServiceImpl implements StripeService {
|
||||
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private PayPalCheckoutService payPalCheckoutService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private PaymentInfoService paymentInfoService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.utils.SpringUtils;
|
||||
import com.ai.da.mapper.primary.TaskListMapper;
|
||||
import com.ai.da.mapper.primary.entity.TaskList;
|
||||
import com.ai.da.model.dto.QueryTaskHistoryDTO;
|
||||
@@ -48,9 +49,6 @@ public class SuperResolutionServiceImpl extends ServiceImpl<TaskListMapper, Task
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
|
||||
@Resource
|
||||
private TaskListService taskListService;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@@ -114,7 +112,7 @@ public class SuperResolutionServiceImpl extends ServiceImpl<TaskListMapper, Task
|
||||
// 6、加入任务列表 设置状态为 等待中
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String name = superResolutionDTO.getImages();
|
||||
taskListService.addToTaskListRedis(new TaskDTO<>(uuid, "SR", name.substring(name.lastIndexOf("/") + 1), superResolutionDTO, "Waiting", LocalDateTime.now().format(dateTimeFormatter)));
|
||||
SpringUtils.getBean(TaskListService.class).addToTaskListRedis(new TaskDTO<>(uuid, "SR", name.substring(name.lastIndexOf("/") + 1), superResolutionDTO, "Waiting", LocalDateTime.now().format(dateTimeFormatter)));
|
||||
|
||||
// 7、将消息发布到MQ消息队列
|
||||
log.info("发送消息到SR_QUEUE,参数 :{}", jsonString);
|
||||
|
||||
@@ -42,7 +42,6 @@ public class TaskListServiceImpl extends ServiceImpl<TaskListMapper, TaskList> i
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private SuperResolutionService superResolutionService;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.RequestInfoUtil;
|
||||
import com.ai.da.common.utils.SendEmailUtil;
|
||||
import com.ai.da.common.utils.SpringUtils;
|
||||
import com.ai.da.mapper.primary.AccountMapper;
|
||||
import com.ai.da.mapper.primary.TrialOrderMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
@@ -40,12 +41,8 @@ public class TrialOrderServiceImpl extends ServiceImpl<TrialOrderMapper, TrialOr
|
||||
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Override
|
||||
public Boolean addTrialUser(AccountTrialDTO accountTrialDTO, HttpServletRequest request) {
|
||||
@@ -238,7 +235,7 @@ public class TrialOrderServiceImpl extends ServiceImpl<TrialOrderMapper, TrialOr
|
||||
throw new BusinessException("用户为正式用户");
|
||||
}
|
||||
libraryService.deleteTrialData(userInfo.getId());
|
||||
userLikeGroupService.deleteTrialData(userInfo.getId());
|
||||
SpringUtils.getBean(UserLikeGroupService.class).deleteTrialData(userInfo.getId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, UserLikeGroup> implements UserLikeGroupService {
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
private final AccountService accountService;
|
||||
private final AccountMapper accountMapper;
|
||||
private final CollectionService collectionService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final WorkspaceService workspaceService;
|
||||
@@ -1963,7 +1963,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
|
||||
}
|
||||
|
||||
Account account = accountService.getById(authPrincipalVo.getId());
|
||||
Account account = accountMapper.selectById(authPrincipalVo.getId());
|
||||
Map<Long, List<UserLikeVO>> finalGroupDetailMap = groupDetailMap;
|
||||
IPage<ProjectVO> convert = page.convert((Function<Project, ProjectVO>) project -> {
|
||||
if (project != null) {
|
||||
@@ -1991,7 +1991,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
userLikeGroupVO.setSketchCount(0);
|
||||
}
|
||||
if (userLikeGroupVO.getOriginal() == 0) {
|
||||
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
userLikeGroupVO.setOriginalAccountName(accountMapper.selectById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
Portfolio byId = portfolioMapper.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
if (Objects.nonNull(byId)) {
|
||||
String portfolioName = byId.getPortfolioName();
|
||||
|
||||
Reference in New Issue
Block a user