ソースを参照

Merge branch 'usky-zyj' of uskycloud/usky-modules into master

gez 1 ヶ月 前
コミット
7ff1bee756

+ 11 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java

@@ -59,6 +59,17 @@ public class EgDeviceController {
         return ApiResult.success();
     }
 
+    /**
+     * 附加功能更新
+     * @param egDevice
+     * @return
+     */
+    @PutMapping("attachUpdate")
+    public ApiResult<Void> attachUpdate(@RequestBody EgDevice egDevice){
+        egDeviceService.attachUpdate(egDevice);
+        return ApiResult.success();
+    }
+
     /**
      * 删除
      * @param id

+ 15 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/domain/EgDevice.java

@@ -108,6 +108,21 @@ public class EgDevice implements Serializable {
      */
     private Integer tenantId;
 
+    /**
+     * 屏保
+     */
+    private String imgPath;
+
+    /**
+     * 标识语
+     */
+    private String remark;
+
+    /**
+     * 开门方式
+     */
+    private String openMode;
+
     /**
      * 用户人脸信息记录
      */

+ 2 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java

@@ -25,6 +25,8 @@ public interface EgDeviceService extends CrudService<EgDevice> {
 
     void update(EgDevice egDevice);
 
+    void attachUpdate(EgDevice egDevice);
+
     void remove(Integer id);
 
     boolean checkNameUnique(EgDevice egDevice);

+ 26 - 4
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java

@@ -72,15 +72,25 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
                 .orderByDesc(EgDevice::getId);
         page = this.page(page,queryWrapper);
         if(page.getRecords().size() > 0){
+
+            LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
+            meetingFaceQuery.eq(MeetingFace::getTenantId,tenantId);
+            List<MeetingFace> meetingAllFaceList = meetingFaceMapper.selectList(meetingFaceQuery);
+
             for (int i = 0; i < page.getRecords().size(); i++) {
                 if(Objects.nonNull(page.getRecords().get(i).getBindFace()) ||StringUtils.isNotBlank(page.getRecords().get(i).getBindFace())){
                     String[] fidListStr = page.getRecords().get(i).getBindFace().split(",");
                     Integer[] fidList = Arrays.stream(fidListStr).map(Integer::parseInt).toArray(Integer[]::new);
 
-                    LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
-                    meetingFaceQuery.in(MeetingFace::getFid,Arrays.asList(fidList));
-                    List<MeetingFace> meetingFaceList = meetingFaceMapper.selectList(meetingFaceQuery);
-
+                    List<MeetingFace> meetingFaceList = new ArrayList<>();
+                    for (int j = 0; j < fidList.length; j++) {
+                        for (int k = 0; k < meetingAllFaceList.size(); k++) {
+                            if(fidList[j] == meetingAllFaceList.get(k).getFid()){
+                                meetingFaceList.add(meetingAllFaceList.get(k));
+                                break;
+                            }
+                        }
+                    }
                     page.getRecords().get(i).setMeetingFaceList(meetingFaceList);
                 }
 
@@ -166,6 +176,18 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
         }
     }
 
+    @Override
+    public void attachUpdate(EgDevice egDevice){
+        if(checkNameUnique(egDevice)){
+            throw new BusinessException("更新门禁设备附加功能'"+egDevice.getDeviceId()+"'失败,设备已存在");
+        }
+
+        egDevice.setUpdateBy(SecurityUtils.getUsername());
+        egDevice.setUpdateTime(LocalDateTime.now());
+
+        this.updateById(egDevice);
+    }
+
     @Override
     public void remove(Integer id){
         EgDevice egDevice = this.getById(id);

+ 3 - 0
service-eg/service-eg-biz/src/main/resources/mapper/eg/EgDeviceMapper.xml

@@ -20,6 +20,9 @@
         <result column="update_time" property="updateTime" />
         <result column="dept_id" property="deptId" />
         <result column="tenant_id" property="tenantId" />
+        <result column="img_path" property="imgPath" />
+        <result column="remark" property="remark" />
+        <result column="open_mode" property="openMode" />
     </resultMap>
     <insert id="insertMeetingFaceDevice" parameterType="integer">
         insert into meeting_face_device (face_id,device_id) value (#{fid}, #{egDeviceId});

+ 2 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseBuildFacilityServiceImpl.java

@@ -328,6 +328,8 @@ public class BaseBuildFacilityServiceImpl extends AbstractCrudService<BaseBuildF
                             if(list2.get(i).getDeviceId().equals(deviceInfoList.get(j).getDeviceId())){
                                 resultVO.setDeviceName(deviceInfoList.get(j).getDeviceName());
                                 resultVO.setDeviceAddress(deviceInfoList.get(j).getInstallAddress());
+                                resultVO.setDeviceId(deviceInfoList.get(j).getDeviceId());
+                                resultVO.setProductCode(deviceInfoList.get(j).getProductCode());
                             }
                         }
                     }

+ 8 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -68,6 +68,14 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
         if (StringUtils.isBlank(dd) || dd.length() == 0){
             throw new BusinessException("新增产品信息'" + dmpProductInfo.getProductCode() + "'失败,设备类型缺少属性");
         }
+
+        QueryWrapper<DmpProductInfo> query = Wrappers.query();
+        query.select("max(id) as id");
+        DmpProductInfo info1 = this.getOne(query);
+        int id = info1.getId()+1;
+        String productCode = String.format("%03d",deviceType)+"_"+String.format("%04d",id);
+        dmpProductInfo.setProductCode(productCode);
+
         dmpProductInfo.setCreatedBy(SecurityUtils.getUsername());
         dmpProductInfo.setCreatedTime(new Date());
         dmpProductInfo.setDeleteFlag(0);

+ 10 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/FacilityDeviceResultVO.java

@@ -41,6 +41,16 @@ public class FacilityDeviceResultVO {
      */
     private String deviceAddress;
 
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 设备id
+     */
+    private String deviceId;
+
     /**
      * 设备属性
      */