Pārlūkot izejas kodu

fix:打卡匹配的计划数据

459242451@qq.com 3 gadi atpakaļ
vecāks
revīzija
50b0fe3567

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/XunTask.java

@@ -155,8 +155,8 @@ public class XunTask {
                 }
                 // 更新到计划中
                 if (StrUtil.isNotBlank(convert.getPatrolmanCard())) {
+                    // 根据当前时间查询符合的计划数据
                     TlPlanRecord tlPlanRecord = new TlPlanRecord();
-                    tlPlanRecord.setPlanDate(DateUtil.formatDate(convert.getCreateTime()));
                     tlPlanRecord.setCard(convert.getPatrolmanCard());
                     tlPlanRecord.setCheckpointCard(convert.getCheckpointCard());
                     tlPlanRecord.setDeviceCode(convert.getDeviceCode());

+ 6 - 1
ruoyi-system/src/main/resources/mapper/qdtl/TlPlanRecordMapper.xml

@@ -153,7 +153,12 @@
             <if test="fence != null">fence = #{fence},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
         </trim>
-        where plan_date = #{planDate} and card = #{card} and checkpoint_card = #{checkpointCard}
+        where str_to_date(concat(plan_date, ' ', start_time), '%Y-%m-%d %H:%i:%s') &lt;= #{createTime}
+        and str_to_date(concat(plan_date, ' ', end_time), '%Y-%m-%d %H:%i:%s') &gt;= #{createTime}
+        and card = #{card}
+        and checkpoint_card = #{checkpointCard}
+        and create_time is null
+        limit 1
     </update>
 
     <delete id="deleteTlPlanRecordById" parameterType="Long">