Compare commits
6 Commits
f5c3621a5d
...
6146112d04
| Author | SHA1 | Date | |
|---|---|---|---|
| 6146112d04 | |||
| 412550df27 | |||
| 497421e7fe | |||
| 891527426c | |||
|
|
8f0d0953b2 | ||
|
|
9a1a0045e0 |
@@ -40,8 +40,8 @@ public class AccountTask {
|
|||||||
accountService.extendValidityForCC();
|
accountService.extendValidityForCC();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每天凌晨0点执行一次
|
// 每天凌晨0点执行一次 目前已没有角色类型为4的用户
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
/*@Scheduled(cron = "0 0 0 * * ?")
|
||||||
public void cancelActivityBenefits() {
|
public void cancelActivityBenefits() {
|
||||||
// 1、查询当前所有参与了活动且过期的用户
|
// 1、查询当前所有参与了活动且过期的用户
|
||||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
||||||
@@ -51,7 +51,7 @@ public class AccountTask {
|
|||||||
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
||||||
accountService.toVisitor(account);
|
accountService.toVisitor(account);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 每天检测正式用户到期情况,每天凌晨0点执行
|
// 每天检测正式用户到期情况,每天凌晨0点执行
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface DesignMapper extends CommonMapper<Design> {
|
|||||||
Long insertDesign(Design design);
|
Long insertDesign(Design design);
|
||||||
|
|
||||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email,
|
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();
|
List<Design> selectDeleteList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,17 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
|| ADMIN_IDS.contains(account.getId())
|
|| ADMIN_IDS.contains(account.getId())
|
||||||
|| ADMIN_IDS_READ_ONLY.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)) {
|
if (StringUtil.isNullOrEmpty(endTime)) {
|
||||||
// yyyy-MM-dd HH:mm:ss "HH"表示24小时制 "hh"表示12小时制
|
// yyyy-MM-dd HH:mm:ss "HH"表示24小时制 "hh"表示12小时制
|
||||||
endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
endTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
@@ -173,7 +183,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
default:
|
default:
|
||||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
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 {
|
} else {
|
||||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@@ -1154,7 +1155,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.toLocalDateTime());
|
.toLocalDateTime());
|
||||||
userPreference.setDesignItemId(designItem.getId());
|
userPreference.setDesignItemId(designItem.getId());
|
||||||
userPreference.setProjectId(projectId);
|
userPreference.setProjectId(projectId);
|
||||||
if (workspaceRelStyles == null || workspaceRelStyles.isEmpty()) {
|
if (workspaceRelStyles == null||workspaceRelStyles.isEmpty()) {
|
||||||
//查不到记录,style应该是all
|
//查不到记录,style应该是all
|
||||||
userPreference.setWorkspaceRelStyleId(0L);
|
userPreference.setWorkspaceRelStyleId(0L);
|
||||||
} else {
|
} else {
|
||||||
@@ -1669,6 +1670,24 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.lt("create_date", endTime)
|
.lt("create_date", endTime)
|
||||||
.select("count(id) as count");
|
.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()) {
|
if (!Objects.isNull(accountIds) && !accountIds.isEmpty()) {
|
||||||
queryWrapper.in("account_id", accountIds);
|
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);
|
List<Map<String, Object>> result = baseMapper.selectMaps(queryWrapper);
|
||||||
if (result != null && !result.isEmpty()) {
|
if (result != null && !result.isEmpty()) {
|
||||||
Object countObj = result.get(0).get("count");
|
Object countObj = result.get(0).get("count");
|
||||||
return (Long) countObj;
|
return countObj != null ? ((Number) countObj).longValue() : 0L;
|
||||||
} else {
|
} else {
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,10 +61,10 @@
|
|||||||
</if>
|
</if>
|
||||||
<!-- 添加时间区间查询条件 -->
|
<!-- 添加时间区间查询条件 -->
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND cd.create_time >= #{startTime}
|
AND create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="endTime != null and endTime != ''">
|
||||||
AND cd.create_time <= #{endTime}
|
AND create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
account_id
|
account_id
|
||||||
|
|||||||
@@ -52,8 +52,10 @@
|
|||||||
AND b.create_date between #{startTime} and #{endTime}
|
AND b.create_date between #{startTime} and #{endTime}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
and b.create_date not like '%:01'
|
<if test="filterBySecond">
|
||||||
and b.create_date not like '%:02'
|
and b.create_date not like '%:01'
|
||||||
|
and b.create_date not like '%:02'
|
||||||
|
</if>
|
||||||
<if test="ids != null and ids.size() > 0">
|
<if test="ids != null and ids.size() > 0">
|
||||||
and a.id in
|
and a.id in
|
||||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||||
|
|||||||
Reference in New Issue
Block a user