|
@@ -8,19 +8,24 @@ import com.yx.face.boot.restful.RestResult;
|
|
|
import com.yx.face.boot.restful.ServiceException;
|
|
|
import com.yx.face.boot.uitls.SMSOrIdCardUtils;
|
|
|
import com.yx.face.dao.UserControlEarlyWarningListDao;
|
|
|
+import com.yx.face.dao.UserControlEarlyWarningListLogDao;
|
|
|
import com.yx.face.model.dto.UserControlEarlyWarningDTO;
|
|
|
import com.yx.face.model.dto.UserWhitelistDTO;
|
|
|
import com.yx.face.model.entity.UserControlEarlyWarningList;
|
|
|
+import com.yx.face.model.entity.UserControlEarlyWarningListLog;
|
|
|
import com.yx.face.model.excel.UserControlEarlyWarningExcel;
|
|
|
import com.yx.face.model.excel.UserWhitelistExcel;
|
|
|
import com.yx.face.model.search.UserControlEarlyWarningSearch;
|
|
|
+import com.yx.face.model.vo.AdminAndUserEarlyWarningVO;
|
|
|
import com.yx.face.model.vo.AdminVO;
|
|
|
import com.yx.face.model.vo.FaceLogVO;
|
|
|
import com.yx.face.model.vo.UserControlEarlyWarningVO;
|
|
|
import com.yx.face.service.AdminService;
|
|
|
import com.yx.face.service.UserControlEarlyWarningListService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -39,47 +44,50 @@ public class UserControlEarlyWarningListServiceImpl implements UserControlEarlyW
|
|
|
|
|
|
@Resource
|
|
|
private UserControlEarlyWarningListDao userControlEarlyWarningListDao;
|
|
|
+ @Resource
|
|
|
+ private UserControlEarlyWarningListLogDao userControlEarlyWarningListLogDao;
|
|
|
|
|
|
@Autowired
|
|
|
private AdminService adminService;
|
|
|
|
|
|
@Override
|
|
|
public Integer addOrUpdate(UserControlEarlyWarningDTO userControlEarlyWarningDTO) {
|
|
|
- if(!SMSOrIdCardUtils.isIdCard(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
|
|
|
- throw new ServiceException("请输入正确的预警人员身份证号");
|
|
|
+ if (!SMSOrIdCardUtils.isIdCard(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
|
|
|
+ throw new ServiceException("请输入正确的预警人员身份证号");
|
|
|
|
|
|
Date date = new Date();
|
|
|
UserControlEarlyWarningList ucewl = new UserControlEarlyWarningList();
|
|
|
- BeanUtils.copyProperties(userControlEarlyWarningDTO,ucewl);
|
|
|
+ BeanUtils.copyProperties(userControlEarlyWarningDTO, ucewl);
|
|
|
ucewl.setUpdateTime(date);
|
|
|
- if(userControlEarlyWarningDTO.getId() == null){
|
|
|
+ if (userControlEarlyWarningDTO.getId() == null) {
|
|
|
UserControlEarlyWarningList u = new UserControlEarlyWarningList();
|
|
|
u.setEarlyWarningIdNumber(userControlEarlyWarningDTO.getEarlyWarningIdNumber());
|
|
|
u.setAdminId(userControlEarlyWarningDTO.getAdminId());
|
|
|
UserControlEarlyWarningList userControlEarlyWarningList = userControlEarlyWarningListDao.selectOne(u);
|
|
|
- if(userControlEarlyWarningList != null)throw new ServiceException("该预警人员已经添加到该账号下了");
|
|
|
+ if (userControlEarlyWarningList != null) throw new ServiceException("该预警人员已经添加到该账号下了");
|
|
|
|
|
|
ucewl.setCreateTime(date);
|
|
|
return userControlEarlyWarningListDao.insertSelective(ucewl);
|
|
|
- }else {
|
|
|
- UserControlEarlyWarningList userControlEarlyWarningList = userControlEarlyWarningListDao.selectByPrimaryKey(userControlEarlyWarningDTO.getId());
|
|
|
- if(!userControlEarlyWarningList.getEarlyWarningIdNumber().equals(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
|
|
|
- throw new ServiceException("预警人员身份照号不可修改");
|
|
|
+ } else {
|
|
|
+// UserControlEarlyWarningList userControlEarlyWarningList = userControlEarlyWarningListDao.selectByPrimaryKey(userControlEarlyWarningDTO.getId());
|
|
|
+// if(!userControlEarlyWarningList.getEarlyWarningIdNumber().equals(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
|
|
|
+// throw new ServiceException("预警人员身份照号不可修改");
|
|
|
ucewl.setId(userControlEarlyWarningDTO.getId());
|
|
|
return userControlEarlyWarningListDao.updateByPrimaryKeySelective(ucewl);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RestResult<List<String>> userControlEarlyWarningListExcel(List<Object> datas,Integer adminId) {
|
|
|
+ public RestResult<List<String>> userControlEarlyWarningListExcel(List<Object> datas, Integer adminId) {
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (int i = 0; i < datas.size(); i++) {
|
|
|
try {
|
|
|
UserControlEarlyWarningExcel ucewe = (UserControlEarlyWarningExcel) datas.get(i);
|
|
|
- if (ucewe.getEarlyWarningIdNumber() == null) throw new ServiceException("第" + (i + 2) + "行,预警人员身份证号不能为空");
|
|
|
+ if (ucewe.getEarlyWarningIdNumber() == null)
|
|
|
+ throw new ServiceException("第" + (i + 2) + "行,预警人员身份证号不能为空");
|
|
|
|
|
|
UserControlEarlyWarningDTO userControlEarlyWarningDTO = new UserControlEarlyWarningDTO();
|
|
|
- BeanUtils.copyProperties(ucewe,userControlEarlyWarningDTO);
|
|
|
+ BeanUtils.copyProperties(ucewe, userControlEarlyWarningDTO);
|
|
|
userControlEarlyWarningDTO.setAdminId(adminId);
|
|
|
try {
|
|
|
this.addOrUpdate(userControlEarlyWarningDTO);
|
|
@@ -111,4 +119,34 @@ public class UserControlEarlyWarningListServiceImpl implements UserControlEarlyW
|
|
|
List<UserControlEarlyWarningVO> list = userControlEarlyWarningListDao.getPageList(map);
|
|
|
return new PageInfo<>(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入匹配人员预警信息
|
|
|
+ *
|
|
|
+ * @param deviceSn 设备编号
|
|
|
+ * @param idNumber 身份证
|
|
|
+ * @param faceLogId 进出记录id
|
|
|
+ */
|
|
|
+ @Async
|
|
|
+ @Override
|
|
|
+ public void addWarningInformation(String deviceSn, String idNumber, Long faceLogId) {
|
|
|
+ // null 代表未查到
|
|
|
+ AdminAndUserEarlyWarningVO adminAndUserEarlyWarningVO = userControlEarlyWarningListDao.getAdminWarningInformation(deviceSn, idNumber, 1);
|
|
|
+ if (adminAndUserEarlyWarningVO != null) {
|
|
|
+ System.out.println(adminAndUserEarlyWarningVO);
|
|
|
+ UserControlEarlyWarningListLog userControlEarlyWarningListLog = new UserControlEarlyWarningListLog();
|
|
|
+ Date date = new Date();
|
|
|
+ userControlEarlyWarningListLog.setUpdateTime(date);
|
|
|
+ userControlEarlyWarningListLog.setCreateTime(date);
|
|
|
+ userControlEarlyWarningListLog.setControlUnit(adminAndUserEarlyWarningVO.getControlUnit());
|
|
|
+ userControlEarlyWarningListLog.setControlPhone(adminAndUserEarlyWarningVO.getControlPhone());
|
|
|
+ userControlEarlyWarningListLog.setControlName(adminAndUserEarlyWarningVO.getControlName());
|
|
|
+ userControlEarlyWarningListLog.setAdminId(adminAndUserEarlyWarningVO.getAdminId());
|
|
|
+ userControlEarlyWarningListLog.setStatus(1);
|
|
|
+ userControlEarlyWarningListLog.setFaceLogId(faceLogId);
|
|
|
+ System.out.println(userControlEarlyWarningListLog);
|
|
|
+ userControlEarlyWarningListLogDao.insert(userControlEarlyWarningListLog);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|