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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.changhong.autoform.rest.associateDataSourse;
 
import java.util.List;
import java.util.Map;
 
 
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.changhong.autoform.entity.BudgetData;
import com.changhong.autoform.entity.BudgetTitle;
import com.changhong.autoform.entity.ProcessBudget;
import com.changhong.autoform.entity.system.RestResult;
import com.changhong.autoform.entity.system.RestResultGenerator;
import com.changhong.autoform.mapper.associate.Associate;
import com.changhong.autoform.rest.excute.Execute;
import com.iemsoft.framework.cloud.core.tools.SpringUtil;
import com.changhong.autoform.constant.data.DataUrl;
import com.changhong.autoform.core.msg.StateMsg;
 
@RestController
@RequestMapping(method=RequestMethod.POST)
public class AssociateDataSourseRest implements DataUrl{
 
    
    @RequestMapping(SELECT_ASSOCIATEDATASOURSE)
    public RestResult<List<Map<String, Object>>> getAssociateDataSourse(){
        List<Map<String, Object>> result = null ;
        List<Associate> associate = SpringUtil.getBeans(Associate.class);
        try {
            result = (associate.get(0) != null ? associate.get(0).getAssociateDataSourse() : null);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return RestResultGenerator.ok(result);
    }
    
    @RequestMapping(SELECT_ASSOCIATEDATA)
    public RestResult<Map<String, Object>> getAssociateData(@RequestBody BudgetData budgetData){
        Map<String, Object> result = null;
        List<Associate> associate = SpringUtil.getBeans(Associate.class);
        try {
            result = (associate.get(0) != null ? associate.get(0).getAssociateData(budgetData) : null);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return RestResultGenerator.ok(result);
    }
    
    @RequestMapping(SELECT_ASSOCIATETITLE)
    public RestResult<List<BudgetTitle>> getAssociateTitle(@RequestBody Map<String, Object> key){
        List<BudgetTitle> result = null;
        List<Associate> associate = SpringUtil.getBeans(Associate.class);
        try {
            result = (associate.get(0) != null ? associate.get(0).getAssociateTitle(key.get("key").toString()) : null);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return RestResultGenerator.ok(result);
    }
        
    
    @RequestMapping(FORM_DATA_BUDGET)
    public RestResult<Boolean> processBudget(@RequestBody ProcessBudget processBudget){
        List<Execute> executes = SpringUtil.getBeans(Execute.class);
        Boolean result = false;
        result = executes.get(0).executeProcessBudget(processBudget);
        return RestResultGenerator.ok(result);
    }
    
    @RequestMapping(FORM_DATA_REFUNDS)
    public RestResult<Boolean> processRefunds(@RequestBody ProcessBudget processBudget){
        List<Execute> executes = SpringUtil.getBeans(Execute.class);
        Boolean result = false;
        result = executes.get(0).processRefunds(processBudget);
        return RestResultGenerator.ok(result);
    }
}