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 | 119 | if (result == 0) { |
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | + log.info("图片开始上传"); | |
| 122 | 123 | // 获取图片请求地址 |
| 123 | 124 | String imageUrl = DriverJob.getDownloadImageUrl(token, imageUlr); |
| 124 | 125 | // 获取图片数据 |
| 125 | 126 | InputStream is = HttpUtils.doGet(imageUrl, new HashMap<>()); |
| 126 | 127 | // 上传图片 |
| 127 | 128 | uploadImage(is, filePath); |
| 129 | + log.debug("图片上传完毕"); | |
| 128 | 130 | } |
| 129 | 131 | |
| 130 | 132 | |
| ... | ... | @@ -132,6 +134,7 @@ public class ThreadJobService { |
| 132 | 134 | |
| 133 | 135 | private void uploadImage(InputStream is, String filePath) { |
| 134 | 136 | File file = new File(filePath + File.separator); |
| 137 | + log.info("文件路径:{}",file.getPath()); | |
| 135 | 138 | if (!file.exists()) { |
| 136 | 139 | if (!file.getParentFile().exists()) { |
| 137 | 140 | file.getParentFile().mkdirs(); | ... | ... |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| ... | ... | @@ -221,16 +221,26 @@ |
| 221 | 221 | </update> |
| 222 | 222 | <update id="updateDriverByComputed"> |
| 223 | 223 | update driver set face_sign_in = 0 |
| 224 | - WHERE job_code in ( | |
| 224 | + WHERE face_sign_in != 1 and job_code in ( | |
| 225 | 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 | 236 | GROUP BY job_code |
| 228 | 237 | HAVING COUNT(*) = #{count} |
| 229 | 238 | ); |
| 230 | 239 | update driver set face_sign_in = 2 |
| 231 | - WHERE job_code in ( | |
| 240 | + WHERE face_sign_in != 1 and job_code in ( | |
| 232 | 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 | 244 | GROUP BY job_code |
| 235 | 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 | 43 | where id = #{id} |
| 44 | 44 | </select> |
| 45 | 45 | <select id="selectEquipmentByDeviceId" resultType="com.ruoyi.equipment.domain.Equipment"> |
| 46 | + <if test="deviceId !=null and deviceId != ''"> | |
| 46 | 47 | <include refid="selectEquipmentVo"></include> |
| 47 | 48 | where device_id = #{deviceId} |
| 49 | + </if> | |
| 48 | 50 | </select> |
| 49 | 51 | <select id="count" resultType="java.lang.Integer"> |
| 50 | 52 | select count(*) from equipment |
| 51 | 53 | where status = 1 |
| 52 | 54 | </select> |
| 53 | 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 | 58 | <if test="drivers != null and drivers.size() > 0"> |
| 57 | 59 | and job_code in |
| 58 | 60 | <foreach collection="drivers" item="item" open="(" separator="," close=")"> | ... | ... |