Commit 6ef0b8fe by 程裕兵

feat:send member message

parent cccf78c7
...@@ -39,6 +39,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -39,6 +39,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
"com.jiejing.message.api", "com.jiejing.message.api",
"com.jiejing.fitness.rpc.api", "com.jiejing.fitness.rpc.api",
"com.jiejing.permcenter.api", "com.jiejing.permcenter.api",
"com.jiejing.configcenter.api",
}) })
@SpringBootApplication(scanBasePackages = "com.jiejing", exclude = { @SpringBootApplication(scanBasePackages = "com.jiejing", exclude = {
DruidDataSourceAutoConfigure.class DruidDataSourceAutoConfigure.class
......
...@@ -86,6 +86,11 @@ ...@@ -86,6 +86,11 @@
<artifactId>permcenter-api</artifactId> <artifactId>permcenter-api</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.jiejing.base</groupId>
<artifactId>configcenter-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- ======================= jiejing api end ======================= --> <!-- ======================= jiejing api end ======================= -->
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<select id="statistic" resultType="com.jiejing.fitness.finance.api.cashier.vo.StudioCashierStatisticVO"> <select id="statistic" resultType="com.jiejing.fitness.finance.api.cashier.vo.StudioCashierStatisticVO">
select sum(trans_amount) as total_trans_amount, select sum(trans_amount) as total_trans_amount,
sum(case when trans_state = 'PAY_IN' then actual_amount else 0 end) as total_actual_amount, sum(actual_amount) as total_actual_amount,
sum(fee) as total_fee, count(id) as total sum(fee) as total_fee, count(id) as total
from studio_cashier_record from studio_cashier_record
<where> <where>
...@@ -150,9 +150,9 @@ ...@@ -150,9 +150,9 @@
<select id="statisticRefund" <select id="statisticRefund"
resultType="com.jiejing.fitness.finance.api.cashier.vo.StudioCashierStatisticVO"> resultType="com.jiejing.fitness.finance.api.cashier.vo.StudioCashierStatisticVO">
select sum(trans_amount) as total_trans_amount, select sum(trans_amount) as total_trans_amount,
sum(case when trans_state = 'REFUND_SUCCESS' then actual_amount else 0 end) as total_actual_amount, sum(actual_amount) as total_actual_amount,
sum(case when trans_state = 'REFUND_SUCCESS' then fee else 0 end) as total_fee, sum(case when trans_state = 'REFUND_SUCCESS' then fee else 0 end) as total_fee,
count(id) as total count(id) as total
from studio_cashier_record from studio_cashier_record
<where> <where>
and trans_type = 'REFUND' and trans_type = 'REFUND'
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
<artifactId>permcenter-api</artifactId> <artifactId>permcenter-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jiejing.base</groupId>
<artifactId>configcenter-api</artifactId>
</dependency>
<dependency>
<groupId>com.jiejing.event</groupId> <groupId>com.jiejing.event</groupId>
<artifactId>scs-event</artifactId> <artifactId>scs-event</artifactId>
</dependency> </dependency>
......
...@@ -16,6 +16,7 @@ import com.jiejing.common.utils.convert.BeanUtil; ...@@ -16,6 +16,7 @@ import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.common.utils.text.StringUtil; import com.jiejing.common.utils.text.StringUtil;
import com.jiejing.common.utils.time.TimeUtil; import com.jiejing.common.utils.time.TimeUtil;
import com.jiejing.fitness.enums.auth.AuthDomainEnum; import com.jiejing.fitness.enums.auth.AuthDomainEnum;
import com.jiejing.fitness.enums.config.ObjectTypeEnum;
import com.jiejing.fitness.enums.finance.BrandCashierTransStateEnum; import com.jiejing.fitness.enums.finance.BrandCashierTransStateEnum;
import com.jiejing.fitness.event.finance.CashierEvent; import com.jiejing.fitness.event.finance.CashierEvent;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantCheckRefundVO; import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantCheckRefundVO;
...@@ -33,6 +34,7 @@ import com.jiejing.fitness.finance.service.merchant.StudioMerchantService; ...@@ -33,6 +34,7 @@ import com.jiejing.fitness.finance.service.merchant.StudioMerchantService;
import com.jiejing.fitness.finance.service.pay.RefundService; import com.jiejing.fitness.finance.service.pay.RefundService;
import com.jiejing.fitness.finance.service.pay.convert.RefundConvert; import com.jiejing.fitness.finance.service.pay.convert.RefundConvert;
import com.jiejing.fitness.finance.service.pay.params.StudioMerchantRefundParams; import com.jiejing.fitness.finance.service.pay.params.StudioMerchantRefundParams;
import com.jiejing.fitness.finance.service.rpc.ConfigRpcService;
import com.jiejing.fitness.finance.service.rpc.PayRpcService; import com.jiejing.fitness.finance.service.rpc.PayRpcService;
import com.jiejing.fitness.finance.service.rpc.PermissionRpcService; import com.jiejing.fitness.finance.service.rpc.PermissionRpcService;
import com.jiejing.fitness.finance.service.rpc.StudioRpcService; import com.jiejing.fitness.finance.service.rpc.StudioRpcService;
...@@ -90,6 +92,9 @@ public class RefundServiceImpl implements RefundService { ...@@ -90,6 +92,9 @@ public class RefundServiceImpl implements RefundService {
@Resource @Resource
private ConfigService configService; private ConfigService configService;
@Resource
private ConfigRpcService configRpcService;
@Resource(name = "financeThreadPool") @Resource(name = "financeThreadPool")
private Executor executor; private Executor executor;
...@@ -206,15 +211,25 @@ public class RefundServiceImpl implements RefundService { ...@@ -206,15 +211,25 @@ public class RefundServiceImpl implements RefundService {
return; return;
} }
Boolean wx = configRpcService.getStudioBoolConfig(record.getStudioId(), "WECHAT_MEMBER_REFUND_SUCCESS");
Boolean sms = configRpcService.getStudioBoolConfig(record.getStudioId(), "SMS_MEMBER_REFUND_SUCCESS");
String targetId; String targetId;
Long memberId = extra.getLong("notice_member_id"); Long memberId = extra.getLong("notice_member_id");
List<MsgChannelEnum> channels = Lists.newArrayList(MsgChannelEnum.SMS); List<MsgChannelEnum> channels = sms ? Lists.newArrayList(MsgChannelEnum.SMS) : Lists.newArrayList();
if (null != memberId) { if (null != memberId) {
targetId = memberId.toString(); targetId = memberId.toString();
channels.add(MsgChannelEnum.WE_CHAT); if (wx) {
channels.add(MsgChannelEnum.WE_CHAT);
}
} else { } else {
targetId = record.getBuyerPhone(); targetId = record.getBuyerPhone();
} }
if (CollectionUtil.isEmpty(channels)) {
log.info("all config is false {}, {}", wx, sms);
return;
}
Map<String, Object> paramMap = new HashMap<>(1); Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("targetId", targetId); paramMap.put("targetId", targetId);
paramMap.put("studioId", record.getStudioId()); paramMap.put("studioId", record.getStudioId());
......
package com.jiejing.fitness.finance.service.rpc;
import com.google.common.collect.Lists;
import com.jiejing.common.model.JsonResult;
import com.jiejing.configcenter.api.config.ConfigApi;
import com.jiejing.configcenter.api.config.request.GetConfigDetailsRequest;
import com.jiejing.configcenter.api.config.vo.DetailVO;
import com.jiejing.fitness.enums.config.ObjectTypeEnum;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author chengyubing
* @since 2024/6/15 17:20
*/
@Slf4j
@Service
public class ConfigRpcService {
@Resource
private ConfigApi configApi;
public List<DetailVO> listConfig(ObjectTypeEnum objectType, Long objectId, List<String> codes) {
JsonResult<List<DetailVO>> result = configApi.getConfigDetails(
GetConfigDetailsRequest.builder().objectType(objectType.getCode()).objectId(objectId).codes(codes)
.build());
result.assertSuccess();
return Optional.ofNullable(result.getResult()).orElse(new ArrayList<>());
}
public DetailVO getConfig(ObjectTypeEnum objectType, Long objectId, String code) {
return this.listConfig(objectType, objectId, Lists.newArrayList(code)).stream().findFirst().orElse(null);
}
public Boolean getStudioBoolConfig(Long objectId, String code) {
DetailVO vo = getConfig(ObjectTypeEnum.STUDIO, objectId, code);
return Boolean.parseBoolean(vo.getConfigValue());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment