QuotaConfigAction.java
2.55 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.cjs.cms.action.quota;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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;
import com.cjs.cms.biz.ServiceException;
import com.cjs.cms.biz.quota.QuotaConfigBiz;
import com.cjs.cms.model.quota.QuotaConfigInfo;
import com.cjs.cms.util.lang.JsonUtil;
/**
* 权益分配
* @author tongxiaochuan
*
*/
@RestController
@RequestMapping("/quota/config")
public class QuotaConfigAction{
Logger log = LogManager.getLogger();
@Autowired
private QuotaConfigBiz quotaConfigBiz;
public static Integer RUNNING = 0;
/**
* 根据藏品编号查询藏品名
* @param otcCode
* @return
*/
@RequestMapping("/getOtcName")
public String getOtcNameBuOtcCode(String otcCode){
return JsonUtil.toJson("otcName", quotaConfigBiz.getOtcNameByOtcCode(otcCode));
}
/**
* 新增权益分配
* @param quotaConfig
* @return
*/
@RequestMapping("/add")
public String add(QuotaConfigInfo quotaConfig){
String msg = JsonUtil.toFormJson("操作成功", true);
try {
quotaConfigBiz.add(quotaConfig);
} catch (ServiceException e) {
log.info(e.getMessage());
msg = JsonUtil.toFormJson(e.getMessage(), false);
}
return msg;
}
/**
* 按条件查询列表
* @param params
* @return
*/
@RequestMapping("/list")
public String list(@RequestParam Map<String, Object> params){
return quotaConfigBiz.getConfigList(params);
}
/**作废*/
@RequestMapping("/invalid")
public int invalid(Integer id) {
return quotaConfigBiz.invalid(id);
}
/**
* 更新分配
* @param id
* @param act
* @return
*/
@RequestMapping("/allot")
public String allot(Integer id){
if (RUNNING == 1) {
return JsonUtil.toFormJson("正在执行,请不要重复操作", false);
}
RUNNING = 1;
try {
quotaConfigBiz.allot(id);
} catch (Exception e) {
log.info("", e);
return JsonUtil.toFormJson(e.getMessage(), false);
} finally {
RUNNING = 0;
}
return JsonUtil.toFormJson("权益分配成功", true);
}
/**
* 根据id获取配置信息
* @param id
* @return
*/
@RequestMapping("/queryById")
public QuotaConfigInfo queryById(String id){
return quotaConfigBiz.getConfigById(id);
}
}