wwh 1 mese fa
parent
commit
71f85cd6b8

+ 11 - 10
huimv-receive/src/main/java/com/huimv/receive/controller/BillAccessDoorController.java

@@ -74,11 +74,11 @@ public class BillAccessDoorController {
                               @RequestParam("image") MultipartFile image,
                               @RequestParam("userName") String userName,
                               @RequestParam("seq") String seq) throws ParseException, IOException {
-        BillAccessDoor door = new BillAccessDoor();
-        door.setBillStatus(Integer.parseInt(result));
+        BillGate gate = new BillGate();
+        gate.setBillStatus(Integer.parseInt(result));
         DateFormat def = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        door.setCheckDate(def.parse(time));
-        door.setUserId(userId);
+        gate.setCheckDate(def.parse(time));
+        gate.setUserId(userId);
         String imageCom = "";
         if (ObjectUtil.isNotEmpty(image)) {
             if (uploadImage.getImageCom(image).equals("上传失败")) {
@@ -86,17 +86,18 @@ public class BillAccessDoorController {
                 return new Result(10001, "图片上传失败", false);
             }
             imageCom = uploadImage.getImageCom(image);
-            door.setUrlImg(imageCom);
+            gate.setCarUrl(imageCom);
         }//9G0487EPAJD7469
+
         //后面需要修改
         QueryWrapper<DeviceList> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("device_code", seq);
         DeviceList deviceList = deviceListService.getOne(queryWrapper);
-        door.setFarmId(Integer.valueOf(deviceList.getFarmId()));
-        door.setLocationId(deviceList.getLocationId());
-        door.setCheckLocation(deviceList.getLocationName());
-        door.setUserName(userName);
-        doorService.save(door);
+        gate.setFarmId(Integer.valueOf(deviceList.getFarmId()));
+        gate.setLocationId(deviceList.getLocationId());
+        gate.setCheckLocation(deviceList.getLocationName());
+        gate.setUserName(userName);
+        gateService.save(gate);
         return new Result(ResultCode.SUCCESS, time, imageCom);
     }
 }

+ 13 - 10
huimv-receive/src/main/java/com/huimv/receive/controller/BillGateController.java

@@ -9,6 +9,7 @@ import com.huimv.receive.common.utils.UploadImage;
 import com.huimv.receive.entity.BillAccessDoor;
 import com.huimv.receive.entity.BillGate;
 import com.huimv.receive.entity.DeviceList;
+import com.huimv.receive.service.IBillAccessDoorService;
 import com.huimv.receive.service.IBillGateService;
 import com.huimv.receive.service.IDeviceListService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +45,8 @@ public class BillGateController {
     private UploadImage uploadImage;
     @Autowired
     private IDeviceListService deviceListService;
+    @Autowired
+    private IBillAccessDoorService doorService;
 
     @RequestMapping("/getGateData")
     public Result getDoorData(@RequestParam("time") String time,
@@ -52,12 +55,12 @@ public class BillGateController {
                               @RequestParam("image") MultipartFile image,
                               @RequestParam("userName") String userName,
                               @RequestParam("seq") String seq) throws ParseException, IOException {
+        BillAccessDoor door = new BillAccessDoor();
 
-        BillGate gate = new BillGate();
-        gate.setBillStatus(Integer.parseInt(result));
+        door.setBillStatus(Integer.parseInt(result));
         DateFormat def = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        gate.setCheckDate(def.parse(time));
-        gate.setCarNum(plateNumber);
+        door.setCheckDate(def.parse(time));
+
         String imageCom = "";
         if (ObjectUtil.isNotEmpty(image)) {
             if (uploadImage.getImageCom(image).equals("上传失败")) {
@@ -65,18 +68,18 @@ public class BillGateController {
                 return new Result(10001, "图片上传失败", false);
             }
             imageCom = uploadImage.getImageCom(image);
-            gate.setCarUrl(imageCom);
+            door.setUrlImg(imageCom);
         }
 
         //后面需要修改
         QueryWrapper<DeviceList> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("device_code", seq);
         DeviceList deviceList = deviceListService.getOne(queryWrapper);
-        gate.setFarmId(Integer.valueOf(deviceList.getFarmId()));
-        gate.setLocationId(deviceList.getLocationId());
-        gate.setCheckLocation(deviceList.getLocationName());
-        gate.setUserName(userName);
-        gateService.save(gate);
+        door.setFarmId(Integer.valueOf(deviceList.getFarmId()));
+        door.setLocationId(deviceList.getLocationId());
+        door.setCheckLocation(deviceList.getLocationName());
+        door.setUserName(userName);
+        doorService.save(door);
         return new Result(ResultCode.SUCCESS, time, imageCom);
     }
 

+ 3 - 1
huimv-receive/src/main/java/com/huimv/receive/entity/PeopleList.java

@@ -41,7 +41,7 @@ public class PeopleList implements Serializable {
     /**
      * 用户id
      */
-    private Integer userId;
+    private String userId;
 
     /**
      * 用户名称
@@ -67,4 +67,6 @@ public class PeopleList implements Serializable {
 
 
     private Integer type;
+
+    private String imgUrl;
 }

+ 52 - 72
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillPcrServiceImpl.java

@@ -48,6 +48,8 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
     private BillPcrMapper billPcrMapper;
     @Autowired
     private BillGoodsInventoryMapper inventoryMapper;
+    @Autowired
+    private SysAccountMultilevelMapper multilevelMapper;
 
     @Override
     public Result listPersonalPcr(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
@@ -623,6 +625,52 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
                     }
                     pcrMapper.insert(billClean);
                     baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                    //下发人脸门禁白名单
+                    if (billPcr.getVistitType() == 0) {
+                        //人员隔离中心流程
+                        if (billPcr.getMidId() == 16 || billPcr.getMidId() == 29 || billPcr.getMidId() == 41 || billPcr.getMidId() == 53) {
+                            DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", "2"));
+                            PeopleList peopleList = new PeopleList();
+                            peopleList.setFarmId("2");
+                            peopleList.setDeviceCode(deviceList.getDeviceCode());
+                            peopleList.setUserId(billPcr.getProcessId().toString());
+                            peopleList.setUserName(billPcr.getAdmissionUserName());
+                            peopleList.setPassword("123456");
+                            peopleList.setType(0);
+                            peopleList.setCreateTime(new Date());
+                            Date now = new Date();
+                            Calendar calendar = Calendar.getInstance();
+                            calendar.setTime(now);
+                            calendar.add(Calendar.HOUR_OF_DAY, 2);
+                            Date date1 = calendar.getTime();
+                            peopleList.setOutTime(date1);
+                            SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
+                            peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
+                            peopleListMapper.insert(peopleList);
+                        }
+                        //人员基地外围
+                        if (billPcr.getMidId() == 17 || billPcr.getMidId() == 30 || billPcr.getMidId() == 42 || billPcr.getMidId() == 54) {
+                            DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", billPcr.getFarmId()));
+                            PeopleList peopleList = new PeopleList();
+                            peopleList.setFarmId(billPcr.getFarmId().toString());
+                            peopleList.setDeviceCode(deviceList.getDeviceCode());
+                            UUID uuid = UUID.randomUUID();
+                            peopleList.setUserId(uuid.toString());
+                            peopleList.setUserName(billPcr.getAdmissionUserName());
+                            peopleList.setPassword("123456");
+                            peopleList.setType(0);
+                            peopleList.setCreateTime(new Date());
+                            Date now = new Date();
+                            Calendar calendar = Calendar.getInstance();
+                            calendar.setTime(now);
+                            calendar.add(Calendar.HOUR_OF_DAY, 2);
+                            Date date1 = calendar.getTime();
+                            peopleList.setOutTime(date1);
+                            SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(billPcr.getAdmissionUserId());
+                            peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
+                            peopleListMapper.insert(peopleList);
+                        }
+                    }
                 } else if (nextId == 3) {
                     //新增洗澡
                     BillClean billClean = (BillClean) newObject;
@@ -689,71 +737,7 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
                     inventoryMapper.insert(before);
                     baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
                 }
-//                //通过生成门禁白名单
-//                QueryWrapper<DeviceList> deviceListQueryWrapper = new QueryWrapper<>();
-//                deviceListQueryWrapper.eq("farm_id", billPcr.getFarmId()).eq("location_id", baseLocation.getId());
-//                List<DeviceList> deviceLists = deviceListMapper.selectList(deviceListQueryWrapper);
-//                //找到对应的入场申请表
-//                QueryWrapper<BillPersonnelAdmission> queryWrapper1 = new QueryWrapper<>();
-//                queryWrapper1.eq("farm_id", billPcr.getFarmId()).eq("process_id", baseProcess.getId());
-//                BillPersonnelAdmission billPersonnelAdmission = personnelAdmissionMapper.selectOne(queryWrapper1);
-//                if (deviceLists.size() > 0) {
-//                    for (DeviceList deviceList : deviceLists) {
-//                        //通过生成门禁白名单
-//                        PeopleList peopleList = new PeopleList();
-//                        peopleList.setFarmId(billPcr.getFarmId().toString());
-//                        peopleList.setDeviceCode(deviceList.getDeviceCode());
-//                        peopleList.setUserId(billPcr.getAdmissionUserId());
-//                        peopleList.setUserName(billPcr.getAdmissionUserName());
-//                        peopleList.setPassword("123456");
-//                        peopleList.setType(0);
-//                        peopleList.setCreateTime(new Date());
-//                        Date date2 = new Date();
-//                        Calendar calendar = Calendar.getInstance();
-//                        calendar.setTime(date2);
-//                        calendar.add(Calendar.HOUR_OF_DAY, 2);
-//                        Date date1 = calendar.getTime();
-//                        peopleList.setOutTime(date1);
-//                        peopleListMapper.insert(peopleList);
-//
-//                        HashMap<String, Object> jsonObject = new HashMap<>();
-//                        jsonObject.put("seq", deviceList.getDeviceCode());
-////                    String savePath = "D:\\works\\pig_projects\\甜妹.jpg";
-//                        String savePath = "/opt/huatong/test.jpg";
-//                        URL url = new URL(billPersonnelAdmission.getUserImgUrl());
-//                        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-//                        connection.setRequestMethod("GET");
-//                        int resCode = connection.getResponseCode();
-//                        if (resCode == HttpURLConnection.HTTP_OK) {
-//                            InputStream inputStream = connection.getInputStream();
-//                            byte[] buffer = new byte[4096];
-//                            int length;
-//                            //读取数据并写入到文件中
-//                            try (FileOutputStream outStream = new FileOutputStream(savePath)) {
-//                                while ((length = inputStream.read(buffer)) != -1) {
-//                                    outStream.write(buffer, 0, length);
-//                                }
-//                                outStream.flush();
-//                            } finally {
-//                                inputStream.close();
-//                            }
-//                        } else {
-//                            System.out.println("文件下载错误码为" + resCode);
-//                        }
-//
-////                    jsonObject.put("face", FileUtil.file("D:\\works\\pig_projects\\甜妹.jpg"));
-//                        jsonObject.put("face", FileUtil.file(savePath));
-//                        jsonObject.put("name", billPersonnelAdmission.getAdmissionUserName());
-//                        jsonObject.put("password", "123456");
-//                        jsonObject.put("timestamp", date1.getTime());
-//                        jsonObject.put("uid", billPersonnelAdmission.getAdmissionUserId());
-//                        String post = HttpRequest.post("http://39.173.90.137:8040/addDeviceUser")
-//                                .header(Header.CONTENT_TYPE, "multipart/form-data")
-//                                .form(jsonObject)
-//                                .timeout(30 * 1000).execute().body();
-//                        System.out.println(post);
-//                    }
-//                }
+
                 baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
                 baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
                 baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
@@ -789,13 +773,9 @@ public class BillPcrServiceImpl extends ServiceImpl<BillPcrMapper, BillPcr> impl
     }
 
     public static void main(String[] args) {
-        String s = "0,1,0,2,0";
-        String a = "0,1,0,2,0";
-        String s1 = "1";
-        int i = s.indexOf(s1);
-        StringBuilder sb = new StringBuilder(a);
-        sb.setCharAt(i, '3');
-        System.out.println(sb);
+        Random random = new Random();
+        int randomNum = random.nextInt(90000000) + 1000;
+        System.out.println(randomNum);
 
 //        String s3 = a.substring(0, s.indexOf(s1) + 3);
 ////        System.out.println(s.indexOf(s1));

+ 4 - 4
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillPersonnelAdmissionServiceImpl.java

@@ -855,7 +855,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
             }
 
             //通过生成门禁白名单
-            QueryWrapper<DeviceList> queryWrapper = new QueryWrapper<>();
+           /* QueryWrapper<DeviceList> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("farm_id", billPersonnelAdmission.getFarmId()).eq("location_id", billPersonnelAdmission.getDestId());
             DeviceList deviceList = deviceListMapper.selectOne(queryWrapper);
             if (ObjectUtil.isNotEmpty(deviceList)) {
@@ -984,7 +984,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
                     System.out.println(post);
                 }
 
-            }
+            }*/
         }
         baseProcessMapper.updateById(baseProcess);
         billPersonnelAdmissionMapper.updateById(billPersonnelAdmission);
@@ -1876,7 +1876,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
                 QueryWrapper<DeviceList> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("farm_id", billPersonnelAdmission.getFarmId()).eq("location_id", billPersonnelAdmission.getDestId());
                 DeviceList deviceList = deviceListMapper.selectOne(queryWrapper);
-                if (ObjectUtil.isNotEmpty(deviceList)) {
+               /* if (ObjectUtil.isNotEmpty(deviceList)) {
                     if (deviceList.getDeviceType() == 0) {
                         //通过生成门禁白名单
                         PeopleList peopleList = new PeopleList();
@@ -2002,7 +2002,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
                         System.out.println(post);
                     }
 
-                }
+                }*/
             }
             baseProcessMapper.updateById(baseProcess);
             billPersonnelAdmissionMapper.updateById(billPersonnelAdmission);

+ 51 - 1
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillSamplingServiceImpl.java

@@ -1,6 +1,8 @@
 package com.huimv.receive.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Snowflake;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -25,7 +27,7 @@ import java.io.IOException;
 import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.Map;
+import java.util.*;
 
 /**
  * <p>
@@ -58,6 +60,12 @@ public class BillSamplingServiceImpl extends ServiceImpl<BillSamplingMapper, Bil
     private BillCleanBeforeMapper billCleanBeforeMapper;
     @Autowired
     private BillGoodsInventoryMapper inventoryMapper;
+    @Autowired
+    private PeopleListMapper peopleListMapper;
+    @Autowired
+    private DeviceListMapper deviceListMapper;
+    @Autowired
+    private SysAccountMultilevelMapper multilevelMapper;
 
     @Override
     public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
@@ -289,6 +297,27 @@ public class BillSamplingServiceImpl extends ServiceImpl<BillSamplingMapper, Bil
                     }
                     billClean.setSamplingId(Integer.parseInt(id));
                     pcrMapper.insert(billClean);
+                    //下发人脸门禁白名单
+                    if (sampling.getVistitType() == 0) {
+                        DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", 1));
+                        PeopleList peopleList = new PeopleList();
+                        peopleList.setFarmId("1");
+                        peopleList.setDeviceCode(deviceList.getDeviceCode());
+                        peopleList.setUserId(sampling.getProcessId().toString());
+                        peopleList.setUserName(sampling.getAdmissionUserName());
+                        peopleList.setPassword("123456");
+                        peopleList.setType(0);
+                        peopleList.setCreateTime(new Date());
+                        Date now = new Date();
+                        Calendar calendar = Calendar.getInstance();
+                        calendar.setTime(now);
+                        calendar.add(Calendar.HOUR_OF_DAY, 2);
+                        Date date1 = calendar.getTime();
+                        peopleList.setOutTime(date1);
+                        SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(sampling.getAdmissionUserId());
+                        peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
+                        peopleListMapper.insert(peopleList);
+                    }
                 } else if (Integer.parseInt(split[1]) == 3) {
                     //新增洗澡
                     BillClean billClean = (BillClean) entity;
@@ -404,6 +433,27 @@ public class BillSamplingServiceImpl extends ServiceImpl<BillSamplingMapper, Bil
             billClean.setSamplingId(Integer.parseInt(id));
             pcrMapper.insert(billClean);
             baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+            //下发人脸门禁白名单
+            if (sampling.getVistitType() == 0) {
+                DeviceList deviceList = deviceListMapper.selectOne(new QueryWrapper<DeviceList>().eq("farm_id", 1));
+                PeopleList peopleList = new PeopleList();
+                peopleList.setFarmId("1");
+                peopleList.setDeviceCode(deviceList.getDeviceCode());
+                peopleList.setUserId(sampling.getProcessId().toString());
+                peopleList.setUserName(sampling.getAdmissionUserName());
+                peopleList.setPassword("123456");
+                peopleList.setType(0);
+                peopleList.setCreateTime(new Date());
+                Date now = new Date();
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(now);
+                calendar.add(Calendar.HOUR_OF_DAY, 2);
+                Date date1 = calendar.getTime();
+                peopleList.setOutTime(date1);
+                SysAccountMultilevel sysAccountMultilevel = multilevelMapper.selectById(sampling.getAdmissionUserId());
+                peopleList.setImgUrl(sysAccountMultilevel.getImgUrl());
+                peopleListMapper.insert(peopleList);
+            }
         } else if (nextId == 3) {
             //新增洗澡
             BillClean billClean = (BillClean) newObject;