Commit aa5754b6a9bba9318fb07b073f40f1c74519cfa6
Merge remote-tracking branch 'origin/dev' into test
Showing
1 changed file
with
7 additions
and
26 deletions
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/erp/SettingController.java
1 | 1 | package cn.fw.valhalla.controller.erp; |
2 | 2 | |
3 | +import cn.fw.common.web.annotation.ControllerMethod; | |
3 | 4 | import cn.fw.common.web.auth.LoginAuthBean; |
4 | 5 | import cn.fw.common.web.auth.annotation.CurrentUser; |
5 | 6 | import cn.fw.data.base.domain.common.Message; |
... | ... | @@ -8,7 +9,6 @@ import cn.fw.security.auth.client.enums.AuthType; |
8 | 9 | import cn.fw.valhalla.domain.dto.SettingDTO; |
9 | 10 | import cn.fw.valhalla.domain.vo.setting.SettingVO; |
10 | 11 | import cn.fw.valhalla.service.bus.setting.SettingBizService; |
11 | -import com.alibaba.fastjson.JSONArray; | |
12 | 12 | import lombok.extern.slf4j.Slf4j; |
13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
14 | 14 | import org.springframework.validation.annotation.Validated; |
... | ... | @@ -19,11 +19,7 @@ import javax.validation.constraints.NotEmpty; |
19 | 19 | import javax.validation.constraints.NotNull; |
20 | 20 | import java.util.List; |
21 | 21 | |
22 | -import static cn.fw.common.web.util.ExceptionHandler.handleException; | |
23 | -import static cn.fw.common.web.util.ResultBuilder.failureWithMessage; | |
24 | 22 | import static cn.fw.common.web.util.ResultBuilder.success; |
25 | -import static cn.fw.valhalla.common.constant.MessageStr.QUERY_FAILURE; | |
26 | -import static cn.fw.valhalla.common.constant.MessageStr.SAVE_FAILURE; | |
27 | 23 | |
28 | 24 | /** |
29 | 25 | * @author : kurisu |
... | ... | @@ -53,17 +49,10 @@ public class SettingController { |
53 | 49 | * @return |
54 | 50 | */ |
55 | 51 | @GetMapping("/list") |
52 | + @ControllerMethod("查询配置列表") | |
56 | 53 | public Message<List<SettingVO>> getList(@CurrentUser LoginAuthBean currentUser, |
57 | 54 | @NotNull(message = "跟进类型不能为空") final Integer category) { |
58 | - final String msg = "查询配置列表[setting/list]"; | |
59 | - try { | |
60 | - log.info("{}: param[{}]", msg, category); | |
61 | - List<SettingVO> list = settingBizService.querySettingByCat(category, currentUser.getGroupId()); | |
62 | - return success(list, data -> log.info("{}", data)); | |
63 | - } catch (Exception ex) { | |
64 | - handleException(ex, e -> log.error("{}失败:param[{}]", msg, category, e)); | |
65 | - return failureWithMessage(QUERY_FAILURE); | |
66 | - } | |
55 | + return success(settingBizService.querySettingByCat(category, currentUser.getGroupId())); | |
67 | 56 | } |
68 | 57 | |
69 | 58 | /** |
... | ... | @@ -74,17 +63,9 @@ public class SettingController { |
74 | 63 | * @return |
75 | 64 | */ |
76 | 65 | @PostMapping("/save") |
77 | - public Message<Void> save(@CurrentUser LoginAuthBean currentUser, | |
78 | - @RequestBody @NotEmpty(message = "设置项不能为空") @Valid final List<SettingDTO> list) { | |
79 | - final String msg = "保存配置[setting/save]"; | |
80 | - try { | |
81 | - log.info("{}: param[{}]", msg, JSONArray.toJSONString(list)); | |
82 | - boolean success = settingBizService.saveSetting(list, currentUser.getGroupId()); | |
83 | - log.info("{}: 操作状态[{}]", msg, success); | |
84 | - return success(); | |
85 | - } catch (Exception ex) { | |
86 | - handleException(ex, e -> log.error("{}失败", msg, e)); | |
87 | - return failureWithMessage(SAVE_FAILURE); | |
88 | - } | |
66 | + @ControllerMethod("保存配置") | |
67 | + public Message<Boolean> save(@CurrentUser LoginAuthBean currentUser, | |
68 | + @RequestBody @NotEmpty(message = "设置项不能为空") @Valid final List<SettingDTO> list) { | |
69 | + return success(settingBizService.saveSetting(list, currentUser.getGroupId())); | |
89 | 70 | } |
90 | 71 | } | ... | ... |