预警信息管理功能开发
This commit is contained in:
parent
66b0a9052f
commit
7702ccf5e4
|
|
@ -0,0 +1,127 @@
|
|||
package com.dkl.large.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||
import com.dkl.large.domain.DklActivity;
|
||||
import com.dkl.large.domain.DklMonitoringCameraData;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.domain.vo.DklMonitoringCameraDataVo;
|
||||
import com.dkl.large.domain.vo.HeatVo;
|
||||
import com.dkl.large.domain.vo.RegionalVo;
|
||||
import com.dkl.large.domain.vo.RiskVo;
|
||||
|
||||
/**
|
||||
* 监控点信息Service接口
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
public interface IDklMonitoringPointsService
|
||||
{
|
||||
/**
|
||||
* 查询监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 监控点信息
|
||||
*/
|
||||
public DklMonitoringPoints selectDklMonitoringPointsById(Long id) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 查询监控点信息列表
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 监控点信息集合
|
||||
*/
|
||||
|
||||
public List<DklMonitoringPoints> selectDklMonitoringPointsList(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
public String selectDklMonitoringPointsListMeaasge(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
/**
|
||||
* 新增监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 修改监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 批量删除监控点信息
|
||||
*
|
||||
* @param ids 需要删除的监控点信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsByIds(int[] ids);
|
||||
|
||||
/**
|
||||
* 删除监控点信息信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsById(Long id);
|
||||
|
||||
/**
|
||||
* 监控点热力图
|
||||
*
|
||||
* @param dataVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<HeatVo> heatMap(HeatVo dataVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域展示图
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RegionalVo> regionalStatistics(RegionalVo regionalVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<DklMonitoringPoints> regionalDataList(RegionalVo regionalVo) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 大客流风险预警信息
|
||||
*
|
||||
* @param riskVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RiskVo> riskDataList(RiskVo riskVo);
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatistics(RiskVo riskVo);
|
||||
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :大客流基础信息统计首页
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatisticsPeople(RiskVo riskVo);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param dklMonitoringPointsList 数据列表
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
public String importDate(List<DklMonitoringPoints> dklMonitoringPointsList, String operName) throws KmsSdkException;
|
||||
|
||||
public boolean checkPointsNameUnique(DklMonitoringPoints dklMonitoringPoints);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,504 @@
|
|||
package com.dkl.large.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||
import com.dkl.common.constant.UserConstants;
|
||||
import com.dkl.common.core.domain.entity.SysDept;
|
||||
import com.dkl.common.core.domain.entity.SysDictData;
|
||||
import com.dkl.common.exception.ServiceException;
|
||||
import com.dkl.common.utils.DateUtils;
|
||||
import com.dkl.common.utils.StringUtils;
|
||||
import com.dkl.large.domain.DklActivity;
|
||||
import com.dkl.large.domain.DklMonitoringCameraData;
|
||||
import com.dkl.large.domain.vo.DklMonitoringCameraDataVo;
|
||||
import com.dkl.large.domain.vo.HeatVo;
|
||||
import com.dkl.large.domain.vo.RegionalVo;
|
||||
import com.dkl.large.domain.vo.RiskVo;
|
||||
import com.dkl.large.utli.EnciphermentUtil;
|
||||
import com.dkl.system.mapper.SysDictDataMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dkl.large.mapper.DklMonitoringPointsMapper;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.service.IDklMonitoringPointsService;
|
||||
|
||||
import static com.dkl.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.dkl.common.utils.SecurityUtils.getUsername;
|
||||
import static org.springframework.util.SerializationUtils.serialize;
|
||||
|
||||
/**
|
||||
* 监控点信息Service业务层处理
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@Service
|
||||
public class DklMonitoringPointsServiceImpl implements IDklMonitoringPointsService
|
||||
{
|
||||
@Autowired
|
||||
private DklMonitoringPointsMapper dklMonitoringPointsMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
//手机号正则
|
||||
private static final String PHONE_REGEX = "^((0\\d{2,3}-\\d{7,8})|(1[3456789]\\d{9}))$";
|
||||
//经度
|
||||
private static final String LNG_REGEX = "^-?\\d{1,3}(\\.\\d+)?$";
|
||||
//维度
|
||||
private static final String LAT_REGEX = "^-?\\d{1,2}(\\.\\d+)?$";
|
||||
/**
|
||||
* 查询监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 监控点信息
|
||||
*/
|
||||
@Override
|
||||
public DklMonitoringPoints selectDklMonitoringPointsById(Long id) throws KmsSdkException {
|
||||
DklMonitoringPoints dklMonitoringPoints = dklMonitoringPointsMapper.selectDklMonitoringPointsById(id);
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPoints.getDutyPeople())&&StringUtils.isNotEmpty(dklMonitoringPoints.getDutyPhone())) {
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
return dklMonitoringPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询监控点信息列表
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 监控点信息
|
||||
*/
|
||||
@Override
|
||||
public List<DklMonitoringPoints> selectDklMonitoringPointsList(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
|
||||
|
||||
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectDklMonitoringPointsListMeaasge(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
byte[] bytes = serialize(dklMonitoringPointsInfo.getDutyPeople()+","+dklMonitoringPointsInfo.getDutyPhone());
|
||||
String isor = EnciphermentUtil.kmsSign(bytes);
|
||||
if (!isor.equals(dklMonitoringPointsInfo.getSigenCode())) {
|
||||
successMsg.append("名称为"+dklMonitoringPointsInfo.getPointName()+"的数据被篡改");
|
||||
}
|
||||
}
|
||||
|
||||
// List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
|
||||
|
||||
|
||||
// for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
// String dutyPeople = null;
|
||||
// String dutyPhone = null;
|
||||
// if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
// dutyPeople = EnciphermentUtil.kmsDencrypt(dklMonitoringPointsInfo.getDutyPeople());
|
||||
// }
|
||||
// if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
// dutyPhone = EnciphermentUtil.kmsDencrypt(dklMonitoringPointsInfo.getDutyPhone());
|
||||
// }
|
||||
// // (序列化)
|
||||
// byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
// String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
// dklMonitoringPointsInfo.setSigenCode(sigenCode);
|
||||
// dklMonitoringPointsMapper.updateDklMonitoringPoints(dklMonitoringPointsInfo);
|
||||
// }
|
||||
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
dklMonitoringPoints.setCreateTime(DateUtils.getNowDate());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
return dklMonitoringPointsMapper.insertDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
dklMonitoringPoints.setUpdateTime(DateUtils.getNowDate());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
return dklMonitoringPointsMapper.updateDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除监控点信息
|
||||
*
|
||||
* @param ids 需要删除的监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDklMonitoringPointsByIds(int[] ids)
|
||||
{
|
||||
return dklMonitoringPointsMapper.deleteDklMonitoringPointsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控点信息信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDklMonitoringPointsById(Long id)
|
||||
{
|
||||
return dklMonitoringPointsMapper.deleteDklMonitoringPointsById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监控点热力图
|
||||
*
|
||||
* @param dataVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<HeatVo> heatMap(HeatVo dataVo) {
|
||||
return dklMonitoringPointsMapper.heatMap(dataVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流总数区域展示图
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<RegionalVo> regionalStatistics(RegionalVo regionalVo) {
|
||||
return dklMonitoringPointsMapper.regionalStatistics(regionalVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<DklMonitoringPoints> regionalDataList(RegionalVo regionalVo) throws KmsSdkException {
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.regionalDataList(regionalVo);
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流风险预警信息
|
||||
*
|
||||
* @param riskVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<RiskVo> riskDataList(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.riskDataList(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RiskVo> homePointsStatistics(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.homePointsStatistics(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RiskVo> homePointsStatisticsPeople(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.homePointsStatisticsPeople(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importDate(List<DklMonitoringPoints> dklMonitoringPointsList, String operName) throws KmsSdkException {
|
||||
//区域集合
|
||||
List<SysDictData> areaDict=sysDictDataMapper.selectDictDataByType("activity_area");
|
||||
//区监控点类型
|
||||
List<SysDictData> pointType=sysDictDataMapper.selectDictDataByType("monitoring_point_type");
|
||||
//所有大客流活动
|
||||
DklMonitoringPoints dklMonitoringPoint = new DklMonitoringPoints();
|
||||
dklMonitoringPoint.setDelFlag("0");
|
||||
List<DklMonitoringPoints> dklMonitoringPointAll= dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoint);
|
||||
if (StringUtils.isNull(dklMonitoringPointsList) || dklMonitoringPointsList.size() == 0) {
|
||||
throw new ServiceException("导入数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (int i = 0; i < dklMonitoringPointsList.size(); i++) {
|
||||
try
|
||||
{
|
||||
//名称
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointName())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据名称为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getPointName().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据名称长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//地址
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointAddress())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据地址为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getPointAddress().length()>=50){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据地址长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
//区域
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getRegionname())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据区域为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getRegionname().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据区域长度过长");
|
||||
}else{
|
||||
for (SysDictData sysDictData : areaDict) {
|
||||
if (sysDictData.getDictLabel().equals(dklMonitoringPointsList.get(i).getRegionname())) {
|
||||
dklMonitoringPointsList.get(i).setPointRegion(sysDictData.getDictValue());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointRegion())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据区域未找到");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//监控点类型
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getMonitoringTypeName())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据监控点类型为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getMonitoringTypeName().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据监控点类型长度过长");
|
||||
}else{
|
||||
for (SysDictData sysDictData : pointType) {
|
||||
if (sysDictData.getDictLabel().equals(dklMonitoringPointsList.get(i).getMonitoringTypeName())) {
|
||||
dklMonitoringPointsList.get(i).setMonitoringType(sysDictData.getDictValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getMonitoringType())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据监控点类型未找到");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//值班人员
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getDutyPeople())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班人员为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getDutyPeople().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班人员长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
//值班联系方式
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getDutyPhone())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getDutyPhone().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式长度过长");
|
||||
}else if (!Pattern.matches(PHONE_REGEX, dklMonitoringPointsList.get(i).getDutyPhone())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式有误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//经度
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getLng())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据经度为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLng().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据经度长度过长");
|
||||
}else if (!Pattern.matches(LNG_REGEX, dklMonitoringPointsList.get(i).getLng())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值经度有误");
|
||||
}
|
||||
}
|
||||
|
||||
//纬度
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getLat())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据纬度为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLat().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据纬度长度过长");
|
||||
}else if (!Pattern.matches(LAT_REGEX, dklMonitoringPointsList.get(i).getLat())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值纬度有误");
|
||||
}
|
||||
}
|
||||
|
||||
//最大承载量
|
||||
if (dklMonitoringPointsList.get(i).getLoadBearingMax()<=0){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据最大承载量为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLoadBearingMax()>=999999999){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据最大承载量长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//风险点
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getIsRisk())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据是否风险点为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getIsRisk().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1)+ "条数据是否风险点长度过长");
|
||||
}else{
|
||||
if (!("Y").equals(dklMonitoringPointsList.get(i).getIsRisk())&&!("N").equals(dklMonitoringPointsList.get(i).getIsRisk())) {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据是否风险点长有误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}
|
||||
else {
|
||||
|
||||
List<DklMonitoringPoints> lists = Stream.of(dklMonitoringPointAll, dklMonitoringPointsList)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
boolean hasDuplicates = lists.stream()
|
||||
.map(DklMonitoringPoints::getPointName)
|
||||
.distinct()
|
||||
.count() != lists.size();
|
||||
if (hasDuplicates) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共导入数据中有和系统原数据名称相同的数据");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
|
||||
} else {
|
||||
for (DklMonitoringPoints dklMonitoringPoints : dklMonitoringPointsList) {
|
||||
//添加系统信息
|
||||
dklMonitoringPoints.setDelFlag("0");
|
||||
dklMonitoringPoints.setCreateTime(new Date());
|
||||
dklMonitoringPoints.setCreateBy(getUsername());
|
||||
dklMonitoringPoints.setDeptId(getDeptId());
|
||||
dklMonitoringPoints.setUpdateTime(new Date());
|
||||
dklMonitoringPoints.setUpdateBy(getUsername());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
dklMonitoringPointsMapper.insertDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPointsNameUnique(DklMonitoringPoints dklMonitoringPoints) {
|
||||
Long deptId = StringUtils.isNull(dklMonitoringPoints.getId()) ? -1L : dklMonitoringPoints.getId();
|
||||
DklMonitoringPoints info = dklMonitoringPointsMapper.checkPointsNameUnique(dklMonitoringPoints.getPointName());
|
||||
if (StringUtils.isNotNull(info) && info.getId() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue