Commit fabca67c9a4aa357a31449f0e8581c5cc688c9c2
Merge remote-tracking branch 'origin/dev' into test
Showing
5 changed files
with
143 additions
and
0 deletions
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/PostUserVO.java
0 → 100644
1 | +package cn.fw.valhalla.domain.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.NoArgsConstructor; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +/** | |
10 | + * @author kurisu | |
11 | + */ | |
12 | +@Data | |
13 | +@AllArgsConstructor | |
14 | +@NoArgsConstructor | |
15 | +public class PostUserVO implements Serializable { | |
16 | + private static final long serialVersionUID = -6108591548534160179L; | |
17 | + /** | |
18 | + * 用户id | |
19 | + */ | |
20 | + private Long userId; | |
21 | + | |
22 | + /** | |
23 | + * 用户姓名 | |
24 | + */ | |
25 | + private String userName; | |
26 | +} | ... | ... |
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/setting/SettingVO.java
1 | 1 | package cn.fw.valhalla.domain.vo.setting; |
2 | 2 | |
3 | 3 | import cn.fw.valhalla.domain.db.setting.FollowSettingDetail; |
4 | +import cn.fw.valhalla.domain.enums.SettingTypeEnum; | |
4 | 5 | import lombok.Data; |
5 | 6 | import lombok.ToString; |
6 | 7 | |
... | ... | @@ -40,6 +41,9 @@ public class SettingVO { |
40 | 41 | SettingVO vo = new SettingVO(); |
41 | 42 | vo.setId(detail.getId()); |
42 | 43 | vo.setDetailValue(detail.getDetailValue()); |
44 | + if (SettingTypeEnum.REVISE_RATIO.equals(detail.getType())) { | |
45 | + vo.setDetailValue(detail.getDetailValue() / 100); | |
46 | + } | |
43 | 47 | vo.setSettingId(detail.getSettingId()); |
44 | 48 | vo.setType(detail.getType().getValue()); |
45 | 49 | vo.setUnit(detail.getUnit().getValue()); | ... | ... |
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/CommonController.java
0 → 100644
1 | +package cn.fw.valhalla.controller.app; | |
2 | + | |
3 | +import cn.fw.data.base.domain.common.Message; | |
4 | +import cn.fw.security.auth.client.annotation.Authorization; | |
5 | +import cn.fw.security.auth.client.annotation.IgnoreAuth; | |
6 | +import cn.fw.security.auth.client.enums.AuthType; | |
7 | +import cn.fw.valhalla.domain.vo.PostUserVO; | |
8 | +import cn.fw.valhalla.service.bus.CommonService; | |
9 | +import lombok.extern.slf4j.Slf4j; | |
10 | +import org.springframework.beans.factory.annotation.Autowired; | |
11 | +import org.springframework.validation.annotation.Validated; | |
12 | +import org.springframework.web.bind.annotation.GetMapping; | |
13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
14 | +import org.springframework.web.bind.annotation.RestController; | |
15 | + | |
16 | +import javax.validation.constraints.NotNull; | |
17 | +import java.util.List; | |
18 | + | |
19 | +import static cn.fw.common.web.util.ExceptionHandler.handleException; | |
20 | +import static cn.fw.common.web.util.ResultBuilder.failureWithMessage; | |
21 | +import static cn.fw.common.web.util.ResultBuilder.success; | |
22 | +import static cn.fw.valhalla.common.constant.MessageStr.SAVE_FAILURE; | |
23 | + | |
24 | +/** | |
25 | + * @author : kurisu | |
26 | + * @className : CommonController | |
27 | + * @description : 公共接口 | |
28 | + * @date: 2020-10-22 11:06 | |
29 | + */ | |
30 | +@Slf4j | |
31 | +@RestController | |
32 | +@Authorization(AuthType.APP) | |
33 | +@Validated | |
34 | +@IgnoreAuth | |
35 | +@RequestMapping("/app/common") | |
36 | +public class CommonController { | |
37 | + private final CommonService commonService; | |
38 | + | |
39 | + @Autowired | |
40 | + public CommonController(final CommonService commonService) { | |
41 | + this.commonService = commonService; | |
42 | + } | |
43 | + | |
44 | + @GetMapping("/staff/list") | |
45 | + public Message<List<PostUserVO>> save(@NotNull(message = "服务站ID不能为空") final Long shopId, | |
46 | + @NotNull(message = "跟进类型ID不能为空") final Integer type) { | |
47 | + final String msg = "查询跟进人员[app/common/staff/list]"; | |
48 | + try { | |
49 | + log.info("{}: param[shopId: {} type: {}]", msg, shopId, type); | |
50 | + List<PostUserVO> list = commonService.getUsers(shopId, type); | |
51 | + return success(list, data -> log.info("{}", data)); | |
52 | + } catch (Exception ex) { | |
53 | + handleException(ex, e -> log.error("{}失败:param[shopId: {} type: {}]", msg, shopId, type, e)); | |
54 | + return failureWithMessage(SAVE_FAILURE); | |
55 | + } | |
56 | + } | |
57 | +} | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CommonService.java
0 → 100644
1 | +package cn.fw.valhalla.service.bus; | |
2 | + | |
3 | +import cn.fw.valhalla.common.constant.RoleCode; | |
4 | +import cn.fw.valhalla.domain.enums.FollowTypeEnum; | |
5 | +import cn.fw.valhalla.domain.vo.PostUserVO; | |
6 | +import cn.fw.valhalla.rpc.erp.UserService; | |
7 | +import cn.fw.valhalla.rpc.erp.dto.PostUserDTO; | |
8 | +import lombok.extern.slf4j.Slf4j; | |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
10 | +import org.springframework.stereotype.Service; | |
11 | + | |
12 | +import java.util.List; | |
13 | +import java.util.stream.Collectors; | |
14 | + | |
15 | +import static cn.fw.common.businessvalidator.Validator.BV; | |
16 | + | |
17 | +/** | |
18 | + * @author : kurisu | |
19 | + * @className : CommonService | |
20 | + * @description : 公共服务 | |
21 | + * @date: 2020-10-22 11:07 | |
22 | + */ | |
23 | +@Service | |
24 | +@Slf4j | |
25 | +public class CommonService { | |
26 | + private final UserService userService; | |
27 | + | |
28 | + @Autowired | |
29 | + public CommonService(final UserService userService) { | |
30 | + this.userService = userService; | |
31 | + } | |
32 | + | |
33 | + public List<PostUserVO> getUsers(final Long shopId, final Integer type) { | |
34 | + FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type); | |
35 | + BV.notNull(typeEnum, () -> "跟进类型错误"); | |
36 | + List<PostUserDTO> userByRole = userService.getUserByRole(shopId, getRoleCode(typeEnum)); | |
37 | + return userByRole.stream().map(user -> new PostUserVO(user.getUserId(), user.getUserName())).collect(Collectors.toList()); | |
38 | + } | |
39 | + | |
40 | + private String getRoleCode(FollowTypeEnum followTypeEnum) { | |
41 | + switch (followTypeEnum) { | |
42 | + case AC: | |
43 | + return RoleCode.SGCGJ; | |
44 | + case IR: | |
45 | + return RoleCode.XBGJ; | |
46 | + case FM: | |
47 | + case RM: | |
48 | + default: | |
49 | + return RoleCode.FWGW; | |
50 | + } | |
51 | + } | |
52 | +} | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/setting/strategy/AbstractSettingStrategy.java
... | ... | @@ -148,6 +148,9 @@ public abstract class AbstractSettingStrategy implements SettingStrategy { |
148 | 148 | detail.setSettingId(setting.getId()); |
149 | 149 | detail.setId(settingDTO.getId()); |
150 | 150 | detail.setDetailValue(settingDTO.getDetailValue()); |
151 | + if (SettingTypeEnum.REVISE_RATIO.getValue().equals(settingDTO.getType())) { | |
152 | + detail.setDetailValue(settingDTO.getDetailValue() * 100); | |
153 | + } | |
151 | 154 | detail.setType(SettingTypeEnum.ofValue(settingDTO.getType())); |
152 | 155 | detail.setUnit(SettingUnitEnum.ofValue(settingDTO.getUnit())); |
153 | 156 | detail.setYn(Boolean.TRUE); |
... | ... | @@ -263,6 +266,7 @@ public abstract class AbstractSettingStrategy implements SettingStrategy { |
263 | 266 | |
264 | 267 | /** |
265 | 268 | * 防重锁 |
269 | + * | |
266 | 270 | * @param groupId |
267 | 271 | * @param type |
268 | 272 | * @return | ... | ... |