解决时间报错

This commit is contained in:
1378012178@qq.com 2026-01-20 11:28:54 +08:00
parent 930b24eacb
commit b6ca58fec9
2 changed files with 18 additions and 9 deletions

View File

@ -262,7 +262,7 @@ public class CareDirectiveApi {
List<DirectiveOrderEntity> current = Lists.newArrayList();
List<DirectiveOrderEntity> future = Lists.newArrayList();
List<DirectiveOrderEntity> all = Lists.newArrayList();
if (StringUtils.isBlank(dto.getNuId()) || dto.getQueryDate() == null || dto.getQueryFuture() == null) {
if (StringUtils.isBlank(dto.getNuId()) || dto.getQueryDate() == null) {
result.put("history", history);
result.put("current", current);
result.put("future", future);

View File

@ -248,16 +248,25 @@
p.positioning,
p.positioning_long,
p.tag_name,
p.start_time as start_time_str,
CONCAT(
DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ',
LPAD(p.start_time, 5, '0'), ':00'
) as start_time,
CASE
WHEN p.iz_package = 'N' AND directive.service_duration IS NOT NULL
THEN DATE_FORMAT(ADDTIME(STR_TO_DATE(p.start_time, '%H:%i'),
SEC_TO_TIME(directive.service_duration * 60)), '%H:%i')
THEN CONCAT(
DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ',
DATE_FORMAT(ADDTIME(STR_TO_DATE(CONCAT(LPAD(p.start_time, 5, '0'), ':00'), '%H:%i:%s'),
SEC_TO_TIME(directive.service_duration * 60)), '%H:%i:%s')
)
WHEN p.iz_package = 'Y' AND package.total_duration IS NOT NULL
THEN DATE_FORMAT(ADDTIME(STR_TO_DATE(p.start_time, '%H:%i'),
SEC_TO_TIME(package.total_duration * 60)), '%H:%i')
THEN CONCAT(
DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ',
DATE_FORMAT(ADDTIME(STR_TO_DATE(CONCAT(LPAD(p.start_time, 5, '0'), ':00'), '%H:%i:%s'),
SEC_TO_TIME(package.total_duration * 60)), '%H:%i:%s')
)
ELSE NULL
END as end_time_str,
END as end_time,
p.create_by,
p.create_time,
p.update_by,
@ -306,9 +315,9 @@
-- 是否查询未来指令
<if test="dto.queryFuture != null and dto.queryFuture">
AND #{dto.queryDate} = CURDATE() AND p.start_time > DATE_FORMAT(NOW(), '%H:%i')
AND #{dto.queryDate} = CURDATE() AND p.start_time > DATE_FORMAT(NOW(), '%H:%i')
</if>
ORDER BY p.start_time ASC
ORDER BY p.start_time ASC
</select>
</mapper>