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,
|
||||
|
||||
REGISTER;
|
||||
REGISTER,
|
||||
/**
|
||||
* Global_Award 活动验证
|
||||
*/
|
||||
GLOBAL_AWARD;
|
||||
|
||||
public static AuthenticationOperationTypeEnum of(String name) {
|
||||
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.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.upload.UploadService;
|
||||
import com.ai.da.service.upload.UploadTask;
|
||||
@@ -145,6 +147,18 @@ public class GlobalAwardController {
|
||||
ContestantDTO dto = globalAwardService.getContestantByEmail(email);
|
||||
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.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -54,6 +55,9 @@ public class ContestantDTO {
|
||||
*/
|
||||
@ApiModelProperty(value = "是否确认覆盖已存在记录", required = false, example = "false")
|
||||
private Boolean confirm = false;
|
||||
|
||||
@NotBlank
|
||||
private String secureToken;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ public class DesignSingleItemDTO implements Serializable {
|
||||
@Schema(description = "45")
|
||||
private double rotate;
|
||||
|
||||
@Schema(description = "带overall印花未分割图片")
|
||||
/*@Schema(description = "带overall印花未分割图片")
|
||||
private String undividedLayerBase64;
|
||||
|
||||
@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 com.ai.da.mapper.primary.entity.Gradient;
|
||||
@@ -62,11 +62,11 @@ public class DesignItemClothesDetailVO {
|
||||
@Schema(description = "渐变色信息")
|
||||
private Gradient gradient;
|
||||
|
||||
@Schema(description = "未分割的图层")
|
||||
/* @Schema(description = "未分割的图层")
|
||||
private String undividedLayer;
|
||||
|
||||
@Schema(description = "添加single印花的未分割的图层")
|
||||
private String undividedLayerWithSinglePrint;
|
||||
private String undividedLayerWithSinglePrint;*/
|
||||
|
||||
@Schema(description = "局部design")
|
||||
private PartialDesignDTO partialDesign;
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface DesignItemService extends IService<DesignItem> {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.model.dto.ContestantDTO;
|
||||
import com.ai.da.model.vo.CheckOTPVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface GlobalAwardService {
|
||||
String uploadPdf(MultipartFile file, String email) throws Exception;
|
||||
|
||||
String uploadVideo(MultipartFile file, String email) throws Exception;
|
||||
|
||||
Map<String, Object> saveContestant(ContestantDTO request);
|
||||
|
||||
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
|
||||
, Long designId, Long designItemId, Long userId
|
||||
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList
|
||||
, Map<String, List<String>> priorityAndUndividedLayer
|
||||
/*, Map<String, List<String>> priorityAndUndividedLayer*/
|
||||
, boolean changeModelFlag
|
||||
, Long modelId, String modelType, boolean isSingleCollectionFlag, String designType) {
|
||||
|
||||
@@ -424,6 +424,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail.setColor(detail.getColor());
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
// designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(detail.getType().toLowerCase()));
|
||||
/*// 取消存储UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||
if (!detail.getType().equals("Body")) {
|
||||
if (!StringUtil.isNullOrEmpty(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(0))) {
|
||||
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))) {
|
||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(detail.getPriority().toString()).get(1));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// 印花存储在design_item_detail_print表中 这里还要存吗?
|
||||
// DesignPythonItemPrint printObject = detail.getPrintToPython();
|
||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
@@ -689,6 +690,9 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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数据太长,所以这里去掉
|
||||
DesignSingleIncludeLayersDTO clone = SerializationUtils.clone(designSingleIncludeLayersDTO);
|
||||
clone.getDesignSingleItemDTOList().forEach(i -> {
|
||||
@@ -713,7 +717,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
i.getPartialDesign().setPartialDesignBase64(null);
|
||||
}
|
||||
// undividedLayerBase64 undividedLayerWithSinglePrintBase64 置空
|
||||
// 前端合成的未分割的图
|
||||
/*// 前端合成的未分割的图
|
||||
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerBase64())) {
|
||||
log.info("set UndividedLayerBase64为空,便于日志打印");
|
||||
i.setUndividedLayerBase64(null);
|
||||
@@ -722,7 +726,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (!StringUtil.isNullOrEmpty(i.getUndividedLayerWithSinglePrintBase64())) {
|
||||
log.info("set UndividedLayerWithSinglePrintBase64为空,便于日志打印");
|
||||
i.setUndividedLayerWithSinglePrintBase64(null);
|
||||
}
|
||||
}*/
|
||||
});
|
||||
|
||||
log.info("designSingle request入参 ==> " + JSONObject.toJSONString(clone));
|
||||
@@ -835,13 +839,13 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
JSONObject outfit = data.getJSONObject("0");
|
||||
|
||||
JSONArray layers = outfit.getJSONArray("layers");
|
||||
Map<String, List<String>> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers, designSingleIncludeLayersDTO);
|
||||
// Map<String, List<String>> priorityAndUndividedLayer = setPriorityAndUndividedLayer(layers, designSingleIncludeLayersDTO);
|
||||
if (!designSingleIncludeLayersDTO.getIsPreview()) {
|
||||
// 更新及保存图层信息
|
||||
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId()
|
||||
, userId, outfit, designSingleIncludeLayersDTO.getTimeZone()
|
||||
, designSingleIncludeLayersDTO.getDesignSingleItemDTOList()
|
||||
, priorityAndUndividedLayer, changeModelFlag, modelId, modelType, isSingleCollectionFlag, designSingleIncludeLayersDTO.getDesignType());
|
||||
/*, priorityAndUndividedLayer*/, changeModelFlag, modelId, modelType, isSingleCollectionFlag, designSingleIncludeLayersDTO.getDesignType());
|
||||
|
||||
saveCollectionElement(designSingleIncludeLayersDTO);
|
||||
} else {
|
||||
@@ -875,8 +879,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
outfit.getString("synthesis_url"),
|
||||
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),
|
||||
detailsVO,
|
||||
design.getSingleOverall(),
|
||||
priorityAndUndividedLayer);
|
||||
design.getSingleOverall()/*,
|
||||
priorityAndUndividedLayer*/);
|
||||
}
|
||||
|
||||
// 方法1:仅查询(无事务)
|
||||
@@ -964,14 +968,27 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
} else if (Objects.isNull(item.getPartialDesign())
|
||||
|| StringUtil.isNullOrEmpty(item.getPartialDesign().getPartialDesignMinioPath())) {
|
||||
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) {
|
||||
designSingleItemDTOS.forEach(item -> {
|
||||
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) {
|
||||
String designType = "default";
|
||||
if (Objects.nonNull(designSingleIncludeLayersDTO)) {
|
||||
@@ -1037,7 +1055,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
|
||||
return priorityAndLayer;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 由于在design过程中没有priority 优先级的概念,并且在design时,不会出现上下两件使用相同服装类型的情况,所以这里依然保留这个方法。
|
||||
@Override
|
||||
@@ -1150,8 +1168,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
String currentFullBodyView,
|
||||
List<DesignSingleItemDTO> designSingleItemDTOList,
|
||||
List<DesignPythonOutfitVO> layersObject,
|
||||
String singleOrOverall,
|
||||
Map<String, List<String>> priorityAndUndividedLayer) {
|
||||
String singleOrOverall/*,
|
||||
Map<String, List<String>> priorityAndUndividedLayer*/) {
|
||||
|
||||
DesignSingleVO designSingleVO = new DesignSingleVO();
|
||||
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);
|
||||
designItemClothesDetailVO.setPartialDesign(new PartialDesignDTO(partialDesignMinioPath, preSignedUrl));
|
||||
|
||||
/*// 取消存储/返回UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||
if (priorityAndUndividedLayer.containsKey(singleItem.getPriority().toString())) {
|
||||
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));
|
||||
@@ -1198,7 +1217,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
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));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
body.setLayersObject(layersObject.stream().filter(layers -> layers.getImageCategory().equals("body")).collect(Collectors.toList()));
|
||||
|
||||
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
|
||||
designSingleItem.getPrintObject().getPrints().forEach(print -> {
|
||||
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],
|
||||
d -> Math.abs(d.getPriority()),
|
||||
(existing, replacement) -> replacement));
|
||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
log.info("all typeLayers Map:{}", typeAndUndividedLayer);
|
||||
Map<String, List<String>> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers, null);
|
||||
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
// log.info("all typeLayers Map:{}", typeAndUndividedLayer);
|
||||
// Map<String, List<String>> priorityAndUndividedLayer = designItemService.setPriorityAndUndividedLayer(layers, null);
|
||||
for (DesignPythonItem detail : item.getItems()) {
|
||||
if (null == detail) {
|
||||
continue;
|
||||
@@ -727,10 +727,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
log.info("detail.getType():{}", detail.getType());
|
||||
if (!detail.getType().equals("Body")) {
|
||||
/* if (!detail.getType().equals("Body")) {
|
||||
log.info("layer : {}", typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||
}
|
||||
}*/
|
||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
//BODY不关联businessId
|
||||
@@ -742,8 +742,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
|
||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetail.setPrintPath(CollectionUtils.isEmpty(printObject.getPrint_path_list()) ? "" : printObject.getPrint_path_list().get(0));
|
||||
designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(0));
|
||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(1));
|
||||
/*designItemDetail.setUndividedLayer(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(0));
|
||||
designItemDetail.setUndividedLayerWithSinglePrint(priorityAndUndividedLayer.get(designItemDetail.getPriority().toString()).get(1));*/
|
||||
}
|
||||
designItemDetailService.save(designItemDetail);
|
||||
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],
|
||||
d -> Math.abs(d.getPriority()),
|
||||
(existing, replacement) -> replacement));
|
||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
for (DesignPythonItem detail : item.getItems()) {
|
||||
if (null == detail) {
|
||||
continue;
|
||||
@@ -864,9 +864,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetail.setDesignItemId(designItemId);
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
if (!detail.getType().equals("Body")) {
|
||||
/*if (!detail.getType().equals("Body")) {
|
||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||
}
|
||||
}*/
|
||||
|
||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
@@ -1157,8 +1157,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (workspaceRelStyles != null) {
|
||||
//查不到记录,style应该是all
|
||||
userPreference.setWorkspaceRelStyleId(0L);
|
||||
} else {
|
||||
userPreference.setWorkspaceRelStyleId(workspaceRelStyles.get(0).getStyleId());
|
||||
}
|
||||
userPreference.setWorkspaceRelStyleId(workspaceRelStyles.get(0).getStyleId());
|
||||
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.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||
/*// 取消存储/返回UndividedLayer和UndividedLayerWithSinglePrint字段
|
||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayer())) {
|
||||
d.setUndividedLayer(minioUtil.getPreSignedUrl(o.getUndividedLayer(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayerWithSinglePrint())) {
|
||||
d.setUndividedLayerWithSinglePrint(minioUtil.getPreSignedUrl(o.getUndividedLayerWithSinglePrint(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
}*/
|
||||
// 根据designItemDetailId获取印花
|
||||
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "print");
|
||||
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],
|
||||
d -> Math.abs(d.getPriority()),
|
||||
(existing, replacement) -> replacement));
|
||||
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
// Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
|
||||
for (DesignPythonItem detail : item.getItems()) {
|
||||
if (null == detail) {
|
||||
continue;
|
||||
@@ -2554,9 +2556,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetail.setDesignItemId(designItemId);
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
if (!detail.getType().equals("Body")) {
|
||||
/*if (!detail.getType().equals("Body")) {
|
||||
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType()));
|
||||
}
|
||||
}*/
|
||||
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
//BODY不关联businessId
|
||||
|
||||
@@ -1,41 +1,64 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
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.NotificationMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
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.PublishSysNotificationDTO;
|
||||
import com.ai.da.model.vo.CheckOTPVO;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
|
||||
@Resource
|
||||
private ContestantMapper contestantMapper;
|
||||
|
||||
private final AccountMapper accountMapper;
|
||||
|
||||
private final MessageCenterService messageCenterService;
|
||||
|
||||
private final NotificationMapper notificationMapper;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
@Value("${file.upload.dir:uploads}")
|
||||
private String uploadDir;
|
||||
|
||||
private static final DateTimeFormatter YYYY_MM_DD = DateTimeFormatter.ofPattern("yyyy/MM");
|
||||
|
||||
private static final String tokenCacheKey = AuthenticationOperationTypeEnum.GLOBAL_AWARD.name() + ":";
|
||||
|
||||
@Value("${minio.bucket:contestants}")
|
||||
private String minioBucket;
|
||||
|
||||
@Value("${global.award.link}")
|
||||
private String link;
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@@ -111,6 +134,14 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
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<>();
|
||||
qw.eq("email", request.getEmail());
|
||||
Contestant existing = contestantMapper.selectOne(qw);
|
||||
@@ -185,6 +216,59 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
||||
dto.setVideoPath(existing.getVideoPath());
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# MinIO配置
|
||||
minio.bucket=contestants
|
||||
minio.bucket=contestants
|
||||
global.award.link=https://www.aida.com.hk/
|
||||
Reference in New Issue
Block a user