y_ys79
2024-01-05 e5840972b6b17ec03bfc1069a9cacfe0cef189c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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());
        }
    }
 
    
    
}