#
Junjie
7 天以前 141696efeb3598b2a8c62aada6e6b45734e56f11
src/main/java/com/zy/asrs/controller/BasMapController.java
@@ -9,6 +9,7 @@
import com.core.common.DateUtils;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.BasMap;
import com.zy.asrs.entity.BasStation;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.BasMapService;
@@ -16,6 +17,7 @@
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.service.BasStationService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.utils.MapExcelUtils;
import com.zy.common.utils.RedisUtil;
@@ -41,6 +43,10 @@
    private DeviceConfigService deviceConfigService;
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private MapExcelUtils mapExcelUtils;
    @Autowired
    private BasStationService basStationService;
    @RequestMapping(value = "/basMap/{id}/auth")
    @ManagerAuth
@@ -158,9 +164,6 @@
        return R.ok().add(levList);
    }
    @Autowired
    private MapExcelUtils mapExcelUtils;
    @PostMapping("/basMap/crn/upload")
    public R uploadExcel(@RequestParam("file") MultipartFile file) throws IOException {
        // 保存上传的文件到临时位置
@@ -204,6 +207,7 @@
                        StationObjModel stationObjModel = new StationObjModel();
                        stationObjModel.setDeviceNo(deviceNo);
                        stationObjModel.setStationId(value.getInteger("stationId"));
                        stationObjModel.setStationLev(lev);
                        List<StationObjModel> stationList = deviceStationMap.getOrDefault(deviceNo, new ArrayList<>());
                        stationList.add(stationObjModel);
@@ -276,8 +280,9 @@
            basMap.setUpdateTime(new Date());
            basMap.setLev(lev);
            basMapService.insertOrUpdate(basMap);
        }
        basStationService.delete(new EntityWrapper<>());
        deviceStationMap.forEach((deviceNo, stationList) -> {
            BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("devp_no", deviceNo));
@@ -318,6 +323,16 @@
                deviceConfig.setFakeInitStatus(JSON.toJSONString(stationList));
                deviceConfigService.updateById(deviceConfig);
            }
            for (StationObjModel stationObjModel : stationList) {
                BasStation basStation = new BasStation();
                basStation.setStationId(stationObjModel.getStationId());
                basStation.setDeviceNo(stationObjModel.getDeviceNo());
                basStation.setStationLev(stationObjModel.getStationLev());
                basStation.setCreateTime(new Date());
                basStation.setStatus(1);
                basStationService.insert(basStation);
            }
        });
        return R.ok();
    }