2024-09-24 生产配置

pull/379/head
zhp 1 year ago
parent 9a586a587f
commit 6394a58bef

@ -2,6 +2,7 @@ package com.ruoyi.system.api;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.domain.http.Merchant;
@ -24,12 +25,12 @@ public interface RemoteCustomerApplyLogService
*
*
*
* @param merchantId
* @param getSumDto
* @param source
* @return
*/
@GetMapping("/log/sum")
public R<Integer> sum(@PathVariable("merchantId") Long merchantId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/log/sum")
public R<Integer> sum(@RequestBody GetSumDto getSumDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*

@ -55,8 +55,9 @@ public interface RemoteCustomerService
/**
* token
* @param phone
* @param channelId
* @return
*/
@GetMapping("/customer/getCustomerToken")
public String getCustomerToken(@RequestParam("phone") String phone);
public String getCustomerToken(@RequestParam("phone") String phone,@RequestParam("channelId")Long channelId);
}

@ -1,6 +1,7 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.domain.http.Merchant;
@ -32,7 +33,7 @@ public class RemoteCustomerApplyLogFallbackFactory implements FallbackFactory<Re
return new RemoteCustomerApplyLogService()
{
@Override
public R<Integer> sum(@PathVariable("merchantId") Long merchantId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source)
public R<Integer> sum(GetSumDto getSumDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source)
{
return R.fail("获取商户已申请数失败:" + throwable.getMessage());
}

@ -46,7 +46,7 @@ public class RemoteCustomerFallbackFactory implements FallbackFactory<RemoteCust
}
@Override
public String getCustomerToken(String phone) {
public String getCustomerToken(String phone, Long channelId) {
return null;
}
};

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -0,0 +1,9 @@
package com.ruoyi.common.core.domain;
import lombok.Data;
@Data
public class GetSumDto {
private Long merchantId;
}

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置
@ -30,12 +30,12 @@ spring:
eager: true
transport:
# 控制台地址
dashboard: 47.109.135.151:8718
dashboard: 124.222.144.55:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 47.109.135.151:8848
server-addr: 124.222.144.55:8848
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json

@ -0,0 +1,16 @@
package com.ruoyi.btc.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "system")
@Data
public class Config {
/**
*
*/
private String AESkey;
}

@ -8,6 +8,7 @@ import com.ruoyi.btc.domain.CustomerInfoDto;
import com.ruoyi.btc.service.ISysPublicAllService;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.domain.http.Customer;
@ -108,7 +109,9 @@ public class SysPublicAllServiceImpl implements ISysPublicAllService
List<Merchant> merchants = new ArrayList<>();
for (Merchant merchant:listR.getData()) {
//限量判定
R<Integer> sum = remoteCustomerApplyLogService.sum(merchant.getId(), SecurityConstants.INNER);
GetSumDto dto = new GetSumDto();
dto.setMerchantId(merchant.getId());
R<Integer> sum = remoteCustomerApplyLogService.sum(dto, SecurityConstants.INNER);
if (merchant.getLimitType()==1&&merchant.getLimitNum()<=sum.getData()){
continue;
}

@ -3,17 +3,18 @@ package com.ruoyi.btc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.btc.config.Config;
import com.ruoyi.btc.domain.ComPublicHalfDto;
import com.ruoyi.btc.domain.CustomerInfoDto;
import com.ruoyi.btc.service.ISysPublicHalfService;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.http.Channel;
import com.ruoyi.common.core.domain.http.Customer;
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
import com.ruoyi.common.core.domain.http.Merchant;
import com.ruoyi.common.core.utils.LocalDateTimeUtils;
import com.ruoyi.common.core.utils.EncryptUtil;
import com.ruoyi.common.core.utils.ProbitUtil;
import com.ruoyi.common.core.utils.SecureUtils;
import com.ruoyi.common.core.utils.StringUtils;
@ -24,7 +25,6 @@ import com.ruoyi.system.api.RemoteCustomerService;
import com.ruoyi.system.api.RemoteMerchantService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.*;
import java.util.stream.Collectors;
@ -42,6 +42,7 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
private final RemoteMerchantService remoteMerchantService;
private final RemoteCustomerApplyLogService remoteCustomerApplyLogService;
private final RedisService redisService;
private final Config config;
/**
*
@ -81,6 +82,7 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
customer.setLastLoginTime(new Date());
customer.setIsAuth(false);
customer.setStatus(2);
customer.setPhoneMd5(customerInfoDto.getPhoneMd5());
R<Customer> customerInfoByPhoneMd5 = remoteCustomerService.getCustomerInfoByPhoneMd5(customerInfoDto.getPhoneMd5(), SecurityConstants.INNER);
if (customerInfoByPhoneMd5.getCode()==200){
remoteCustomerService.updateByPhoneMd5(customer,SecurityConstants.INNER);
@ -111,7 +113,9 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
List<Merchant> merchants = new ArrayList<>();
for (Merchant merchant:listR.getData()) {
//限量判定
R<Integer> sum = remoteCustomerApplyLogService.sum(merchant.getId(), SecurityConstants.INNER);
GetSumDto dto = new GetSumDto();
dto.setMerchantId(merchant.getId());
R<Integer> sum = remoteCustomerApplyLogService.sum(dto, SecurityConstants.INNER);
if (merchant.getLimitType()==1&&merchant.getLimitNum()<=sum.getData()){
continue;
}
@ -224,6 +228,9 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
customer.setStatus(1);
R<Customer> customerInfoByPhoneMd5 = remoteCustomerService.getCustomerInfoByPhoneMd5(customerInfoDto.getPhoneMd5(), SecurityConstants.INNER);
if (customerInfoByPhoneMd5.getCode()==200){
customer.setPhone(EncryptUtil.AESencode(customer.getPhone(), config.getAESkey()));
customer.setIdCard(EncryptUtil.AESencode(customer.getIdCard(),config.getAESkey()));
customer.setActurlName(EncryptUtil.AESencode(customer.getActurlName(),config.getAESkey()));
remoteCustomerService.updateByPhoneMd5(customer,SecurityConstants.INNER);
}else {
remoteCustomerService.add(customer,SecurityConstants.INNER);
@ -240,7 +247,7 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
result.put("data",map);
return AjaxResult.success(result);
}
String url = channel.getHtmlLocation() + "?token="+remoteCustomerService.getCustomerToken(customer.getPhone());
String url = channel.getHtmlLocation()+"?sign="+channel.getChannelSign() + "&token="+remoteCustomerService.getCustomerToken(customer.getPhone(),channel.getId() );
map.put("url",url);
map.put("regist",true);
result.put("data",map);

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -1,5 +1,6 @@
package com.ruoyi.file.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@ -13,6 +14,7 @@ import com.ruoyi.file.utils.FileUploadUtils;
*/
@Primary
@Service
@Slf4j
public class LocalSysFileServiceImpl implements ISysFileService
{
/**

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.GetSumDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.dto.ApplyCallback;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,13 +48,13 @@ public class CustomerApplyLogController extends BaseController
*
*
*
* @param merchantId
* @param getSumDto
* @param source
* @return
*/
@GetMapping("/sum")
public R<Integer> sum(@PathVariable("merchantId") Long merchantId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return R.ok(customerApplyLogService.getApplySum(merchantId));
@PostMapping("/sum")
public R<Integer> sum(@RequestBody GetSumDto getSumDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return R.ok(customerApplyLogService.getApplySum(getSumDto.getMerchantId()));
}
/**

@ -88,7 +88,7 @@ public class CustomerController extends BaseController
* @return
*/
@PostMapping("/updateByPhoneMd5")
public R updateByPhoneMd5(Customer customer ,@RequestHeader(SecurityConstants.FROM_SOURCE) String source){
public R updateByPhoneMd5(@RequestBody Customer customer ,@RequestHeader(SecurityConstants.FROM_SOURCE) String source){
return customerService.updateByPhoneMd5(customer);
}
@ -143,7 +143,7 @@ public class CustomerController extends BaseController
* @return
*/
@GetMapping("/getCustomerToken")
public String getCustomerToken(@RequestParam("phone") String phone) {
public String getCustomerToken(@RequestParam("phone") String phone,@RequestParam("channelId")Long channelId) {
return customerService.getCustomerToken(phone);
}

@ -6,11 +6,14 @@ import lombok.Data;
public class MerchantListDto {
//商户名
String merchantName;
private String merchantName;
//商户跳转地址
String merchantUrl;
private String merchantUrl;
//商户描述
String merchantDescribe;
private String merchantDescribe;
//商户ID
private Long merchantId;
}

@ -86,6 +86,13 @@ public interface ICustomerService extends IService<Customer>
*/
String getCustomerToken(String phone);
/**
* token
* @param phone
* @return
*/
public String registAndretrunToken(String phone,Long channelId);
/**
* h5
* @param phone

@ -40,7 +40,9 @@ public class ChannelServiceImpl implements IChannelService
log.info("初始化渠道数据开始");
List<Channel> channels = channelMapper.selectList(new LambdaQueryWrapper<Channel>());
for (Channel channel:channels) {
redisService.deleteObject(CacheConstants.CHANNEL_ID+channel.getId());
redisService.setCacheObject(CacheConstants.CHANNEL_ID+channel.getId(),channel);
redisService.deleteObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign());
redisService.setCacheObject(CacheConstants.CHANNEL_SIGN+channel.getChannelSign(),channel);
}
}

@ -149,8 +149,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
@Override
public String getCustomerToken(String phone) {
log.info("获取用户token,手机号:{},加密结果:{}", phone, EncryptUtil.AESencode(phone, systemConfig.getAESkey()));
Customer customer = this.getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getPhone, EncryptUtil.AESencode(phone, systemConfig.getAESkey())));
log.info("获取用户token,手机号:{}", phone);
Customer customer = this.getOne(new LambdaQueryWrapper<Customer>().eq(Customer::getPhone, phone));
log.info("获取用户token,用户信息:{}", customer);
//获取到用户登陆的token
String token = customerTokenService.getToken(customer.getId());

@ -155,6 +155,7 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
merchantListDto.setMerchantName(merchant.getMerchantName());
merchantListDto.setMerchantDescribe(merchant.getMerchantDescribe());
merchantListDto.setMerchantUrl(merchant.getHitUrl());
merchantListDto.setMerchantId(merchant.getId());
merchantListDtos.add(merchantListDto);
}
return AjaxResult.success(merchantListDtos);

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
namespace: b8ad3fd2-18ea-4cdf-a82c-4ce483392b1a
server-addr: 124.222.144.55:8848
namespace: 9a5181d5-598c-4b27-9644-ef14e7fd250c
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 47.109.135.151:8848
server-addr: 124.222.144.55:8848
config:
# 配置中心地址
server-addr: 47.109.135.151:8848
server-addr: 124.222.144.55:8848
# 配置文件格式
file-extension: yml
# 共享配置

Loading…
Cancel
Save