Commit 791685da22cc64316742dfb5f8cd1af61c4aca74
1 parent
3b6e7ba7
2022年10月19日16:20:50
Showing
27 changed files
with
383 additions
and
72 deletions
fw-dalaran-common/src/main/java/cn/fw/dalaran/common/constants/DalaranConstants.java renamed to fw-dalaran-common/src/main/java/cn/fw/dalaran/common/constants/Constants.java
... | ... | @@ -6,7 +6,7 @@ package cn.fw.dalaran.common.constants; |
6 | 6 | * @date 2022/4/13 16:40 |
7 | 7 | * @Description Dalaran系统常量 |
8 | 8 | */ |
9 | -public interface DalaranConstants { | |
9 | +public interface Constants { | |
10 | 10 | /** |
11 | 11 | * 系统名 |
12 | 12 | */ |
... | ... | @@ -35,4 +35,14 @@ public interface DalaranConstants { |
35 | 35 | * 直播审计角色码 |
36 | 36 | */ |
37 | 37 | String ZBSJ_ROLE_CODE = "ZMT-ZBSJ"; |
38 | + | |
39 | + /** | |
40 | + * 薪酬绩效相关常量 | |
41 | + */ | |
42 | + interface Performance { | |
43 | + /** | |
44 | + * 综合得分目标达成率 | |
45 | + */ | |
46 | + String SCORE_RATE = "6574EA0766114615"; | |
47 | + } | |
38 | 48 | } | ... | ... |
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/db/ConfigGroup.java
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/db/GlobalConfig.java
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/enums/ConfigEnum.java
fw-dalaran-domain/src/main/java/cn/fw/dalaran/domain/vo/ConfigGroupVo.java
fw-dalaran-rpc/pom.xml
... | ... | @@ -39,6 +39,11 @@ |
39 | 39 | <groupId>cn.fw</groupId> |
40 | 40 | <artifactId>fw-attendance-sdk</artifactId> |
41 | 41 | </dependency> |
42 | + <!-- 绩效系统 --> | |
43 | + <dependency> | |
44 | + <groupId>cn.fw</groupId> | |
45 | + <artifactId>fw-morax-sdk</artifactId> | |
46 | + </dependency> | |
42 | 47 | <!-- 校验注解 --> |
43 | 48 | <dependency> |
44 | 49 | <groupId>javax.validation</groupId> | ... | ... |
fw-dalaran-rpc/src/main/java/cn/fw/dalaran/rpc/erp/ErpTaskRpc.java
1 | 1 | package cn.fw.dalaran.rpc.erp; |
2 | 2 | |
3 | 3 | import cn.fw.common.exception.BusinessException; |
4 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
4 | +import cn.fw.dalaran.common.constants.Constants; | |
5 | 5 | import cn.fw.dalaran.rpc.erp.dto.TaskSetReq; |
6 | 6 | import cn.fw.data.base.domain.common.Message; |
7 | 7 | import cn.fw.erp.sdk.api.TaskApi; |
... | ... | @@ -29,7 +29,7 @@ public class ErpTaskRpc { |
29 | 29 | try { |
30 | 30 | TaskAddReq<T> addReq = new TaskAddReq<>(); |
31 | 31 | BeanUtils.copyProperties(req, addReq); |
32 | - addReq.setSystem(DalaranConstants.APPLICATION_NAME); | |
32 | + addReq.setSystem(Constants.APPLICATION_NAME); | |
33 | 33 | final Message<Long> msg = taskApi.addTask(addReq); |
34 | 34 | log.info("调用ERP系统添加定时任务结果[{}]", JSON.toJSONString(msg)); |
35 | 35 | } catch (Exception e) { | ... | ... |
fw-dalaran-rpc/src/main/java/cn/fw/dalaran/rpc/morax/SalaryRpc.java
0 → 100644
1 | +package cn.fw.dalaran.rpc.morax; | |
2 | + | |
3 | +import cn.fw.dalaran.common.utils.PublicUtil; | |
4 | +import cn.fw.data.base.domain.common.Message; | |
5 | +import cn.fw.morax.sdk.api.IKpiReportService; | |
6 | +import cn.fw.morax.sdk.api.ISalaryReportService; | |
7 | +import cn.fw.morax.sdk.dto.CustomList; | |
8 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserQuery; | |
9 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserResult; | |
10 | +import cn.fw.morax.sdk.dto.kpi.UserIndicatorReq; | |
11 | +import lombok.RequiredArgsConstructor; | |
12 | +import lombok.extern.slf4j.Slf4j; | |
13 | +import org.springframework.stereotype.Component; | |
14 | + | |
15 | +import java.util.Collections; | |
16 | +import java.util.List; | |
17 | + | |
18 | + | |
19 | +/** | |
20 | + * @author wmy3969 | |
21 | + * @version 1.0 | |
22 | + * @date 2022/10/9 14:05 | |
23 | + * @Description 绩效薪酬rpc | |
24 | + */ | |
25 | +@Slf4j | |
26 | +@Component | |
27 | +@RequiredArgsConstructor | |
28 | +public class SalaryRpc { | |
29 | + | |
30 | + private final IKpiReportService kpiApi;// 绩效api | |
31 | + private final ISalaryReportService salaryApi;// 薪酬api | |
32 | + | |
33 | + /** | |
34 | + * 查询绩效组人员 | |
35 | + */ | |
36 | + public List<KpiGroupUserResult> queryGroupUsers(KpiGroupUserQuery kpiGroupUserQuery) { | |
37 | + try { | |
38 | + Message<List<KpiGroupUserResult>> groupUser = kpiApi.queryKpiGroupUser(kpiGroupUserQuery); | |
39 | + PublicUtil.assertTrue(groupUser.isSuccess(), "查询绩效组人员失败!"); | |
40 | + return groupUser.getData(); | |
41 | + } catch (Exception e) { | |
42 | + log.error("查询绩效组人员发生错误, 错误信息为: {}", e.getMessage()); | |
43 | + return Collections.emptyList(); | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * 上报人员绩效数据 | |
49 | + */ | |
50 | + public void reportKpi(CustomList<UserIndicatorReq> userIndicatorList) { | |
51 | + try { | |
52 | + Message<Void> msg = kpiApi.indicatorReport(userIndicatorList); | |
53 | + PublicUtil.assertTrue(msg.isSuccess(), "上报人员绩效数据失败!"); | |
54 | + } catch (Exception e) { | |
55 | + log.error("上报人员绩效数据发生错误, 错误信息为: {}", e.getMessage()); | |
56 | + } | |
57 | + } | |
58 | + | |
59 | +} | ... | ... |
fw-dalaran-server/pom.xml
... | ... | @@ -26,6 +26,11 @@ |
26 | 26 | <groupId>cn.fw</groupId> |
27 | 27 | <artifactId>fw-notice-sdk</artifactId> |
28 | 28 | </dependency> |
29 | + <!-- 绩效系统 --> | |
30 | + <dependency> | |
31 | + <groupId>cn.fw</groupId> | |
32 | + <artifactId>fw-morax-sdk</artifactId> | |
33 | + </dependency> | |
29 | 34 | <dependency> |
30 | 35 | <groupId>cn.fw</groupId> |
31 | 36 | <artifactId>fw-attendance-sdk</artifactId> |
... | ... | @@ -153,6 +158,7 @@ |
153 | 158 | <include>**/*.yml</include> |
154 | 159 | <include>**/*.properties</include> |
155 | 160 | <include>**/*.xml</include> |
161 | + <include>**/banner.txt</include> | |
156 | 162 | </includes> |
157 | 163 | </resource> |
158 | 164 | </resources> | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/Application.java
... | ... | @@ -9,6 +9,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
9 | 9 | import org.springframework.cloud.openfeign.EnableFeignClients; |
10 | 10 | import org.springframework.context.annotation.ComponentScan; |
11 | 11 | import org.springframework.context.annotation.Configuration; |
12 | +import org.springframework.context.annotation.EnableAspectJAutoProxy; | |
12 | 13 | import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; |
13 | 14 | import org.springframework.scheduling.annotation.EnableAsync; |
14 | 15 | import org.springframework.scheduling.annotation.EnableScheduling; |
... | ... | @@ -17,7 +18,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
17 | 18 | /** |
18 | 19 | * 启动类 |
19 | 20 | * |
20 | - *@author kurisu | |
21 | + * @author kurisu | |
21 | 22 | */ |
22 | 23 | @EnableAsync |
23 | 24 | @SpringBootApplication |
... | ... | @@ -31,6 +32,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
31 | 32 | @MapperScan("cn.fw.**.dao") |
32 | 33 | @ComponentScan({"cn.fw.dalaran.*"}) |
33 | 34 | @EnableFeignClients({"cn.fw.**.sdk"}) |
35 | +@EnableAspectJAutoProxy(exposeProxy = true) | |
34 | 36 | public class Application { |
35 | 37 | public static void main(final String[] args) { |
36 | 38 | SpringApplication.run(Application.class, args); | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/ConfigGroupController.java
1 | 1 | package cn.fw.dalaran.server.controller.web; |
2 | 2 | |
3 | -import cn.fw.common.web.annotation.ControllerMethod; | |
4 | 3 | import cn.fw.common.web.auth.LoginAuthBean; |
5 | 4 | import cn.fw.common.web.auth.annotation.CurrentUser; |
6 | 5 | import cn.fw.dalaran.domain.vo.ConfigGroupVo; |
... | ... | @@ -42,7 +41,6 @@ public class ConfigGroupController { |
42 | 41 | * @return 操作结果 |
43 | 42 | */ |
44 | 43 | @GetMapping("/init") |
45 | - @ControllerMethod("初始化配置组") | |
46 | 44 | public Message<ConfigGroupVo> init(@CurrentUser LoginAuthBean user) { |
47 | 45 | return success(configGroupService.init(user.getUserId(), user.getGroupId())); |
48 | 46 | } |
... | ... | @@ -66,7 +64,6 @@ public class ConfigGroupController { |
66 | 64 | * @return 符合条件的配置列表 |
67 | 65 | */ |
68 | 66 | @GetMapping("/list") |
69 | - @ControllerMethod("查询配置列表") | |
70 | 67 | public Message<List<ConfigGroupVo>> list(@CurrentUser LoginAuthBean user) { |
71 | 68 | return success(configGroupService.queryList(user.getUserId(), user.getGroupId())); |
72 | 69 | } | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/TestBizService.java
0 → 100644
1 | +package cn.fw.dalaran.server.controller.web; | |
2 | + | |
3 | +import cn.fw.dalaran.domain.db.Account; | |
4 | +import cn.fw.dalaran.domain.enums.PlatformEnum; | |
5 | +import cn.fw.dalaran.service.data.AccountService; | |
6 | +import lombok.RequiredArgsConstructor; | |
7 | +import lombok.extern.slf4j.Slf4j; | |
8 | +import org.springframework.aop.framework.AopContext; | |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
10 | +import org.springframework.stereotype.Service; | |
11 | +import org.springframework.transaction.annotation.Transactional; | |
12 | + | |
13 | +/** | |
14 | + * @author wmy3969 | |
15 | + * @version 1.0 | |
16 | + * @date 2022/10/12 0:23 | |
17 | + * @Description | |
18 | + */ | |
19 | +@Slf4j | |
20 | +@Service | |
21 | +@RequiredArgsConstructor | |
22 | +public class TestBizService { | |
23 | + | |
24 | + /* | |
25 | + * A(不+事务注解)中调用B(+事务注解): | |
26 | + * A无事务, B无事务 | |
27 | + * | |
28 | + * A(+事务注解)中调用B(+事务注解): | |
29 | + * A有事务, B无事务 | |
30 | + * | |
31 | + * 解决方案: | |
32 | + * 1: bean中自己注入自己, 让A中调用B方法使用注入的自己去调用B方法(testBizService.methodB(), 而不是this.methodB()) | |
33 | + * 2: 配置类上声明@EnableAspectJAutoProxy(exposeProxy = true), 然后业务方法((TestBizService) AopContext.currentProxy()).methodB() | |
34 | + * AopContext.currentProxy()其实就是获取的代理对象, bean中注入的自己也是代理对象 | |
35 | + */ | |
36 | + | |
37 | + private TestBizService testBizService; | |
38 | + | |
39 | + @Autowired | |
40 | + public void inject(TestBizService testBizService) { | |
41 | + this.testBizService = testBizService; | |
42 | + } | |
43 | + | |
44 | + private final AccountService accountService; | |
45 | + | |
46 | + @Transactional(rollbackFor = Exception.class) | |
47 | + public void methodA() { | |
48 | + Account account = new Account(); | |
49 | + account.setAccount("methodA"); | |
50 | + account.setYn(Boolean.FALSE); | |
51 | + account.setGroupId(2L); | |
52 | + account.setType(PlatformEnum.DY); | |
53 | + account.setUserId(1545L); | |
54 | + account.setShopId(11L); | |
55 | + accountService.save(account); | |
56 | + try { | |
57 | + //this.methodB(); | |
58 | + //testBizService.methodB(); | |
59 | + //testBizService1.methodB(); | |
60 | + ((TestBizService) AopContext.currentProxy()).methodB(); | |
61 | + } catch (Exception e) { | |
62 | + e.printStackTrace(); | |
63 | + } | |
64 | + //int i = 1 / 0; | |
65 | + } | |
66 | + | |
67 | + @Transactional(rollbackFor = Exception.class/*, propagation = Propagation.REQUIRES_NEW*/) | |
68 | + public void methodB() { | |
69 | + Account account = new Account(); | |
70 | + account.setAccount("methodB"); | |
71 | + account.setYn(Boolean.FALSE); | |
72 | + account.setGroupId(2L); | |
73 | + account.setType(PlatformEnum.DY); | |
74 | + account.setUserId(1545L); | |
75 | + account.setShopId(11L); | |
76 | + accountService.save(account); | |
77 | + int i = 1 / 0; | |
78 | + } | |
79 | +} | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/web/TestController.java
0 → 100644
1 | +package cn.fw.dalaran.server.controller.web; | |
2 | + | |
3 | +import cn.fw.security.auth.client.annotation.Authorization; | |
4 | +import cn.fw.security.auth.client.annotation.IgnoreAuth; | |
5 | +import cn.fw.security.auth.client.enums.AuthType; | |
6 | +import lombok.RequiredArgsConstructor; | |
7 | +import lombok.extern.slf4j.Slf4j; | |
8 | +import org.springframework.validation.annotation.Validated; | |
9 | +import org.springframework.web.bind.annotation.GetMapping; | |
10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
11 | +import org.springframework.web.bind.annotation.RestController; | |
12 | + | |
13 | +/** | |
14 | + * @author wmy3969 | |
15 | + * @version 1.0 | |
16 | + * @date 2022/10/12 0:23 | |
17 | + * @Description | |
18 | + */ | |
19 | +@Slf4j | |
20 | +@Validated | |
21 | +@RestController | |
22 | +@RequiredArgsConstructor | |
23 | +@Authorization(AuthType.ERP) | |
24 | +@RequestMapping("/web/test") | |
25 | +@IgnoreAuth | |
26 | +public class TestController { | |
27 | + | |
28 | + private final TestBizService testBizService; | |
29 | + | |
30 | + @GetMapping("/methodA") | |
31 | + public void methodA() { | |
32 | + testBizService.methodA(); | |
33 | + } | |
34 | + | |
35 | +} | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/InitStaffWorkStatusConsumer.java
1 | 1 | package cn.fw.dalaran.server.rocketMQ; |
2 | 2 | |
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | 4 | import cn.fw.dalaran.domain.db.Account; |
5 | 5 | import cn.fw.dalaran.domain.db.ActivityTheme; |
6 | 6 | import cn.fw.dalaran.service.data.AccountService; |
... | ... | @@ -25,9 +25,9 @@ import java.util.stream.Collectors; |
25 | 25 | @Component |
26 | 26 | @RequiredArgsConstructor |
27 | 27 | @RocketMQMessageListener( |
28 | - topic = "task-" + DalaranConstants.APPLICATION_NAME, | |
29 | - consumerGroup = DalaranConstants.APPLICATION_NAME + "-task-" + DalaranConstants.INIT_ACCOUNT_STATUS, | |
30 | - selectorExpression = DalaranConstants.INIT_ACCOUNT_STATUS) | |
28 | + topic = "task-" + Constants.APPLICATION_NAME, | |
29 | + consumerGroup = Constants.APPLICATION_NAME + "-task-" + Constants.INIT_ACCOUNT_STATUS, | |
30 | + selectorExpression = Constants.INIT_ACCOUNT_STATUS) | |
31 | 31 | public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { |
32 | 32 | |
33 | 33 | private final AccountService accountService; |
... | ... | @@ -35,7 +35,7 @@ public class InitStaffWorkStatusConsumer implements RocketMQListener<Long> { |
35 | 35 | |
36 | 36 | @Override |
37 | 37 | public void onMessage(Long themeId) { |
38 | - log.info("收到topic为: task-{}, tag为: {}的消息, 消息内容(themeId): {}", DalaranConstants.APPLICATION_NAME, DalaranConstants.INIT_ACCOUNT_STATUS, themeId); | |
38 | + log.info("收到topic为: task-{}, tag为: {}的消息, 消息内容(themeId): {}", Constants.APPLICATION_NAME, Constants.INIT_ACCOUNT_STATUS, themeId); | |
39 | 39 | ActivityTheme theme; |
40 | 40 | if (Objects.nonNull(theme = activityThemeService.getById(themeId))) { |
41 | 41 | if (Objects.equals(theme.getAllShop(), 0)) { | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/SalaryEventConsumer.java
0 → 100644
1 | +package cn.fw.dalaran.server.rocketMQ; | |
2 | + | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | +import cn.fw.dalaran.common.utils.PublicUtil; | |
5 | +import cn.fw.dalaran.rpc.morax.SalaryRpc; | |
6 | +import cn.fw.dalaran.service.data.ActivityThemeService; | |
7 | +import cn.fw.morax.sdk.dto.CustomList; | |
8 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserQuery; | |
9 | +import cn.fw.morax.sdk.dto.kpi.KpiGroupUserResult; | |
10 | +import cn.fw.morax.sdk.dto.kpi.KpiReportNoticeMQ; | |
11 | +import cn.fw.morax.sdk.dto.kpi.UserIndicatorReq; | |
12 | +import cn.fw.starter.redis.redis.RedisUtil; | |
13 | +import com.alibaba.fastjson.JSON; | |
14 | +import lombok.RequiredArgsConstructor; | |
15 | +import lombok.extern.slf4j.Slf4j; | |
16 | +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | |
17 | +import org.apache.rocketmq.spring.core.RocketMQListener; | |
18 | +import org.springframework.stereotype.Component; | |
19 | + | |
20 | +import java.util.List; | |
21 | +import java.util.Objects; | |
22 | + | |
23 | +/** | |
24 | + * @author wmy3969 | |
25 | + * @version 1.0 | |
26 | + * @date 2022/10/09 10:51 | |
27 | + * @Description 薪酬绩效MQ | |
28 | + */ | |
29 | +@Slf4j | |
30 | +@Component | |
31 | +@RequiredArgsConstructor | |
32 | +@RocketMQMessageListener( | |
33 | + topic = KpiReportNoticeMQ.TOPIC, | |
34 | + consumerGroup = Constants.APPLICATION_NAME + "-" + KpiReportNoticeMQ.TOPIC) | |
35 | +public class SalaryEventConsumer implements RocketMQListener<KpiReportNoticeMQ> { | |
36 | + | |
37 | + private final RedisUtil redisUtil;// redis操作工具 | |
38 | + private final SalaryRpc salaryRpc;// 薪酬绩效rpc | |
39 | + private final ActivityThemeService activityThemeService;// 活动主题业务 | |
40 | + | |
41 | + /** | |
42 | + * 处理'上报薪酬绩效'消息 | |
43 | + * | |
44 | + * @param kpiReport | |
45 | + */ | |
46 | + @Override | |
47 | + public void onMessage(KpiReportNoticeMQ kpiReport) { | |
48 | + String indicatorCode = kpiReport.getIndicatorCode(); | |
49 | + if (Objects.equals(Constants.Performance.SCORE_RATE, indicatorCode)) | |
50 | + return; | |
51 | + log.info("收到上报薪酬绩效消息 message:{}", JSON.toJSONString(kpiReport)); | |
52 | + String redisKey = "SalaryEventConsumer:onMessage"; | |
53 | + if (redisUtil.getLock(redisKey)) { | |
54 | + try { | |
55 | + KpiGroupUserQuery param = new KpiGroupUserQuery(); | |
56 | + param.setGroupId(kpiReport.getGroupId()); | |
57 | + param.setDataDate(kpiReport.getUploadDate().getTime()); | |
58 | + param.setPostId(kpiReport.getPostId()); | |
59 | + param.setIndicatorCode(indicatorCode); | |
60 | + List<KpiGroupUserResult> users = salaryRpc.queryGroupUsers(param); | |
61 | + CustomList<UserIndicatorReq> indicates = new CustomList<>(); | |
62 | + users.forEach(item -> {// 遍历每个组 | |
63 | + /*BigDecimal targetValue = item.getTargetValue();// 目标值 | |
64 | + TargetTypeEnum targetType = item.getTargetType();// 获取目标类型*/ | |
65 | + List<KpiGroupUserResult.SimpleUserData> userIdList = item.getUserIdList(); | |
66 | + userIdList.forEach(item1 -> {// 每个组下的不同人 | |
67 | + UserIndicatorReq userIndicator = PublicUtil.copy(item1, UserIndicatorReq.class); | |
68 | + userIndicator.setIndicatorCode(indicatorCode); | |
69 | + userIndicator.setDataDate(kpiReport.getUploadDate()); | |
70 | + userIndicator.setUid(kpiReport.getUid()); | |
71 | + //userIndicator.setValue(); | |
72 | + indicates.add(userIndicator); | |
73 | + }); | |
74 | + }); | |
75 | + salaryRpc.reportKpi(indicates); | |
76 | + } catch (Exception e) { | |
77 | + log.error("处理上报薪酬绩效消息发生异常 message:{}", JSON.toJSONString(kpiReport), e); | |
78 | + } finally { | |
79 | + redisUtil.unlock(redisKey); | |
80 | + } | |
81 | + } else { | |
82 | + log.info("执行cn.fw.dalaran.server.rocketMQ.SalaryEventConsumer.onMessage()方法获取锁失败, 不消费消息"); | |
83 | + } | |
84 | + } | |
85 | + | |
86 | +} | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/rocketMQ/StaffLeaveEventConsumer.java
1 | 1 | package cn.fw.dalaran.server.rocketMQ; |
2 | 2 | |
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | 4 | import cn.fw.dalaran.domain.db.Account; |
5 | 5 | import cn.fw.dalaran.service.data.AccountService; |
6 | 6 | import cn.fw.ehr.sdk.api.mq.StaffLeaveEvent; |
... | ... | @@ -24,7 +24,7 @@ import java.util.Date; |
24 | 24 | @RequiredArgsConstructor |
25 | 25 | @RocketMQMessageListener( |
26 | 26 | topic = StaffLeaveEvent.TOPIC, |
27 | - consumerGroup = DalaranConstants.APPLICATION_NAME + "-" + StaffLeaveEvent.TOPIC) | |
27 | + consumerGroup = Constants.APPLICATION_NAME + "-" + StaffLeaveEvent.TOPIC) | |
28 | 28 | public class StaffLeaveEventConsumer implements RocketMQListener<StaffLeaveEvent> { |
29 | 29 | |
30 | 30 | private final AccountService accountService; | ... | ... |
fw-dalaran-server/src/main/java/cn/fw/dalaran/server/task/TodoTask.java
1 | 1 | package cn.fw.dalaran.server.task; |
2 | 2 | |
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | 4 | import cn.fw.dalaran.domain.db.Account; |
5 | 5 | import cn.fw.dalaran.domain.db.ActivityTheme; |
6 | 6 | import cn.fw.dalaran.domain.db.LivePool; |
... | ... | @@ -60,10 +60,10 @@ public class TodoTask { |
60 | 60 | final Map<String, List<TodoHistory>> todoMap = list.stream() |
61 | 61 | .collect(Collectors.groupingBy(TodoHistory::getTodoCode));// 根据待办编码分组 |
62 | 62 | final List<TodoHistory> loginAccount = Optional |
63 | - .ofNullable(todoMap.get(DalaranConstants.ACCOUNT_INVALID)) | |
63 | + .ofNullable(todoMap.get(Constants.ACCOUNT_INVALID)) | |
64 | 64 | .orElse(new ArrayList<>()); |
65 | 65 | final List<TodoHistory> checkLive = Optional |
66 | - .ofNullable(todoMap.get(DalaranConstants.CHECK_LIVE)) | |
66 | + .ofNullable(todoMap.get(Constants.CHECK_LIVE)) | |
67 | 67 | .orElse(new ArrayList<>()); |
68 | 68 | for (TodoHistory history : loginAccount) {// 处理账号登录待办 |
69 | 69 | Account account = accountService.getById(history.getDataId()); |
... | ... | @@ -116,7 +116,7 @@ public class TodoTask { |
116 | 116 | return; |
117 | 117 | } |
118 | 118 | for (TodoHistory history : list) { |
119 | - if (Objects.equals(history.getTodoCode(), DalaranConstants.ACCOUNT_INVALID)) {// 账号失效待办 | |
119 | + if (Objects.equals(history.getTodoCode(), Constants.ACCOUNT_INVALID)) {// 账号失效待办 | |
120 | 120 | Account account = accountService.getById(history.getDataId()); |
121 | 121 | if (Objects.isNull(account)) { |
122 | 122 | continue; |
... | ... | @@ -176,7 +176,7 @@ public class TodoTask { |
176 | 176 | if (CollectionUtils.isEmpty(themeVos)) |
177 | 177 | return; |
178 | 178 | List<TodoHistory> hasSaveTodo = todoHistoryService.lambdaQuery() |
179 | - .eq(TodoHistory::getTodoCode, DalaranConstants.CHECK_LIVE) | |
179 | + .eq(TodoHistory::getTodoCode, Constants.CHECK_LIVE) | |
180 | 180 | .in(TodoHistory::getDataId, themeVos.stream() |
181 | 181 | .map(ActivityThemeVo::getId) |
182 | 182 | .collect(Collectors.toList()) |
... | ... | @@ -186,12 +186,12 @@ public class TodoTask { |
186 | 186 | .stream() |
187 | 187 | .map(item -> {// 遍历每个门店 |
188 | 188 | TodoHistory todo = new TodoHistory(); |
189 | - List<UserInfoDTO> users = userRoleRpcService.getUsers(item, DalaranConstants.ZBSJ_ROLE_CODE);// 获取门店拥有'直播审计'角色的人 | |
189 | + List<UserInfoDTO> users = userRoleRpcService.getUsers(item, Constants.ZBSJ_ROLE_CODE);// 获取门店拥有'直播审计'角色的人 | |
190 | 190 | if (users.size() > 0) { |
191 | 191 | todo.setSend(false); |
192 | 192 | todo.setDone(false); |
193 | 193 | todo.setTodoDone(false); |
194 | - todo.setTodoCode(DalaranConstants.CHECK_LIVE); | |
194 | + todo.setTodoCode(Constants.CHECK_LIVE); | |
195 | 195 | todo.setDataId(themeVos.stream() |
196 | 196 | .filter(item1 -> item1.getShopIds().contains(item)) |
197 | 197 | .collect(Collectors.toList()) | ... | ... |
fw-dalaran-server/src/main/resources/application-local.yml
... | ... | @@ -12,8 +12,10 @@ nacos: |
12 | 12 | spring: |
13 | 13 | application: |
14 | 14 | name: fw-dalaran-local |
15 | + banner: | |
16 | + location: "classpath:banner.txt" | |
15 | 17 | rocketmq: |
16 | -# name-server: 192.168.0.230:9876 | |
18 | + # name-server: 192.168.0.230:9876 | |
17 | 19 | name-server: 172.26.154.169:9876 |
18 | 20 | producer: |
19 | 21 | group: ${spring.application.name} | ... | ... |
fw-dalaran-server/src/main/resources/application.yml
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/AccountBizService.java
... | ... | @@ -2,7 +2,7 @@ package cn.fw.dalaran.service.biz; |
2 | 2 | |
3 | 3 | import cn.fw.common.page.AppPage; |
4 | 4 | import cn.fw.common.web.annotation.DisLock; |
5 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
5 | +import cn.fw.dalaran.common.constants.Constants; | |
6 | 6 | import cn.fw.dalaran.common.exception.BusinessException; |
7 | 7 | import cn.fw.dalaran.common.utils.DateUtil; |
8 | 8 | import cn.fw.dalaran.domain.db.Account; |
... | ... | @@ -10,6 +10,7 @@ import cn.fw.dalaran.domain.db.TodoHistory; |
10 | 10 | import cn.fw.dalaran.domain.dto.AccountDTO; |
11 | 11 | import cn.fw.dalaran.domain.dto.AccountQueryDTO; |
12 | 12 | import cn.fw.dalaran.domain.dto.UpdateAccountParam; |
13 | +import cn.fw.dalaran.domain.enums.AccountStatusEnum; | |
13 | 14 | import cn.fw.dalaran.domain.enums.PlatformEnum; |
14 | 15 | import cn.fw.dalaran.domain.vo.AccountStatusVo; |
15 | 16 | import cn.fw.dalaran.domain.vo.AccountVO; |
... | ... | @@ -112,9 +113,9 @@ public class AccountBizService { |
112 | 113 | history.setDataId(account1.getId()); |
113 | 114 | history.setShopId(account1.getShopId()); |
114 | 115 | history.setUserId(account1.getUserId()); |
115 | - history.setTodoCode(DalaranConstants.ACCOUNT_INVALID); | |
116 | + history.setTodoCode(Constants.ACCOUNT_INVALID); | |
116 | 117 | todos.add(history); |
117 | - List<UserInfoDTO> users = userRoleRpcService.getUsers(account1.getShopId(), DalaranConstants.ZHSZ_ROLE_CODE); | |
118 | + List<UserInfoDTO> users = userRoleRpcService.getUsers(account1.getShopId(), Constants.ZHSZ_ROLE_CODE); | |
118 | 119 | if (!CollectionUtils.isEmpty(users)) { |
119 | 120 | Long managerId = users.get(0).getUserId(); |
120 | 121 | TodoHistory manageTodo = new TodoHistory(); |
... | ... | @@ -128,7 +129,7 @@ public class AccountBizService { |
128 | 129 | .map(Account::getId) |
129 | 130 | .collect(Collectors.toList());// 失败账号id |
130 | 131 | List<TodoHistory> todayHasSendList = todoHistoryService.lambdaQuery() |
131 | - .eq(TodoHistory::getTodoCode, DalaranConstants.ACCOUNT_INVALID) | |
132 | + .eq(TodoHistory::getTodoCode, Constants.ACCOUNT_INVALID) | |
132 | 133 | .in(!CollectionUtils.isEmpty(waitSendIds), TodoHistory::getDataId, waitSendIds) |
133 | 134 | .last(" and DATEDIFF(create_time, NOW()) = 0") |
134 | 135 | .list(); |
... | ... | @@ -256,8 +257,8 @@ public class AccountBizService { |
256 | 257 | .eq(Account::getAffirm, Boolean.TRUE) |
257 | 258 | .eq(Account::getValid, Boolean.TRUE) |
258 | 259 | .eq(Account::getType, platformEnum) |
259 | - .ne(Account::getAccountStatus, -1) | |
260 | - //.eq(Account::getAccountStatus, 1) | |
260 | + .ne(Account::getAccountStatus, AccountStatusEnum.HAS_LEAVE.getValue()) | |
261 | + //.eq(Account::getAccountStatus, AccountStatusEnum.IN_WORK.getValue()) | |
261 | 262 | .eq(Account::getYn, Boolean.TRUE) |
262 | 263 | ); |
263 | 264 | if (CollectionUtils.isEmpty(list)) { | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/OtherBizService.java
1 | 1 | package cn.fw.dalaran.service.biz; |
2 | 2 | |
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | 4 | import cn.fw.dalaran.common.exception.BusinessException; |
5 | 5 | import cn.fw.dalaran.common.utils.PublicUtil; |
6 | 6 | import cn.fw.dalaran.common.utils.StringUtils; |
... | ... | @@ -58,10 +58,10 @@ public class OtherBizService { |
58 | 58 | * @param themeId 主题id |
59 | 59 | * @return 审计视图 |
60 | 60 | */ |
61 | - @Transactional | |
61 | + @Transactional(rollbackFor = Exception.class) | |
62 | 62 | public LiveCheckVo getLiveCheck(Long userId, Long themeId) { |
63 | 63 | LiveCheckVo vo = new LiveCheckVo(); |
64 | - final List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(userId, DalaranConstants.ZBSJ_ROLE_CODE);// 查询用户角色授权范围 | |
64 | + final List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(userId, Constants.ZBSJ_ROLE_CODE);// 查询用户角色授权范围 | |
65 | 65 | List<LiveCheckResult> waitCheckLives = new ArrayList<>(); |
66 | 66 | List<LiveCheckResult> list = liveCheckResultService.lambdaQuery() |
67 | 67 | .eq(LiveCheckResult::getThemeId, themeId) |
... | ... | @@ -123,7 +123,7 @@ public class OtherBizService { |
123 | 123 | * @param param 审核结果 |
124 | 124 | * @return 操作结果 |
125 | 125 | */ |
126 | - @Transactional | |
126 | + @Transactional(rollbackFor = Exception.class) | |
127 | 127 | public boolean saveCheckResult(Long userId, LiveCheckParams param) { |
128 | 128 | final Integer type = param.getType(); |
129 | 129 | final Long dataId = param.getDataId(); |
... | ... | @@ -180,7 +180,7 @@ public class OtherBizService { |
180 | 180 | .set(TodoHistory::getDone, true) |
181 | 181 | .eq(TodoHistory::getUserId, userId) |
182 | 182 | .eq(TodoHistory::getDataId, dataId) |
183 | - .eq(TodoHistory::getTodoCode, DalaranConstants.CHECK_LIVE) | |
183 | + .eq(TodoHistory::getTodoCode, Constants.CHECK_LIVE) | |
184 | 184 | .update()) |
185 | 185 | throw new BusinessException("完成待办失败"); |
186 | 186 | final List<Long> invalidLiveIds = summaries.stream() | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ActivityThemeServiceImpl.java
... | ... | @@ -2,7 +2,7 @@ package cn.fw.dalaran.service.data.impl; |
2 | 2 | |
3 | 3 | import cn.fw.common.page.AppPage; |
4 | 4 | import cn.fw.common.web.auth.LoginAuthBean; |
5 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
5 | +import cn.fw.dalaran.common.constants.Constants; | |
6 | 6 | import cn.fw.dalaran.common.exception.BusinessException; |
7 | 7 | import cn.fw.dalaran.common.utils.DateUtil; |
8 | 8 | import cn.fw.dalaran.common.utils.ImageUtils; |
... | ... | @@ -125,7 +125,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti |
125 | 125 | * @return |
126 | 126 | */ |
127 | 127 | @Override |
128 | - @Transactional | |
128 | + @Transactional(rollbackFor = Exception.class) | |
129 | 129 | public boolean save(ActivityThemeVo themeVo) { |
130 | 130 | ConfigGroup configGroup = configGroupService.getById(themeVo.getConfigGroupId()); |
131 | 131 | ActivityTheme activityTheme = ActivityThemeVo.toDB(themeVo); |
... | ... | @@ -140,9 +140,9 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti |
140 | 140 | if (result) { |
141 | 141 | erpTaskRpc.setTask(TaskSetReq.<Long>builder() |
142 | 142 | .executeTime(new Date(activityTheme.getStartTime().getTime() + 24 * 3600 * 1000L)) |
143 | - .system(DalaranConstants.APPLICATION_NAME) | |
143 | + .system(Constants.APPLICATION_NAME) | |
144 | 144 | .param(activityTheme.getId()) |
145 | - .tag(DalaranConstants.INIT_ACCOUNT_STATUS) | |
145 | + .tag(Constants.INIT_ACCOUNT_STATUS) | |
146 | 146 | .build() |
147 | 147 | ); |
148 | 148 | this.saveFiles(activityTheme.getId(), themeVo.getAllFileDesc()); |
... | ... | @@ -189,7 +189,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti |
189 | 189 | * @return |
190 | 190 | */ |
191 | 191 | @Override |
192 | - @Transactional | |
192 | + @Transactional(rollbackFor = Exception.class) | |
193 | 193 | public boolean addCover(AddThemeCoverParams params) { |
194 | 194 | Long themeId = params.getThemeId(); |
195 | 195 | List<FileDesc> fileList = params.getCovers() |
... | ... | @@ -379,20 +379,18 @@ public class ActivityThemeServiceImpl extends ServiceImpl<ActivityThemeDao, Acti |
379 | 379 | * 活动主题数据封面图处理 |
380 | 380 | */ |
381 | 381 | public static void main(String[] args) { |
382 | - int themeId = 76; | |
382 | + int themeId = 81; | |
383 | 383 | String tempDir = System.getProperty("java.io.tmpdir");// 获取当前环境临时文件夹路径 |
384 | - Arrays.asList("1076f977869a4874bbe046627e24653a", | |
385 | - "409e23a6e5b04fe8999b3fd5e4897b59", | |
386 | - "4346c78272a5430494b034279ac51777", | |
387 | - "4e515025cea04d518f3c97707ae53d15", | |
388 | - "54081e10b2ad4323970f0ecce4874781", | |
389 | - "564efb8b46c641628035d6b77d85e40a", | |
390 | - "6ed3e5f2cb2246148f4231ea12a84c0b", | |
391 | - "79be977223f345f3b98523b84852ff3f", | |
392 | - "821294cc1fd8468aaf3b9f3dd7e00775", | |
393 | - "82b8f8f1ba6e45f0aaac47e69131e950", | |
394 | - "a948a03cc2c4431ea9ac4c60fd39c6be", | |
395 | - "e10bf422633c47c4a4061eaa0afe3ff2") | |
384 | + Arrays.asList("137c401527774851b8f941eef128ea31", | |
385 | + "1c3612176f1143a292d8ee2115b44644", | |
386 | + "3d09e66cf4ec4d6e9abec9d67cc61b6f", | |
387 | + "54ab375a3f1d48c6a872613add1ccbb4", | |
388 | + "8dec2c73874344b08ef45cc71b6796ff", | |
389 | + "b3e80f1c5ca74c118e99f74254f1dc2b", | |
390 | + "b5463674fe9e4bf6ac864a693a5e53b6", | |
391 | + "bac0533d6f664fab9668d2fce2aafe3c", | |
392 | + "d9440d5dc08c4b1189f4eac9a64dfce8", | |
393 | + "f42e23fd3ed24dc8a7dfa54d0f9acff6") | |
396 | 394 | .forEach(item -> { |
397 | 395 | try { |
398 | 396 | File downloadFile = ImageUtils.convertFileByUrl("https://gate.feewee.cn/file/show?fid=" + item, item); | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ConfigGroupServiceImpl.java
1 | 1 | package cn.fw.dalaran.service.data.impl; |
2 | 2 | |
3 | -import cn.fw.dalaran.common.constants.DalaranConstants; | |
3 | +import cn.fw.dalaran.common.constants.Constants; | |
4 | 4 | import cn.fw.dalaran.common.exception.BusinessException; |
5 | 5 | import cn.fw.dalaran.dao.ConfigGroupDao; |
6 | 6 | import cn.fw.dalaran.domain.db.ActivityTheme; |
... | ... | @@ -66,14 +66,15 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr |
66 | 66 | * @return |
67 | 67 | */ |
68 | 68 | @Override |
69 | - @Transactional | |
69 | + @Transactional(rollbackFor = Exception.class) | |
70 | 70 | public ConfigGroupVo init(Long userId, Long groupId) { |
71 | - if (this.lambdaQuery() | |
71 | + if (!this.lambdaQuery() | |
72 | 72 | .eq(ConfigGroup::getGroupId, groupId) |
73 | 73 | .eq(ConfigGroup::getUserId, userId) |
74 | 74 | .eq(ConfigGroup::getAllShop, -2) |
75 | - .list().size() > 0) | |
76 | - throw new BusinessException("该用户存在一个已初始化但未赋值修改的配置组"); | |
75 | + .list() | |
76 | + .isEmpty() | |
77 | + ) throw new BusinessException("该用户存在一个已初始化但未赋值修改的配置组"); | |
77 | 78 | ConfigGroup configGroup = new ConfigGroup(); |
78 | 79 | configGroup.setUserId(userId); |
79 | 80 | configGroup.setGroupId(groupId); |
... | ... | @@ -94,7 +95,7 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr |
94 | 95 | * @return |
95 | 96 | */ |
96 | 97 | @Override |
97 | - @Transactional | |
98 | + @Transactional(rollbackFor = Exception.class) | |
98 | 99 | public boolean update(Long userId, ConfigGroupVo param) { |
99 | 100 | if (!Objects.equals(userId, param.getUserId())) |
100 | 101 | throw new BusinessException("不允许修改别人的配置组"); |
... | ... | @@ -105,14 +106,14 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr |
105 | 106 | .list();// 找到对应集团的所有生效的配置组 |
106 | 107 | Integer allShop = param.getAllShop(); |
107 | 108 | if (Objects.equals(allShop, 1)) {// 本次指定配置是否为全部门店 |
108 | - if (list.size() > 0) throw new BusinessException("该集团已存在门店配置, 新配置不能设置为[全部门店]"); | |
109 | + if (!list.isEmpty()) throw new BusinessException("该集团已存在门店配置, 新配置不能设置为[全部门店]"); | |
109 | 110 | } else if (list.stream().anyMatch(item -> Objects.equals(item.getAllShop(), 1))) {// 已存在的配置组是否有全部门店的 |
110 | 111 | throw new BusinessException("该集团已存在[全部门店]配置, 新配置不能生效"); |
111 | 112 | } else { |
112 | 113 | List<Long> shopIds = param.getShopIds();// 本次配置指定生效门店 |
113 | 114 | List<String> shopNames = param.getShopNames();// 本次配置指定生效门店 |
114 | 115 | if (Objects.equals(allShop, -1)) {// 指定为授权门店 |
115 | - List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(param.getUserId(), DalaranConstants.ZBSZ_ROLE_CODE);// 查询用户角色授权范围 | |
116 | + List<ShopMsg> userRoleRange = userRoleRpcService.getUserRoleRange(param.getUserId(), Constants.ZBSZ_ROLE_CODE);// 查询用户角色授权范围 | |
116 | 117 | shopIds.clear(); |
117 | 118 | shopNames.clear(); |
118 | 119 | for (ShopMsg shopMsg : userRoleRange) { |
... | ... | @@ -201,20 +202,20 @@ public class ConfigGroupServiceImpl extends ServiceImpl<ConfigGroupDao, ConfigGr |
201 | 202 | */ |
202 | 203 | @Override |
203 | 204 | public List<ConfigGroupVo> queryList(Long userId, Long groupId) { |
204 | - List<ConfigGroupVo> collect = this.lambdaQuery() | |
205 | + Map<Long, List<ConfigGroupVo>> collectMap = this.lambdaQuery() | |
205 | 206 | .eq(ConfigGroup::getGroupId, groupId) |
206 | 207 | .list() |
207 | 208 | .stream() |
208 | 209 | .map(item -> this.processVo(item, true)) |
209 | - .collect(Collectors.toList()); | |
210 | - Map<Long, List<ConfigGroupVo>> collectMap = collect.stream() | |
211 | 210 | .collect(Collectors.groupingBy(ConfigGroupVo::getUserId)); |
212 | 211 | List<ConfigGroupVo> vos = new ArrayList<>(Optional |
213 | 212 | .ofNullable(collectMap.get(userId)) |
214 | 213 | .orElse(new ArrayList<>()) |
215 | 214 | );// 尝试获取属于登录用户的配置组 |
215 | + /* 下面两步操作, 为了让属于自己的配置组能展示在最前面 */ | |
216 | 216 | collectMap.remove(userId);// 将属于该用户的配置从map中移除 |
217 | 217 | collectMap.forEach((k, v) -> vos.addAll(v));// 将其他人的配置组加入vo |
218 | + vos.forEach(item -> item.setCanAlter(Objects.equals(item.getUserId(), userId)));// 标记是否是自己的配置组 | |
218 | 219 | return vos; |
219 | 220 | } |
220 | 221 | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/GlobalConfigServiceImpl.java
... | ... | @@ -6,6 +6,7 @@ import cn.fw.dalaran.domain.db.GlobalConfig; |
6 | 6 | import cn.fw.dalaran.domain.enums.ConfigEnum; |
7 | 7 | import cn.fw.dalaran.service.data.GlobalConfigService; |
8 | 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | 10 | import org.springframework.stereotype.Service; |
10 | 11 | import org.springframework.transaction.annotation.Transactional; |
11 | 12 | |
... | ... | @@ -25,6 +26,13 @@ import java.util.stream.Collectors; |
25 | 26 | @Service("globalConfigService") |
26 | 27 | public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, GlobalConfig> implements GlobalConfigService { |
27 | 28 | |
29 | + private GlobalConfigServiceImpl globalConfigService; | |
30 | + | |
31 | + @Autowired | |
32 | + public void inject(GlobalConfigServiceImpl globalConfigService) { | |
33 | + this.globalConfigService = globalConfigService; | |
34 | + } | |
35 | + | |
28 | 36 | /** |
29 | 37 | * 获取列表 |
30 | 38 | * |
... | ... | @@ -39,6 +47,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global |
39 | 47 | .list();// 获取数据库中的配置列表 |
40 | 48 | final int length = ConfigEnum.values().length;// 获取枚举中规定的配置数 |
41 | 49 | if (list.size() != length) { |
50 | + //list = ((GlobalConfigServiceImpl) AopContext.currentProxy()).initConfigList(configGroupId); | |
42 | 51 | list = this.initConfigList(configGroupId); |
43 | 52 | } |
44 | 53 | return list; |
... | ... | @@ -51,8 +60,10 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global |
51 | 60 | */ |
52 | 61 | @Override |
53 | 62 | public void updateConfig(List<GlobalConfig.GlobalConfigVo> globalConfigs) { |
54 | - PublicUtil.assertFalse(globalConfigs.stream().anyMatch(item -> item.getRate().compareTo(BigDecimal.ZERO) < 0), "占比必须 > 0%"); | |
55 | - PublicUtil.assertFalse(globalConfigs.stream().anyMatch(item -> item.getRate().compareTo(BigDecimal.valueOf(100)) > 0), "占比必须 < 100%"); | |
63 | + PublicUtil.assertFalse(globalConfigs.stream() | |
64 | + .anyMatch(item -> item.getRate().compareTo(BigDecimal.ZERO) < 0), "占比必须 > 0%"); | |
65 | + PublicUtil.assertFalse(globalConfigs.stream() | |
66 | + .anyMatch(item -> item.getRate().compareTo(BigDecimal.valueOf(100)) > 0), "占比必须 < 100%"); | |
56 | 67 | this.saveOrUpdateBatch(PublicUtil.copyList(globalConfigs, GlobalConfig.class)); |
57 | 68 | } |
58 | 69 | |
... | ... | @@ -62,7 +73,7 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global |
62 | 73 | * @param configGroupId 所属配置组id |
63 | 74 | * @return |
64 | 75 | */ |
65 | - @Transactional | |
76 | + @Transactional(rollbackFor = Exception.class) | |
66 | 77 | public List<GlobalConfig> initConfigList(Long configGroupId) { |
67 | 78 | final List<GlobalConfig> list = this.lambdaQuery() |
68 | 79 | .eq(GlobalConfig::getConfigGroupId, configGroupId) |
... | ... | @@ -76,13 +87,15 @@ public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigDao, Global |
76 | 87 | List<GlobalConfig> collect1 = list.stream() |
77 | 88 | .filter(item1 -> Objects.equals(item.getValue(), item1.getType())) |
78 | 89 | .collect(Collectors.toList()); |
79 | - if (collect1.size() > 0) { | |
90 | + if (!collect1.isEmpty()) { | |
80 | 91 | rate = collect1.get(0).getRate(); |
81 | 92 | } |
82 | 93 | return new GlobalConfig(configGroupId, item.getValue(), rate); |
83 | 94 | }) |
84 | 95 | .collect(Collectors.toList()); |
85 | 96 | this.saveBatch(collect); |
97 | + //int i = 1 / 0; | |
86 | 98 | return collect; |
87 | 99 | } |
100 | + | |
88 | 101 | } | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/LivePoolServiceImpl.java
... | ... | @@ -87,7 +87,7 @@ public class LivePoolServiceImpl extends ServiceImpl<LivePoolDao, LivePool> impl |
87 | 87 | * @return |
88 | 88 | */ |
89 | 89 | @Override |
90 | - @Transactional | |
90 | + @Transactional(rollbackFor = Exception.class) | |
91 | 91 | public boolean markBestLive(Long liveId) { |
92 | 92 | final LivePool live = this.getById(liveId); |
93 | 93 | final Long themeId = live.getThemeId();// 获取主题id | ... | ... |
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ValidConfigNewServiceImpl.java
... | ... | @@ -38,7 +38,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va |
38 | 38 | * @return |
39 | 39 | */ |
40 | 40 | @Override |
41 | - @Transactional | |
41 | + @Transactional(rollbackFor = Exception.class) | |
42 | 42 | public boolean updateConfig(List<ValidConfigNewVo.singleVo> details) { |
43 | 43 | details.forEach(item -> this.updateById(ValidConfigNewVo.toDB(item))); |
44 | 44 | publisher.publishEvent("validConfigAlertEvent#" + details.get(0).getConfigGroupId()); |
... | ... | @@ -84,7 +84,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va |
84 | 84 | * @param configGroupId 所属配置组id |
85 | 85 | * @return |
86 | 86 | */ |
87 | - @Transactional | |
87 | + @Transactional(rollbackFor = Exception.class) | |
88 | 88 | public List<ValidConfigNew> initVideoConfigList(Long configGroupId) { |
89 | 89 | final List<ValidConfigNew> list = this.lambdaQuery() |
90 | 90 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) |
... | ... | @@ -115,7 +115,7 @@ public class ValidConfigNewServiceImpl extends ServiceImpl<ValidConfigNewDao, Va |
115 | 115 | * @param configGroupId 所属配置组id |
116 | 116 | * @return |
117 | 117 | */ |
118 | - @Transactional | |
118 | + @Transactional(rollbackFor = Exception.class) | |
119 | 119 | public List<ValidConfigNew> initLiveConfigList(Long configGroupId) { |
120 | 120 | final List<ValidConfigNew> list = this.lambdaQuery() |
121 | 121 | .eq(ValidConfigNew::getConfigGroupId, configGroupId) | ... | ... |
pom.xml
... | ... | @@ -41,6 +41,7 @@ |
41 | 41 | <fw.attendance.sdk.version>1.0.0</fw.attendance.sdk.version> |
42 | 42 | <fw.notice.sdk.version>1.0.0</fw.notice.sdk.version> |
43 | 43 | <fw.rocketmq.sdk.version>1.0</fw.rocketmq.sdk.version> |
44 | + <fw.morax.sdk.version>1.0.0</fw.morax.sdk.version> | |
44 | 45 | <fastjson>1.2.78</fastjson> |
45 | 46 | <fw-oop-sdk.version>3.0.0</fw-oop-sdk.version> |
46 | 47 | <mybatis-typehandlers-jsr310>1.0.1</mybatis-typehandlers-jsr310> |
... | ... | @@ -147,6 +148,12 @@ |
147 | 148 | <artifactId>fw-backlog-sdk</artifactId> |
148 | 149 | <version>${fw.backlog.sdk}</version> |
149 | 150 | </dependency> |
151 | + <!-- 绩效系统 --> | |
152 | + <dependency> | |
153 | + <groupId>cn.fw</groupId> | |
154 | + <artifactId>fw-morax-sdk</artifactId> | |
155 | + <version>${fw.morax.sdk.version}</version> | |
156 | + </dependency> | |
150 | 157 | <dependency> |
151 | 158 | <groupId>cn.fw</groupId> |
152 | 159 | <artifactId>fw-erp-sdk</artifactId> | ... | ... |