Merge remote-tracking branch 'origin/dev/3.1_release_merge' into dev-ltx
# Conflicts: # src/main/java/com/ai/da/controller/GlobalAwardController.java # src/main/java/com/ai/da/model/dto/ContestantDTO.java # src/main/resources/application-dev.properties # src/main/resources/application-prod.properties
This commit is contained in:
@@ -33,7 +33,11 @@ public enum AuthenticationOperationTypeEnum {
|
|||||||
*/
|
*/
|
||||||
UPDATE_USERINFO,
|
UPDATE_USERINFO,
|
||||||
|
|
||||||
REGISTER;
|
REGISTER,
|
||||||
|
/**
|
||||||
|
* Global_Award 活动验证
|
||||||
|
*/
|
||||||
|
GLOBAL_AWARD;
|
||||||
|
|
||||||
public static AuthenticationOperationTypeEnum of(String name) {
|
public static AuthenticationOperationTypeEnum of(String name) {
|
||||||
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);
|
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.ai.da.controller;
|
|||||||
|
|
||||||
import com.ai.da.common.response.Response;
|
import com.ai.da.common.response.Response;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
import com.ai.da.service.GlobalAwardService;
|
import com.ai.da.service.GlobalAwardService;
|
||||||
import com.ai.da.service.upload.UploadService;
|
import com.ai.da.service.upload.UploadService;
|
||||||
import com.ai.da.service.upload.UploadTask;
|
import com.ai.da.service.upload.UploadTask;
|
||||||
@@ -145,6 +147,18 @@ public class GlobalAwardController {
|
|||||||
ContestantDTO dto = globalAwardService.getContestantByEmail(email);
|
ContestantDTO dto = globalAwardService.getContestantByEmail(email);
|
||||||
return Response.success(dto);
|
return Response.success(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/checkEmail")
|
||||||
|
public Response<String> checkEmail(@RequestParam("email") String email) {
|
||||||
|
globalAwardService.checkEmail(email);
|
||||||
|
return Response.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/checkCode")
|
||||||
|
public Response<CheckOTPVO> checkOTP(@RequestParam("email") String email, @RequestParam("code") String code) {
|
||||||
|
return Response.success(globalAwardService.checkOTP(email, code));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ai.da.model.dto;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +55,9 @@ public class ContestantDTO {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "是否确认覆盖已存在记录", required = false, example = "false")
|
@ApiModelProperty(value = "是否确认覆盖已存在记录", required = false, example = "false")
|
||||||
private Boolean confirm = false;
|
private Boolean confirm = false;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String secureToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ public class DesignSingleItemDTO implements Serializable {
|
|||||||
@Schema(description = "45")
|
@Schema(description = "45")
|
||||||
private double rotate;
|
private double rotate;
|
||||||
|
|
||||||
@Schema(description = "带overall印花未分割图片")
|
/*@Schema(description = "带overall印花未分割图片")
|
||||||
private String undividedLayerBase64;
|
private String undividedLayerBase64;
|
||||||
|
|
||||||
@Schema(description = "带overall/single印花未分割图片")
|
@Schema(description = "带overall/single印花未分割图片")
|
||||||
private String undividedLayerWithSinglePrintBase64;
|
private String undividedLayerWithSinglePrintBase64;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main/java/com/ai/da/model/vo/CheckOTPVO.java
Normal file
16
src/main/java/com/ai/da/model/vo/CheckOTPVO.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CheckOTPVO {
|
||||||
|
|
||||||
|
private String secureToken;
|
||||||
|
|
||||||
|
private ContestantDTO contestantDTO;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
package com.ai.da.model.vo;
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import com.ai.da.mapper.primary.entity.Gradient;
|
import com.ai.da.mapper.primary.entity.Gradient;
|
||||||
@@ -62,11 +62,11 @@ public class DesignItemClothesDetailVO {
|
|||||||
@Schema(description = "渐变色信息")
|
@Schema(description = "渐变色信息")
|
||||||
private Gradient gradient;
|
private Gradient gradient;
|
||||||
|
|
||||||
@Schema(description = "未分割的图层")
|
/* @Schema(description = "未分割的图层")
|
||||||
private String undividedLayer;
|
private String undividedLayer;
|
||||||
|
|
||||||
@Schema(description = "添加single印花的未分割的图层")
|
@Schema(description = "添加single印花的未分割的图层")
|
||||||
private String undividedLayerWithSinglePrint;
|
private String undividedLayerWithSinglePrint;*/
|
||||||
|
|
||||||
@Schema(description = "局部design")
|
@Schema(description = "局部design")
|
||||||
private PartialDesignDTO partialDesign;
|
private PartialDesignDTO partialDesign;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public interface DesignItemService extends IService<DesignItem> {
|
|||||||
|
|
||||||
DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
|
DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
|
||||||
|
|
||||||
Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers, DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
|
// Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers, DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
|
||||||
|
|
||||||
Map<String, String> setTypeAndUndividedLayer(JSONArray layers);
|
Map<String, String> setTypeAndUndividedLayer(JSONArray layers);
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
package com.ai.da.service;
|
package com.ai.da.service;
|
||||||
|
|
||||||
import com.ai.da.model.dto.ContestantDTO;
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface GlobalAwardService {
|
public interface GlobalAwardService {
|
||||||
String uploadPdf(MultipartFile file, String email) throws Exception;
|
String uploadPdf(MultipartFile file, String email) throws Exception;
|
||||||
|
|
||||||
String uploadVideo(MultipartFile file, String email) throws Exception;
|
String uploadVideo(MultipartFile file, String email) throws Exception;
|
||||||
|
|
||||||
Map<String, Object> saveContestant(ContestantDTO request);
|
Map<String, Object> saveContestant(ContestantDTO request);
|
||||||
|
|
||||||
com.ai.da.model.dto.ContestantDTO getContestantByEmail(String email);
|
com.ai.da.model.dto.ContestantDTO getContestantByEmail(String email);
|
||||||
|
|
||||||
|
void checkEmail(String email);
|
||||||
|
|
||||||
|
CheckOTPVO checkOTP(String email, String otp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
public List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
|
public List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
|
||||||
, Long designId, Long designItemId, Long userId
|
, Long designId, Long designItemId, Long userId
|
||||||
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList
|
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList
|
||||||
, Map<String, List<String>> priorityAndUndividedLayer
|
/*, Map<String, List<String>> priorityAndUndividedLayer*/
|
||||||
, boolean changeModelFlag
|
, boolean changeModelFlag
|
||||||
, Long modelId, String modelType, boolean isSingleCollectionFlag, String designType) {
|
, Long modelId, String modelType, boolean isSingleCollectionFlag, String designType) {
|
||||||
|
|
||||||
@@ -424,6 +424,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
designItemDetail.setColor(detail.getColor());
|
designItemDetail.setColor(detail.getColor());
|
||||||
designItemDetail.setIconPath(detail.getIcon());
|
designItemDetail.setIconPath(detail.getIcon());
|
||||||
// designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getType().toLowerCase()));
|
// designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getType().toLowerCase()));
|
||||||
|
/*// 取消存储UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||||
if (!detail.getType().equals("Body")) {
|
if (!detail.getType().equals("Body")) {
|
||||||
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(0))) {
|
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(0))) {
|
||||||
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getPriority().toString()).getFirst());
|
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getPriority().toString()).getFirst());
|
||||||
@@ -431,7 +432,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1))) {
|
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1))) {
|
||||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1));
|
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
// 印花存储在design_item_detail_print表中 这里还要存吗?
|
// 印花存储在design_item_detail_print表中 这里还要存吗?
|
||||||
// DesignPythonItemPrint printObject = detail.getPrintToPython();
|
// DesignPythonItemPrint printObject = detail.getPrintToPython();
|
||||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||||
@@ -689,6 +690,9 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
public DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
||||||
|
if (!designSingleIncludeLayersDTO.getDesignType().equals("merge") && !designSingleIncludeLayersDTO.getDesignType().equals("default")) {
|
||||||
|
throw new BusinessException("The value of DesignType can only be 'default' or 'merge' ");
|
||||||
|
}
|
||||||
// 记录入参 base64数据太长,所以这里去掉
|
// 记录入参 base64数据太长,所以这里去掉
|
||||||
DesignSingleIncludeLayersDTO clone = SerializationUtils.clone(designSingleIncludeLayersDTO);
|
DesignSingleIncludeLayersDTO clone = SerializationUtils.clone(designSingleIncludeLayersDTO);
|
||||||
clone.getDesignSingleItemDTOList().forEach(i -> {
|
clone.getDesignSingleItemDTOList().forEach(i -> {
|
||||||
@@ -713,7 +717,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
i.getPartialDesign().setPartialDesignBase64(null);
|
i.getPartialDesign().setPartialDesignBase64(null);
|
||||||
}
|
}
|
||||||
// undividedLayerBase64 undividedLayerWithSinglePrintBase64 置空
|
// undividedLayerBase64 undividedLayerWithSinglePrintBase64 置空
|
||||||
// 前端合成的未分割的图
|
/*// 前端合成的未分割的图
|
||||||
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerBase64())) {
|
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerBase64())) {
|
||||||
log.info("set UndividedLayerBase64为空,便于日志打印");
|
log.info("set UndividedLayerBase64为空,便于日志打印");
|
||||||
i.setUndividedLayerBase64(null);
|
i.setUndividedLayerBase64(null);
|
||||||
@@ -722,7 +726,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerWithSinglePrintBase64())) {
|
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerWithSinglePrintBase64())) {
|
||||||
log.info("set UndividedLayerWithSinglePrintBase64为空,便于日志打印");
|
log.info("set UndividedLayerWithSinglePrintBase64为空,便于日志打印");
|
||||||
i.setUndividedLayerWithSinglePrintBase64(null);
|
i.setUndividedLayerWithSinglePrintBase64(null);
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("designSingle request入参 ==> " + JSONObject.toJSONString(clone));
|
log.info("designSingle request入参 ==> " + JSONObject.toJSONString(clone));
|
||||||
@@ -835,13 +839,13 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
JSONObject outfit = data.getJSONObject("0");
|
JSONObject outfit = data.getJSONObject("0");
|
||||||
|
|
||||||
JSONArray layers = outfit.getJSONArray("layers");
|
JSONArray layers = outfit.getJSONArray("layers");
|
||||||
Map<String, List<String>> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers, designSingleIncludeLayersDTO);
|
// Map<String, List<String>> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers, designSingleIncludeLayersDTO);
|
||||||
if (!designSingleIncludeLayersDTO.getIsPreview()) {
|
if (!designSingleIncludeLayersDTO.getIsPreview()) {
|
||||||
// 更新及保存图层信息
|
// 更新及保存图层信息
|
||||||
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId()
|
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId()
|
||||||
, userId, outfit, designSingleIncludeLayersDTO.getTimeZone()
|
, userId, outfit, designSingleIncludeLayersDTO.getTimeZone()
|
||||||
, designSingleIncludeLayersDTO.getDesignSingleItemDTOList()
|
, designSingleIncludeLayersDTO.getDesignSingleItemDTOList()
|
||||||
, priorityAndUndividedLayer, changeModelFlag, modelId, modelType, isSingleCollectionFlag, designSingleIncludeLayersDTO.getDesignType());
|
/*, priorityAndUndividedLayer*/, changeModelFlag, modelId, modelType, isSingleCollectionFlag, designSingleIncludeLayersDTO.getDesignType());
|
||||||
|
|
||||||
saveCollectionElement(designSingleIncludeLayersDTO);
|
saveCollectionElement(designSingleIncludeLayersDTO);
|
||||||
} else {
|
} else {
|
||||||
@@ -875,8 +879,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
outfit.getString("synthesis_url"),
|
outfit.getString("synthesis_url"),
|
||||||
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),
|
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),
|
||||||
detailsVO,
|
detailsVO,
|
||||||
design.getSingleOverall(),
|
design.getSingleOverall()/*,
|
||||||
priorityAndUndividedLayer);
|
priorityAndUndividedLayer*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 方法1:仅查询(无事务)
|
// 方法1:仅查询(无事务)
|
||||||
@@ -964,14 +968,27 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
} else if (Objects.isNull(item.getPartialDesign())
|
} else if (Objects.isNull(item.getPartialDesign())
|
||||||
|| StringUtil.isNullOrEmpty(item.getPartialDesign().getPartialDesignMinioPath())) {
|
|| StringUtil.isNullOrEmpty(item.getPartialDesign().getPartialDesignMinioPath())) {
|
||||||
if (designType.equals("merge")) {
|
if (designType.equals("merge")) {
|
||||||
log.error("merge模式下,必须提供partialDesign");
|
// 先去数据库进行查找,如果数据库中也是空,则提示需要提供,否则无法生成
|
||||||
throw new BusinessException("required.partialDesign");
|
DesignItemDetail designItemDetail = designItemDetailService.getById(item.getId());
|
||||||
|
if (Objects.isNull(designItemDetail)){
|
||||||
|
log.error("未知designItemDetailId: {}", item.getId());
|
||||||
|
throw new BusinessException("designItemDetails.not.found");
|
||||||
|
} else if (StringUtil.isNullOrEmpty(designItemDetail.getPartialDesign())) {
|
||||||
|
item.setPartialDesign(new PartialDesignDTO(designItemDetail.getUndividedLayer()));
|
||||||
|
/*log.error("merge模式下,必须提供partialDesign");
|
||||||
|
throw new BusinessException("required.partialDesign");*/
|
||||||
|
} else {
|
||||||
|
item.setPartialDesign(new PartialDesignDTO(designItemDetail.getPartialDesign()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.setPartialDesign(new PartialDesignDTO(null));
|
||||||
}
|
}
|
||||||
item.setPartialDesign(new PartialDesignDTO(null));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
取消存储UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||||
private void undividedLayerBase64ToImage(List<DesignSingleItemDTO> designSingleItemDTOS) {
|
private void undividedLayerBase64ToImage(List<DesignSingleItemDTO> designSingleItemDTOS) {
|
||||||
designSingleItemDTOS.forEach(item -> {
|
designSingleItemDTOS.forEach(item -> {
|
||||||
if (!StringUtil.isNullOrEmpty(item.getUndividedLayerBase64())) {
|
if (!StringUtil.isNullOrEmpty(item.getUndividedLayerBase64())) {
|
||||||
@@ -1006,9 +1023,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
|
取消存储UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||||
public Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers, DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
public Map<String, List<String>> setPriorityAndUndividedLayer(JSONArray layers, DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
||||||
String designType = "default";
|
String designType = "default";
|
||||||
if (Objects.nonNull(designSingleIncludeLayersDTO)) {
|
if (Objects.nonNull(designSingleIncludeLayersDTO)) {
|
||||||
@@ -1037,7 +1055,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
}
|
}
|
||||||
|
|
||||||
return priorityAndLayer;
|
return priorityAndLayer;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 由于在design过程中没有priority 优先级的概念,并且在design时,不会出现上下两件使用相同服装类型的情况,所以这里依然保留这个方法。
|
// 由于在design过程中没有priority 优先级的概念,并且在design时,不会出现上下两件使用相同服装类型的情况,所以这里依然保留这个方法。
|
||||||
@Override
|
@Override
|
||||||
@@ -1150,8 +1168,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
String currentFullBodyView,
|
String currentFullBodyView,
|
||||||
List<DesignSingleItemDTO> designSingleItemDTOList,
|
List<DesignSingleItemDTO> designSingleItemDTOList,
|
||||||
List<DesignPythonOutfitVO> layersObject,
|
List<DesignPythonOutfitVO> layersObject,
|
||||||
String singleOrOverall,
|
String singleOrOverall/*,
|
||||||
Map<String, List<String>> priorityAndUndividedLayer) {
|
Map<String, List<String>> priorityAndUndividedLayer*/) {
|
||||||
|
|
||||||
DesignSingleVO designSingleVO = new DesignSingleVO();
|
DesignSingleVO designSingleVO = new DesignSingleVO();
|
||||||
ArrayList<DesignItemClothesDetailVO> clothes = new ArrayList<>();
|
ArrayList<DesignItemClothesDetailVO> clothes = new ArrayList<>();
|
||||||
@@ -1191,6 +1209,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
String preSignedUrl = StringUtil.isNullOrEmpty(partialDesignMinioPath) ? null : minioUtil.getPreSignedUrl(partialDesignMinioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true);
|
String preSignedUrl = StringUtil.isNullOrEmpty(partialDesignMinioPath) ? null : minioUtil.getPreSignedUrl(partialDesignMinioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true);
|
||||||
designItemClothesDetailVO.setPartialDesign(new PartialDesignDTO(partialDesignMinioPath, preSignedUrl));
|
designItemClothesDetailVO.setPartialDesign(new PartialDesignDTO(partialDesignMinioPath, preSignedUrl));
|
||||||
|
|
||||||
|
/*// 取消存储/返回UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||||
if (priorityAndUndividedLayer.containsKey(singleItem.getPriority().toString())) {
|
if (priorityAndUndividedLayer.containsKey(singleItem.getPriority().toString())) {
|
||||||
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(0))) {
|
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(0))) {
|
||||||
designItemClothesDetailVO.setUndividedLayer(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).getFirst(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
|
designItemClothesDetailVO.setUndividedLayer(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).getFirst(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
|
||||||
@@ -1198,7 +1217,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(1))) {
|
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(1))) {
|
||||||
designItemClothesDetailVO.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(1), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
|
designItemClothesDetailVO.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(priorityAndUndividedLayer.get(singleItem.getPriority().toString()).get(1), CommonConstant.MINIO_IMAGE_EXPIRE_TIME, true));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
body.setLayersObject(layersObject.stream().filter(layers -> layers.getImageCategory().equals("body")).collect(Collectors.toList()));
|
body.setLayersObject(layersObject.stream().filter(layers -> layers.getImageCategory().equals("body")).collect(Collectors.toList()));
|
||||||
|
|
||||||
clothes.add(designItemClothesDetailVO);
|
clothes.add(designItemClothesDetailVO);
|
||||||
@@ -1374,6 +1393,9 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Objects.isNull(designSingleItem.getPrintObject()) || Objects.isNull(designSingleItem.getPrintObject().getPrints())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 添加print到library
|
// 添加print到library
|
||||||
designSingleItem.getPrintObject().getPrints().forEach(print -> {
|
designSingleItem.getPrintObject().getPrints().forEach(print -> {
|
||||||
if (!StringUtil.isNullOrEmpty(print.getDesignType()) && print.getDesignType().equals("Collection")) {
|
if (!StringUtil.isNullOrEmpty(print.getDesignType()) && print.getDesignType().equals("Collection")) {
|
||||||
|
|||||||
@@ -713,9 +713,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
||||||
d -> Math.abs(d.getPriority()),
|
d -> Math.abs(d.getPriority()),
|
||||||
(existing, replacement) -> replacement));
|
(existing, replacement) -> replacement));
|
||||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||||
log.info("all typeLayers Map:{}", typeAndUndividedLayer);
|
// log.info("all typeLayers Map:{}", typeAndUndividedLayer);
|
||||||
Map<String, List<String>> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers, null);
|
// Map<String, List<String>> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers, null);
|
||||||
for (DesignPythonItem detail : item.getItems()) {
|
for (DesignPythonItem detail : item.getItems()) {
|
||||||
if (null == detail) {
|
if (null == detail) {
|
||||||
continue;
|
continue;
|
||||||
@@ -727,10 +727,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
log.info("detail.getType():{}", detail.getType());
|
log.info("detail.getType():{}", detail.getType());
|
||||||
if (!detail.getType().equals("Body")) {
|
/* if (!detail.getType().equals("Body")) {
|
||||||
log.info("layer : {}", typeAndUndividedLayer.get(designItemDetail.getType()));
|
log.info("layer : {}", typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||||
}
|
}*/
|
||||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||||
designItemDetail.setPath(detail.getBody_path());
|
designItemDetail.setPath(detail.getBody_path());
|
||||||
//BODY不关联businessId
|
//BODY不关联businessId
|
||||||
@@ -742,8 +742,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
|
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
|
||||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||||
designItemDetail.setPrintPath(CollectionUtils.isEmpty(printObject.getPrint_path_list()) ? "" : printObject.getPrint_path_list().get(0));
|
designItemDetail.setPrintPath(CollectionUtils.isEmpty(printObject.getPrint_path_list()) ? "" : printObject.getPrint_path_list().get(0));
|
||||||
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(0));
|
/*designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(0));
|
||||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(1));
|
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(1));*/
|
||||||
}
|
}
|
||||||
designItemDetailService.save(designItemDetail);
|
designItemDetailService.save(designItemDetail);
|
||||||
if (!SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) && !StringUtil.isNullOrEmpty(designItemDetail.getPrintPath())) {
|
if (!SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) && !StringUtil.isNullOrEmpty(designItemDetail.getPrintPath())) {
|
||||||
@@ -853,7 +853,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
||||||
d -> Math.abs(d.getPriority()),
|
d -> Math.abs(d.getPriority()),
|
||||||
(existing, replacement) -> replacement));
|
(existing, replacement) -> replacement));
|
||||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||||
for (DesignPythonItem detail : item.getItems()) {
|
for (DesignPythonItem detail : item.getItems()) {
|
||||||
if (null == detail) {
|
if (null == detail) {
|
||||||
continue;
|
continue;
|
||||||
@@ -864,9 +864,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designItemDetail.setDesignItemId(designItemId);
|
designItemDetail.setDesignItemId(designItemId);
|
||||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
if (!detail.getType().equals("Body")) {
|
/*if (!detail.getType().equals("Body")) {
|
||||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||||
designItemDetail.setPath(detail.getBody_path());
|
designItemDetail.setPath(detail.getBody_path());
|
||||||
@@ -1157,8 +1157,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
if (workspaceRelStyles != null) {
|
if (workspaceRelStyles != null) {
|
||||||
//查不到记录,style应该是all
|
//查不到记录,style应该是all
|
||||||
userPreference.setWorkspaceRelStyleId(0L);
|
userPreference.setWorkspaceRelStyleId(0L);
|
||||||
|
} else {
|
||||||
|
userPreference.setWorkspaceRelStyleId(workspaceRelStyles.get(0).getStyleId());
|
||||||
}
|
}
|
||||||
userPreference.setWorkspaceRelStyleId(workspaceRelStyles.get(0).getStyleId());
|
|
||||||
userPreferenceMapper.insert(userPreference);
|
userPreferenceMapper.insert(userPreference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1330,12 +1331,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
d.setScope(o.getPath().startsWith("aida-sys-image") ? "sys" : "user");
|
d.setScope(o.getPath().startsWith("aida-sys-image") ? "sys" : "user");
|
||||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||||
|
/*// 取消存储/返回UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayer())) {
|
if (!StringUtil.isNullOrEmpty(o.getUndividedLayer())) {
|
||||||
d.setUndividedLayer(minioUtil.getPreSignedUrl(o.getUndividedLayer(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
d.setUndividedLayer(minioUtil.getPreSignedUrl(o.getUndividedLayer(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||||
}
|
}
|
||||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayerWithSinglePrint())) {
|
if (!StringUtil.isNullOrEmpty(o.getUndividedLayerWithSinglePrint())) {
|
||||||
d.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(o.getUndividedLayerWithSinglePrint(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
d.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(o.getUndividedLayerWithSinglePrint(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||||
}
|
}*/
|
||||||
// 根据designItemDetailId获取印花
|
// 根据designItemDetailId获取印花
|
||||||
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "print");
|
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "print");
|
||||||
prints.removeIf(print -> !minioUtil.doesObjectExist(print.getPath()));
|
prints.removeIf(print -> !minioUtil.doesObjectExist(print.getPath()));
|
||||||
@@ -2543,7 +2545,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
|
||||||
d -> Math.abs(d.getPriority()),
|
d -> Math.abs(d.getPriority()),
|
||||||
(existing, replacement) -> replacement));
|
(existing, replacement) -> replacement));
|
||||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||||
for (DesignPythonItem detail : item.getItems()) {
|
for (DesignPythonItem detail : item.getItems()) {
|
||||||
if (null == detail) {
|
if (null == detail) {
|
||||||
continue;
|
continue;
|
||||||
@@ -2554,9 +2556,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
designItemDetail.setDesignItemId(designItemId);
|
designItemDetail.setDesignItemId(designItemId);
|
||||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||||
if (!detail.getType().equals("Body")) {
|
/*if (!detail.getType().equals("Body")) {
|
||||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||||
}
|
}*/
|
||||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||||
designItemDetail.setPath(detail.getBody_path());
|
designItemDetail.setPath(detail.getBody_path());
|
||||||
//BODY不关联businessId
|
//BODY不关联businessId
|
||||||
|
|||||||
@@ -1,41 +1,64 @@
|
|||||||
package com.ai.da.service.impl;
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
|
import com.ai.da.common.enums.AuthenticationOperationTypeEnum;
|
||||||
|
import com.ai.da.common.utils.*;
|
||||||
|
import com.ai.da.mapper.primary.AccountMapper;
|
||||||
import com.ai.da.mapper.primary.ContestantMapper;
|
import com.ai.da.mapper.primary.ContestantMapper;
|
||||||
|
import com.ai.da.mapper.primary.NotificationMapper;
|
||||||
|
import com.ai.da.mapper.primary.entity.Account;
|
||||||
import com.ai.da.mapper.primary.entity.Contestant;
|
import com.ai.da.mapper.primary.entity.Contestant;
|
||||||
|
import com.ai.da.mapper.primary.entity.Notification;
|
||||||
import com.ai.da.model.dto.ContestantDTO;
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
|
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||||
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
import com.ai.da.service.GlobalAwardService;
|
import com.ai.da.service.GlobalAwardService;
|
||||||
|
import com.ai.da.service.MessageCenterService;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import com.ai.da.common.utils.MinioUtil;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class GlobalAwardServiceImpl implements GlobalAwardService {
|
public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ContestantMapper contestantMapper;
|
private ContestantMapper contestantMapper;
|
||||||
|
|
||||||
|
private final AccountMapper accountMapper;
|
||||||
|
|
||||||
|
private final MessageCenterService messageCenterService;
|
||||||
|
|
||||||
|
private final NotificationMapper notificationMapper;
|
||||||
|
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
@Value("${file.upload.dir:uploads}")
|
@Value("${file.upload.dir:uploads}")
|
||||||
private String uploadDir;
|
private String uploadDir;
|
||||||
|
|
||||||
private static final DateTimeFormatter YYYY_MM_DD = DateTimeFormatter.ofPattern("yyyy/MM");
|
private static final DateTimeFormatter YYYY_MM_DD = DateTimeFormatter.ofPattern("yyyy/MM");
|
||||||
|
|
||||||
|
private static final String tokenCacheKey = AuthenticationOperationTypeEnum.GLOBAL_AWARD.name() + ":";
|
||||||
|
|
||||||
@Value("${minio.bucket:contestants}")
|
@Value("${minio.bucket:contestants}")
|
||||||
private String minioBucket;
|
private String minioBucket;
|
||||||
|
|
||||||
|
@Value("${global.award.link}")
|
||||||
|
private String link;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
@@ -111,6 +134,14 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
throw new BusinessException("Email is required.");
|
throw new BusinessException("Email is required.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String key = tokenCacheKey + request.getEmail();
|
||||||
|
String tokenCache = redisUtil.getFromString(key);
|
||||||
|
if (StringUtils.isBlank(tokenCache)) {
|
||||||
|
throw new BusinessException("请先完成邮箱认证");
|
||||||
|
} else if (!tokenCache.equals(request.getSecureToken())){
|
||||||
|
throw new BusinessException("身份认证失败,请先完成邮箱认证");
|
||||||
|
}
|
||||||
|
|
||||||
QueryWrapper<Contestant> qw = new QueryWrapper<>();
|
QueryWrapper<Contestant> qw = new QueryWrapper<>();
|
||||||
qw.eq("email", request.getEmail());
|
qw.eq("email", request.getEmail());
|
||||||
Contestant existing = contestantMapper.selectOne(qw);
|
Contestant existing = contestantMapper.selectOne(qw);
|
||||||
@@ -185,6 +216,59 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
dto.setVideoPath(existing.getVideoPath());
|
dto.setVideoPath(existing.getVideoPath());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkEmail(String email) {
|
||||||
|
List<Integer> validRole = Arrays.asList(1, 2, 7, 8);
|
||||||
|
// 1. 验证邮箱在aida中有无账号
|
||||||
|
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(Account::getUserEmail, email);
|
||||||
|
List<Account> accounts = accountMapper.selectList(queryWrapper);
|
||||||
|
if (accounts.isEmpty()) {
|
||||||
|
throw new BusinessException("请注册并订阅AiDA,再重新提交申请");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 验证账号是否是付费用户(如果首次提交是,但是修改的时候已经不是了,how?不允许修改吗)
|
||||||
|
if (validRole.contains(accounts.getFirst().getSystemUser())) {
|
||||||
|
String randomVerifyCode = RandomsUtil.generateVerifyCode(100000L, 999999L);
|
||||||
|
LocalCacheUtils.setVerifyCodeCache(
|
||||||
|
AuthenticationOperationTypeEnum.GLOBAL_AWARD.name() + "_" + email, randomVerifyCode);
|
||||||
|
SendEmailUtil.send(email, null,
|
||||||
|
SendEmailUtil.LOGIN_TEMPLATE_ID, randomVerifyCode);
|
||||||
|
} else {
|
||||||
|
throw new BusinessException("请订阅AiDA,再重新提交申请");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckOTPVO checkOTP(String email, String otp) {
|
||||||
|
String otpCache = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.GLOBAL_AWARD.name() + "_" + email);
|
||||||
|
assert otpCache != null;
|
||||||
|
if (otpCache.equals(otp)) {
|
||||||
|
// 1. 生成唯一token
|
||||||
|
String secureToken = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
redisUtil.addToString(tokenCacheKey + email, secureToken, 3 * 24 * 60 * 60L);
|
||||||
|
|
||||||
|
return new CheckOTPVO(secureToken, getContestantByEmail(email));
|
||||||
|
} else {
|
||||||
|
throw new BusinessException("验证码错误,请重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送站内信
|
||||||
|
public void sendSiteMsg(String applicationId, Long userId) {
|
||||||
|
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
|
||||||
|
Notification notification = new Notification();
|
||||||
|
notification.setType("system");
|
||||||
|
notification.setReceiverId(userId);
|
||||||
|
sysNotificationDTO.setTitle("System Notification 系统通知");
|
||||||
|
// todo
|
||||||
|
sysNotificationDTO.setContent(link + applicationId);
|
||||||
|
notification.setContent(JSON.toJSONString(sysNotificationDTO));
|
||||||
|
notification.setIsRead(0);
|
||||||
|
notification.setCreateTime(LocalDateTime.now());
|
||||||
|
notificationMapper.insert(notification);
|
||||||
|
// 这里推送消息是在接受到视频生成结束后发生的,所以UserContext中没有用户信息
|
||||||
|
messageCenterService.pushMessage("system", userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -181,4 +181,5 @@ file.upload.max.size.video=104857600
|
|||||||
file.upload.task.expiry.hours=24
|
file.upload.task.expiry.hours=24
|
||||||
|
|
||||||
# MinIO配置
|
# MinIO配置
|
||||||
minio.bucket=contestants
|
minio.bucket=contestants
|
||||||
|
global.award.link=https://develop.aida.com.hk/
|
||||||
@@ -179,4 +179,5 @@ file.upload.max.size.video=104857600
|
|||||||
file.upload.task.expiry.hours=24
|
file.upload.task.expiry.hours=24
|
||||||
|
|
||||||
# MinIO配置
|
# MinIO配置
|
||||||
minio.bucket=contestants
|
minio.bucket=contestants
|
||||||
|
global.award.link=https://www.aida.com.hk/
|
||||||
Reference in New Issue
Block a user