Authored by mali

视频直播

  1 +package com.yoho.ufo.order.service.impl;
  2 +
  3 +import com.yoho.order.dal.CameraRecordMapper;
  4 +import com.yoho.order.model.CameraRecord;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +import java.util.Collections;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * Created by li.ma on 2019/5/8.
  13 + */
  14 +@Service
  15 +public class CameraRecordService {
  16 + @Autowired
  17 + private CameraRecordMapper cameraRecordMapper;
  18 +
  19 +
  20 + public String selectNameByCode(Integer cameraCode) {
  21 + if (null == cameraCode) {
  22 + return "";
  23 + }
  24 +
  25 + List<CameraRecord> cameraRecordList = cameraRecordMapper.selectAllCameraRecord();
  26 +
  27 + final String result;
  28 +
  29 + for (CameraRecord item : cameraRecordList) {
  30 + if (cameraCode.equals(item.getCameraCode())) {
  31 + return item.getCameraName();
  32 + }
  33 + }
  34 +
  35 + return "";
  36 + }
  37 +}
@@ -2,6 +2,7 @@ package com.yoho.ufo.order.service.impl; @@ -2,6 +2,7 @@ package com.yoho.ufo.order.service.impl;
2 2
3 import com.yoho.error.exception.ServiceException; 3 import com.yoho.error.exception.ServiceException;
4 import com.yoho.order.dal.AreaMapper; 4 import com.yoho.order.dal.AreaMapper;
  5 +import com.yoho.order.dal.CameraRecordMapper;
5 import com.yoho.order.dal.PhoneUidCameraMapper; 6 import com.yoho.order.dal.PhoneUidCameraMapper;
6 import com.yoho.order.model.Area; 7 import com.yoho.order.model.Area;
7 import com.yoho.order.model.PhoneUidCamera; 8 import com.yoho.order.model.PhoneUidCamera;
@@ -28,6 +29,9 @@ public class PhoneUidCameraService { @@ -28,6 +29,9 @@ public class PhoneUidCameraService {
28 @Autowired 29 @Autowired
29 private AreaMapper areaMapper; 30 private AreaMapper areaMapper;
30 31
  32 + @Autowired
  33 + private CameraRecordService cameraRecordService;
  34 +
31 public boolean insert(PhoneUidCameraBo record) { 35 public boolean insert(PhoneUidCameraBo record) {
32 if (StringUtils.isEmpty(record.getPhoneUid()) || null == record.getCameraCode()) { 36 if (StringUtils.isEmpty(record.getPhoneUid()) || null == record.getCameraCode()) {
33 return false; 37 return false;
@@ -57,6 +61,7 @@ public class PhoneUidCameraService { @@ -57,6 +61,7 @@ public class PhoneUidCameraService {
57 PhoneUidCameraBo bo = new PhoneUidCameraBo(); 61 PhoneUidCameraBo bo = new PhoneUidCameraBo();
58 bo.setCameraCode(phoneUidCamera.getCameraCode()); 62 bo.setCameraCode(phoneUidCamera.getCameraCode());
59 bo.setPhoneUid(phoneUidCamera.getPhoneUid()); 63 bo.setPhoneUid(phoneUidCamera.getPhoneUid());
  64 + bo.setCameraName(cameraRecordService.selectNameByCode(phoneUidCamera.getCameraCode()));
60 return bo; 65 return bo;
61 } 66 }
62 67