Commit b3b6a9d8bff36cfc180228a47d55caf831d1e2b7
1 parent
c5cf607f
数据字典添加分别字符key
Showing
3 changed files
with
66 additions
and
18 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssEquipmentController.java
| ... | ... | @@ -250,7 +250,10 @@ public class DssEquipmentController extends BaseController { |
| 250 | 250 | equimentAddressParamVo.setInteger(Convert.toInt(sysDictData.getDictValue())); |
| 251 | 251 | } |
| 252 | 252 | } else if (Objects.equals(sysDictData.getDictType(), "resource_base_url") && Objects.nonNull(sysDictData.getDictValue())) { |
| 253 | - configVo.setResourceBashURL(sysDictData.getDictValueStr()); | |
| 253 | + if (StringUtils.equals(sysDictData.getDiscKey(), "resource_base_url")) { | |
| 254 | + configVo.setResourceBashURL(Objects.nonNull(sysDictData.getDictValue()) ? sysDictData.getDictValue().toString() : null); | |
| 255 | + } | |
| 256 | + | |
| 254 | 257 | } |
| 255 | 258 | } |
| 256 | 259 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| 1 | 1 | package com.ruoyi.driver.service.impl; |
| 2 | 2 | |
| 3 | -import java.io.File; | |
| 4 | -import java.io.IOException; | |
| 5 | -import java.io.InputStream; | |
| 6 | -import java.nio.file.Paths; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import java.time.temporal.ChronoUnit; | |
| 9 | -import java.util.*; | |
| 10 | -import java.util.stream.Collectors; | |
| 11 | - | |
| 12 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 13 | 4 | import cn.hutool.http.HttpUtil; |
| 14 | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| ... | ... | @@ -19,6 +10,7 @@ import com.ruoyi.common.cache.SchedulingCache; |
| 19 | 10 | import com.ruoyi.common.cache.TempCache; |
| 20 | 11 | import com.ruoyi.common.config.RuoYiConfig; |
| 21 | 12 | import com.ruoyi.common.core.domain.AjaxResult; |
| 13 | +import com.ruoyi.common.core.domain.entity.SysDictData; | |
| 22 | 14 | import com.ruoyi.common.core.redis.RedisCache; |
| 23 | 15 | import com.ruoyi.common.exception.file.InvalidExtensionException; |
| 24 | 16 | import com.ruoyi.common.global.Result; |
| ... | ... | @@ -27,12 +19,15 @@ import com.ruoyi.common.utils.DateUtils; |
| 27 | 19 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 28 | 20 | import com.ruoyi.common.utils.file.FileUtils; |
| 29 | 21 | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 22 | +import com.ruoyi.domain.DriverScheduling; | |
| 23 | +import com.ruoyi.domain.EquipmentDriverExpand; | |
| 24 | +import com.ruoyi.driver.domain.Driver; | |
| 25 | +import com.ruoyi.driver.mapper.DriverMapper; | |
| 26 | +import com.ruoyi.driver.service.IDriverService; | |
| 30 | 27 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 31 | 28 | import com.ruoyi.framework.config.ServerConfig; |
| 32 | 29 | import com.ruoyi.job.DriverJob; |
| 33 | 30 | import com.ruoyi.pojo.DriverSignInRecommendation; |
| 34 | -import com.ruoyi.domain.EquipmentDriverExpand; | |
| 35 | -import com.ruoyi.domain.DriverScheduling; | |
| 36 | 31 | import com.ruoyi.pojo.request.DriverRequestVo; |
| 37 | 32 | import com.ruoyi.pojo.request.DriverSignInRequestVo; |
| 38 | 33 | import com.ruoyi.pojo.request.FaceUpdateReqVo; |
| ... | ... | @@ -44,9 +39,11 @@ import com.ruoyi.service.RuleAttendanceMainService; |
| 44 | 39 | import com.ruoyi.service.SchedulingService; |
| 45 | 40 | import com.ruoyi.service.ThreadJobService; |
| 46 | 41 | import com.ruoyi.system.domain.SysNotice; |
| 42 | +import com.ruoyi.system.service.ISysDictDataService; | |
| 47 | 43 | import com.ruoyi.system.service.ISysNoticeService; |
| 48 | 44 | import com.ruoyi.utils.ConstDateUtil; |
| 49 | 45 | import com.ruoyi.utils.ListUtils; |
| 46 | +import org.apache.commons.collections4.CollectionUtils; | |
| 50 | 47 | import org.apache.commons.io.FilenameUtils; |
| 51 | 48 | import org.apache.tomcat.util.buf.StringUtils; |
| 52 | 49 | import org.slf4j.Logger; |
| ... | ... | @@ -54,15 +51,20 @@ import org.slf4j.LoggerFactory; |
| 54 | 51 | import org.springframework.beans.factory.annotation.Autowired; |
| 55 | 52 | import org.springframework.beans.factory.annotation.Value; |
| 56 | 53 | import org.springframework.stereotype.Service; |
| 57 | -import com.ruoyi.driver.mapper.DriverMapper; | |
| 58 | -import com.ruoyi.driver.domain.Driver; | |
| 59 | -import com.ruoyi.driver.service.IDriverService; | |
| 60 | 54 | import org.springframework.web.multipart.MultipartFile; |
| 61 | 55 | |
| 62 | 56 | import javax.annotation.Resource; |
| 63 | 57 | import javax.servlet.ServletOutputStream; |
| 64 | 58 | import javax.servlet.http.HttpServletRequest; |
| 65 | 59 | import javax.servlet.http.HttpServletResponse; |
| 60 | +import java.io.File; | |
| 61 | +import java.io.IOException; | |
| 62 | +import java.io.InputStream; | |
| 63 | +import java.nio.file.Paths; | |
| 64 | +import java.time.LocalDateTime; | |
| 65 | +import java.time.temporal.ChronoUnit; | |
| 66 | +import java.util.*; | |
| 67 | +import java.util.stream.Collectors; | |
| 66 | 68 | |
| 67 | 69 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 68 | 70 | import static com.ruoyi.common.ConstDriverProperties.*; |
| ... | ... | @@ -70,8 +72,6 @@ import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| 70 | 72 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 71 | 73 | import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW; |
| 72 | 74 | |
| 73 | -import com.ruoyi.driver.service.IDriverService; | |
| 74 | - | |
| 75 | 75 | /** |
| 76 | 76 | * 驾驶员信息Service业务层处理 |
| 77 | 77 | * |
| ... | ... | @@ -113,6 +113,8 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme |
| 113 | 113 | private ServerConfig serverConfig; |
| 114 | 114 | @Autowired |
| 115 | 115 | private DriverMapper driverMapper; |
| 116 | + @Autowired | |
| 117 | + private ISysDictDataService sysDictDataService; | |
| 116 | 118 | |
| 117 | 119 | @Autowired |
| 118 | 120 | private ThreadJobService threadJobService; |
| ... | ... | @@ -146,12 +148,51 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme |
| 146 | 148 | @Override |
| 147 | 149 | public List<Driver> selectDriverList(DriverRequestVo driver) { |
| 148 | 150 | List<Driver> drivers = driverMapper.selectDriverList(driver); |
| 151 | + | |
| 152 | + SysDictData source = new SysDictData(); | |
| 153 | + source.setDictType("resource_base_url"); | |
| 154 | + List<SysDictData> sysDictDatas = sysDictDataService.queryDictDateList(source); | |
| 155 | + | |
| 156 | + String url1 = ""; | |
| 157 | + String flag1 = null; | |
| 158 | + | |
| 159 | + if (CollectionUtils.isNotEmpty(sysDictDatas)) { | |
| 160 | + for (SysDictData s : sysDictDatas) { | |
| 161 | + if (Objects.equals(s.getDiscKey(), "resource_base_url")) { | |
| 162 | + url1 = s.getDictValueStr(); | |
| 163 | + continue; | |
| 164 | + } | |
| 165 | + | |
| 166 | + if (org.apache.commons.lang3.StringUtils.equals(s.getDiscKey(), "resource_base_url_flag")) { | |
| 167 | + flag1 = s.getDictValueStr(); | |
| 168 | + continue; | |
| 169 | + } | |
| 170 | + } | |
| 171 | + } | |
| 172 | + | |
| 173 | + String url = url1; | |
| 174 | + String flag = flag1; | |
| 175 | + | |
| 149 | 176 | List<EquipmentDriverExpand> list = equipmentMapper.querySignListByJobCode(drivers); |
| 150 | 177 | for (Driver item : drivers) { |
| 151 | 178 | // 查询对应工号的注册设备号 然后用,拼接展示在前端 |
| 152 | 179 | List<String> collect = list.stream().filter(todo -> item.getJobCode().equals(todo.getJobCode())).map(EquipmentDriverExpand::getDeviceId).collect(Collectors.toList()); |
| 153 | 180 | item.setSignInEquipment(StringUtils.join(collect)); |
| 154 | 181 | } |
| 182 | + if (org.apache.commons.lang3.StringUtils.equals("1", flag)) { | |
| 183 | + drivers = drivers.stream().map(d -> { | |
| 184 | + String fil = "/"; | |
| 185 | + | |
| 186 | + if (org.apache.commons.lang3.StringUtils.startsWith(d.getImage(), "/") || org.apache.commons.lang3.StringUtils.startsWith(d.getImage(), "\\")) { | |
| 187 | + fil = ""; | |
| 188 | + } else if (org.apache.commons.lang3.StringUtils.endsWith(url, "/")) { | |
| 189 | + fil = ""; | |
| 190 | + } | |
| 191 | + d.setImage(org.apache.commons.lang3.StringUtils.join(url, fil, d.getImage())); | |
| 192 | + | |
| 193 | + return d; | |
| 194 | + }).collect(Collectors.toList()); | |
| 195 | + } | |
| 155 | 196 | return drivers; |
| 156 | 197 | } |
| 157 | 198 | ... | ... |
Bsth-system/src/main/resources/mapper/system/SysDictDataMapper.xml
| ... | ... | @@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 18 | 18 | <result property="createTime" column="create_time" /> |
| 19 | 19 | <result property="updateBy" column="update_by" /> |
| 20 | 20 | <result property="updateTime" column="update_time" /> |
| 21 | + <result property="discKey" column="disc_key" /> | |
| 21 | 22 | </resultMap> |
| 22 | 23 | |
| 23 | 24 | <sql id="selectDictDataVo"> |
| 24 | - select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark | |
| 25 | + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark,disc_key | |
| 25 | 26 | from sys_dict_data |
| 26 | 27 | </sql> |
| 27 | 28 | |
| ... | ... | @@ -84,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 84 | 85 | <if test="status != null">status = #{status},</if> |
| 85 | 86 | <if test="remark != null">remark = #{remark},</if> |
| 86 | 87 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| 88 | + <if test="discKey != null and discKey != ''">disc_key=#{discKey},</if> | |
| 87 | 89 | update_time = sysdate() |
| 88 | 90 | </set> |
| 89 | 91 | where dict_code = #{dictCode} |
| ... | ... | @@ -105,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 105 | 107 | <if test="status != null">status,</if> |
| 106 | 108 | <if test="remark != null and remark != ''">remark,</if> |
| 107 | 109 | <if test="createBy != null and createBy != ''">create_by,</if> |
| 110 | + <if test="discKey != null and discKey != ''">disc_key,</if> | |
| 108 | 111 | create_time |
| 109 | 112 | )values( |
| 110 | 113 | <if test="dictSort != null">#{dictSort},</if> |
| ... | ... | @@ -117,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 117 | 120 | <if test="status != null">#{status},</if> |
| 118 | 121 | <if test="remark != null and remark != ''">#{remark},</if> |
| 119 | 122 | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| 123 | + <if test="discKey != null and discKey != ''">#{discKey},</if> | |
| 120 | 124 | sysdate() |
| 121 | 125 | ) |
| 122 | 126 | </insert> | ... | ... |