Merge branch 'dev/dev' into dev/dev_xp
# Conflicts: # src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java # src/main/resources/application-dev.properties
This commit is contained in:
@@ -154,63 +154,63 @@ public class GenerateConsumer {
|
||||
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer1(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 1");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer2(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 2");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer3(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 3");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer4(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 4");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer5(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 5");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer6(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 6");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer7(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 7");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer8(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 8");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitHandler
|
||||
public void generateConsumer9(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 9");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE)
|
||||
@RabbitHandler
|
||||
public void getGenerateResult(Message msg, Channel channel) {
|
||||
processGenerateResult(msg, channel);
|
||||
}
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer1(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 1");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer2(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 2");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer3(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 3");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer4(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 4");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer5(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 5");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer6(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 6");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer7(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 7");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer8(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 8");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void generateConsumer9(Message msg, Channel channel) {
|
||||
// generate(msg, channel, "consumer 9");
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void getGenerateResult(Message msg, Channel channel) {
|
||||
// processGenerateResult(msg, channel);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -218,17 +218,17 @@ public class SRConsumer {
|
||||
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.SR_QUEUE)
|
||||
@RabbitHandler
|
||||
public void SRConsumer1(Message msg, Channel channel) {
|
||||
superResolution(msg, channel, "consumer 1");
|
||||
}
|
||||
|
||||
|
||||
@RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
|
||||
@RabbitHandler
|
||||
public void SRResultConsumer1(Message msg, Channel channel) {
|
||||
getSRResult(msg, channel, "consumer 1");
|
||||
}
|
||||
// @RabbitListener(queues = MQConfig.SR_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void SRConsumer1(Message msg, Channel channel) {
|
||||
// superResolution(msg, channel, "consumer 1");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
|
||||
// @RabbitHandler
|
||||
// public void SRResultConsumer1(Message msg, Channel channel) {
|
||||
// getSRResult(msg, channel, "consumer 1");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MyTaskScheduler {
|
||||
|
||||
// 定时任务,每十五天执行一次
|
||||
// @Scheduled(cron = "0 0 0 ? * MON")
|
||||
@Scheduled(cron = "0 0 0 */15 * ?")
|
||||
// @Scheduled(cron = "0 0 0 */15 * ?")
|
||||
public void checkExpiry() {
|
||||
// 检测正式用户是否快要过期
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
@@ -68,7 +68,7 @@ public class MyTaskScheduler {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Scheduled(cron = "0 0 8 * * ?")
|
||||
// @Scheduled(cron = "0 0 8 * * ?")
|
||||
public void sendTrialOrderExcelToManagements() {
|
||||
// 获取前一天日期
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
public class GenerateTask {
|
||||
|
||||
@Scheduled(cron = "0 0 */1 * * ?")
|
||||
// @Scheduled(cron = "0 0 */1 * * ?")
|
||||
public void generateScheduled(){
|
||||
log.info("测试定时器:generate");
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PaypalTask {
|
||||
@Resource
|
||||
private PayPalCheckoutService payPalCheckoutService;
|
||||
|
||||
@Scheduled(cron = "0/30 * * * * ?")
|
||||
// @Scheduled(cron = "0/30 * * * * ?")
|
||||
public void orderConfirm() throws SerializeException {
|
||||
|
||||
log.info("PayPal orderConfirm 被执行......");
|
||||
|
||||
@@ -357,7 +357,10 @@ public class SendEmailUtil {
|
||||
}
|
||||
|
||||
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
|
||||
public static void sendUpgradeNotification(Account account, String senderAddress) {
|
||||
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID = 118856L;
|
||||
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
|
||||
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE = 122899L;
|
||||
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
@@ -376,8 +379,20 @@ public class SendEmailUtil {
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
subject = "Upcoming AiDA 3.0 Launch and Scheduled Maintenance";
|
||||
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// if (type == 1) {
|
||||
// subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// }else {
|
||||
// subject = "即将到来的AiDA 3.0系统升级";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
// }
|
||||
if (type == 1) {
|
||||
subject = "Successful System Upgrade and New Features in AiDA 3.0";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
|
||||
}else {
|
||||
subject = "系统升级成功和AiDA 3.0新功能";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
|
||||
59
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
59
src/main/java/com/ai/da/controller/PortfolioController.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.model.dto.PortfolioDTO;
|
||||
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||
import com.ai.da.model.vo.PortfolioVO;
|
||||
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(tags = "Portfolio模块")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/portfolio")
|
||||
public class PortfolioController {
|
||||
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@ApiOperation(value = "发布作品集")
|
||||
@PostMapping("/publish")
|
||||
public Response<Boolean> preLogin(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.publish(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "作品集page")
|
||||
@PostMapping("/page")
|
||||
public Response<PageBaseResponse<PortfolioVO>> page(@Valid @RequestBody QueryPortfolioPageDTO query) {
|
||||
return Response.success(portfolioService.page(query));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "作品详情")
|
||||
@PostMapping("/detail")
|
||||
public Response<PortfolioVO> detail(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.detail(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "选择作品")
|
||||
@PostMapping("/choose")
|
||||
public Response<UserLikeChooseVO> choose(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.choose(portfolioDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新作品")
|
||||
@PostMapping("/update")
|
||||
public Response<PortfolioVO> update(@Valid @RequestBody PortfolioDTO portfolioDTO) {
|
||||
return Response.success(portfolioService.update(portfolioDTO));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
import com.ai.da.mapper.primary.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.dto.WorkspaceSaveDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.StyleVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -66,8 +69,8 @@ public class WorkspaceController {
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@ApiOperation(value = "新增或编辑", notes = "传入workspace")
|
||||
public Response saveOrUpdate(@Valid @RequestBody Workspace workspace) {
|
||||
return Response.success(workspaceService.saveOrUpdate(workspace));
|
||||
public Response saveOrUpdate(@Valid @RequestBody WorkspaceSaveDTO workspaceDTO) {
|
||||
return Response.success(workspaceService.saveOrUpdate(workspaceDTO));
|
||||
}
|
||||
|
||||
|
||||
@@ -115,10 +118,17 @@ public class WorkspaceController {
|
||||
}
|
||||
|
||||
@PostMapping("maleDataInsert")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperation(value = "男装数据入库入minio")
|
||||
public Response<Boolean> maleDataInsert() throws FileNotFoundException {
|
||||
workspaceService.maleDataInsert();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("styleList")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@ApiOperation(value = "获取style列表")
|
||||
public Response<List<StyleVO>> styleList() {
|
||||
return Response.success(workspaceService.styleList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
|
||||
public interface PortfolioMapper extends CommonMapper<Portfolio> {
|
||||
}
|
||||
17
src/main/java/com/ai/da/mapper/primary/StyleMapper.java
Normal file
17
src/main/java/com/ai/da/mapper/primary/StyleMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface StyleMapper extends CommonMapper<Style> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.WorkspaceRelStyle;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface WorkspaceRelStyleMapper extends CommonMapper<WorkspaceRelStyle> {
|
||||
|
||||
|
||||
}
|
||||
55
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
55
src/main/java/com/ai/da/mapper/primary/entity/Portfolio.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
@ApiModel(value = "Portfolio对象", description = "作品集")
|
||||
@TableName("portfolio")
|
||||
public class Portfolio implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "collection ID")
|
||||
private Long collectionId;
|
||||
|
||||
@ApiModelProperty(value = "userLikeGroup源")
|
||||
private Long userLikeGroupSourceId;
|
||||
|
||||
@ApiModelProperty(value = "作品名称")
|
||||
private String portfolioName;
|
||||
|
||||
@ApiModelProperty(value = "作品描述")
|
||||
private String portfolioDes;
|
||||
|
||||
@ApiModelProperty(value = "作品类型")
|
||||
private String portfolioType;
|
||||
|
||||
@ApiModelProperty(value = "封面ID")
|
||||
private Long coverId;
|
||||
|
||||
@ApiModelProperty(value = "作品状态1公开0隐藏")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "作品集作者ID")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createDate;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDeleted;
|
||||
}
|
||||
17
src/main/java/com/ai/da/mapper/primary/entity/Style.java
Normal file
17
src/main/java/com/ai/da/mapper/primary/entity/Style.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("style")
|
||||
public class Style implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("workspace_rel_style")
|
||||
public class WorkspaceRelStyle implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long workspaceId;
|
||||
private Long styleId;
|
||||
}
|
||||
@@ -9,5 +9,5 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@ApiModel("AccountTrial")
|
||||
public class AccountTrialDTO extends TrialOrder {
|
||||
|
||||
private String ref;
|
||||
}
|
||||
|
||||
10
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
10
src/main/java/com/ai/da/model/dto/PortfolioDTO.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortfolioDTO extends Portfolio {
|
||||
private Long userLikeGroupId;
|
||||
|
||||
}
|
||||
14
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
14
src/main/java/com/ai/da/model/dto/QueryPortfolioPageDTO.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("作品集分页查询")
|
||||
public class QueryPortfolioPageDTO extends PageQueryBaseVo {
|
||||
|
||||
}
|
||||
22
src/main/java/com/ai/da/model/dto/WorkspaceSaveDTO.java
Normal file
22
src/main/java/com/ai/da/model/dto/WorkspaceSaveDTO.java
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Workspace;
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 数据传输对象实体类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WorkspaceSaveDTO extends Workspace {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long styleId;
|
||||
|
||||
}
|
||||
57
src/main/java/com/ai/da/model/enums/StyleEnum.java
Normal file
57
src/main/java/com/ai/da/model/enums/StyleEnum.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum StyleEnum {
|
||||
// 定义风格及其对应的中英文描述
|
||||
NEO_CHINESE("新中式", "Neo Chinese"),
|
||||
COUNTRY_STYLE("田园风", "Country Style"),
|
||||
FUTURISM("未来主义", "Futurism"),
|
||||
MINIMALISM("极简风", "Minimalism"),
|
||||
LOLITA("洛丽塔", "Lolita"),
|
||||
Y2K("Y2K", "Y2K"),
|
||||
BUSINESS("商务风", "Business"),
|
||||
MERLAD("美拉德", "Merlad"),
|
||||
OUTDOOR_FUNCTIONAL("户外机能", "Outdoor Functional"),
|
||||
ROCK("摇滚", "Rock"),
|
||||
DOPAMINE("多巴胺", "Dopamine"),
|
||||
GOTHIC("哥特风", "Gothic"),
|
||||
POST_APOCALYPTIC("废土", "Post-apocalyptic"),
|
||||
ROMANTIC("浪漫", "Romantic"),
|
||||
WABI_SABI("侘寂", "Wabi-sabi");
|
||||
|
||||
private final String chinese;
|
||||
private final String english;
|
||||
|
||||
// 构造函数
|
||||
StyleEnum(String chinese, String english) {
|
||||
this.chinese = chinese;
|
||||
this.english = english;
|
||||
}
|
||||
|
||||
// 获取中文描述
|
||||
public String getChinese() {
|
||||
return chinese;
|
||||
}
|
||||
|
||||
// 获取英文描述
|
||||
public String getEnglish() {
|
||||
return english;
|
||||
}
|
||||
|
||||
// 重写toString方法,返回格式化的描述
|
||||
@Override
|
||||
public String toString() {
|
||||
return chinese + " (" + english + ")";
|
||||
}
|
||||
public static StyleEnum fromName(String name) {
|
||||
for (StyleEnum style : StyleEnum.values()) {
|
||||
if (style.name().equals(name)) {
|
||||
return style;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("No enum constant for name: " + name);
|
||||
}
|
||||
}
|
||||
16
src/main/java/com/ai/da/model/vo/PortfolioVO.java
Normal file
16
src/main/java/com/ai/da/model/vo/PortfolioVO.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.CollectionElement;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import com.ai.da.mapper.primary.entity.TDesignPythonOutfit;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PortfolioVO extends Portfolio {
|
||||
private String designPythonOutfitUrl;
|
||||
|
||||
private List<CollectionElement> collectionElementList;
|
||||
private List<TDesignPythonOutfit> designPythonOutfitList;
|
||||
}
|
||||
16
src/main/java/com/ai/da/model/vo/StyleVO.java
Normal file
16
src/main/java/com/ai/da/model/vo/StyleVO.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class StyleVO extends Style {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String value;
|
||||
}
|
||||
@@ -33,4 +33,6 @@ public class WorkspaceVO extends Workspace {
|
||||
|
||||
private BizJson positionEnum;
|
||||
|
||||
private String styleName;
|
||||
|
||||
}
|
||||
|
||||
21
src/main/java/com/ai/da/service/PortfolioService.java
Normal file
21
src/main/java/com/ai/da/service/PortfolioService.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import com.ai.da.model.dto.PortfolioDTO;
|
||||
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||
import com.ai.da.model.vo.PortfolioVO;
|
||||
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface PortfolioService extends IService<Portfolio> {
|
||||
Boolean publish(PortfolioDTO portfolioDTO);
|
||||
|
||||
PortfolioVO update(PortfolioDTO portfolioDTO);
|
||||
|
||||
PageBaseResponse<PortfolioVO> page(QueryPortfolioPageDTO query);
|
||||
|
||||
PortfolioVO detail(PortfolioDTO portfolioDTO);
|
||||
|
||||
UserLikeChooseVO choose(PortfolioDTO portfolioDTO);
|
||||
}
|
||||
@@ -23,4 +23,6 @@ public interface UserLikeService extends IService<UserLike> {
|
||||
UserLike getByDesignItemId(Long designItemId);
|
||||
|
||||
void updateDate(Long designItemId,String timeZone);
|
||||
|
||||
List<UserLike> getUserLikeList(Long id);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Style;
|
||||
import com.ai.da.mapper.primary.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.dto.WorkspaceSaveDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.StyleVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -29,7 +32,7 @@ public interface WorkspaceService extends IService<Workspace> {
|
||||
*/
|
||||
IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace);
|
||||
|
||||
boolean saveOrUpdate(Workspace workspace);
|
||||
boolean saveOrUpdate(WorkspaceSaveDTO workspaceDTO);
|
||||
|
||||
WorkspaceVO getPage(WorkspaceDTO query);
|
||||
|
||||
@@ -46,4 +49,8 @@ public interface WorkspaceService extends IService<Workspace> {
|
||||
void maleDataInsert() throws FileNotFoundException;
|
||||
|
||||
List<Long> delete(List<Workspace> workspaceList);
|
||||
|
||||
Workspace getCurrentWorkspace();
|
||||
|
||||
List<StyleVO> styleList();
|
||||
}
|
||||
|
||||
@@ -184,6 +184,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
|
||||
private void validateUserValidaExpire(Account account) {
|
||||
|
||||
Long currentTime = new Date().getTime();
|
||||
if (Objects.nonNull(account.getValidStartTime())) {
|
||||
if (currentTime < account.getValidStartTime()) {
|
||||
@@ -515,7 +516,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
if (StringUtils.isNotBlank(accountTrialDTO.getRef())) {
|
||||
account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli());
|
||||
}else {
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
}
|
||||
accountMapper.updateById(account);
|
||||
}else {
|
||||
account.setUserName(trialOrder.getUserName());
|
||||
@@ -523,7 +528,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setUserEmail(trialOrder.getEmail());
|
||||
account.setLanguage(Language.ENGLISH.name());
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
if (StringUtils.isNotBlank(accountTrialDTO.getRef())) {
|
||||
account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli());
|
||||
}else {
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
}
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
@@ -892,15 +901,23 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Override
|
||||
public void upgradeNotification() {
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq("id", 88L);
|
||||
queryWrapper.and(wrapper ->
|
||||
wrapper.gt("valid_end_time", 1709515797000L)
|
||||
wrapper.gt("valid_end_time", 1715817600000L)
|
||||
.or().isNull("valid_end_time"))
|
||||
.isNotNull("user_email");
|
||||
|
||||
List<Account> accountList = accountMapper.selectList(queryWrapper);
|
||||
System.out.println(accountList);
|
||||
for (Account account : accountList) {
|
||||
SendEmailUtil.sendUpgradeNotification(account, null);
|
||||
// SendEmailUtil.sendUpgradeNotification(account, null, 0);
|
||||
// SendEmailUtil.sendUpgradeNotification(account, null, 1);
|
||||
if (account.getLanguage().equals(Language.CHINESE_SIMPLIFIED.name())) {
|
||||
SendEmailUtil.sendUpgradeNotification(account, null, 0);
|
||||
}else {
|
||||
// 英文
|
||||
SendEmailUtil.sendUpgradeNotification(account, null, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -353,14 +353,16 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class);
|
||||
List<CollectionColorDTO> colorBoards = elementVO.getColorBoards();
|
||||
for (CollectionColorDTO colorBoard : colorBoards) {
|
||||
String colorImg = colorBoard.getGradient().getColorImg();
|
||||
String[] parts = colorImg.split(",");
|
||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||
String base64Data = parts[1];
|
||||
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
|
||||
colorBoard.setGradientMinioUrl(gradientMinioUrl);
|
||||
colorBoard.getGradient().setColorImg(null);
|
||||
colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient()));
|
||||
if (Objects.nonNull(colorBoard.getGradient())) {
|
||||
String colorImg = colorBoard.getGradient().getColorImg();
|
||||
String[] parts = colorImg.split(",");
|
||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||
String base64Data = parts[1];
|
||||
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
|
||||
colorBoard.setGradientMinioUrl(gradientMinioUrl);
|
||||
colorBoard.getGradient().setColorImg(null);
|
||||
colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient()));
|
||||
}
|
||||
}
|
||||
elementVO.setColorBoards(colorBoards);
|
||||
List<Long> usedElementIds = elementVO.getUsedElementIds();
|
||||
@@ -781,7 +783,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
element.setColorRgb(color.getRgbValue());
|
||||
//按时区计算
|
||||
element.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
color.getGradient().setColorImg(null);
|
||||
if (Objects.nonNull(color.getGradient())) {
|
||||
color.getGradient().setColorImg(null);
|
||||
}
|
||||
element.setGradientString(JSON.toJSONString(color.getGradient()));
|
||||
elements.add(element);
|
||||
});
|
||||
|
||||
474
src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
Normal file
474
src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java
Normal file
@@ -0,0 +1,474 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.PortfolioDTO;
|
||||
import com.ai.da.model.dto.QueryPortfolioPageDTO;
|
||||
import com.ai.da.model.enums.Position;
|
||||
import com.ai.da.model.enums.Sex;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionMapper collectionMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Override
|
||||
public Boolean publish(PortfolioDTO portfolioDTO) {
|
||||
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||
userLikeGroupNew.setAccountId(-1L);
|
||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setCollectionId(collectionIdNew);
|
||||
element.setId(null);
|
||||
collectionElementMapper.insert(element);
|
||||
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||
collectionElementRelationNew.setElementId(element.getId());
|
||||
collectionElementRelationNew.setCreateDate(new Date());
|
||||
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||
}
|
||||
Portfolio portfolio = new Portfolio();
|
||||
Long coverIdOld = portfolioDTO.getCoverId();
|
||||
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||
portfolio.setPortfolioType("History");
|
||||
portfolio.setCollectionId(collectionIdNew);
|
||||
portfolio.setAccountId(authPrincipalVo.getId());
|
||||
portfolio.setCreateDate(LocalDateTime.now());
|
||||
portfolio.setUpdateDate(LocalDateTime.now());
|
||||
portfolio.setStatus(1);
|
||||
portfolio.setIsDeleted(0);
|
||||
portfolio.setUserLikeGroupSourceId(portfolioDTO.getUserLikeGroupId());
|
||||
portfolioMapper.insert(portfolio);
|
||||
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||
// List<Long> designPythonOutfitIdList = userLikeList.stream().map(UserLike::getDesignOutfitId).collect(Collectors.toList());
|
||||
//
|
||||
// QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||
// qw.lambda().in(TDesignPythonOutfit::getId, designPythonOutfitIdList);
|
||||
// List<TDesignPythonOutfit> designPythonOutfits = designPythonOutfitMapper.selectList(qw);
|
||||
Long coverIdNew = null;
|
||||
Boolean flag = false;
|
||||
for (UserLike userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(-1L);
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
if (designPythonOutfit.getId().equals(coverIdOld)) {
|
||||
flag = true;
|
||||
}
|
||||
designPythonOutfit.setId(null);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
coverIdNew = designOutfitIdNew;
|
||||
portfolio.setCoverId(coverIdNew);
|
||||
portfolioMapper.updateById(portfolio);
|
||||
flag = false;
|
||||
}
|
||||
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(-1L);
|
||||
designItemOld.setDesignId(-1L);
|
||||
designItemOld.setCollectionId(collectionIdNew);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getDesignId();
|
||||
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(-1L);
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||
designItemDetailOld.setAccountId(-1L);
|
||||
designItemDetailOld.setDesignId(-1L);
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortfolioVO update(PortfolioDTO portfolioDTO) {
|
||||
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||
userLikeGroupNew.setAccountId(-1L);
|
||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setCollectionId(collectionIdNew);
|
||||
element.setId(null);
|
||||
collectionElementMapper.insert(element);
|
||||
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||
collectionElementRelationNew.setElementId(element.getId());
|
||||
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||
}
|
||||
Portfolio portfolio = getPortfolioByUserGroupIdSource(portfolioDTO.getUserLikeGroupId());
|
||||
Long coverIdOld = portfolioDTO.getCoverId();
|
||||
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||
// portfolio.setPortfolioType("History");
|
||||
portfolio.setCollectionId(collectionIdNew);
|
||||
portfolio.setAccountId(authPrincipalVo.getId());
|
||||
portfolio.setCreateDate(LocalDateTime.now());
|
||||
portfolio.setUpdateDate(LocalDateTime.now());
|
||||
portfolio.setStatus(1);
|
||||
portfolio.setIsDeleted(0);
|
||||
portfolioMapper.updateById(portfolio);
|
||||
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||
|
||||
Long coverIdNew = null;
|
||||
Boolean flag = false;
|
||||
for (UserLike userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(-1L);
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
if (!flag && designPythonOutfit.getId() == coverIdOld) {
|
||||
flag = true;
|
||||
}
|
||||
designPythonOutfit.setId(null);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
coverIdNew = designPythonOutfit.getId();
|
||||
portfolio.setCoverId(coverIdNew);
|
||||
portfolioMapper.updateById(portfolio);
|
||||
}
|
||||
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(-1L);
|
||||
designItemOld.setDesignId(-1L);
|
||||
designItemOld.setCollectionId(collectionIdNew);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getDesignId();
|
||||
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(-1L);
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||
designItemDetailOld.setAccountId(-1L);
|
||||
designItemDetailOld.setDesignId(-1L);
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Portfolio getPortfolioByUserGroupIdSource(Long userLikeGroupId) {
|
||||
QueryWrapper<Portfolio> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Portfolio::getUserLikeGroupSourceId, userLikeGroupId);
|
||||
return portfolioMapper.selectOne(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageBaseResponse<PortfolioVO> page(QueryPortfolioPageDTO query) {
|
||||
QueryWrapper<Portfolio> qw = new QueryWrapper<>();
|
||||
qw.lambda().orderByDesc(Portfolio::getUpdateDate);
|
||||
IPage<Portfolio> page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()),qw);
|
||||
IPage<PortfolioVO> convert = page.convert((Function<Portfolio, PortfolioVO>) portfolio -> {
|
||||
if (portfolio != null) {
|
||||
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(vo.getCoverId());
|
||||
vo.setDesignPythonOutfitUrl(minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
return PageBaseResponse.success(convert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortfolioVO detail(PortfolioDTO portfolioDTO) {
|
||||
Portfolio portfolio = portfolioMapper.selectById(portfolioDTO.getId());
|
||||
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||
Long collectionId = portfolio.getCollectionId();
|
||||
List<CollectionElement> collectionElementList = collectionElementService.getByCollectionId(collectionId);
|
||||
for (CollectionElement element : collectionElementList) {
|
||||
if (StringUtils.isEmpty(element.getUrl())) {
|
||||
continue;
|
||||
}
|
||||
element.setUrl(minioUtil.getPresignedUrl(element.getUrl(), 24 * 60));
|
||||
}
|
||||
vo.setCollectionElementList(collectionElementList);
|
||||
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfit::getCollectionId, portfolio.getCollectionId());
|
||||
List<TDesignPythonOutfit> designPythonOutfitList = designPythonOutfitMapper.selectList(qw);
|
||||
for (TDesignPythonOutfit tDesignPythonOutfit : designPythonOutfitList) {
|
||||
tDesignPythonOutfit.setDesignUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
vo.setDesignPythonOutfitList(designPythonOutfitList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLikeChooseVO choose(PortfolioDTO portfolioDTO) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||
userLikeGroupNew.setAccountId(authPrincipalVo.getId());
|
||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||
collectionOld.setId(null);
|
||||
collectionMapper.insert(collectionOld);
|
||||
Long collectionIdNew = collectionOld.getId();
|
||||
|
||||
Workspace workspace = workspaceService.getCurrentWorkspace();
|
||||
Design design = new Design();
|
||||
design.setCollectionId(collectionIdNew);
|
||||
design.setAccountId(authPrincipalVo.getId());
|
||||
if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||
design.setTemplateId(workspace.getMannequinFemaleId());
|
||||
design.setModelType(workspace.getMannequinFemaleType());
|
||||
}else {
|
||||
design.setTemplateId(workspace.getMannequinMaleId());
|
||||
design.setModelType(workspace.getMannequinMaleType());
|
||||
}
|
||||
design.setSystemScale(BigDecimal.valueOf(workspace.getSystemDesignerPercentage()));
|
||||
if (workspace.getPosition().equals(Position.OVERALL.getValue())) {
|
||||
design.setSingleOverall("overall");
|
||||
design.setSwitchCategory("");
|
||||
}else {
|
||||
design.setSingleOverall("single");
|
||||
design.setSwitchCategory(workspace.getPosition());
|
||||
}
|
||||
design.setCreateDate(new Date());
|
||||
designMapper.insert(design);
|
||||
|
||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||
for (CollectionElement element : collectionElementListOld) {
|
||||
element.setCollectionId(collectionIdNew);
|
||||
element.setId(null);
|
||||
collectionElementMapper.insert(element);
|
||||
TCollectionElementRelation collectionElementRelationNew = new TCollectionElementRelation();
|
||||
collectionElementRelationNew.setCollectionId(collectionIdNew);
|
||||
collectionElementRelationNew.setElementId(element.getId());
|
||||
collectionElementRelationNew.setCreateDate(new Date());
|
||||
collectionElementRelationMapper.insert(collectionElementRelationNew);
|
||||
}
|
||||
|
||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||
|
||||
for (UserLike userLike : userLikeList) {
|
||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||
designPythonOutfit.setDesignId(design.getId());
|
||||
designPythonOutfit.setDesignItemId(-1L);
|
||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||
|
||||
designPythonOutfit.setId(null);
|
||||
designPythonOutfitMapper.insert(designPythonOutfit);
|
||||
Long designOutfitIdNew = designPythonOutfit.getId();
|
||||
userLike.setDesignOutfitId(designOutfitIdNew);
|
||||
QueryWrapper<TDesignPythonOutfitDetail> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
||||
tDesignPythonOutfitDetail.setId(null);
|
||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||
}
|
||||
|
||||
Long designItemIdOld = userLike.getDesignItemId();
|
||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||
designItemOld.setId(null);
|
||||
designItemOld.setAccountId(-1L);
|
||||
designItemOld.setDesignId(-1L);
|
||||
designItemOld.setCollectionId(collectionIdNew);
|
||||
designItemMapper.insert(designItemOld);
|
||||
Long designItemIdNew = designItemOld.getDesignId();
|
||||
|
||||
designPythonOutfit.setDesignItemId(designItemIdNew);
|
||||
designPythonOutfitMapper.updateById(designPythonOutfit);
|
||||
|
||||
userLike.setDesignItemId(designItemIdNew);
|
||||
userLike.setId(null);
|
||||
userLike.setDesignId(design.getId());
|
||||
userLike.setUserLikeGroupId(userLikeGroupNew.getId());
|
||||
userLikeMapper.insert(userLike);
|
||||
QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItemOld);
|
||||
List<DesignItemDetail> designItemDetailListOld = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
for (DesignItemDetail designItemDetailOld : designItemDetailListOld) {
|
||||
Long designItemDetailIdOld = designItemDetailOld.getId();
|
||||
designItemDetailOld.setAccountId(authPrincipalVo.getId());
|
||||
designItemDetailOld.setDesignId(design.getId());
|
||||
designItemDetailOld.setDesignItemId(designItemIdNew);
|
||||
designItemDetailMapper.insert(designItemDetailOld);
|
||||
Long designItemDetailIdNew = designItemDetailOld.getId();
|
||||
QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetailIdOld);
|
||||
DesignItemDetailPrint designItemDetailPrint = designItemDetailPrintMapper.selectOne(designItemDetailPrintQueryWrapper);
|
||||
designItemDetailPrint.setDesignItemDetailId(designItemDetailIdNew);
|
||||
designItemDetailPrintMapper.insert(designItemDetailPrint);
|
||||
}
|
||||
}
|
||||
|
||||
return userLikeGroupService.choose(userLikeGroupNew.getId());
|
||||
}
|
||||
}
|
||||
@@ -123,15 +123,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
List<UserLikeVO> userLikeVOS = userLikeService.getGroupDetail(userGroupId);
|
||||
String sex = null;
|
||||
// if (CollectionUtil.isNotEmpty(userLikeVOS)) {
|
||||
// Long designId = userLikeVOS.get(0).getDesignId();
|
||||
// Design design = designMapper.selectById(designId);
|
||||
// if (design.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
// sex = sysFileMapper.selectById(design.getTemplateId()).getLevel2Type();
|
||||
// }else {
|
||||
// sex = libraryMapper.selectById(design.getTemplateId()).getLevel2Type();
|
||||
// }
|
||||
// }
|
||||
userLikeVOS.forEach(o -> {
|
||||
TDesignPythonOutfit tDesignPythonOutfit1 = designPythonOutfitMapper.selectById(o.getDesignOutfitId());
|
||||
o.setUrl(tDesignPythonOutfit1.getDesignUrl());
|
||||
|
||||
@@ -81,4 +81,11 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
|
||||
baseMapper.update(null,uw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserLike> getUserLikeList(Long id) {
|
||||
QueryWrapper<UserLike> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(UserLike::getUserLikeGroupId, id);
|
||||
return userLikeMapper.selectList(qw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,18 +9,12 @@ import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.LibraryMapper;
|
||||
import com.ai.da.mapper.primary.SysFileMapper;
|
||||
import com.ai.da.mapper.primary.WorkspaceMapper;
|
||||
import com.ai.da.mapper.primary.entity.Library;
|
||||
import com.ai.da.mapper.primary.entity.SysFile;
|
||||
import com.ai.da.mapper.primary.entity.Workspace;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.dto.WorkspaceSaveDTO;
|
||||
import com.ai.da.model.enums.*;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.ai.da.model.vo.ModelVO;
|
||||
import com.ai.da.model.vo.ModelsVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -37,11 +31,13 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.naming.Context;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -57,6 +53,12 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Resource
|
||||
private StyleMapper styleMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
|
||||
@@ -82,7 +84,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
private final static Integer SYSTEM_DESIGNER_PERCENTAGE = 30;
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdate(Workspace workspace) {
|
||||
public boolean saveOrUpdate(WorkspaceSaveDTO workspaceDTO) {
|
||||
Workspace workspace = CopyUtil.copyObject(workspaceDTO, Workspace.class);
|
||||
// 防止前端传值修改标识
|
||||
workspace.setIsLastIndex(null);
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
@@ -113,12 +116,35 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
if (insert <= 0) {
|
||||
throw new BusinessException("save.workspace.failed");
|
||||
}
|
||||
if (workspaceDTO.getStyleId() != null) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(workspace.getId());
|
||||
rel.setStyleId(workspaceDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
int update = workspaceMapper.updateById(workspace);
|
||||
if (update <= 0) {
|
||||
throw new BusinessException("update.workspace.failed");
|
||||
}
|
||||
if (workspaceDTO.getStyleId() != null) {
|
||||
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspace.getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
WorkspaceRelStyle rel = new WorkspaceRelStyle();
|
||||
rel.setWorkspaceId(workspace.getId());
|
||||
rel.setStyleId(workspaceDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}else {
|
||||
WorkspaceRelStyle workspaceRelStyle = workspaceRelStyles.get(0);
|
||||
if (!Objects.equals(workspaceRelStyle.getStyleId(), workspaceDTO.getStyleId())) {
|
||||
workspaceRelStyle.setStyleId(workspaceRelStyle.getStyleId());
|
||||
workspaceRelStyleMapper.updateById(workspaceRelStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -250,6 +276,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
|
||||
@Override
|
||||
public WorkspaceVO getByIdNew(Long id) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
|
||||
qwOld.lambda().eq(Workspace::getAccountId, accountId);
|
||||
@@ -260,26 +287,21 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
Workspace newIsLastIndex = workspaceMapper.selectById(id);
|
||||
newIsLastIndex.setIsLastIndex(1);
|
||||
workspaceMapper.updateById(newIsLastIndex);
|
||||
WorkspaceVO vo = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
|
||||
if (vo.getMannequinFemaleId() != null) {
|
||||
if (vo.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
WorkspaceVO workspaceVO = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
|
||||
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspaceVO.getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
Long styleId = workspaceRelStyles.get(0).getStyleId();
|
||||
Style style = styleMapper.selectById(styleId);
|
||||
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
workspaceVO.setStyleName(styleEnum.getEnglish());
|
||||
}else {
|
||||
workspaceVO.setStyleName(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
if (vo.getMannequinMaleId() != null) {
|
||||
if (vo.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Sex sex = Sex.getSex(vo.getSex());
|
||||
Position position = Position.getPosition(vo.getPosition());
|
||||
vo.setSexEnum(new BizJson(sex.getValue(), sex.name(), BusinessException.getMessageFromResource(sex.name())));
|
||||
vo.setPositionEnum(new BizJson(position.getValue(), position.name(), BusinessException.getMessageFromResource(position.name())));
|
||||
return vo;
|
||||
return workspaceVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -502,44 +524,36 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
return deleteIds;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) throws FileNotFoundException {
|
||||
// String b = "C:\\workspace\\fileData\\aida_men_library\\top\\mens_test_9992.png";
|
||||
// File pngFile = new File(b);
|
||||
// SysFile sysFile = new SysFile();
|
||||
// String fileName = pngFile.getName();
|
||||
// sysFile.setName(fileName);
|
||||
// sysFile.setLevel1Type("Images");
|
||||
// sysFile.setLevel3Type("Male");
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.append("aida-sys-image/images/male");
|
||||
// String absolutePath = pngFile.getAbsolutePath();
|
||||
// if (absolutePath.contains("bottom")) {
|
||||
// sysFile.setLevel2Type("Bottoms");
|
||||
// sb.append("/bottoms/");
|
||||
// }else if(absolutePath.contains("top")) {
|
||||
// sysFile.setLevel2Type("Tops");
|
||||
// sb.append("/tops/");
|
||||
// }else if(absolutePath.contains("outer")) {
|
||||
// sysFile.setLevel2Type("Outwear");
|
||||
// sb.append("/outwear/");
|
||||
// }
|
||||
// sb.append(fileName);
|
||||
// String url = sb.toString();
|
||||
// sysFile.setUrl(url);
|
||||
// sysFile.setMd5(MD5Utils.encryptFile(new FileInputStream(pngFile)));
|
||||
//// boolean b = minioUtil.doesObjectExist("aida-sys-image", uploadMinioPath);
|
||||
//// if (!b) {
|
||||
//// FileItem a = getMultipartFile(file, file.getName());
|
||||
//// MultipartFile multipartFile = new CommonsMultipartFile(a);
|
||||
//// minioUtil.upload(bucketName, uploadMinioPath, multipartFile, "");
|
||||
//// }
|
||||
// FileItem a = getMultipartFile(pngFile, fileName);
|
||||
// MultipartFile multipartFile = new CommonsMultipartFile(a);
|
||||
// System.out.println(url.substring(0,14));
|
||||
// System.out.println(url.substring(15));
|
||||
//// minioUtil.upload(url.substring(0,14), url.substring(15), multipartFile, "");
|
||||
// sysFile.setCreateDate(new Date());
|
||||
// }
|
||||
@Override
|
||||
public Workspace getCurrentWorkspace() {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getAccountId, authPrincipalVo.getId());
|
||||
qw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
// qw.lambda().eq(Workspace::getIsDeleted, 0);
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("workspace not found.");
|
||||
}
|
||||
return workspaces.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StyleVO> styleList() {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
QueryWrapper<Style> qw = new QueryWrapper<>();
|
||||
List<Style> styles = styleMapper.selectList(qw);
|
||||
List<StyleVO> styleVOS = CopyUtil.copyList(styles, StyleVO.class);
|
||||
for (StyleVO styleVO : styleVOS) {
|
||||
StyleEnum styleEnum = StyleEnum.fromName(styleVO.getName());
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
styleVO.setValue(styleEnum.getEnglish());
|
||||
}else {
|
||||
styleVO.setValue(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
return styleVOS;
|
||||
}
|
||||
|
||||
public static List<File> getPNGFiles(String directoryPath) {
|
||||
List<File> pngFiles = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
server.port=5567
|
||||
|
||||
#datasource
|
||||
spring.datasource.primary.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.primary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/aida?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
spring.datasource.primary.username=aida_con
|
||||
@@ -20,7 +19,7 @@ spring.security.jwtExpiration=8640000000
|
||||
#spring security权限设置 认证了token还要认证权限 不然报错Full authentication is required to access this resource
|
||||
spring.security.ignorePaths=/,/favicon.ico,/doc.html,/webjars/**,/swagger-resources,/v2/api-docs,\
|
||||
/api/account/**,/api/element/**,/api/python/**,/api/design/**,/api/history/**,/api/library/**,/api/third/party/**,/api/generate/**,/api/workspace/**,/api/classification/**,\
|
||||
/api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**
|
||||
/api/product/**,/api/ali-pay/**,/api/order-info/**,/api/paypal/**,/api/credits/**,/api/inquiry/**,/api/tasks/**,/api/python/prepareForSR,/api/alipay-hk/**,/api/portfolio/**
|
||||
spring.security.authApi=/auth/login
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user