Compare commits
4 Commits
dev/dev
...
9c61b1c8fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c61b1c8fe | |||
| e30fdf7401 | |||
| ba2d10afbc | |||
| 412550df27 |
@@ -19,7 +19,7 @@ public interface DesignMapper extends CommonMapper<Design> {
|
||||
Long insertDesign(Design design);
|
||||
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email,
|
||||
String role, String organizationName);
|
||||
String role, String organizationName, boolean filterBySecond);
|
||||
|
||||
List<Design> selectDeleteList();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,17 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
|| ADMIN_IDS.contains(account.getId())
|
||||
|| ADMIN_IDS_READ_ONLY.contains(account.getId())
|
||||
)) {
|
||||
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
|
||||
boolean filterBySecond ;
|
||||
if (StringUtil.isNullOrEmpty(startTime)) {
|
||||
startTime = "2024-02-01 00:00:00";
|
||||
filterBySecond = true;
|
||||
} else {
|
||||
LocalDateTime thresholdTime = LocalDateTime.of(2024, 5, 1, 0, 0, 0);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(startTime, formatter);
|
||||
filterBySecond = startDateTime.isBefore(thresholdTime);
|
||||
}
|
||||
|
||||
if (StringUtil.isNullOrEmpty(endTime)) {
|
||||
// yyyy-MM-dd HH:mm:ss "HH"表示24小时制 "hh"表示12小时制
|
||||
endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -173,7 +183,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
default:
|
||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
return designMapper.getDesignStatistic(startTime, endTime, ids, email, role, account.getOrganizationName());
|
||||
return designMapper.getDesignStatistic(startTime, endTime, ids, email, role, account.getOrganizationName(), filterBySecond);
|
||||
} else {
|
||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -1669,6 +1670,24 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
.lt("create_date", endTime)
|
||||
.select("count(id) as count");
|
||||
|
||||
// 如果startTime早于2024-05-01 00:00:00,添加额外的筛选条件
|
||||
LocalDateTime thresholdTime = LocalDateTime.of(2024, 5, 1, 0, 0, 0);
|
||||
|
||||
try {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(startTime, formatter);
|
||||
|
||||
if (startDateTime.isBefore(thresholdTime)) {
|
||||
// 使用 notLike 来排除以 ":01" 或 ":02" 结尾的时间
|
||||
// 方案2.1:使用 apply 方法执行数据库函数 (create_date 字段的实际存储格式(可能包含毫秒),所以取最后三个字符进行匹配)
|
||||
queryWrapper.apply("DATE_FORMAT(create_date, '%s') NOT IN ('01', '02')");
|
||||
/*queryWrapper.notLike("create_date", "%:01")
|
||||
.notLike("create_date", "%:02");*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to parse startTime: {}, skip time-based filtering", startTime, e);
|
||||
}
|
||||
|
||||
if (!Objects.isNull(accountIds) && !accountIds.isEmpty()) {
|
||||
queryWrapper.in("account_id", accountIds);
|
||||
}
|
||||
@@ -1676,7 +1695,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
List<Map<String, Object>> result = baseMapper.selectMaps(queryWrapper);
|
||||
if (result != null && !result.isEmpty()) {
|
||||
Object countObj = result.get(0).get("count");
|
||||
return (Long) countObj;
|
||||
return countObj != null ? ((Number) countObj).longValue() : 0L;
|
||||
} else {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -53,7 +54,11 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
// 参数校验
|
||||
validateInputParams(libraryModelPointDTO);
|
||||
|
||||
LibraryModelPointVO libraryModelPointVO = CopyUtil.copyObject(libraryModelPointDTO, LibraryModelPointVO.class);
|
||||
|
||||
// 不管是保存还是另存为,都需要传模特的libraryId
|
||||
@@ -71,7 +76,8 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
// 更新模特图片
|
||||
if (flag) {
|
||||
libModel.setUrl(url);
|
||||
libModel.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false));
|
||||
String preSignedUrl = minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
libModel.setMd5(MD5Utils.encryptFile(preSignedUrl, false));
|
||||
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(url);
|
||||
libModel.setWidth(imagesWidthAndHeight.get(0));
|
||||
libModel.setHigh(imagesWidthAndHeight.get(1));
|
||||
@@ -104,25 +110,10 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
|
||||
} else {
|
||||
// 不覆盖,即另存为
|
||||
// 新增模特library信息
|
||||
Library saveAsModel = new Library();
|
||||
saveAsModel.setAccountId(libModel.getAccountId());
|
||||
saveAsModel.setLevel1Type(libModel.getLevel1Type());
|
||||
saveAsModel.setLevel2Type(libModel.getLevel2Type());
|
||||
String ageGroup = StringUtil.isNullOrEmpty(libModel.getLevel3Type()) ? "Adult" : libModel.getLevel3Type();
|
||||
saveAsModel.setLevel3Type(ageGroup);
|
||||
saveAsModel.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
|
||||
saveAsModel.setUrl(url);
|
||||
saveAsModel.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false));
|
||||
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(url);
|
||||
saveAsModel.setWidth(imagesWidthAndHeight.get(0));
|
||||
saveAsModel.setHigh(imagesWidthAndHeight.get(1));
|
||||
saveAsModel.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
libraryService.save(saveAsModel);
|
||||
// 更新新的模特在library中的id,用于后面新建模特点位信息用
|
||||
libraryModelPointDTO.setLibraryId(saveAsModel.getId());
|
||||
Library saveAsModel = createNewLibraryCopy(libModel, libraryModelPointDTO);
|
||||
|
||||
// 新增模特点位信息
|
||||
libraryModelPointDTO.setLibraryId(saveAsModel.getId()); // 更新libraryId为新创建的模型ID
|
||||
LibraryModelPoint libraryModelPoint = resolvePoint(libraryModelPointDTO);
|
||||
libraryModelPoint.setModelType("Library");
|
||||
libraryModelPoint.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
@@ -130,22 +121,50 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
|
||||
libraryModelPointVO.setRelationId(libraryModelPoint.getRelationId());
|
||||
}
|
||||
//编辑
|
||||
/*if (!StringUtils.isEmpty(libraryModelPointDTO.getModelSex())) {
|
||||
Library byId = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
||||
if (!byId.getLevel2Type().equals(libraryModelPointDTO.getModelSex())) {
|
||||
if (byId.getLevel2Type().equals(Sex.FEMALE.getValue())) {
|
||||
libraryService.checkModel(Sex.FEMALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
||||
}else {
|
||||
libraryService.checkModel(Sex.MALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
||||
}
|
||||
byId.setLevel2Type(libraryModelPointDTO.getModelSex());
|
||||
libraryService.updateById(byId);
|
||||
}
|
||||
}*/
|
||||
return libraryModelPointVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证输入参数
|
||||
*/
|
||||
private void validateInputParams(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
if (libraryModelPointDTO == null) {
|
||||
throw new BusinessException("libraryModelPointDTO cannot be null");
|
||||
}
|
||||
if (libraryModelPointDTO.getLibraryId() == null || libraryModelPointDTO.getLibraryId() <= 0) {
|
||||
throw new BusinessException("libraryId is required");
|
||||
}
|
||||
if (StringUtils.isEmpty(libraryModelPointDTO.getModelPath())) {
|
||||
throw new BusinessException("modelPath is required");
|
||||
}
|
||||
if (StringUtils.isEmpty(libraryModelPointDTO.getTimeZone())) {
|
||||
throw new BusinessException("timeZone is required");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新的库模型副本
|
||||
*/
|
||||
private Library createNewLibraryCopy(Library originalModel, LibraryModelPointDTO libraryModelPointDTO) {
|
||||
// 新增模特library信息
|
||||
Library saveAsModel = new Library();
|
||||
saveAsModel.setAccountId(originalModel.getAccountId());
|
||||
saveAsModel.setLevel1Type(originalModel.getLevel1Type());
|
||||
saveAsModel.setLevel2Type(originalModel.getLevel2Type());
|
||||
String ageGroup = StringUtil.isNullOrEmpty(originalModel.getLevel3Type()) ? "Adult" : originalModel.getLevel3Type();
|
||||
saveAsModel.setLevel3Type(ageGroup);
|
||||
saveAsModel.setName(DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD));
|
||||
saveAsModel.setUrl(libraryModelPointDTO.getModelPath());
|
||||
String preSignedUrl = minioUtil.getPreSignedUrl(libraryModelPointDTO.getModelPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
saveAsModel.setMd5(MD5Utils.encryptFile(preSignedUrl, false));
|
||||
List<Integer> imagesWidthAndHeight = minioUtil.getImagesWidthAndHeight(libraryModelPointDTO.getModelPath());
|
||||
saveAsModel.setWidth(imagesWidthAndHeight.get(0));
|
||||
saveAsModel.setHigh(imagesWidthAndHeight.get(1));
|
||||
saveAsModel.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
libraryService.save(saveAsModel);
|
||||
return saveAsModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LibraryModelPointVO saveOrEditTemplatePointOld(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
// Library library = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
||||
|
||||
@@ -125,9 +125,9 @@ orderList.link=https://develop.aida.com.hk/home/homePage?order=
|
||||
# 0 不发送邮件通知 1 发送邮件通知
|
||||
stripe.webhook.fail.reminder=0
|
||||
# kim test
|
||||
stripe.paymentMethodConfiguration=pmc_1LywTWH7nPZ8bkrN6FvdCUWG
|
||||
#stripe.paymentMethodConfiguration=pmc_1LywTWH7nPZ8bkrN6FvdCUWG
|
||||
# developer test
|
||||
#stripe.paymentMethodConfiguration=pmc_1QIKyq02n1TEydyNKVEYvhW7
|
||||
stripe.paymentMethodConfiguration=pmc_1QIKyq02n1TEydyNKVEYvhW7
|
||||
#thymelea模板配置
|
||||
#控制 Thymeleaf 是否启用模板缓存 生产环境用true,以提高性能
|
||||
spring.thymeleaf.cache=false
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
</if>
|
||||
<!-- 添加时间区间查询条件 -->
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND cd.create_time >= #{startTime}
|
||||
AND create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND cd.create_time <= #{endTime}
|
||||
AND create_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
account_id
|
||||
|
||||
@@ -52,8 +52,10 @@
|
||||
AND b.create_date between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
and b.create_date not like '%:01'
|
||||
and b.create_date not like '%:02'
|
||||
<if test="filterBySecond">
|
||||
and b.create_date not like '%:01'
|
||||
and b.create_date not like '%:02'
|
||||
</if>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
and a.id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user