Authored by mali

Merge branch 'hotfix_live1' into test6.9.3

  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;
@@ -61,6 +65,7 @@ public class PhoneUidCameraService { @@ -61,6 +65,7 @@ public class PhoneUidCameraService {
61 PhoneUidCameraBo bo = new PhoneUidCameraBo(); 65 PhoneUidCameraBo bo = new PhoneUidCameraBo();
62 bo.setCameraCode(phoneUidCamera.getCameraCode()); 66 bo.setCameraCode(phoneUidCamera.getCameraCode());
63 bo.setPhoneUid(phoneUidCamera.getPhoneUid()); 67 bo.setPhoneUid(phoneUidCamera.getPhoneUid());
  68 + bo.setCameraName(cameraRecordService.selectNameByCode(phoneUidCamera.getCameraCode()));
64 return bo; 69 return bo;
65 } 70 }
66 71