Commit 57e106cca177983e5580362cae1b1988f6cbb155
1 parent
c88a377b
fix: resolve sql query error
Showing
3 changed files
with
21 additions
and
6 deletions
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -119,12 +119,14 @@ public class ThreadJobService { | @@ -119,12 +119,14 @@ public class ThreadJobService { | ||
| 119 | if (result == 0) { | 119 | if (result == 0) { |
| 120 | continue; | 120 | continue; |
| 121 | } | 121 | } |
| 122 | + log.info("图片开始上传"); | ||
| 122 | // 获取图片请求地址 | 123 | // 获取图片请求地址 |
| 123 | String imageUrl = DriverJob.getDownloadImageUrl(token, imageUlr); | 124 | String imageUrl = DriverJob.getDownloadImageUrl(token, imageUlr); |
| 124 | // 获取图片数据 | 125 | // 获取图片数据 |
| 125 | InputStream is = HttpUtils.doGet(imageUrl, new HashMap<>()); | 126 | InputStream is = HttpUtils.doGet(imageUrl, new HashMap<>()); |
| 126 | // 上传图片 | 127 | // 上传图片 |
| 127 | uploadImage(is, filePath); | 128 | uploadImage(is, filePath); |
| 129 | + log.debug("图片上传完毕"); | ||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | 132 | ||
| @@ -132,6 +134,7 @@ public class ThreadJobService { | @@ -132,6 +134,7 @@ public class ThreadJobService { | ||
| 132 | 134 | ||
| 133 | private void uploadImage(InputStream is, String filePath) { | 135 | private void uploadImage(InputStream is, String filePath) { |
| 134 | File file = new File(filePath + File.separator); | 136 | File file = new File(filePath + File.separator); |
| 137 | + log.info("文件路径:{}",file.getPath()); | ||
| 135 | if (!file.exists()) { | 138 | if (!file.exists()) { |
| 136 | if (!file.getParentFile().exists()) { | 139 | if (!file.getParentFile().exists()) { |
| 137 | file.getParentFile().mkdirs(); | 140 | file.getParentFile().mkdirs(); |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| @@ -221,16 +221,26 @@ | @@ -221,16 +221,26 @@ | ||
| 221 | </update> | 221 | </update> |
| 222 | <update id="updateDriverByComputed"> | 222 | <update id="updateDriverByComputed"> |
| 223 | update driver set face_sign_in = 0 | 223 | update driver set face_sign_in = 0 |
| 224 | - WHERE job_code in ( | 224 | + WHERE face_sign_in != 1 and job_code in ( |
| 225 | SELECT job_code | 225 | SELECT job_code |
| 226 | - FROM driver_face_device_id | 226 | + FROM driver_face_device_id,equipment |
| 227 | + WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id | ||
| 228 | + GROUP BY job_code | ||
| 229 | + HAVING COUNT(*) = #{count} | ||
| 230 | + ); | ||
| 231 | + update driver set face_sign_in = 0 | ||
| 232 | + WHERE face_sign_in = 1 and job_code in ( | ||
| 233 | + SELECT job_code | ||
| 234 | + FROM driver_face_device_id,equipment | ||
| 235 | + WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id | ||
| 227 | GROUP BY job_code | 236 | GROUP BY job_code |
| 228 | HAVING COUNT(*) = #{count} | 237 | HAVING COUNT(*) = #{count} |
| 229 | ); | 238 | ); |
| 230 | update driver set face_sign_in = 2 | 239 | update driver set face_sign_in = 2 |
| 231 | - WHERE job_code in ( | 240 | + WHERE face_sign_in != 1 and job_code in ( |
| 232 | SELECT job_code | 241 | SELECT job_code |
| 233 | - FROM driver_face_device_id | 242 | + FROM driver_face_device_id,equipment |
| 243 | + WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id | ||
| 234 | GROUP BY job_code | 244 | GROUP BY job_code |
| 235 | HAVING COUNT(*) != #{count} | 245 | HAVING COUNT(*) != #{count} |
| 236 | ); | 246 | ); |
ruoyi-admin/src/main/resources/mapper/equipment/EquipmentMapper.xml
| @@ -43,16 +43,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -43,16 +43,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 43 | where id = #{id} | 43 | where id = #{id} |
| 44 | </select> | 44 | </select> |
| 45 | <select id="selectEquipmentByDeviceId" resultType="com.ruoyi.equipment.domain.Equipment"> | 45 | <select id="selectEquipmentByDeviceId" resultType="com.ruoyi.equipment.domain.Equipment"> |
| 46 | + <if test="deviceId !=null and deviceId != ''"> | ||
| 46 | <include refid="selectEquipmentVo"></include> | 47 | <include refid="selectEquipmentVo"></include> |
| 47 | where device_id = #{deviceId} | 48 | where device_id = #{deviceId} |
| 49 | + </if> | ||
| 48 | </select> | 50 | </select> |
| 49 | <select id="count" resultType="java.lang.Integer"> | 51 | <select id="count" resultType="java.lang.Integer"> |
| 50 | select count(*) from equipment | 52 | select count(*) from equipment |
| 51 | where status = 1 | 53 | where status = 1 |
| 52 | </select> | 54 | </select> |
| 53 | <select id="querySignListByJobCode" resultType="com.ruoyi.pojo.domain.EquipmentDriverExpand"> | 55 | <select id="querySignListByJobCode" resultType="com.ruoyi.pojo.domain.EquipmentDriverExpand"> |
| 54 | - select * from driver_face_device_id | ||
| 55 | - where 1=1 | 56 | + select driver_face_device_id.* from driver_face_device_id,equipment |
| 57 | + where 1=1 and equipment.status = 1 | ||
| 56 | <if test="drivers != null and drivers.size() > 0"> | 58 | <if test="drivers != null and drivers.size() > 0"> |
| 57 | and job_code in | 59 | and job_code in |
| 58 | <foreach collection="drivers" item="item" open="(" separator="," close=")"> | 60 | <foreach collection="drivers" item="item" open="(" separator="," close=")"> |