Explorar o código

相机台账导入判断

gao.qiang hai 1 ano
pai
achega
593c7a6c48

+ 47 - 19
business-service/src/main/java/com/ozs/service/impl/BaseCameraManagementServiceImpl.java

@@ -156,29 +156,57 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
 //                                accountManagement.setInstallMile(accountManagement.getInstallMileBD() * 1000);
 //                                accountManagement.setEndMile(accountManagement.getEndMile() * 1000);
 //                                accountManagement.setBeginMile(accountManagement.getBeginMile() * 1000);
-                            if (accountManagement.getBeginMile() < accountManagement.getEndMile()) {
-                                if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
-                                    List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
-                                    for (SysDictData datum : data) {
-                                        if (datum.getDictLabel().equals(cameraManagementVos.getMonitoringDirectionName())) {
-                                            accountManagement.setMonitoringDirection(Integer.valueOf(datum.getDictValue()));
+                            if (accountManagement.getLineDir() == 1) {
+                                if (accountManagement.getBeginMile() < accountManagement.getEndMile()) {
+                                    if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
+                                        List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
+                                        for (SysDictData datum : data) {
+                                            if (datum.getDictLabel().equals(cameraManagementVos.getMonitoringDirectionName())) {
+                                                accountManagement.setMonitoringDirection(Integer.valueOf(datum.getDictValue()));
+                                            }
                                         }
                                     }
+                                    if (!StringUtils.isEmpty(cameraManagementVos.getEnableOrNotName())) {
+                                        accountManagement.setEnableOrNot(cameraManagementVos.getEnableOrNotName().equals("启用") ? 1 : 2);
+                                    }
+                                    baseCameraManagementMapper.insert(accountManagement);
+                                    BaseDeviceDynamicManagement baseDeviceDynamicManagement = new BaseDeviceDynamicManagement();
+                                    baseDeviceDynamicManagement.setCameraCode(accountManagement.getCameraCode());
+                                    baseDeviceDynamicManagement.setUpdateBy(userId);
+                                    baseDeviceDynamicManagement.setCreateBy(userId);
+                                    baseDeviceDynamicManagementMapper.insert(baseDeviceDynamicManagement);
+                                    successNum++;
+                                    successMsg.append(successNum + "、相机编码 " + accountManagement.getCameraCode() + " 导入成功");
+                                } else {
+                                    failureNum++;
+                                    failureMsg.append(failureNum + "、相机编码为: " + accountManagement.getCameraCode() + "的数据,监控范围开始里程位置不能大于监控范围结束里程位置");
                                 }
-                                if (!StringUtils.isEmpty(cameraManagementVos.getEnableOrNotName())) {
-                                    accountManagement.setEnableOrNot(cameraManagementVos.getEnableOrNotName().equals("启用") ? 1 : 2);
+                            }
+                            if (accountManagement.getLineDir() == 2) {
+                                if (accountManagement.getBeginMile() > accountManagement.getEndMile()) {
+                                    if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
+                                        List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
+                                        for (SysDictData datum : data) {
+                                            if (datum.getDictLabel().equals(cameraManagementVos.getMonitoringDirectionName())) {
+                                                accountManagement.setMonitoringDirection(Integer.valueOf(datum.getDictValue()));
+                                            }
+                                        }
+                                    }
+                                    if (!StringUtils.isEmpty(cameraManagementVos.getEnableOrNotName())) {
+                                        accountManagement.setEnableOrNot(cameraManagementVos.getEnableOrNotName().equals("启用") ? 1 : 2);
+                                    }
+                                    baseCameraManagementMapper.insert(accountManagement);
+                                    BaseDeviceDynamicManagement baseDeviceDynamicManagement = new BaseDeviceDynamicManagement();
+                                    baseDeviceDynamicManagement.setCameraCode(accountManagement.getCameraCode());
+                                    baseDeviceDynamicManagement.setUpdateBy(userId);
+                                    baseDeviceDynamicManagement.setCreateBy(userId);
+                                    baseDeviceDynamicManagementMapper.insert(baseDeviceDynamicManagement);
+                                    successNum++;
+                                    successMsg.append(successNum + "、相机编码 " + accountManagement.getCameraCode() + " 导入成功");
+                                } else {
+                                    failureNum++;
+                                    failureMsg.append(failureNum + "、相机编码为: " + accountManagement.getCameraCode() + "的数据,监控范围开始里程位置不能小于监控范围结束里程位置");
                                 }
-                                baseCameraManagementMapper.insert(accountManagement);
-                                BaseDeviceDynamicManagement baseDeviceDynamicManagement = new BaseDeviceDynamicManagement();
-                                baseDeviceDynamicManagement.setCameraCode(accountManagement.getCameraCode());
-                                baseDeviceDynamicManagement.setUpdateBy(userId);
-                                baseDeviceDynamicManagement.setCreateBy(userId);
-                                baseDeviceDynamicManagementMapper.insert(baseDeviceDynamicManagement);
-                                successNum++;
-                                successMsg.append(successNum + "、相机编码 " + accountManagement.getCameraCode() + " 导入成功");
-                            } else {
-                                failureNum++;
-                                failureMsg.append(failureNum + "、相机编码为: " + accountManagement.getCameraCode() + "的数据,监控范围开始里程位置不能大于监控范围结束里程位置");
                             }
                         }
                     } else {