Administrator
2024-06-13 9860dd8d6a437ba7e11168f490f86d4cc6edf584
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.dy.pipIrrMwTestWeb.test;
 
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1;
import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0;
import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com97Vo;
import com.dy.common.mw.protocol.p206V1_0_0.downVos.Com98Vo;
import com.dy.common.webUtil.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * @Author: liurunyu
 * @Date: 2024/5/29 09:17
 * @Description
 */
@Slf4j
@RestController
@RequestMapping(path="comP206V100")
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class CommandP206V100Ctrl extends ComSupportP206V100 {
 
    @GetMapping(path = "test")
    public BaseResponse<String> test() {
        //return this.connect() ;//连接通信中间件测试
        //return this.cd97() ;
        //return this.cd98() ;
        return this.online() ;
    }
 
    /**
     * 测试连通性
     * @return
     */
    private BaseResponse connect(){
        return this.sendTest() ;
    }
 
    //APP远程开阀
    private BaseResponse cd97(){
        Com97Vo comVo = new Com97Vo() ;
        comVo.icCardNo = CommandP206V100Ctrl.icCardNo ;
        comVo.moneyRemain = 234.56 ;
        comVo.waterPrice = 1.2 ;
 
        return this.sendCom2Mw(this.command(CodeV1_0_1.cd_97, comVo, null)) ;
    }
    //APP远程关阀
    private BaseResponse cd98(){
        Com98Vo comVo = new Com98Vo() ;
        comVo.icCardNo = CommandP206V100Ctrl.icCardNo ;
        return this.sendCom2Mw(this.command(CodeV1_0_1.cd_98, comVo, null)) ;
    }
    //在线情况
    private BaseResponse online(){
        Command com = new Command() ;
        com.id = Command.defaultId;//实际应用中,替换成数据库记录id
        com.protocol = ProtocolConstantV206V1_0_0.protocolName ;
        com.code = CodeLocal.onLine ;
        com.type = CommandType.innerCommand ;
        com.rtuResultSendWebUrl = rtuResultSendWebUrl ;
        return this.sendCom2Mw(com) ;
    }
 
 
}