Commit 2737c109 authored by 王晓倩's avatar 王晓倩

预警数据推送校验设备编号是否存在

parent cc78ea6b
......@@ -349,6 +349,10 @@ public class TDetectorReportController extends BaseController
log.error("【新增泽宏设备上报数据】参数不正确,zhDeviceReportDataForm={}",tDetectorReportDataForm);
throw new IOCException(ResultEnum.PARAM_ERROR.getCode(),bindingResult.getFieldError().getDefaultMessage());
}
TDetectorInfo detector = tDetectorInfoService.selectTDetectorInfoByCode(tDetectorReportDataForm.getDeviceNo());
if(detector == null){
throw new IOCException(ResultEnum.DETECTOR_NOEXIST);
}
log.info("泽宏设备上报数据===="+tDetectorReportDataForm.toString());
try {
......
......@@ -55,9 +55,9 @@ public enum ResultEnum {
ENTERPRISE_EXIST(6000, "企业机构代码已注册!"),
ENTERPRISE_NOEXIST(6001, "企业机构代码不存在!")
ENTERPRISE_NOEXIST(6001, "企业机构代码不存在!"),
DETECTOR_NOEXIST(7000, "探测器编号不存在!")
;
......
......@@ -19,6 +19,14 @@ public interface TDetectorInfoMapper
*/
public TDetectorInfo selectTDetectorInfoById(Long detectorId);
/**
* 查询探测器
*
* @param detectorCode 探测器编号
* @return 探测器
*/
public TDetectorInfo selectTDetectorInfoByCode(String detectorCode);
/**
* 查询探测器列表
*
......
......@@ -20,6 +20,14 @@ public interface ITDetectorInfoService
*/
public TDetectorInfo selectTDetectorInfoById(Long detectorId);
/**
* 查询探测器
*
* @param detectorCode 探测器编号
* @return 探测器
*/
public TDetectorInfo selectTDetectorInfoByCode(String detectorCode);
/**
* 查询探测器列表
*
......
......@@ -32,6 +32,16 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
return tDetectorInfoMapper.selectTDetectorInfoById(detectorId);
}
/**
* 查询探测器
*
* @param detectorCode 探测器编号
* @return 探测器
*/
public TDetectorInfo selectTDetectorInfoByCode(String detectorCode) {
return tDetectorInfoMapper.selectTDetectorInfoByCode(detectorCode);
}
/**
* 查询探测器列表
*
......
......@@ -58,6 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTDetectorInfoVo"/>
where detector_id = #{detectorId}
</select>
<select id="selectTDetectorInfoByCode" parameterType="String" resultMap="TDetectorInfoResult">
<include refid="selectTDetectorInfoVo"/>
where detector_code = #{detectorCode}
and is_del = '0'
</select>
<insert id="insertTDetectorInfo" parameterType="TDetectorInfo" useGeneratedKeys="true" keyProperty="detectorId">
insert into t_detector_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment