Commit 1e060a01 by 杨林龙

假性离线需求开发--- 优化导入校验

1 parent b93289ed
...@@ -239,7 +239,7 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn ...@@ -239,7 +239,7 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
// 校验车辆和设备的绑定关系 // 校验车辆和设备的绑定关系
checkVinAndDevice(stringBuilder, vi.getVin(), vi.getSn(), importSnList, vehicleAndDeviceMap); checkVinAndDevice(stringBuilder, vi.getVin(), vi.getSn(), importSnList, vehicleAndDeviceMap);
importSnList.add(vi.getVin().concat("-").concat(vi.getSn())); importSnList.add((vi.getVin() == null ? "" : vi.getVin()).concat("-").concat(vi.getSn()));
if (StringUtils.isNotEmpty(stringBuilder)) { if (StringUtils.isNotEmpty(stringBuilder)) {
WhiteListFailExport failExport = new WhiteListFailExport(); WhiteListFailExport failExport = new WhiteListFailExport();
...@@ -281,8 +281,8 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn ...@@ -281,8 +281,8 @@ public class WhiteListSnImportListener extends AnalysisEventListener<WhiteListSn
*/ */
private void checkVinAndDevice(StringBuilder stringBuilder, String vin, String sn, List<String> importSnList, Map<String, String> vehicleAndDeviceMap) { private void checkVinAndDevice(StringBuilder stringBuilder, String vin, String sn, List<String> importSnList, Map<String, String> vehicleAndDeviceMap) {
// 校验设备号是否重复 // 校验设备号是否重复
if (importSnList.contains(vin.concat("-").concat(sn))) { if (importSnList.contains((vin == null ? "" : vin).concat("-").concat(sn))) {
stringBuilder.append(vin.concat("-").concat(sn)).append("重复数据;"); stringBuilder.append((vin == null ? "" : vin).concat("-").concat(sn)).append("重复数据;");
} }
String sns = vehicleAndDeviceMap.get(vin); String sns = vehicleAndDeviceMap.get(vin);
......
...@@ -70,6 +70,7 @@ public class FakeOfflineService extends AbstractCommonService { ...@@ -70,6 +70,7 @@ public class FakeOfflineService extends AbstractCommonService {
Map<String, Integer> reasonMap = Maps.newHashMap(); Map<String, Integer> reasonMap = Maps.newHashMap();
List<String> vinList = getFakeOfficeVinList(reasonMap); List<String> vinList = getFakeOfficeVinList(reasonMap);
if (CollectionUtil.isEmpty(vinList)) { if (CollectionUtil.isEmpty(vinList)) {
log.warn("没有假性离线车辆===" + ShieldContextHolder.getUsername());
return new PageInfo(); return new PageInfo();
} }
...@@ -111,10 +112,10 @@ public class FakeOfflineService extends AbstractCommonService { ...@@ -111,10 +112,10 @@ public class FakeOfflineService extends AbstractCommonService {
} }
} }
} }
//对于触碰围栏假性离线的设备 封装家庭地址和工作地址
buildPredictAddr(fakeOfficeExport, vin);
builder.append("】设备离线"); builder.append("】设备离线");
fakeOfficeExport.setReason(builder.toString()); fakeOfficeExport.setReason(builder.toString());
//对于触碰围栏假性离线的设备 封装家庭地址和工作地址
buildPredictAddr(fakeOfficeExport, vin);
} }
} }
...@@ -170,10 +171,10 @@ public class FakeOfflineService extends AbstractCommonService { ...@@ -170,10 +171,10 @@ public class FakeOfflineService extends AbstractCommonService {
List<FakeOfficeMapDto> vehicleNumMapList = fakeOfflineVinMapper.getVehicleNumMap(); List<FakeOfficeMapDto> vehicleNumMapList = fakeOfflineVinMapper.getVehicleNumMap();
log.info("vehicleNumMapList===" + JSONUtil.toJsonStr(vehicleNumMapList)); log.info("vehicleNumMapList===" + JSONUtil.toJsonStr(vehicleNumMapList));
vehicleNumMapList.forEach(vehicleNum -> vehicleNumMap.put(vehicleNum.getVin(), vehicleNum.getNum())); vehicleNumMapList.forEach(vehicleNum -> vehicleNumMap.put(vehicleNum.getVin(), vehicleNum.getNum()));
log.info("vehicleNumMap===" + JSONUtil.toJsonStr(vehicleNumMap));
Map<String, Integer> offlineVehicleNumMap = Maps.newHashMap(); Map<String, Integer> offlineVehicleNumMap = Maps.newHashMap();
List<FakeOfficeMapDto> offlineVehicleNumMapList = fakeOfflineVinMapper.getOfflineVehicleNumMap(); List<FakeOfficeMapDto> offlineVehicleNumMapList = fakeOfflineVinMapper.getOfflineVehicleNumMap();
log.info("offlineVehicleNumMapList===" + JSONUtil.toJsonStr(offlineVehicleNumMapList));
offlineVehicleNumMapList.forEach(offlineVehicleNum -> offlineVehicleNumMap.put(offlineVehicleNum.getVin(), offlineVehicleNum.getNum())); offlineVehicleNumMapList.forEach(offlineVehicleNum -> offlineVehicleNumMap.put(offlineVehicleNum.getVin(), offlineVehicleNum.getNum()));
for (Map.Entry<String, Integer> stringIntegerEntry : offlineVehicleNumMap.entrySet()) { for (Map.Entry<String, Integer> stringIntegerEntry : offlineVehicleNumMap.entrySet()) {
String vin = stringIntegerEntry.getKey(); String vin = stringIntegerEntry.getKey();
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</sql> </sql>
<select id="getFakeOfflineVinByFence" resultType="String"> <select id="getFakeOfflineVinByFence" resultType="String">
SELECT DISTINCT tfov.vin FROM t_fake_offline_vin tfov WHERE tfov.del_flag = 0 AND tfov.`status` = 1; SELECT DISTINCT tfov.vin FROM t_fake_offline_vin tfov WHERE tfov.del_flag = 0 AND tfov.`status` = 1
</select> </select>
<select id="getVehicleNumMap" resultType="cn.com.glsx.admin.modules.model.FakeOfficeMapDto"> <select id="getVehicleNumMap" resultType="cn.com.glsx.admin.modules.model.FakeOfficeMapDto">
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvd.del_flag = 0 and tvd.del_flag = 0
group by tv.vin; group by tv.vin
</select> </select>
<select id="getOfflineVehicleNumMap" resultType="cn.com.glsx.admin.modules.model.FakeOfficeMapDto"> <select id="getOfflineVehicleNumMap" resultType="cn.com.glsx.admin.modules.model.FakeOfficeMapDto">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and
timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1) timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1)
or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0)) or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0))
group by tv.vin; group by tv.vin
</select> </select>
<select id="searchFakeOfficeList" resultType="cn.com.glsx.admin.modules.model.export.FakeOfficeExport"> <select id="searchFakeOfficeList" resultType="cn.com.glsx.admin.modules.model.export.FakeOfficeExport">
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and and ((timestampdiff(SECOND, tdl.last_gps_time, now()) > 259200 and
timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1) timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 1)
or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0)) or (timestampdiff(SECOND, tdl.last_bs_time, now()) > 259200 and td.source = 0))
<if test="vinList != null and vinList.size !=0 "> <if test="vinList != null and vinList.size > 0 ">
and tv.vin in and tv.vin in
<foreach collection="vinList" separator="," open="(" close=")" item="item"> <foreach collection="vinList" separator="," open="(" close=")" item="item">
#{item} #{item}
...@@ -91,5 +91,6 @@ ...@@ -91,5 +91,6 @@
from t_fake_offline_vin from t_fake_offline_vin
where vin = #{vin} where vin = #{vin}
and status = 1 and status = 1
and del_flag = 0
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
</update> </update>
<select id="getWriteListVin" resultType="String"> <select id="getWriteListVin" resultType="String">
SELECT DISTINCT vin FROM t_whitelist_sn WHERE 1 = 1 SELECT DISTINCT vin FROM t_whitelist_sn WHERE del_flag = 0
<if test="deptIds != null "> <if test="deptIds != null and deptIds.size() > 0">
department_id IN and department_id IN
<foreach collection="deptIds" separator="," open="(" close=")" item="item"> <foreach collection="deptIds" separator="," open="(" close=")" item="item">
#{item} #{item}
</foreach> </foreach>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!