zhang
7 天以前 12c3f4de5ce151b50e187066a3c105260523abb8
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
package com.zy.acs.manager.core.integrate.charge;
 
import com.ghgande.j2mod.modbus.facade.ModbusTCPMaster;
import com.zy.acs.charge.ChargeCoreService;
import com.zy.acs.charge.model.ChargerStatus;
import com.zy.acs.common.constant.RedisConstant;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.framework.common.R;
import com.zy.acs.manager.common.annotation.IntegrationAuth;
import com.zy.acs.manager.core.domain.type.NamespaceType;
import com.zy.acs.manager.core.service.ChargeService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@Api(tags = "Open Api")
@RestController
@RequestMapping("/api/open")
public class ChargeTestController {
 
    private final RedisSupport redis = RedisSupport.defaultRedisSupport;
 
 
 
    @Autowired
    private ChargeService chargeService;
 
    @Autowired
    private ChargeCoreService chargeCoreService;
 
    @IntegrationAuth(name = NamespaceType.RCS_STA_QUERY)
    @GetMapping("/charge/{type}")
    public R test(@PathVariable("type") String type){
        ModbusTCPMaster modbusTCPMaster = chargeService.get(type);
        ChargerStatus status = chargeCoreService.getStatus(modbusTCPMaster);
        return R.ok(status);
    }
 
    @IntegrationAuth(name = NamespaceType.RCS_STA_QUERY)
    @GetMapping("/write/{agvId}/{type}")
    public R test2(@PathVariable("agvId") Integer agvId,@PathVariable("type") Integer type){
        redis.setMap(RedisConstant.AGV_CHARGE_FLAG, agvId+"", type);
        return R.ok();
    }
 
}