mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 17:58:17 +08:00
新增rabbitmq
This commit is contained in:
parent
ad12201c3f
commit
696b39e6af
2
pom.xml
2
pom.xml
@ -24,7 +24,7 @@
|
||||
<poi.version>5.2.3</poi.version>
|
||||
<easyexcel.version>3.2.1</easyexcel.version>
|
||||
<velocity.version>2.3</velocity.version>
|
||||
<satoken.version>1.34.0</satoken.version>
|
||||
<satoken.version>1.35.0.RC</satoken.version>
|
||||
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
||||
<p6spy.version>3.9.1</p6spy.version>
|
||||
<hutool.version>5.8.18</hutool.version>
|
||||
|
||||
@ -94,10 +94,11 @@
|
||||
<artifactId>ruoyi-file</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-rabbitmq</artifactId>
|
||||
</dependency>-->
|
||||
<version>4.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- skywalking 整合 logback -->
|
||||
<!-- <dependency>-->
|
||||
|
||||
@ -4,11 +4,18 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.captcha.AbstractCaptcha;
|
||||
import cn.hutool.captcha.generator.CodeGenerator;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.annotation.RateLimiter;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.CaptchaType;
|
||||
import com.ruoyi.common.enums.LimitType;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.exception.user.UserException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.email.MailUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
@ -18,7 +25,9 @@ import com.ruoyi.framework.config.properties.CaptchaProperties;
|
||||
import com.ruoyi.framework.config.properties.MailProperties;
|
||||
import com.ruoyi.sms.config.properties.SmsProperties;
|
||||
import com.ruoyi.sms.core.SmsTemplate;
|
||||
import com.ruoyi.sms.core.TelecomSendMsg;
|
||||
import com.ruoyi.sms.entity.SmsResult;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -50,6 +59,7 @@ public class CaptchaController {
|
||||
private final SmsProperties smsProperties;
|
||||
private final ISysConfigService configService;
|
||||
private final MailProperties mailProperties;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
/**
|
||||
* 短信验证码
|
||||
@ -61,15 +71,22 @@ public class CaptchaController {
|
||||
if (!smsProperties.getEnabled()) {
|
||||
return R.fail("当前系统没有开启短信功能!");
|
||||
}
|
||||
//判断系统中是否存在该人才
|
||||
SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getPhonenumber, SysUser::getStatus)
|
||||
.eq(SysUser::getPhonenumber, phonenumber));
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
log.info("登录用户:{} 不存在.", phonenumber);
|
||||
throw new UserException("user.not.exists", phonenumber);
|
||||
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
||||
log.info("登录用户:{} 已被停用.", phonenumber);
|
||||
throw new UserException("user.blocked", phonenumber);
|
||||
}
|
||||
String key = CacheConstants.CAPTCHA_CODE_KEY + phonenumber;
|
||||
String code = RandomUtil.randomNumbers(4);
|
||||
String code = RandomUtil.randomNumbers(6);
|
||||
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
||||
// 验证码模板id 自行处理 (查数据库或写死均可)
|
||||
String templateId = "";
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
map.put("code", code);
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
SmsResult result = smsTemplate.send(phonenumber, templateId, map);
|
||||
TelecomSendMsg smsTemplate = SpringUtils.getBean(TelecomSendMsg.class);
|
||||
SmsResult result = smsTemplate.telecomSendCode(phonenumber, code, "login");
|
||||
if (!result.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", result);
|
||||
return R.fail(result.getMessage());
|
||||
|
||||
@ -126,6 +126,7 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 首页购房申请表展示
|
||||
*/
|
||||
// @SaCheckPermission("system:houses:indexType")
|
||||
@GetMapping("/indexType")
|
||||
public R<?>getIndexType(){
|
||||
return iBuyHousesService.getIndexType();
|
||||
@ -134,6 +135,7 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 首页企业所在地展示
|
||||
*/
|
||||
// @SaCheckPermission("system:houses:companyDistrict")
|
||||
@GetMapping("/companyDistrict")
|
||||
public R<?>getCompanyDistrict(){
|
||||
return iBuyHousesService.getCompanyDistrict();
|
||||
@ -141,6 +143,7 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 首页国籍和婚姻状态展示
|
||||
*/
|
||||
// @SaCheckPermission("system:houses:nationalityAndMarital")
|
||||
@GetMapping("/nationalityAndMarital")
|
||||
public R<?>getNationalityAndMarital(){
|
||||
return iBuyHousesService.getNationalityAndMarital();
|
||||
@ -149,6 +152,7 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 首页第一排基础数据
|
||||
*/
|
||||
// @SaCheckPermission("system:houses:basicData")
|
||||
@GetMapping("/basicData")
|
||||
public R getBasicData(){
|
||||
return iBuyHousesService.getBasicData();
|
||||
@ -157,6 +161,7 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 复审柱状图
|
||||
*/
|
||||
// @SaCheckPermission("system:houses:histogram")
|
||||
@GetMapping("/histogram")
|
||||
public R getHistogram(String date){
|
||||
return iBuyHousesService.getHistogram(date);
|
||||
|
||||
@ -14,7 +14,9 @@ import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.excel.ExcelResult;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.BuyHouses;
|
||||
import com.ruoyi.system.domain.HousesReview;
|
||||
@ -179,6 +181,19 @@ public class HousesReviewController extends BaseController {
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
ExcelResult<HousesReviewVo> result = ExcelUtil.importExcel(file.getInputStream(), HousesReviewVo.class, true);
|
||||
List<HousesReviewVo> volist = result.getList();
|
||||
//判断时间格式是否正确
|
||||
volist.stream().forEach(v ->{
|
||||
if (!DateUtils.checkDate(v.getQualificationConfirmTime(),DateUtils.YYYY_MM_DD_HH_MM_SS)){
|
||||
throw new ServiceException("资格确认时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
if (!DateUtils.checkDate(v.getAuditTime(),DateUtils.YYYY_MM_DD)){
|
||||
throw new ServiceException("审核时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD);
|
||||
}
|
||||
if (!DateUtils.checkDate(v.getRegisterFailureTime(),DateUtils.YYYY_MM_DD)){
|
||||
throw new ServiceException("登记失效时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD);
|
||||
}
|
||||
});
|
||||
|
||||
List<HousesReview> list = BeanUtil.copyToList(volist, HousesReview.class);
|
||||
//先获取到导入数据的身份证去购房一期数据库去查
|
||||
//过滤出导入表中的身份证号码
|
||||
|
||||
@ -47,7 +47,7 @@ public class SysUserOnlineController extends BaseController {
|
||||
for (String key : keys) {
|
||||
String token = StringUtils.substringAfterLast(key, ":");
|
||||
// 如果已经过期则跳过
|
||||
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < -1) {
|
||||
if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) {
|
||||
continue;
|
||||
}
|
||||
userOnlineDTOList.add(RedisUtils.getCacheObject(CacheConstants.ONLINE_TOKEN_KEY + token));
|
||||
|
||||
@ -16,6 +16,7 @@ import com.ruoyi.common.utils.StrUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.sms.core.SmsTemplate;
|
||||
import com.ruoyi.sms.core.TelecomSendMsg;
|
||||
import com.ruoyi.sms.entity.SmsResult;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
@ -44,6 +45,7 @@ public class SysLoginController {
|
||||
private final ISysMenuService menuService;
|
||||
private final ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
@ -220,7 +222,7 @@ public class SysLoginController {
|
||||
if (!matches) {
|
||||
return R.fail("手机号格式不正确");
|
||||
}
|
||||
return sendMsg(phones,CacheConstants.RORGOT_PASSWORD_SEND_MSG+phones);
|
||||
return sendMsg(phones,CacheConstants.RORGOT_PASSWORD_SEND_MSG+phones,"forgetPwd");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -236,7 +238,7 @@ public class SysLoginController {
|
||||
if (!matches) {
|
||||
return R.fail("手机号格式不正确");
|
||||
}
|
||||
return sendMsg(phones,CacheConstants.REGISTER_SEND_MSG+phones);
|
||||
return sendMsg(phones,CacheConstants.REGISTER_SEND_MSG+phones,"register");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,20 +254,20 @@ public class SysLoginController {
|
||||
if (!matches) {
|
||||
return R.fail("手机号格式不正确");
|
||||
}
|
||||
return sendMsg(phones,CacheConstants.SMS_LOGIN_SEND_MSG+phones);
|
||||
return sendMsg(phones,CacheConstants.SMS_LOGIN_SEND_MSG+phones,"login");
|
||||
}
|
||||
|
||||
public R<?> sendMsg(String phones,String key ){
|
||||
public R<?> sendMsg(String phones,String key ,String type){
|
||||
//1.获取redis中是否存在该key
|
||||
Boolean aBoolean = RedisUtils.hasKey(key + phones);
|
||||
if (aBoolean) {
|
||||
return R.fail("当前账号验证码已发送,2分钟内有效,请勿再次点击");
|
||||
} else {
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
TelecomSendMsg smsTemplate = SpringUtils.getBean(TelecomSendMsg.class);
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
String code = StrUtils.getRandomString(6);
|
||||
map.put("code",code);
|
||||
SmsResult send = smsTemplate.send(phones, "SMS_174992554", map);
|
||||
SmsResult send = smsTemplate.telecomSendCode(phones, code, type);
|
||||
if (send.isSuccess()){
|
||||
RedisUtils.setCacheObject(key + phones, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
|
||||
return R.ok();
|
||||
|
||||
@ -9,11 +9,14 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.common.utils.file.MimeTypeUtils;
|
||||
import com.ruoyi.file.service.ISysFileService;
|
||||
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||
import com.ruoyi.system.service.ISysOssService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -34,7 +37,8 @@ import java.util.Map;
|
||||
public class SysProfileController extends BaseController {
|
||||
|
||||
private final ISysUserService userService;
|
||||
private final ISysOssService iSysOssService;
|
||||
// private final ISysOssService iSysOssService;
|
||||
private final ISysFileService sysFileService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
@ -104,17 +108,18 @@ public class SysProfileController extends BaseController {
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) {
|
||||
public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) throws Exception {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
if (!avatarfile.isEmpty()) {
|
||||
String extension = FileUtil.extName(avatarfile.getOriginalFilename());
|
||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
||||
return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||
}
|
||||
SysOssVo oss = iSysOssService.upload(avatarfile);
|
||||
String avatar = oss.getUrl();
|
||||
if (userService.updateUserAvatar(getUsername(), avatar)) {
|
||||
ajax.put("imgUrl", avatar);
|
||||
String url = sysFileService.uploadFile(avatarfile);
|
||||
/*SysOssVo oss = iSysOssService.upload(avatarfile);
|
||||
String avatar = oss.getUrl();*/
|
||||
if (userService.updateUserAvatar(getUsername(), url)) {
|
||||
ajax.put("imgUrl", url);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,10 +116,10 @@ spring:
|
||||
ssl: false
|
||||
#mq
|
||||
rabbitmq:
|
||||
host: 127.0.0.1
|
||||
host: 182.42.90.82
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
username: cddbxqtalents
|
||||
password: 1234Qwer@
|
||||
virtual-host: /
|
||||
#确认消息已发送到队列
|
||||
publisher-returns: true
|
||||
@ -134,6 +134,17 @@ spring:
|
||||
acknowledge-mode: manual
|
||||
simple:
|
||||
acknowledge-mode: manual
|
||||
# 消费者预取1条数据到内存,默认为250条
|
||||
prefetch: 1
|
||||
#重试机制
|
||||
retry:
|
||||
enabled: false
|
||||
max-attempts: 5 #最大重试次数
|
||||
initial-interval: 1000 #重试间隔时间
|
||||
max-interval: 10000 #重试最大时间间隔
|
||||
# 乘子。间隔时间*乘子=下一次的间隔时间,不能超过max-interval
|
||||
# 以本处为例:第一次间隔 5 秒,第二次间隔 10 秒,以此类推
|
||||
multiplier: 2
|
||||
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,8 @@ spring:
|
||||
# 数据库索引
|
||||
database: 7
|
||||
# 密码(如没有密码请注释掉)
|
||||
password: 123456
|
||||
password: N8PTRAirBO
|
||||
# password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@ -106,7 +106,10 @@ sa-token:
|
||||
# token有效期 设为一天 (必定过期) 单位: 秒
|
||||
timeout: 86400
|
||||
# token临时有效期 (指定时间无操作就过期) 单位: 秒
|
||||
activity-timeout: 1800
|
||||
# activity-timeout: 1800
|
||||
# 多端不同 token 有效期 可查看 LoginHelper.loginByDevice 方法自定义
|
||||
# token最低活跃时间 (指定时间无操作就过期) 单位: 秒
|
||||
active-timeout: 1800
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
|
||||
@ -3,6 +3,7 @@ package com.ruoyi.test;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.io.resource.ClassPathResource;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@ -22,18 +23,23 @@ import com.antherd.smcrypto.sm2.Sm2;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.utils.AesUtil;
|
||||
import com.ruoyi.common.utils.CardsUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.MyFileUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.demo.domain.ImageDemoData;
|
||||
import com.ruoyi.mq.config.PluginDelayRabbitConfig;
|
||||
import com.ruoyi.mq.config.TalentsDelayRabbitConfig;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.HousesReviewVo;
|
||||
import com.ruoyi.system.domain.vo.MaterialTalentsVo;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.IBuyHousesService;
|
||||
import com.ruoyi.system.service.impl.BuyHousesServiceImpl;
|
||||
import com.ruoyi.system.service.impl.MaterialModuleServiceImpl;
|
||||
import com.ruoyi.system.service.impl.SysConfigServiceImpl;
|
||||
import com.ruoyi.work.domain.ActProcess;
|
||||
@ -41,7 +47,6 @@ import com.ruoyi.work.domain.HisProcess;
|
||||
import com.ruoyi.work.domain.TProcess;
|
||||
import com.ruoyi.work.domain.vo.ActProcessVo;
|
||||
import com.ruoyi.work.domain.vo.ProcessVo;
|
||||
import com.ruoyi.work.dto.BusinessDTO;
|
||||
import com.ruoyi.work.dto.HousingConstructionBureauPushDto;
|
||||
import com.ruoyi.work.mapper.ActProcessMapper;
|
||||
import com.ruoyi.work.mapper.HisProcessMapper;
|
||||
@ -51,17 +56,23 @@ import com.ruoyi.work.utils.WorkComplyUtils;
|
||||
import org.apache.commons.text.CaseUtils;
|
||||
import org.bouncycastle.crypto.engines.SM2Engine;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.amqp.AmqpException;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import java.io.*;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyPair;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@ -125,9 +136,13 @@ public class DemoUnitTest {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
*/
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate amqpTemplate;*/
|
||||
private BuyHousesServiceImpl buyHousesService;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate amqpTemplate;
|
||||
|
||||
|
||||
@DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
|
||||
@ -585,7 +600,7 @@ public class DemoUnitTest {
|
||||
System.out.println("result2 = " + result2);
|
||||
}
|
||||
|
||||
//String privateKey="9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e";
|
||||
//String privateKey="9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e";
|
||||
@Test
|
||||
public void test0212311123123(){
|
||||
String publicKey="0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78";
|
||||
@ -783,12 +798,26 @@ public class DemoUnitTest {
|
||||
*/
|
||||
@Test
|
||||
public void test0004(){
|
||||
Keypair keypair = Sm2.generateKeyPairHex();
|
||||
/*Keypair keypair = Sm2.generateKeyPairHex();
|
||||
String publicKey = keypair.getPublicKey();
|
||||
System.out.println("publicKey = " + publicKey);
|
||||
|
||||
String privateKey = keypair.getPrivateKey();
|
||||
System.out.println("privateKey = " + privateKey);
|
||||
System.out.println("privateKey = " + privateKey);*/
|
||||
// String substring = DesensitizedUtil.idCardNum("510503199602214055", 4, 0).substring(0, 9);
|
||||
// System.out.println("card = " + substring);
|
||||
buyHousesService.excelZip();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestMessageAck() throws UnsupportedEncodingException {
|
||||
String msg="消息4";
|
||||
Message build = MessageBuilder.withBody(msg.getBytes()).build();
|
||||
build.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
|
||||
build.getMessageProperties().setDelay(50000);
|
||||
amqpTemplate.convertAndSend(TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_EXCHANGE,TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_KEY,build);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.ruoyi.common.helper;
|
||||
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.context.model.SaStorage;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
@ -66,7 +67,12 @@ public class LoginHelper {
|
||||
if (loginUser != null) {
|
||||
return loginUser;
|
||||
}
|
||||
loginUser = (LoginUser) StpUtil.getTokenSession().get(LOGIN_USER_KEY);
|
||||
// loginUser = (LoginUser) StpUtil.getTokenSession().get(LOGIN_USER_KEY);
|
||||
SaSession session = StpUtil.getTokenSession();
|
||||
if (ObjectUtil.isNull(session)) {
|
||||
return null;
|
||||
}
|
||||
loginUser = (LoginUser) session.get(LOGIN_USER_KEY);
|
||||
SaHolder.getStorage().set(LOGIN_USER_KEY, loginUser);
|
||||
return loginUser;
|
||||
}
|
||||
@ -75,7 +81,12 @@ public class LoginHelper {
|
||||
* 获取用户基于token
|
||||
*/
|
||||
public static LoginUser getLoginUser(String token) {
|
||||
return (LoginUser) StpUtil.getTokenSessionByToken(token).get(LOGIN_USER_KEY);
|
||||
// return (LoginUser) StpUtil.getTokenSessionByToken(token).get(LOGIN_USER_KEY);
|
||||
SaSession session = StpUtil.getTokenSessionByToken(token);
|
||||
if (ObjectUtil.isNull(session)) {
|
||||
return null;
|
||||
}
|
||||
return (LoginUser) session.get(LOGIN_USER_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
199
ruoyi-common/src/main/java/com/ruoyi/common/utils/CardsUtil.java
Normal file
199
ruoyi-common/src/main/java/com/ruoyi/common/utils/CardsUtil.java
Normal file
@ -0,0 +1,199 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import jodd.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @Description 各证件卡号校验类
|
||||
* @author longwei
|
||||
* @date 2020/7/23 14:17
|
||||
*/
|
||||
public class CardsUtil {
|
||||
|
||||
/** 正则表达式:验证身份证 */
|
||||
public static final String REGEX_ID_CARD = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
|
||||
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
|
||||
|
||||
/** 正则表达式:验证户口簿 9位数字 */
|
||||
public static final String REGEX_HUKOU_CARD = "\\d{9}";
|
||||
|
||||
/** 正则表达式:验证护照 数字+字母,共9位 */
|
||||
public static final String REGEX_PASSPORT_CARD = "^([a-zA-z]|[0-9]){9}$";
|
||||
|
||||
/** 正则表达式:验证军官证 汉字+8位数字 */
|
||||
public static final String REGEX_OFFICER_CARD = "^[\\u4E00-\\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$";
|
||||
|
||||
/** 正则表达式:验证驾驶证 12位数字 */
|
||||
public static final String REGEX_DRIVE_CARD = "\\d{12}$";
|
||||
|
||||
/** 正则表达式:验证港澳居民通行证 H/M + 10位或8位数字 */
|
||||
public static final String REGEX_HK_CARD = "^[HMhm]{1}([0-9]{10}|[0-9]{8})$";
|
||||
|
||||
/** 正则表达式:验证台湾居民通行证 新版8位或18位数字,旧版10位数字 + 英文字母 */
|
||||
public static final String REGEX_TW_CARD = "^\\d{8}|^[a-zA-Z0-9]{10}|^\\d{18}$";
|
||||
|
||||
/**
|
||||
* 校验身份证
|
||||
*
|
||||
* @param idCardNo 身份证号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
* @by https://blog.csdn.net/u011106915/article/details/76066985
|
||||
*/
|
||||
public static boolean isIDCard(String idCardNo) {
|
||||
//校验非空
|
||||
if (StringUtil.isEmpty(idCardNo)) {
|
||||
return false;
|
||||
}
|
||||
//校验长度
|
||||
int idCardLength = idCardNo.length();
|
||||
if (idCardLength != 18 && idCardLength != 15 && idCardLength != 9) {
|
||||
return false;
|
||||
}
|
||||
if (idCardLength==9){
|
||||
return idCardNo.matches(REGEX_PASSPORT_CARD);
|
||||
}
|
||||
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
|
||||
//假设18位身份证号码:41000119910101123X 410001 19910101 123X
|
||||
//^开头
|
||||
//[1-9] 第一位1-9中的一个 4
|
||||
//\\d{5} 五位数字 10001(前六位省市县地区)
|
||||
//(18|19|20) 19(现阶段可能取值范围18xx-20xx年)
|
||||
//\\d{2} 91(年份)
|
||||
//((0[1-9])|(10|11|12)) 01(月份)
|
||||
//(([0-2][1-9])|10|20|30|31)01(日期)
|
||||
//\\d{3} 三位数字 123(第十七位奇数代表男,偶数代表女)
|
||||
//[0-9Xx] 0123456789Xx其中的一个 X(第十八位为校验值)
|
||||
//$结尾
|
||||
|
||||
//假设15位身份证号码:410001910101123 410001 910101 123
|
||||
//^开头
|
||||
//[1-9] 第一位1-9中的一个 4
|
||||
//\\d{5} 五位数字 10001(前六位省市县地区)
|
||||
//\\d{2} 91(年份)
|
||||
//((0[1-9])|(10|11|12)) 01(月份)
|
||||
//(([0-2][1-9])|10|20|30|31)01(日期)
|
||||
//\\d{3} 三位数字 123(第十五位奇数代表男,偶数代表女),15位身份证不含X
|
||||
//$结尾
|
||||
|
||||
boolean matches = idCardNo.matches(REGEX_ID_CARD);
|
||||
|
||||
//判断第18位校验值
|
||||
if (matches) {
|
||||
|
||||
//如是15位身份证,不做更多校验,直接返回合法
|
||||
if (idCardLength == 15) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (idCardLength == 18) {
|
||||
try {
|
||||
char[] charArray = idCardNo.toCharArray();
|
||||
//前十七位加权因子
|
||||
int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
|
||||
//这是除以11后,可能产生的11位余数对应的验证码
|
||||
String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
|
||||
int sum = 0;
|
||||
for (int i = 0; i < idCardWi.length; i++) {
|
||||
int current = Integer.parseInt(String.valueOf(charArray[i]));
|
||||
int count = current * idCardWi[i];
|
||||
sum += count;
|
||||
}
|
||||
char idCardLast = charArray[17];
|
||||
int idCardMod = sum % 11;
|
||||
return idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验户口簿
|
||||
*
|
||||
* @param huKouNo 户口簿号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isHuKouCard(String huKouNo) {
|
||||
//校验非空 校验长度
|
||||
if (StringUtils.isEmpty(huKouNo) || huKouNo.length() != 9 ) {
|
||||
return false;
|
||||
}
|
||||
return huKouNo.matches(REGEX_HUKOU_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验护照
|
||||
*
|
||||
* @param passPortNo 护照号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isPassPortCard(String passPortNo) {
|
||||
//校验非空
|
||||
if (StringUtil.isEmpty(passPortNo)) {
|
||||
return false;
|
||||
}
|
||||
return passPortNo.matches(REGEX_PASSPORT_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验军官证
|
||||
* 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
|
||||
* 样本: 军字第2001988号, 士字第P011816X号
|
||||
* @param officerNo 军官证号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isofficerCard(String officerNo) {
|
||||
//校验非空
|
||||
if (StringUtil.isEmpty(officerNo)) {
|
||||
return false;
|
||||
}
|
||||
return officerNo.matches(REGEX_OFFICER_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验驾驶证
|
||||
*
|
||||
* @param driveNo 驾驶证号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isDriveCard(String driveNo) {
|
||||
//校验非空 校验长度
|
||||
if (StringUtil.isEmpty(driveNo) || driveNo.length() != 12 ) {
|
||||
return false;
|
||||
}
|
||||
return driveNo.matches(REGEX_DRIVE_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验港澳通行证
|
||||
*
|
||||
* @param HMNo 港澳通行证号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isHMCard(String HMNo) {
|
||||
//校验非空
|
||||
if (StringUtil.isEmpty(HMNo)) {
|
||||
return false;
|
||||
}
|
||||
return HMNo.matches(REGEX_HK_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验台湾通行证
|
||||
* 规则 新版8位或18位数字,旧版10位数字 + 英文字母
|
||||
* @param TWNo 台湾通行证号
|
||||
* @return 校验通过返回true,否则返回false
|
||||
*/
|
||||
public static boolean isTWCard(String TWNo) {
|
||||
//校验非空
|
||||
if (StringUtil.isEmpty(TWNo)) {
|
||||
return false;
|
||||
}
|
||||
return TWNo.matches(REGEX_TW_CARD);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@ -170,4 +172,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否符合时间格式
|
||||
* @param sDate
|
||||
* @param format
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkDate(String sDate,String format){
|
||||
int legalLen = sDate.length();
|
||||
if (ObjectUtil.isNull(legalLen) || legalLen==0){
|
||||
return false;
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat(format);
|
||||
try {
|
||||
Date date = formatter.parse(sDate);
|
||||
return sDate.equals(formatter.format(date));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,4 +322,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param str
|
||||
* @function 判断输入的数据是否是大于等于零的整数
|
||||
*/
|
||||
public static boolean isNumeric(String str) {
|
||||
for (int i = str.length(); --i >= 0;) {
|
||||
if (!Character.isDigit(str.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<!--rabbitmq-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
/*
|
||||
package com.ruoyi.mq.config;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.CustomExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class DelayedRabbitMQConfig {
|
||||
*/
|
||||
/**
|
||||
* 延迟队列名称
|
||||
*//*
|
||||
|
||||
public static final String DELAYED_QUEUE_NAME = "delay.queue.demo.delay.queue";
|
||||
*/
|
||||
/**
|
||||
* 延迟队列交换机
|
||||
*//*
|
||||
|
||||
public static final String DELAYED_EXCHANGE_NAME = "delay.queue.demo.delay.exchange";
|
||||
*/
|
||||
/**
|
||||
* 延迟队列路由键
|
||||
*//*
|
||||
|
||||
public static final String DELAYED_ROUTING_KEY = "delay.queue.demo.delay.routingkey";
|
||||
|
||||
// 声明延迟队列
|
||||
@Bean
|
||||
public Queue delayedSmsQueueInit() {
|
||||
return new Queue("sms_delayed_queue",true);
|
||||
}
|
||||
|
||||
// 声明延迟交换机
|
||||
@Bean
|
||||
public CustomExchange delayedExchangeInit() {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
args.put("x-delayed-type", "direct");
|
||||
return new CustomExchange("delayed_exchange", "x-delayed-message", true, false, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding delayedBindingSmsQueue(Queue delayedSmsQueueInit, CustomExchange customExchange) {
|
||||
// 延迟队列绑定延迟交换机并设置RoutingKey为sms
|
||||
return BindingBuilder.bind(delayedSmsQueueInit).to(customExchange).with("sms").noargs();
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -14,21 +14,31 @@ import java.util.Map;
|
||||
@Configuration
|
||||
public class PluginDelayRabbitConfig {
|
||||
|
||||
@Bean("pluginDelayExchange")
|
||||
public static final String PLUGIN_DELAY_EXCHANGE = "pluginDelayExchange";
|
||||
public static final String PLUGIN_DELAY_QUEUE = "pluginDelayQueue";
|
||||
public static final String PLUGIN_DELAY_KEY_TALENTS = "pluginDelayKeyTalents";
|
||||
|
||||
@Bean(PLUGIN_DELAY_EXCHANGE)
|
||||
public CustomExchange pluginDelayExchange() {
|
||||
Map<String, Object> argMap = new HashMap<>();
|
||||
argMap.put("x-delayed-type", "direct");//必须要配置这个类型,可以是direct,topic和fanout
|
||||
//第二个参数必须为x-delayed-message
|
||||
return new CustomExchange("PLUGIN_DELAY_EXCHANGE","x-delayed-message",true, false, argMap);
|
||||
return new CustomExchange(PLUGIN_DELAY_EXCHANGE,"x-delayed-message",true, false, argMap);
|
||||
}
|
||||
|
||||
@Bean("pluginDelayQueue")
|
||||
@Bean(PLUGIN_DELAY_QUEUE)
|
||||
public Queue pluginDelayQueue(){
|
||||
return new Queue("PLUGIN_DELAY_QUEUE");
|
||||
return new Queue(PLUGIN_DELAY_QUEUE,true,false,false);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding pluginDelayBinding(@Qualifier("pluginDelayQueue") Queue queue, @Qualifier("pluginDelayExchange") CustomExchange customExchange){
|
||||
return BindingBuilder.bind(queue).to(customExchange).with("delay").noargs();
|
||||
//使用下 ImmediateRequeueMessageRecoverer 重新排队在RabbitMQConfiguration中配置
|
||||
/*@Bean
|
||||
public MessageRecoverer messageRecoverer(RabbitTemplate rabbitTemplate) {
|
||||
return new RepublishMessageRecoverer(rabbitTemplate,"test_dead_letter_exchange","test_dead_letter_key");
|
||||
}*/
|
||||
|
||||
@Bean("pluginDelayBinding")
|
||||
public Binding pluginDelayBinding(@Qualifier(PLUGIN_DELAY_QUEUE) Queue queue, @Qualifier(PLUGIN_DELAY_EXCHANGE) CustomExchange customExchange){
|
||||
return BindingBuilder.bind(queue).to(customExchange).with(PLUGIN_DELAY_KEY_TALENTS).noargs();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @Author : JCccc
|
||||
* @CreateTime : 2019/9/3
|
||||
* @Description :
|
||||
*/
|
||||
|
||||
**/
|
||||
|
||||
@Configuration
|
||||
public class RabbitConfig {
|
||||
@ -43,7 +44,6 @@ public class RabbitConfig {
|
||||
System.out.println("ReturnCallback: "+"路由键:"+routingKey);
|
||||
}
|
||||
});
|
||||
|
||||
return rabbitTemplate;
|
||||
}
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
package com.ruoyi.mq.config;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.FanoutExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author whc
|
||||
* @date 2022/5/23 10:18
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitMQConfiguration {
|
||||
|
||||
//1.声明注册fanout模式的交换机
|
||||
@Bean
|
||||
public FanoutExchange fanoutExchange() {
|
||||
return new FanoutExchange("fanout_order_exchange", true, false);
|
||||
}
|
||||
|
||||
//2.声明队列,sms.fanout.queue email.fanout.queue msg.fanout.queue
|
||||
@Bean
|
||||
public Queue smsQueue() {
|
||||
return new Queue("sms.fanout.queue", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue emailQueue() {
|
||||
return new Queue("email.fanout.queue", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue msgQueue() {
|
||||
return new Queue("msg.fanout.queue", true);
|
||||
}
|
||||
|
||||
//3.完成绑定关系(队列与交换机完成绑定关系)
|
||||
@Bean
|
||||
public Binding smsBind() {
|
||||
return BindingBuilder.bind(smsQueue()).to(fanoutExchange());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding emailBind() {
|
||||
return BindingBuilder.bind(emailQueue()).to(fanoutExchange());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding msgBind() {
|
||||
return BindingBuilder.bind(msgQueue()).to(fanoutExchange());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.ruoyi.mq.config;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.CustomExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 人才认定消息配置
|
||||
*/
|
||||
@Configuration
|
||||
public class TalentsDelayRabbitConfig {
|
||||
public static final String TALENTS_PLUGIN_DELAY_EXCHANGE = "talentsPluginDelayExchange";
|
||||
public static final String TALENTS_PLUGIN_DELAY_QUEUE = "talentsPluginDelayQueue";
|
||||
public static final String TALENTS_PLUGIN_DELAY_KEY = "talentsPluginDelayKey";
|
||||
|
||||
@Bean(TALENTS_PLUGIN_DELAY_EXCHANGE)
|
||||
public CustomExchange talentsPluginDelayExchange() {
|
||||
Map<String, Object> argMap = new HashMap<>();
|
||||
argMap.put("x-delayed-type", "direct");//必须要配置这个类型,可以是direct,topic和fanout
|
||||
//第二个参数必须为x-delayed-message
|
||||
return new CustomExchange(TALENTS_PLUGIN_DELAY_EXCHANGE,"x-delayed-message",true, false, argMap);
|
||||
}
|
||||
|
||||
@Bean(TALENTS_PLUGIN_DELAY_QUEUE)
|
||||
public Queue talentsPluginDelayQueue(){
|
||||
return new Queue(TALENTS_PLUGIN_DELAY_QUEUE,true,false,false);
|
||||
}
|
||||
|
||||
//使用下 ImmediateRequeueMessageRecoverer 重新排队在RabbitMQConfiguration中配置
|
||||
/*@Bean
|
||||
public MessageRecoverer messageRecoverer(RabbitTemplate rabbitTemplate) {
|
||||
return new RepublishMessageRecoverer(rabbitTemplate,"test_dead_letter_exchange","test_dead_letter_key");
|
||||
}*/
|
||||
|
||||
@Bean
|
||||
public Binding talentsPluginDelayBinding(@Qualifier(TALENTS_PLUGIN_DELAY_QUEUE) Queue queue, @Qualifier(TALENTS_PLUGIN_DELAY_EXCHANGE) CustomExchange customExchange){
|
||||
return BindingBuilder.bind(queue).to(customExchange).with(TALENTS_PLUGIN_DELAY_KEY).noargs();
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class Consumer {
|
||||
|
||||
@RabbitListener(queues = "sms_delayed_queue")
|
||||
public void receiveD(Message message, Channel channel) throws IOException {
|
||||
String msg = new String(message.getBody());
|
||||
log.info("当前时间:{},延时队列收到消息:{}", new Date().toString(), msg);
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.ruoyi.mq.config.TalentsDelayRabbitConfig;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class DirectReceiver {
|
||||
|
||||
@RabbitListener(queues = TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_QUEUE)//监听的队列名称 TestDirectQueue
|
||||
public void processs(Message message,Channel channel) throws IOException {
|
||||
String msg = new String(message.getBody(), "UTF-8");
|
||||
System.out.println("msg = " + msg);
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
|
||||
// 重新发送消息到队尾
|
||||
// 参数:Exchange、routingKey、额外的设置属性、消息字节数组
|
||||
/*channel.basicPublish(message.getMessageProperties().getReceivedExchange(),
|
||||
message.getMessageProperties().getReceivedRoutingKey(),
|
||||
null,msg.getBytes());*/
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author whc
|
||||
* @date 2022/5/23 18:53
|
||||
*/
|
||||
@RabbitListener(queues = "email.fanout.queue")
|
||||
@Component
|
||||
public class FanoutEmailConsumer {
|
||||
|
||||
@RabbitHandler
|
||||
public void messageService(String message) {
|
||||
System.out.println("fanout email ==>" + message);
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author whc
|
||||
* @date 2022/5/23 18:50
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class OrderService {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
public void makeOrder() {
|
||||
String orderId = UUID.randomUUID().toString();
|
||||
System.out.println("订单生成成功:" + orderId);
|
||||
String exchange_name = "fanout_order_exchange";
|
||||
String routeingKey = "";
|
||||
rabbitTemplate.convertAndSend(exchange_name, routeingKey, orderId);
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageProperties;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
public class PluginDelayConsumer {
|
||||
|
||||
@RabbitHandler
|
||||
@RabbitListener(queues = "PLUGIN_DELAY_QUEUE")//监听延时队列
|
||||
public void fanoutConsumer(Message msg, Channel channel) throws IOException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("【插件延迟队列】【" + sdf.format(new Date()) + "】收到消息:" + msg);
|
||||
// channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class Produceras {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
public void sendDelayMsg(String msg, Integer delayTime) {
|
||||
rabbitTemplate.convertAndSend("delayed_exchange", "sms", msg, a -> {
|
||||
a.getMessageProperties().setDelay(delayTime*1000);
|
||||
return a;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.mq.service;
|
||||
|
||||
import com.ruoyi.mq.config.TalentsDelayRabbitConfig;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageBuilder;
|
||||
import org.springframework.amqp.core.MessageDeliveryMode;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 发送人才认定延时模板
|
||||
*/
|
||||
@Component
|
||||
public class SendTalentsTemplate {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate amqpTemplate;
|
||||
|
||||
public void sendDelayTalentsMsgStr(String msg){
|
||||
// 5*24=120小时=120*60分钟=7200分=7200*60秒=432000秒=432000*1000=432000000毫秒
|
||||
Message build = MessageBuilder.withBody(msg.getBytes()).build();
|
||||
build.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
|
||||
build.getMessageProperties().setDelay(259200000);
|
||||
amqpTemplate.convertAndSend(TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_EXCHANGE,TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_KEY,build);
|
||||
}
|
||||
}
|
||||
@ -23,4 +23,5 @@ public interface SmsTemplate {
|
||||
*/
|
||||
SmsResult send(String phones, String templateId, Map<String, String> param);
|
||||
|
||||
|
||||
}
|
||||
|
||||
159
ruoyi-sms/src/main/java/com/ruoyi/sms/core/TelecomSendMsg.java
Normal file
159
ruoyi-sms/src/main/java/com/ruoyi/sms/core/TelecomSendMsg.java
Normal file
@ -0,0 +1,159 @@
|
||||
package com.ruoyi.sms.core;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.sms.entity.SmsResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Service
|
||||
public class TelecomSendMsg{
|
||||
private final String url ="https://msg.cdht.org.cn:8082/apigbk/BatchSend2";
|
||||
private final String CorpID ="jxxc";
|
||||
private final String Pwd ="ULul@2023";
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
* @param phones
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
public SmsResult telecomSendCode(String phones, String content,String type) {
|
||||
try {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("CorpID",CorpID);
|
||||
paramMap.put("Pwd",Pwd);
|
||||
paramMap.put("Mobile",phones);
|
||||
String gbk = null;
|
||||
if ("register".equals(type)){
|
||||
gbk = URLEncoder.encode("验证码:"+content+".尊敬的用户,您正在办理用户注册操作,我们不会向您索要此验证码,切勿告知他人.次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟.【成都高新人才安居资格认定】", "GBK");
|
||||
}else if ("login".equals(type)){
|
||||
gbk = URLEncoder.encode("验证码:"+content+".尊敬的用户,您正在办理用户登录操作,我们不会向您索要此验证码,切勿告知他人.次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟.【成都高新人才安居资格认定】", "GBK");
|
||||
}else if ("forgetPwd".equals(type)){
|
||||
gbk = URLEncoder.encode("验证码:"+content+".尊敬的用户,您正在办理用户忘记密码操作,我们不会向您索要此验证码,切勿告知他人.次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟.【成都高新人才安居资格认定】", "GBK");
|
||||
}else if("updatePwd".equals(type)){
|
||||
gbk = URLEncoder.encode("验证码:"+content+".尊敬的用户,您正在办理用户修改密码,我们不会向您索要此验证码,切勿告知他人.次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟.【成都高新人才安居资格认定】", "GBK");
|
||||
}else if ("updatePhone".equals(type)){
|
||||
|
||||
}
|
||||
paramMap.put("Content",gbk);
|
||||
String result = HttpRequest.get(url)
|
||||
.form(paramMap)//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
if (returnStatus(result)){
|
||||
return SmsResult.builder()
|
||||
.isSuccess(true)
|
||||
.build();
|
||||
}
|
||||
throw new ServiceException("未知异常");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信通知
|
||||
* @param phones
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
public SmsResult telecomSendNotice(String phones, String content) {
|
||||
try {
|
||||
// String url ="https://msg.cdht.org.cn:8082/apigbk/BatchSend2";
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("CorpID","jxxc");
|
||||
paramMap.put("Pwd","ULul@2023");
|
||||
paramMap.put("Mobile",phones);
|
||||
String gbk = null;
|
||||
gbk = URLEncoder.encode(content+"【成都高新人才安居资格认定】", "GBK");
|
||||
paramMap.put("Content",gbk);
|
||||
String result = HttpRequest.get(url)
|
||||
.form(paramMap)//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
if (returnStatus(result)){
|
||||
return SmsResult.builder()
|
||||
.isSuccess(true)
|
||||
.build();
|
||||
}
|
||||
System.out.println("result2 = " + result);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 状态返回值
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
private boolean returnStatus(String number){
|
||||
if (!StringUtils.isNumeric(number)) {
|
||||
switch (number) {
|
||||
case "-1":
|
||||
throw new ServiceException("账户或密码错误,未获取到用户信息");
|
||||
case "-2":
|
||||
throw new ServiceException("其他错误(未知错误,网络波动,请稍后再试)");
|
||||
case "-3":
|
||||
throw new ServiceException("账户配置不正确");
|
||||
case "-4":
|
||||
throw new ServiceException("在禁止发送的时间段");
|
||||
case "-5":
|
||||
throw new ServiceException("余额不足,请充值");
|
||||
case "-6":
|
||||
throw new ServiceException("定时发送时间不是有效的时间格式");
|
||||
case "-7":
|
||||
throw new ServiceException("提交信息末尾未签名,请添加中文的企业签名【 】或内容乱码");
|
||||
case "-8":
|
||||
throw new ServiceException("发送号码数量超出系统限制");
|
||||
case "-9":
|
||||
throw new ServiceException("发送字数超出系统限制长度");
|
||||
case "-10":
|
||||
throw new ServiceException("产品不存在");
|
||||
case "-11":
|
||||
throw new ServiceException("内容不能再存在签名");
|
||||
case "-12":
|
||||
throw new ServiceException("传入参数不正确!");
|
||||
case "-13":
|
||||
throw new ServiceException("手机号校验不正确");
|
||||
case "-14":
|
||||
throw new ServiceException("内容中存在黑字典关键字");
|
||||
case "-15":
|
||||
throw new ServiceException("定时时间格式错误");
|
||||
case "-16":
|
||||
throw new ServiceException("扩展号格式不正确");
|
||||
case "-17":
|
||||
throw new ServiceException("子号池全被占用,请等待释放后再操作");
|
||||
case "-18":
|
||||
throw new ServiceException("该扩展号被投票问卷占用,请使用其他的扩展");
|
||||
case "-19":
|
||||
throw new ServiceException("SendSms计费类型选择不正确");
|
||||
case "-100":
|
||||
throw new ServiceException("发送失败");
|
||||
case "-101":
|
||||
throw new ServiceException("调用频率过快");
|
||||
case "-103":
|
||||
throw new ServiceException("IP未导白");
|
||||
case "-111":
|
||||
throw new ServiceException("个性短信入口错误");
|
||||
case "-200":
|
||||
throw new ServiceException("网络连接失败");
|
||||
case "-401":
|
||||
throw new ServiceException("账号没有调用接口权限,请联系客服专员");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -40,4 +40,6 @@ public class SubscribeExport extends BaseEntity {
|
||||
|
||||
private String processKey;
|
||||
|
||||
private String exportStatus;
|
||||
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ public class BuyHousesEvent extends BaseEntity {
|
||||
private String companyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String excelUserId;
|
||||
private Long excelId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyHousesMember> buyHousesMemberList;
|
||||
|
||||
@ -2,8 +2,12 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.CreditCodeUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@ -18,6 +22,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.CardsUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.MyFileUtils;
|
||||
@ -83,9 +88,9 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
private String prefix;
|
||||
|
||||
//正式地址
|
||||
// private final String URL = "https://gx.chengdutalent.cn:8010/candidates/getCardId";
|
||||
private final String URL = "https://gx.chengdutalent.cn:8010/candidates/getCardId";
|
||||
//测试地址
|
||||
private final String URL = "https://mihuatang.xyz/gaoxin-api/candidates/getCardId";
|
||||
// private final String URL = "https://mihuatang.xyz/gaoxin-api/candidates/getCardId";
|
||||
//本地地址
|
||||
// private final String URL = "http://127.0.0.1:8010/candidates/getCardId";
|
||||
|
||||
@ -152,6 +157,7 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
if (ObjectUtil.isNotNull(bo.getIds())){
|
||||
lqw.in(BuyHouses::getId,bo.getIds());
|
||||
}
|
||||
lqw.eq(ObjectUtil.isNotNull(bo.getId()), BuyHouses::getId, bo.getId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHouses::getInsidepageUrl, bo.getInsidepageUrl());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHouses::getCardId, bo.getCardId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCommitmentUrl()), BuyHouses::getCommitmentUrl, bo.getCommitmentUrl());
|
||||
@ -313,6 +319,13 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
*/
|
||||
private void validEntityBeforeSave(BuyHouses entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
//数据校验
|
||||
if (!CardsUtil.isIDCard(entity.getCardId())){
|
||||
throw new ServiceException("证件号码格式不正确");
|
||||
}
|
||||
if (!CreditCodeUtil.isCreditCode(entity.getSocialCode())){
|
||||
throw new ServiceException("社会统一社会信用代码格式不正确");
|
||||
}
|
||||
//验证当前状态是否可以修改
|
||||
//判断数据库中是否存在该人才通过身份证去验证
|
||||
Long userId = LoginHelper.getUserId();
|
||||
@ -508,10 +521,11 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
*/
|
||||
@Override
|
||||
public R getGaoXinCandidateInfoByCardId(String cardId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("cardId", cardId);
|
||||
String json = HttpUtil.get(URL, paramMap);
|
||||
JSONObject entries = JSONUtil.parseObj(json);
|
||||
HttpResponse execute = HttpRequest.get(URL)
|
||||
.form("cardId",cardId)
|
||||
.timeout(5000)
|
||||
.execute();
|
||||
JSONObject entries = JSONUtil.parseObj(execute.body());
|
||||
String code = String.valueOf(entries.get("code"));
|
||||
LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>();
|
||||
if (ObjectUtil.isNull(code)){
|
||||
@ -543,7 +557,20 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
@Override
|
||||
public R subscribeExport(BuyHousesEvent bo) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
bo.setExcelUserId(userId.toString());
|
||||
//判断是否存在正在导出记录
|
||||
SubscribeExport subscribeExport1 = subscribeExportMapper.selectOne(new LambdaQueryWrapper<>(SubscribeExport.class)
|
||||
.eq(SubscribeExport::getUserId, userId)
|
||||
.eq(SubscribeExport::getExportStatus, "0"));
|
||||
if (ObjectUtil.isNotNull(subscribeExport1)){
|
||||
return R.fail("您已存在一条正在导出数据,请等待前一条导出之后再执行");
|
||||
}
|
||||
//添加导出记录
|
||||
SubscribeExport subscribeExport = new SubscribeExport();
|
||||
subscribeExport.setProcessKey(bo.getProcessKey());
|
||||
subscribeExport.setDescription(bo.getDescription());
|
||||
subscribeExport.setUserId(userId.toString());
|
||||
subscribeExportMapper.insert(subscribeExport);
|
||||
bo.setExcelId(subscribeExport.getId());
|
||||
SpringUtils.context().publishEvent(bo);
|
||||
return R.ok("预约成功");
|
||||
}
|
||||
@ -1257,10 +1284,142 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
System.out.println("url = " + url);
|
||||
SubscribeExport subscribeExport = new SubscribeExport();
|
||||
subscribeExport.setPath(url);
|
||||
subscribeExport.setProcessKey(event.getProcessKey());
|
||||
subscribeExport.setDescription(event.getDescription());
|
||||
subscribeExport.setUserId(event.getExcelUserId());
|
||||
subscribeExportMapper.insert(subscribeExport);
|
||||
subscribeExport.setId(event.getExcelId());
|
||||
subscribeExport.setExportStatus("1");
|
||||
subscribeExportMapper.updateById(subscribeExport);
|
||||
}
|
||||
}
|
||||
|
||||
public void excelZip(){
|
||||
BuyHousesBo bo =new BuyHousesBo();
|
||||
bo.setId(3L);
|
||||
bo.setProcessStatus(Constants.SUCCEED);
|
||||
LambdaQueryWrapper<BuyHouses> lqw = buildQueryWrapper(bo);
|
||||
List<BuyHousesVo> buyHousesVoList = baseMapper.selectVoList(lqw);
|
||||
if (buyHousesVoList.size() > 0) {
|
||||
//查询家庭附件
|
||||
List<Long> collect = buyHousesVoList.stream().map(BuyHousesVo::getId).collect(Collectors.toList());
|
||||
List<BuyHousesMember> buyHousesMemberList = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).in(BuyHousesMember::getBuyHousesId, collect));
|
||||
//对每一个HouseId分组
|
||||
Map<String, List<BuyHousesMember>> buyHousesMemberMap = buyHousesMemberList.stream().collect(Collectors.groupingBy(BuyHousesMember::getBuyHousesId));
|
||||
buyHousesVoList.stream().forEach(r -> {
|
||||
String dir="D:\\gaoxin\\images\\house\\";
|
||||
//护照或者身份证
|
||||
if (ObjectUtil.isNotEmpty(r.getInsidepageUrl())){
|
||||
String insidepageUrl = r.getInsidepageUrl();
|
||||
String fileName =dir+insidepageUrl.substring(insidepageUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(insidepageUrl, fileName);
|
||||
}
|
||||
//申请表
|
||||
if (ObjectUtil.isNotEmpty(r.getCommitmentUrl())){
|
||||
String commitmentUrl = r.getCommitmentUrl();
|
||||
String fileName= dir+commitmentUrl.substring(commitmentUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(commitmentUrl, fileName);
|
||||
}
|
||||
//申明书
|
||||
if (ObjectUtil.isNotEmpty(r.getDeclarationUrl())){
|
||||
String declarationUrl = r.getDeclarationUrl();
|
||||
String fileName= dir+declarationUrl.substring(declarationUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(declarationUrl, fileName);
|
||||
}
|
||||
|
||||
//身份证正面
|
||||
if (ObjectUtil.isNotEmpty(r.getFrontUrl())){
|
||||
String frontUrl = r.getFrontUrl();
|
||||
String fileName= dir+frontUrl.substring(frontUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(frontUrl, fileName);
|
||||
}
|
||||
|
||||
//房屋记录
|
||||
if (ObjectUtil.isNotEmpty(r.getHomeRecordUrl())){
|
||||
String homeRecordUrl = r.getHomeRecordUrl();
|
||||
String fileName= dir+homeRecordUrl.substring(homeRecordUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(homeRecordUrl, fileName);
|
||||
}
|
||||
|
||||
|
||||
//户口簿主页
|
||||
if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){
|
||||
String homepageUrl = r.getHomepageUrl();
|
||||
String fileName= dir+homepageUrl.substring(homepageUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(homepageUrl, fileName);
|
||||
}
|
||||
|
||||
//劳动合同
|
||||
if (ObjectUtil.isNotEmpty(r.getLaborContractUrl())){
|
||||
String laborContractUrl = r.getLaborContractUrl();
|
||||
String fileName= dir+laborContractUrl.substring(laborContractUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(laborContractUrl, fileName);
|
||||
}
|
||||
|
||||
//企业营业执照
|
||||
if (ObjectUtil.isNotEmpty(r.getLicenseUrl())){
|
||||
String licenseUrl = r.getLicenseUrl();
|
||||
String fileName= dir+licenseUrl.substring(licenseUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(licenseUrl, fileName);
|
||||
}
|
||||
|
||||
//户口簿主页
|
||||
if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){
|
||||
String homepageUrl = r.getHomepageUrl();
|
||||
String fileName= dir+homepageUrl.substring(homepageUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(homepageUrl, fileName);
|
||||
}
|
||||
|
||||
//婚姻证明材料
|
||||
if (ObjectUtil.isNotEmpty(r.getMaritalUrl())){
|
||||
String maritalUrl = r.getMaritalUrl();
|
||||
String fileName= dir+maritalUrl.substring(maritalUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(maritalUrl, fileName);
|
||||
}
|
||||
|
||||
//身份证背面
|
||||
if (ObjectUtil.isNotEmpty(r.getReverseUrl())){
|
||||
String reverseUrl = r.getReverseUrl();
|
||||
String fileName=dir+reverseUrl.substring(reverseUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(reverseUrl, fileName);
|
||||
}
|
||||
|
||||
//社保证明
|
||||
if (ObjectUtil.isNotEmpty(r.getSocialSecurityUrl())){
|
||||
String socialSecurityUrl = r.getSocialSecurityUrl();
|
||||
String fileName= dir+socialSecurityUrl.substring(socialSecurityUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(socialSecurityUrl, fileName);
|
||||
}
|
||||
|
||||
//人才影像卡
|
||||
if (ObjectUtil.isNotEmpty(r.getPictureInformationUrl())){
|
||||
String pictureInformationUrl = r.getPictureInformationUrl();
|
||||
String fileName= dir+pictureInformationUrl.substring(pictureInformationUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(pictureInformationUrl, fileName);
|
||||
}
|
||||
//家庭信息
|
||||
List<BuyHousesMember> buyHousesMembers = buyHousesMemberMap.get(r.getId().toString());
|
||||
if (ObjectUtil.isNotNull(buyHousesMembers)) {
|
||||
buyHousesMembers.stream().forEach(m -> {
|
||||
if (ObjectUtil.isNotEmpty(m.getFrontUrl())) {
|
||||
String frontUrl = m.getFrontUrl();
|
||||
String fileName = dir+frontUrl.substring(frontUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(frontUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(m.getInsidepageUrl())) {
|
||||
String insidepageUrl = m.getInsidepageUrl();
|
||||
String fileName =dir+ insidepageUrl.substring(insidepageUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(insidepageUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(m.getReverseUrl())) {
|
||||
String reverseUrl = m.getReverseUrl();
|
||||
String fileName =dir+ reverseUrl.substring(reverseUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(reverseUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(m.getHomeRecordUrl())) {
|
||||
String homeRecordUrl = m.getHomeRecordUrl();
|
||||
String fileName = dir+homeRecordUrl.substring(homeRecordUrl.lastIndexOf("/") + 1);
|
||||
MyFileUtils.downLoadPic(homeRecordUrl, fileName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.CreditCodeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -11,6 +12,7 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.CardsUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.MyFileUtils;
|
||||
import com.ruoyi.common.utils.poi.DeleteFileUtil;
|
||||
@ -324,6 +326,12 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HousesReview entity){
|
||||
if (!CardsUtil.isIDCard(entity.getCard())){
|
||||
throw new ServiceException("证件号码格式不正确");
|
||||
}
|
||||
if (!CreditCodeUtil.isCreditCode(entity.getCreditCode())){
|
||||
throw new ServiceException("社会统一社会信用代码格式不正确");
|
||||
}
|
||||
if (!"D".equals(entity.getTalentsType())){
|
||||
entity.setTypeExtend("");
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ public class SysRoleServiceImpl implements ISysRoleService, IWorkSysRoleService
|
||||
keys.parallelStream().forEach(key -> {
|
||||
String token = StringUtils.substringAfterLast(key, ":");
|
||||
// 如果已经过期则跳过
|
||||
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < -1) {
|
||||
if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) {
|
||||
return;
|
||||
}
|
||||
LoginUser loginUser = LoginHelper.getLoginUser(token);
|
||||
|
||||
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="processKey" column="process_key"/>
|
||||
<result property="exportStatus" column="export_status"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
@ -85,8 +85,8 @@ public class WorkComplyUtils {
|
||||
if (ObjectUtil.isNull(params)){
|
||||
throw new ServiceException("params不可为空");
|
||||
}
|
||||
|
||||
ProcessVo tProcessByKey = processMapper.selectVoOne(lqw);
|
||||
params.put("step",tProcessByKey.getStep());
|
||||
Object companyName = params.get("companyName");
|
||||
if (ObjectUtil.isNotNull(companyName)){
|
||||
actProcessVo.setCompanyName(String.valueOf(companyName));
|
||||
@ -818,7 +818,7 @@ public class WorkComplyUtils {
|
||||
e.setChecked("1");//绿色
|
||||
}else if ( new Integer(e.getStep()).equals(new Integer(a.getStep()))){
|
||||
if (collect1.size()>0){
|
||||
e.setChecked("2");//红色
|
||||
e.setChecked("4");//红色
|
||||
}else {
|
||||
e.setChecked("1");
|
||||
}
|
||||
@ -836,7 +836,7 @@ public class WorkComplyUtils {
|
||||
if (auditLogs.size()>0){
|
||||
AuditLog auditLog = auditLogs.get(auditLogs.size()-1);
|
||||
if (auditLog.getAudit().equals(e.getAudit1()) && auditLog.getStep().equals(e.getStep()) && auditLog.getAuditType().equals(e.getCheckType())){
|
||||
e.setChecked("4");
|
||||
e.setChecked("2");
|
||||
}
|
||||
}
|
||||
}else if (Constants.CANCEL.equals(process_status.toString())){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user