Commit 30c97f431e655436e6200f21ea23693f78db8c90

Authored by liujun001
1 parent fa9ea695

对接文件系统和蓝斯设备日志上传

Bsth-admin/src/main/java/com/ruoyi/config/BsthSystemConfig.java
1 1 package com.ruoyi.config;
2 2  
3   -import com.ruoyi.common.config.RuoYiConfig;
  3 +import com.ruoyi.system.service.ISysDictDataService;
  4 +import com.ruoyi.utils.SpringApplicationUtil;
4 5 import lombok.Data;
5 6 import org.apache.commons.lang3.ArrayUtils;
6   -import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.beans.factory.annotation.Value;
8 8 import org.springframework.stereotype.Component;
9 9  
... ... @@ -30,22 +30,25 @@ public class BsthSystemConfig {
30 30 @Value("${api.url.getDriverInfo}")
31 31 private String getDriverInfoURL;
32 32  
33   - @Autowired
34   - private RuoYiConfig ruoYiConfig;
  33 +// @Autowired
  34 +// private RuoYiConfig ruoYiConfig;
35 35  
36 36 @Value("${bsth.face.faceFeature.url}")
37 37 private String faceFeatureURL;
38 38  
39   - public String getImageBasePath(){
40   - return combationChar(ruoYiConfig.getUploadPath(),imageBasePath1);
  39 + public String getImageBasePath() {
  40 + ISysDictDataService service = SpringApplicationUtil.getBean(ISysDictDataService.class);
  41 + return service.combationValue("");
  42 +// return combationChar(ruoYiConfig.getUploadPath(),imageBasePath1);
41 43 }
42 44  
43 45  
44   - public String getVideoBasePath(){
45   - return combationChar(ruoYiConfig.getUploadPath(),videoBasePath1);
  46 + public String getVideoBasePath() {
  47 + ISysDictDataService service = SpringApplicationUtil.getBean(ISysDictDataService.class);
  48 + return service.combationValue("");
46 49 }
47 50  
48   - public static String combationChar(String...strs){
  51 + public static String combationChar(String... strs) {
49 52 StringBuilder builder = new StringBuilder();
50 53 int length = ArrayUtils.getLength(strs);
51 54 for (int i = 0; i < length; i++) {
... ...
Bsth-admin/src/main/java/com/ruoyi/config/FaceEngineConfig.java
... ... @@ -31,10 +31,8 @@ public class FaceEngineConfig {
31 31  
32 32 @Bean
33 33 public FaceEngine createFaceEngine(BsthSystemConfig bsthSystemConfig) {
34   - if(isDev()){
35   - return null;
36   - }
37 34 FaceEngine faceEngine = new FaceEngine(bsthSystemConfig.getFaceLibPath());
  35 +
38 36 // FaceEngine faceEngine = new FaceEngine("D:\\\\arcsoft_lib");
39 37 //激活引擎
40 38 int errorCode = faceEngine.activeOnline(bsthSystemConfig.getFaceAppId(), bsthSystemConfig.getFaceSdkKey());
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/RefreshController.java
1 1 package com.ruoyi.controller;
2 2  
3 3 import com.alibaba.fastjson2.JSON;
  4 +import com.alibaba.fastjson2.JSONObject;
  5 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 6 import com.ruoyi.common.core.domain.ResponseResult;
5 7 import com.ruoyi.common.utils.sign.Base64;
6 8 import com.ruoyi.controller.dss.DssFaceController;
... ... @@ -8,6 +10,7 @@ import com.ruoyi.domain.driver.NewDriver;
8 10 import com.ruoyi.domain.driver.dss.syn.res.dto.FaceRegisterDTO;
9 11 import com.ruoyi.domain.dss.app.vo.SignReportGroupByVo;
10 12 import com.ruoyi.domain.scheduling.LinggangScheduling;
  13 +import com.ruoyi.domain.sign.in.resource.LinggangSignInResource;
11 14 import com.ruoyi.domain.sign.in.summary.SignReportDaySummary;
12 15 import com.ruoyi.equipment.domain.Equipment;
13 16 import com.ruoyi.equipment.service.IEquipmentService;
... ... @@ -17,12 +20,15 @@ import com.ruoyi.service.SignReportServer;
17 20 import com.ruoyi.service.driver.NewDriverService;
18 21 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
19 22 import com.ruoyi.service.scheduling.LinggangSchedulingService;
  23 +import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService;
20 24 import com.ruoyi.service.sign.in.summary.SignReportDaySummaryService;
21 25 import com.ruoyi.utils.DateUtil;
  26 +import com.ruoyi.utils.HttpClientUtil;
22 27 import io.swagger.annotations.ApiOperation;
23 28 import lombok.extern.slf4j.Slf4j;
24 29 import org.apache.commons.collections4.CollectionUtils;
25 30 import org.apache.commons.io.FileUtils;
  31 +import org.apache.commons.io.IOUtils;
26 32 import org.apache.commons.lang3.ArrayUtils;
27 33 import org.apache.commons.lang3.StringUtils;
28 34 import org.apache.commons.lang3.time.DateUtils;
... ... @@ -31,8 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
31 37 import org.springframework.security.access.prepost.PreAuthorize;
32 38 import org.springframework.web.bind.annotation.*;
33 39  
34   -import java.io.File;
35   -import java.io.IOException;
  40 +import java.io.*;
36 41 import java.text.ParseException;
37 42 import java.util.*;
38 43 import java.util.stream.Collectors;
... ... @@ -63,6 +68,10 @@ public class RefreshController {
63 68 private SignReportServer signReportServer;
64 69 @Autowired
65 70 private SignReportSummerJob signReportSummerJob;
  71 + @Autowired
  72 + private HttpClientUtil httpClientUtil;
  73 + @Autowired
  74 + private LinggangSignInResourceService signInResourceService;
66 75  
67 76  
68 77 @GetMapping(value = "/scheduling")
... ... @@ -292,7 +301,7 @@ public class RefreshController {
292 301 boolean flag = false;
293 302 while (true) {
294 303 index++;
295   - Date startDate1 = DateUtils.addMonths(startDate,index);
  304 + Date startDate1 = DateUtils.addMonths(startDate, index);
296 305 dateStr = DateUtil.YYYY_MM_LINK.format(startDate1);
297 306 List<SignReportGroupByVo> signReportGroupByVos = signReportServer.querySignReportGroupByDateStrVo(dateStr);
298 307  
... ... @@ -302,7 +311,7 @@ public class RefreshController {
302 311 if (DateUtils.isSameDay(now, date)) {
303 312 flag = true;
304 313 break;
305   - }else if(date.getTime()>=now.getTime()){
  314 + } else if (date.getTime() >= now.getTime()) {
306 315 flag = true;
307 316 break;
308 317 }
... ... @@ -342,4 +351,159 @@ public class RefreshController {
342 351 return ResponseResult.success();
343 352 }
344 353  
  354 + @GetMapping("/init/driver/data")
  355 + public ResponseResult<Boolean> initDriverData() {
  356 + LambdaQueryWrapper<NewDriver> ndWrapper = new LambdaQueryWrapper<>();
  357 + ndWrapper.isNotNull(NewDriver::getFaceFeature);
  358 +
  359 + List<NewDriver> drivers = newDriverService.list(ndWrapper);
  360 + if (CollectionUtils.isEmpty(drivers)) {
  361 + return ResponseResult.success(Boolean.TRUE);
  362 + }
  363 +
  364 + String basePath = "C:\\Users\\密码:0000\\Desktop\\fsdownload\\uploadPath\\upload\\image\\";
  365 + String basePath1 = "C:\\Users\\密码:0000\\Desktop\\fsdownload\\uploadPath\\upload\\image\\";
  366 + String token = getToken();
  367 + Map<String, Object> headMap = new HashMap<>();
  368 + headMap.put("Content-Type", "application/json");
  369 + headMap.put("Authorization", token);
  370 +
  371 + for (NewDriver driver : drivers) {
  372 + StringBuilder path = new StringBuilder();
  373 + path.append(basePath);
  374 + path.append(driver.getImage());
  375 +
  376 +
  377 + InputStream inputStream = null;
  378 + try {
  379 + File file = new File(path.toString());
  380 + inputStream = new FileInputStream(file);
  381 + String content = cn.hutool.core.codec.Base64.encode(inputStream);
  382 + Map<String, Object> pms = new HashMap<>();
  383 + pms.put("device", "10001");
  384 + pms.put("regTime", DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.format(new Date()));
  385 + pms.put("staffCode", driver.getJobCode());
  386 + pms.put("faceValue", content);
  387 +
  388 + String json = httpClientUtil.doPost("http://10.10.150.173:8102/dss/Face/FaceRegister", pms, headMap);
  389 + log.info("[{}],[{}]", json, JSON.toJSONString(pms));
  390 + } catch (Exception e) {
  391 + log.error("读取图片异常", e);
  392 + } finally {
  393 + IOUtils.closeQuietly(inputStream);
  394 + }
  395 + }
  396 + return ResponseResult.success(Boolean.TRUE);
  397 + }
  398 +
  399 + @GetMapping("/init/driver/sign/resource/{dateStr}")
  400 + public ResponseResult<Boolean> initDriverSignResource(@PathVariable String dateStr) {
  401 + LambdaQueryWrapper<LinggangSignInResource> wrapper = new LambdaQueryWrapper<>();
  402 + wrapper.ge(LinggangSignInResource::getTime, dateStr);
  403 +
  404 + List<LinggangSignInResource> sources = signInResourceService.list(wrapper);
  405 + if (CollectionUtils.isEmpty(sources)) {
  406 + return ResponseResult.success(Boolean.TRUE);
  407 + }
  408 +
  409 + String token = getToken();
  410 + String basePath = "C:\\Users\\密码:0000\\Desktop\\fsdownload\\uploadPath\\upload\\image\\";
  411 + for (LinggangSignInResource source : sources) {
  412 + if (Objects.equals(source.getResourceType(), 2)) {
  413 + uploadSignResource2(source, token, basePath);
  414 + } else {
  415 + uploadSignResource(source, token, basePath);
  416 + }
  417 + }
  418 +
  419 +
  420 + return ResponseResult.success(Boolean.TRUE);
  421 + }
  422 +
  423 + private String uploadSignResource(LinggangSignInResource source, String token, String basePath) {
  424 + Map<String, Object> headMap = new HashMap<>();
  425 + headMap.put("Content-Type", "application/json");
  426 + headMap.put("Authorization", token);
  427 +
  428 +
  429 + Map<String, Object> pms = new HashMap<>();
  430 + pms.put("device", "10001");
  431 + pms.put("driverCode", "10001");
  432 + pms.put("testId", source.getSignId());
  433 + pms.put("time", DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.format(source.getTime()));
  434 +
  435 + List<Map<String, Object>> lists = new ArrayList<>();
  436 + Map<String, Object> pms1 = new HashMap<>();
  437 + pms1.put("index", source.getIndex1());
  438 + pms1.put("time", DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.format(source.getTime()));
  439 +
  440 + InputStream inputStream = null;
  441 + try {
  442 + StringBuilder path = new StringBuilder();
  443 + path.append(basePath);
  444 + path.append(source.getPath());
  445 +
  446 + inputStream = new FileInputStream(new File(path.toString()));
  447 + String content = cn.hutool.core.codec.Base64.encode(inputStream);
  448 + pms1.put("pic", content);
  449 +
  450 + lists.add(pms1);
  451 + pms.put("picData", lists);
  452 +
  453 + String json = httpClientUtil.doPost("http://10.10.150.173:8102/dss/Driver/UpLoadPicture", pms, headMap);
  454 + log.info("[{}],[{}]", json, JSON.toJSONString(pms));
  455 + return json;
  456 + } catch (Exception e) {
  457 + log.error("读取图片异常", e);
  458 + } finally {
  459 + IOUtils.closeQuietly(inputStream);
  460 + }
  461 + return null;
  462 + }
  463 +
  464 + private String uploadSignResource2(LinggangSignInResource source, String token, String basePath) {
  465 + Map<String, Object> headMap = new HashMap<>();
  466 + headMap.put("Content-Type", "application/json");
  467 + headMap.put("Authorization", token);
  468 +
  469 +
  470 + Map<String, Object> pms = new HashMap<>();
  471 + pms.put("device", "10001");
  472 + pms.put("driverCode", "10001");
  473 + pms.put("testId", source.getSignId());
  474 + pms.put("time", DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.format(source.getTime()));
  475 +
  476 +
  477 + InputStream inputStream = null;
  478 + try {
  479 + StringBuilder path = new StringBuilder();
  480 + path.append(basePath);
  481 + path.append(source.getPath());
  482 +
  483 + inputStream = new FileInputStream(new File(path.toString()));
  484 + String content = cn.hutool.core.codec.Base64.encode(inputStream);
  485 + pms.put("video", content);
  486 +
  487 + String json = httpClientUtil.doPost("http://10.10.150.173:8102/dss/Driver/UpLoadVideo", pms, headMap);
  488 + log.info("[{}],[{}]", json, JSON.toJSONString(pms));
  489 + return json;
  490 + } catch (Exception e) {
  491 + log.error("读取图片异常", e);
  492 + } finally {
  493 + IOUtils.closeQuietly(inputStream);
  494 + }
  495 + return null;
  496 + }
  497 +
  498 +
  499 + private String getToken() {
  500 + Map<String, Object> pms = new HashMap<>();
  501 + pms.put("authTime", DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.format(new Date()));
  502 + pms.put("device", "10001");
  503 +
  504 + String json = httpClientUtil.doPost("http://10.10.150.173:8102/dss/Driver/Auth", pms, null);
  505 + JSONObject jsonObject = JSON.parseObject(json);
  506 + JSONObject jsonObject1 = jsonObject.getJSONObject("data");
  507 + return jsonObject1.getString("access_token");
  508 + }
345 509 }
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssFaceController.java
... ... @@ -264,7 +264,7 @@ public class DssFaceController extends BaseController {
264 264  
265 265 private FaceCheckVo convertFaceCheckVo(NewDriver driver) {
266 266 FaceCheckVo faceCheckVo = new FaceCheckVo();
267   - faceCheckVo.setDriverCode(driver.getIcRfid());
  267 + faceCheckVo.setDriverCode(driver.getJobCode());
268 268  
269 269 return faceCheckVo;
270 270 }
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/venue/info/LinggangVenueInfoController.java
... ... @@ -56,7 +56,17 @@ public class LinggangVenueInfoController extends BaseController {
56 56 public com.ruoyi.common.core.domain.ResponseResult<List<LinggangVenueInfoVO>> listSelect(LinggangVenueInfoQueryDTO request) {
57 57 LinggangVenueInfo entity = convert(request);
58 58 List<LinggangVenueInfo> selectList = linggangVenueInfoService.listOfSelect(entity);
59   - return com.ruoyi.common.core.domain.ResponseResult.success(convert(selectList));
  59 +
  60 + return com.ruoyi.common.core.domain.ResponseResult.success(
  61 + java.util.Optional.ofNullable(selectList).map(scs -> {
  62 + return scs.stream().map(source -> {
  63 + LinggangVenueInfoVO target = new LinggangVenueInfoVO();
  64 + BeanUtils.copyProperties(source, target);
  65 + target.setName(target.getName() + "-" + target.getParkCode());
  66 + return target;
  67 + }).collect(java.util.stream.Collectors.toList());
  68 + }).orElseGet(null)
  69 + );
60 70 }
61 71  
62 72 @PreAuthorize("@ss.hasPermi('linggang:venue:info:export')")
... ...
Bsth-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
... ... @@ -18,7 +18,6 @@ import com.ruoyi.system.service.ISysDictDataService;
18 18 import io.swagger.annotations.Api;
19 19 import io.swagger.annotations.ApiOperation;
20 20 import io.swagger.annotations.ApiParam;
21   -import org.apache.commons.lang3.StringUtils;
22 21 import org.springframework.beans.factory.annotation.Autowired;
23 22 import org.springframework.validation.annotation.Validated;
24 23 import org.springframework.web.bind.annotation.*;
... ... @@ -156,9 +155,7 @@ public class DriverController extends BaseController {
156 155 @PutMapping("/edit")
157 156 @ApiOperation("修改驾驶员信息")
158 157 public AjaxResult edit(@ApiParam("driver") @RequestBody Driver driver) {
159   - if (StringUtils.isNotEmpty(driver.getImage())) {
160   - driver.setImage(sysDictDataService.splitURL(driver.getImage()));
161   - }
  158 +
162 159 return toAjax(driverService.updateDriver(driver) + 1);
163 160 }
164 161  
... ...
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
... ... @@ -51,7 +51,6 @@ import com.ruoyi.utils.ListUtils;
51 51 import com.ruoyi.utils.SpringApplicationUtil;
52 52 import org.apache.commons.collections4.CollectionUtils;
53 53 import org.apache.commons.io.FilenameUtils;
54   -import org.apache.commons.io.IOUtils;
55 54 import org.apache.commons.lang3.RandomUtils;
56 55 import org.apache.commons.lang3.StringUtils;
57 56 import org.slf4j.Logger;
... ... @@ -60,17 +59,14 @@ import org.springframework.beans.factory.annotation.Autowired;
60 59 import org.springframework.beans.factory.annotation.Value;
61 60 import org.springframework.stereotype.Service;
62 61 import org.springframework.web.multipart.MultipartFile;
63   -import sun.misc.BASE64Encoder;
64 62  
65 63 import javax.annotation.Resource;
66 64 import javax.servlet.ServletOutputStream;
67 65 import javax.servlet.http.HttpServletRequest;
68 66 import javax.servlet.http.HttpServletResponse;
69 67 import java.io.File;
70   -import java.io.FileInputStream;
71 68 import java.io.IOException;
72 69 import java.io.InputStream;
73   -import java.nio.file.Paths;
74 70 import java.time.LocalDateTime;
75 71 import java.time.temporal.ChronoUnit;
76 72 import java.util.*;
... ... @@ -313,7 +309,7 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
313 309 driver.setImageVersion(imageVersion.toString());
314 310 log.info("[{}]", JSON.toJSONString(driver));
315 311 }
316   -
  312 + driver.setImage(sysDictDataService.splitURL(driver.getImage()));
317 313 }
318 314  
319 315 return driverMapper.updateDriver(driver);
... ... @@ -398,14 +394,11 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
398 394 }
399 395  
400 396 @Override
401   - public AjaxResult uploadImage(MultipartFile file, Integer id) throws InvalidExtensionException, IOException {
402   - // 上传并返回新文件名称
403   - // 上传文件路径
404   - String baseUrl = RuoYiConfig.getUploadPath() + headImagePre;
  397 + public AjaxResult uploadImage(MultipartFile file, Integer id) throws InvalidExtensionException {
405 398 // 校验文件格式
406 399 FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
407 400 // 后期可以通过请求头拿到对应的工号
408   - String fileName = FilenameUtils.getBaseName(file.getOriginalFilename()) + "." + FileUploadUtils.getExtension(file);
  401 + String fileName = FilenameUtils.getBaseName(file.getOriginalFilename()) +"_"+UUID.randomUUID().toString().replaceAll("-","")+ "." + FileUploadUtils.getExtension(file);
409 402 if (Objects.nonNull(id)) {
410 403 fileName = StringUtils.join(id, "/", fileName);
411 404 } else {
... ... @@ -823,14 +816,10 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
823 816 }
824 817  
825 818 private String calimageContentFaceFeature(String imagePath) {
826   - String baseUrl = RuoYiConfig.getUploadPath() + headImagePre;
827   - try {
828   - String path = FileUploadUtils.getAbsoluteFile(baseUrl, imagePath).getAbsolutePath();
829   - ResponseResult<String> responseResult = SpringApplicationUtil.getBean(FaceService.class).getFaceFeatureImagePath(path);
830   - return Objects.nonNull(responseResult) && responseResult.isSuccess() ? responseResult.getData() : null;
831   - } catch (IOException e) {
832   - throw new RuntimeException(e);
833   - }
  819 + String baseUrl = sysDictDataService.combationValue(imagePath);
  820 + ResponseResult<String> result = SpringApplicationUtil.getBean(FaceService.class).getFaceFeatureImageURL(baseUrl);
  821 + return Objects.isNull(result) ? null : result.isSuccess() ? result.getData() : null;
  822 +
834 823 }
835 824  
836 825  
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/venue/info/LinggangVenueInfoMapper.java
1 1 package com.ruoyi.mapper.venue.info;
2 2  
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.ruoyi.domain.DriverScheduling;
4 5 import com.ruoyi.domain.venue.info.LinggangVenueInfo;
5 6 import org.apache.ibatis.annotations.Mapper;
6 7  
  8 +import java.util.List;
  9 +
7 10  
8 11 @Mapper
9 12 /**场地Info Mapper接口*/
... ... @@ -11,5 +14,7 @@ public interface LinggangVenueInfoMapper extends BaseMapper&lt;LinggangVenueInfo&gt; {
11 14 /**
12 15 * 插入有值的列
13 16 */
14   - int insertSelective(LinggangVenueInfo name);
  17 + int insertSelective(LinggangVenueInfo entity);
  18 +
  19 + boolean insertNotExit(LinggangVenueInfo entity);
15 20 }
16 21 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -40,6 +40,7 @@ import com.ruoyi.service.driver.NewDriverService;
40 40 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
41 41 import com.ruoyi.service.scheduling.LinggangSchedulingService;
42 42 import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService;
  43 +import com.ruoyi.service.venue.info.LinggangVenueInfoService;
43 44 import com.ruoyi.system.domain.SysNotice;
44 45 import com.ruoyi.system.service.ISysNoticeService;
45 46 import com.ruoyi.utils.ConstDateUtil;
... ... @@ -139,6 +140,8 @@ public class ThreadJobService {
139 140 private NewDriverService newDriverService;
140 141 @Autowired
141 142 private LingangCarInfoService lingangCarInfoService;
  143 + @Autowired
  144 + private LinggangVenueInfoService venueInfoService;
142 145  
143 146 @Value("${bsth.process.sign.url}")
144 147 private String processSignExceptionURL;
... ... @@ -342,8 +345,6 @@ public class ThreadJobService {
342 345 List<NewDriver> newDrivers = null;
343 346 if (CollectionUtils.isNotEmpty(linggangSchedulings)) {
344 347 qdznames = linggangSchedulings.stream().map(LinggangScheduling::getQdzname).filter(org.apache.commons.lang3.StringUtils::isNotEmpty).collect(Collectors.toSet());
345   - qdznames.add("鸿音路临时停车点");
346   -
347 348 newDrivers = newDriverService.listByQdzName(qdznames);
348 349 }
349 350  
... ... @@ -373,7 +374,7 @@ public class ThreadJobService {
373 374 map.put("noticeIssuer", "运控中心");
374 375 map.put("noticeRecipient", "05-" + newDriver.getJobCode());
375 376 map.put("noticeTitle", "异常通知");
376   - map.put("noticeSubtitle", "");
  377 +// map.put("noticeSubtitle", "");
377 378  
378 379 StringBuilder builder = new StringBuilder();
379 380 builder
... ... @@ -387,13 +388,6 @@ public class ThreadJobService {
387 388 map.put("phone", newDriver.getTelphone());
388 389 map.put("smscontent", builder.toString());
389 390 map.put("noticeType", "岗前检查");
390   - map.put("remark", "schedulingId=" + item.getId() + "&signId=" + signIn.getId());
391   - map.put("signId", signIn.getId());
392   - map.put("associatedId", item.getId());
393   -
394   - Map<String, Object> paramMap = new HashMap<>();
395   - paramMap.put("schedulingId", item.getId());
396   - map.put("params", paramMap);
397 391  
398 392 String key = SignatureUtils.generateSignature(map, "your_secret_key_here");
399 393 map.put("signature", key);
... ... @@ -411,6 +405,28 @@ public class ThreadJobService {
411 405 }
412 406 }
413 407  
  408 + public static void main(String[] args) {
  409 + Map<String, Object> map = new HashMap<>();
  410 + map.put("noticeIssuer", "运控中心");
  411 + map.put("noticeRecipient", "05-006154");
  412 + map.put("noticeTitle", "异常通知");
  413 +
  414 +
  415 + map.put("noticeContent", "工号:1700003,姓名:测试,工种:驾驶员,排班:有排班,打卡时间:2025-01-07 03:29:20,酒精测试超标,当前测试值达到50mg/100ml。属于饮酒后驾驶机动车");
  416 + map.put("phone", "13681905733");
  417 + map.put("smscontent", "工号:1700003,姓名:测试,工种:驾驶员,排班:有排班,打卡时间:2025-01-07 03:29:20,酒精测试超标,当前测试值达到50mg/100ml。属于饮酒后驾驶机动车");
  418 + map.put("noticeType", "岗前检查");
  419 +
  420 + String key = SignatureUtils.generateSignature(map, "your_secret_key_here");
  421 + System.out.println(key);
  422 + }
  423 +
  424 + private static String[] comStrs(String str) {
  425 + String[] values = new String[1];
  426 + values[0] = str;
  427 + return values;
  428 + }
  429 +
414 430 private String getResultString(BigDecimal alcoholIntake) {
415 431 if (alcoholIntake.compareTo(new BigDecimal(20)) >= 0 && alcoholIntake.compareTo(new BigDecimal(80)) < 0) {
416 432 return "饮酒后驾驶机动车";
... ... @@ -628,7 +644,7 @@ public class ThreadJobService {
628 644 TempCache.resetMapStatus();
629 645 }
630 646 List<DriverScheduling> bcList = getBcList(originSchedulingMap, type);
631   -
  647 + insertThread(bcList);
632 648 lingangCarInfoService.insert(bcList);
633 649  
634 650 // 处理非司售人员的排班明细
... ... @@ -1160,5 +1176,17 @@ public class ThreadJobService {
1160 1176 return recoveryList;
1161 1177 }
1162 1178  
  1179 + private void insertThread(List<DriverScheduling> entities) {
  1180 + String userId = JwtAuthenticationTokenFilter.getRequestIdOfMDCValue();
  1181 + String traceId = JwtAuthenticationTokenFilter.getRequestIdOfMDCValue();
  1182 + new Thread(new Runnable() {
  1183 + @Override
  1184 + public void run() {
  1185 + JwtAuthenticationTokenFilter.putMDC(userId, traceId + "_002");
  1186 + venueInfoService.insertNotExit(entities);
  1187 + }
  1188 + }).start();
  1189 + }
  1190 +
1163 1191  
1164 1192 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/dss/FaceService.java
... ... @@ -23,5 +23,6 @@ public interface FaceService {
23 23  
24 24 ResponseResult<String> getFaceFeatureImageContent(String content);
25 25 ResponseResult<String> getFaceFeatureImagePath(String path);
  26 + ResponseResult<String> getFaceFeatureImageURL(String url);
26 27  
27 28 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/dss/FaceServiceImpl.java
1 1 package com.ruoyi.service.impl.dss;
2 2  
3 3 import cn.hutool.core.convert.Convert;
  4 +import cn.hutool.http.HttpUtil;
4 5 import com.alibaba.fastjson2.JSON;
5 6 import com.arcsoft.face.FaceEngine;
6 7 import com.arcsoft.face.FaceFeature;
... ... @@ -9,6 +10,7 @@ import com.arcsoft.face.FaceSimilar;
9 10 import com.arcsoft.face.enums.ErrorInfo;
10 11 import com.arcsoft.face.toolkit.ImageFactory;
11 12 import com.arcsoft.face.toolkit.ImageInfo;
  13 +import com.ruoyi.common.config.RuoYiConfig;
12 14 import com.ruoyi.common.core.domain.ResponseResult;
13 15 import com.ruoyi.common.utils.file.FileUploadUtils;
14 16 import com.ruoyi.common.utils.sign.Base64;
... ... @@ -16,15 +18,16 @@ import com.ruoyi.config.BsthSystemConfig;
16 18 import com.ruoyi.domain.driver.NewDriver;
17 19 import com.ruoyi.service.driver.NewDriverService;
18 20 import com.ruoyi.service.dss.FaceService;
  21 +import com.ruoyi.system.service.ISysDictDataService;
19 22 import com.ruoyi.utils.HttpClientUtil;
20 23 import com.ruoyi.utils.SpringApplicationUtil;
21 24 import lombok.extern.slf4j.Slf4j;
22 25 import org.apache.commons.collections4.CollectionUtils;
  26 +import org.apache.commons.io.FileUtils;
23 27 import org.apache.commons.io.IOUtils;
24 28 import org.apache.commons.lang3.StringUtils;
25 29 import org.springframework.beans.factory.annotation.Autowired;
26 30 import org.springframework.stereotype.Service;
27   -import sun.misc.BASE64Encoder;
28 31  
29 32 import javax.imageio.ImageIO;
30 33 import java.awt.image.BufferedImage;
... ... @@ -47,6 +50,10 @@ public class FaceServiceImpl implements FaceService {
47 50 private BsthSystemConfig bsthSystemConfig;
48 51 @Autowired
49 52 private HttpClientUtil httpClientUtil;
  53 + @Autowired
  54 + private ISysDictDataService sysDictDataService;
  55 + @Autowired
  56 + private RuoYiConfig ruoYiConfig;
50 57  
51 58  
52 59 @Override
... ... @@ -82,7 +89,7 @@ public class FaceServiceImpl implements FaceService {
82 89  
83 90 json = httpClientUtil.doPost(bsthSystemConfig.getFaceFeatureURL(), parentMap, null);
84 91 if (StringUtils.isEmpty(json)) {
85   - log.warn("获取面部特征失败,请检查数据:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
  92 + log.warn("获取面部特征失败,请检查数据:[{}],[{}],[{}]", json, bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
86 93 return ResponseResult.error("获取面部特征失败,请稍后再试");
87 94 }
88 95 json = StringUtils.substringAfter(json, "{");
... ... @@ -98,15 +105,15 @@ public class FaceServiceImpl implements FaceService {
98 105  
99 106  
100 107 if (!StringUtils.equalsIgnoreCase(resultMap.get("result"), "ok")) {
101   - log.warn("获取面部特征不成功,,请检查数据:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
  108 + log.warn("获取面部特征不成功,,请检查数据:[{}],[{}],[{}]", json, bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
102 109 return ResponseResult.error("获取面部特征失败,请稍后再试");
103 110 }
104 111 String faceFeature = Convert.toStr(resultMap.get("strlitefeature"));
105   - ResponseResult<String> responseResult =ResponseResult.success();
  112 + ResponseResult<String> responseResult = ResponseResult.success();
106 113 responseResult.setData(faceFeature);
107 114 return responseResult;
108 115 } catch (Exception e) {
109   - log.error("获取面部特征异常,返回的结果是:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap), e);
  116 + log.error("获取面部特征异常,返回的结果是:[{}],[{}],[{}]", json, bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap), e);
110 117 return ResponseResult.error("获取面部特征异常,请稍后再试");
111 118 }
112 119 }
... ... @@ -117,6 +124,27 @@ public class FaceServiceImpl implements FaceService {
117 124 return getFaceFeatureImageContent(content);
118 125 }
119 126  
  127 + @Override
  128 + public ResponseResult<String> getFaceFeatureImageURL(String urlString) {
  129 + String path = null;
  130 + try {
  131 +// String fileName = sysDictDataService.splitURL(urlString);
  132 +// path = RuoYiConfig.getDownloadPath() + fileName+"/";
  133 + byte[] bytes = HttpUtil.downloadBytes(urlString);
  134 + String content = convertBase64(bytes);
  135 + return getFaceFeatureImageContent(content);
  136 + } finally {
  137 +// if(StringUtils.isNotEmpty(path)) {
  138 +// File file = new File()
  139 +// }
  140 + }
  141 + }
  142 +
  143 + public static void main(String[] args) {
  144 + FaceServiceImpl faceService = new FaceServiceImpl();
  145 + faceService.getFaceFeatureImageURL("http://192.168.168.167:9000/alchohol/head/76408/driver.png");
  146 + }
  147 +
120 148 private NewDriver checkFace(List<NewDriver> drivers, NewDriver sourceDriver) {
121 149 if (CollectionUtils.isEmpty(drivers)) {
122 150 return null;
... ... @@ -173,14 +201,28 @@ public class FaceServiceImpl implements FaceService {
173 201 return -1;
174 202 }
175 203 StringBuilder builder = new StringBuilder();
176   - builder.append(bsthSystemConfig.getImageBasePath());
177   - builder.append("/");
  204 + builder.append(RuoYiConfig.getDownloadPath1());
  205 + if (!StringUtils.startsWith(dr.getImage(), "/")) {
  206 + dr.setImage("/"+dr.getImage()) ;
  207 + }
  208 + if(!StringUtils.startsWith(dr.getImage(),"/head")){
  209 + dr.setImage("/head"+dr.getImage()) ;
  210 + }
178 211 builder.append(dr.getImage());
179 212  
180 213 File targetFile = new File(builder.toString());
181 214 if (!targetFile.exists() || !targetFile.isFile()) {
182   - log.error("没有比对的图片;[{}]", dr);
183   - return -1;
  215 + String url = sysDictDataService.combationValue(dr.getImage());
  216 + try {
  217 + FileUtils.forceMkdirParent(targetFile);
  218 + HttpUtil.downloadFileFromUrl(url, targetFile);
  219 + } catch (Exception e) {
  220 + log.error("[{}] error", url, e);
  221 + }
  222 +
  223 + if (!targetFile.isFile()) {
  224 + return -1;
  225 + }
184 226 }
185 227  
186 228 ImageInfo target = getRGBData(targetFile);
... ... @@ -243,7 +285,7 @@ public class FaceServiceImpl implements FaceService {
243 285  
244 286 private String convertBase64(byte[] data) {
245 287 // 对字节数组进行Base64编码,得到Base64编码的字符串
246   - return Base64.encode(data);
  288 + return Base64.encode(data);
247 289 }
248 290  
249 291 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/venue/info/LinggangVenueInfoServiceImpl.java
... ... @@ -5,17 +5,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7 import com.github.pagehelper.PageHelper;
  8 +import com.ruoyi.domain.DriverScheduling;
8 9 import com.ruoyi.domain.OrderEntity;
9 10 import com.ruoyi.domain.venue.info.LinggangVenueInfo;
10 11 import com.ruoyi.mapper.venue.info.LinggangVenueInfoMapper;
11 12 import com.ruoyi.service.venue.info.LinggangVenueInfoService;
12 13 import lombok.extern.slf4j.Slf4j;
  14 +import org.apache.commons.collections4.CollectionUtils;
  15 +import org.apache.commons.lang3.StringUtils;
13 16 import org.springframework.beans.factory.annotation.Autowired;
14 17 import org.springframework.stereotype.Service;
  18 +import org.springframework.transaction.annotation.Transactional;
15 19  
16   -import java.util.Collection;
17   -import java.util.Collections;
18   -import java.util.List;
  20 +import java.util.*;
19 21  
20 22 @Slf4j
21 23 @Service
... ... @@ -59,7 +61,8 @@ public class LinggangVenueInfoServiceImpl extends ServiceImpl&lt;LinggangVenueInfoM
59 61 @Override
60 62 public List<LinggangVenueInfo> listOfSelect(LinggangVenueInfo entity) {
61 63 LambdaQueryWrapper<LinggangVenueInfo> wrapper = new LambdaQueryWrapper<>(entity);
62   - wrapper.select(LinggangVenueInfo::getId, LinggangVenueInfo::getName);
  64 + wrapper.select(LinggangVenueInfo::getId, LinggangVenueInfo::getName, LinggangVenueInfo::getParkCode);
  65 + wrapper.orderByAsc(LinggangVenueInfo::getName);
63 66 return list(wrapper);
64 67 }
65 68  
... ... @@ -120,6 +123,36 @@ public class LinggangVenueInfoServiceImpl extends ServiceImpl&lt;LinggangVenueInfoM
120 123 return save(entity);
121 124 }
122 125  
  126 + @Override
  127 + public boolean insertNotExit(List<DriverScheduling> entities) {
  128 + if (CollectionUtils.isEmpty(entities)) {
  129 + return Boolean.TRUE;
  130 + }
  131 +
  132 + Set<LinggangVenueInfo> venueInfos = new HashSet<>();
  133 + entities.stream().forEach(entity -> {
  134 + LinggangVenueInfo venueInfo = new LinggangVenueInfo();
  135 + venueInfo.setParkCode(entity.getQdzCode());
  136 + venueInfo.setName(entity.getQdzName());
  137 + venueInfo.setDelFlag(Boolean.FALSE);
  138 + venueInfos.add(venueInfo);
  139 +
  140 + venueInfo = new LinggangVenueInfo();
  141 + venueInfo.setParkCode(entity.getZdzCode());
  142 + venueInfo.setName(entity.getZdzName());
  143 + venueInfo.setDelFlag(Boolean.FALSE);
  144 + venueInfos.add(venueInfo);
  145 + });
  146 +
  147 + for (LinggangVenueInfo venueInfo : venueInfos) {
  148 + if (StringUtils.isNotEmpty(venueInfo.getParkCode()) && StringUtils.isNotEmpty(venueInfo.getName())) {
  149 + linggangVenueInfoMapper.insertNotExit(venueInfo);
  150 + }
  151 + }
  152 +
  153 + return Boolean.TRUE;
  154 + }
  155 +
123 156 /**
124 157 * 根据主键修改数据
125 158 */
... ... @@ -196,4 +229,5 @@ public class LinggangVenueInfoServiceImpl extends ServiceImpl&lt;LinggangVenueInfoM
196 229 wrapper.orderByDesc(LinggangVenueInfo::getId);
197 230 }
198 231 }
  232 +
199 233 }
200 234 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/venue/info/LinggangVenueInfoService.java
... ... @@ -2,6 +2,7 @@ package com.ruoyi.service.venue.info;
2 2  
3 3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.baomidou.mybatisplus.extension.service.IService;
  5 +import com.ruoyi.domain.DriverScheduling;
5 6 import com.ruoyi.domain.OrderEntity;
6 7 import com.ruoyi.domain.venue.info.LinggangVenueInfo;
7 8  
... ... @@ -45,6 +46,7 @@ public interface LinggangVenueInfoService extends IService&lt;LinggangVenueInfo&gt; {
45 46  
46 47 /***插入数据*/
47 48 boolean insert(LinggangVenueInfo entity);
  49 + boolean insertNotExit(List<DriverScheduling> entities);
48 50  
49 51 /**
50 52 * 根据主键修改数据
... ...
Bsth-admin/src/main/resources/mapper/venue/inf/LinggangVenueInfoMapper.xml
... ... @@ -19,6 +19,13 @@
19 19 <include refid="insertSelectiveColumn"></include>
20 20 <include refid="insertSelectiveValue"></include>
21 21 </insert>
  22 + <insert id="insertNotExit" keyColumn="ID" keyProperty="id" useGeneratedKeys="true"
  23 + parameterType="com.ruoyi.domain.venue.info.LinggangVenueInfo">
  24 + INSERT INTO venue_info (park_Code,del_flag,name)
  25 + select #{parkCode} park_Code,#{delFlag} del_flag,#{name} name from(
  26 + select count(park_Code) c from venue_info vi where vi.park_Code =#{parkCode}
  27 + )t where t.c=0
  28 + </insert>
22 29  
23 30 <sql id="columns">
24 31 ID
... ...
Bsth-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
... ... @@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
5 5  
6 6 /**
7 7 * 读取项目相关配置
8   - *
  8 + *
9 9 * @author ruoyi
10 10 */
11 11 @Component
... ... @@ -125,6 +125,11 @@ public class RuoYiConfig
125 125 return getProfile() + "/download/";
126 126 }
127 127  
  128 + public static String getDownloadPath1()
  129 + {
  130 + return getProfile() + "/download";
  131 + }
  132 +
128 133 /**
129 134 * 获取上传路径
130 135 */
... ...
Bsth-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
... ... @@ -117,6 +117,10 @@ public class SysDictDataServiceImpl extends ServiceImpl&lt;SysDictDataMapper, SysDi
117 117 return url;
118 118 }
119 119  
  120 + if(StringUtils.startsWith(url,dictData.getDictValueStr())){
  121 + return url;
  122 + }
  123 +
120 124 if (dictData.isCombationVal()) {
121 125 String fil = "/";
122 126  
... ...