package com.qianwen.mdc.controller;
|
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.qianwen.mdc.common.OpResult;
|
import com.qianwen.mdc.dto.MachineQueryDTO;
|
import com.qianwen.mdc.dto.WorkshopMapDTO;
|
import com.qianwen.mdc.service.machine.MachineQueryService;
|
import com.qianwen.mdc.service.sysaccount.AccountTokenService;
|
|
|
/**
|
*
|
*/
|
@RestController
|
@CrossOrigin
|
@RequestMapping(value = "/machine", method = RequestMethod.POST)
|
public class MachineQueryController {
|
@Autowired
|
private AccountTokenService accountTokenService;
|
|
@Autowired
|
private MachineQueryService queryService;
|
|
public static final Logger logger = LoggerFactory.getLogger(MachineQueryController.class);
|
|
/**
|
* 车间地图的设备列表,原来的列表未车间地图和车间列表共用
|
* @param token
|
* @param dto 查询参数对象
|
* @return
|
*/
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
public OpResult<WorkshopMapDTO> machineList4WorkshopMap(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
|
MachineQueryDTO dto) {
|
|
try {
|
accountTokenService.checkToken(token);
|
return OpResult.success(this.queryService.list4WorkshopMap(dto));
|
}catch(Exception e) {
|
logger.error("查询异常2",e);
|
return OpResult.fail(e.getMessage());
|
}
|
}
|
|
|
|
}
|