DeviceLocationController.java 2.13 KB
package cn.com.glsx.stdinterface.modules.controller;

import cn.com.glsx.stdinterface.api.DeviceLocationClient;
import cn.com.glsx.stdinterface.dto.DeviceLocationDto;
import cn.com.glsx.stdinterface.modules.service.DeviceLocationService;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;

/**
 * 设备上点表Controller
 *
 * @author yll
 */
@Slf4j
@RestController
@RequestMapping(value = "/devicelocation")
@Api(value = "设备上点", tags = {"设备上点"})
public class DeviceLocationController implements DeviceLocationClient {

    private final static String MODULE = "设备上点";

    @Autowired
    private DeviceLocationService deviceLocationService;

    @Override
    @PostMapping(value = "/saveorupdatedevicelocationdata")
    @SysLog(module = MODULE, value = "插入或者更新设备上点数据", action = OperateType.EDIT)
    @ApiOperation(value = "插入或者更新设备上点数据")
    public R<Integer> saveOrUpdateDeviceLocationData(Collection<DeviceLocationDto> deviceLocationDtos) {
        log.info("插入或者更新设备上点数据大小===" + deviceLocationDtos.size());
        deviceLocationService.saveOrUpdateDeviceLocationData(deviceLocationDtos);
        return R.ok();
    }

    @Override
    @GetMapping(value = "/getallsninneweshield")
    @SysLog(module = MODULE, value = "获取E盾中的所有设备号集合", action = OperateType.QUERY)
    @ApiOperation(value = "获取E盾中的所有设备号集合")
    public R<List<String>> getAllSnInNewEshield() {
        List<String> allSns = deviceLocationService.getAllSnInNewEshield();
        return R.ok().data(allSns);
    }
}