zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
package com.codingapi.tm.api.controller;
 
import com.codingapi.tm.api.service.ApiTxManagerService;
import com.codingapi.tm.model.TxServer;
import com.codingapi.tm.model.TxState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * Created by lorne on 2017/7/1.
 */
@RestController
@RequestMapping("/tx/manager")
public class TxManagerController {
 
    private Logger logger = LoggerFactory.getLogger(TxManagerController.class);
 
    @Autowired
    private ApiTxManagerService apiTxManagerService;
 
 
    @RequestMapping("/getServer")
    public TxServer getServer() {
        return apiTxManagerService.getServer();
    }
 
 
    @RequestMapping("/cleanNotifyTransaction")
    public int cleanNotifyTransaction(@RequestParam("groupId") String groupId,@RequestParam("taskId") String taskId) {
        return apiTxManagerService.cleanNotifyTransaction(groupId,taskId);
    }
 
 
    @RequestMapping("/sendMsg")
    public String sendMsg(@RequestParam("msg") String msg,@RequestParam("model") String model) {
        logger.info("msg:"+msg+",model:"+model);
        String obj = apiTxManagerService.sendMsg(model,msg);
        logger.info("result:"+obj);
        return obj;
    }
 
 
    @RequestMapping("/sendCompensateMsg")
    public boolean sendCompensateMsg(@RequestParam("model") String model, @RequestParam("uniqueKey") String uniqueKey,
                                     @RequestParam("currentTime") long currentTime,
                                     @RequestParam("groupId") String groupId, @RequestParam("className") String className,
                                     @RequestParam("time") int time, @RequestParam("data") String data,
                                     @RequestParam("methodStr") String methodStr, @RequestParam("address") String address,
                                     @RequestParam("startError") int startError) {
        return apiTxManagerService.sendCompensateMsg(currentTime, groupId, model, address, uniqueKey, className, methodStr, data, time,startError);
    }
 
 
 
    @RequestMapping("/state")
    public TxState state() {
        return apiTxManagerService.getState();
    }
}