优化bug

This commit is contained in:
ljl 2023-08-22 18:07:59 +08:00
parent fd5080dd1f
commit 487991eb61
17 changed files with 121 additions and 63 deletions

View File

@ -66,6 +66,7 @@ public class CaptchaController {
@GetMapping("/captchaSms")
public R<Void> smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") String username) {
//判断系统中是否存在该人才
username = org.springframework.util.StringUtils.trimAllWhitespace(username);
SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
.select(SysUser::getPhonenumber, SysUser::getStatus)
.eq(SysUser::getPhonenumber, username));

View File

@ -1,7 +1,9 @@
package com.ruoyi.web.controller.house;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
@ -31,12 +33,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -181,8 +180,13 @@ 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,3);
List<HousesReviewVo> volist = result.getList();
Set<String> set = new HashSet<>();
//判断时间格式是否正确
volist.stream().forEach(v ->{
if (ObjectUtil.isEmpty(v.getProjectName())){
throw new ServiceException("项目名称不可为空");
}
set.add(v.getProjectName());
if (!DateUtils.checkDate(v.getQualificationConfirmTime(),DateUtils.YYYY_MM_DD_HH_MM_SS)){
throw new ServiceException("资格确认时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD_HH_MM_SS);
}
@ -193,7 +197,6 @@ public class HousesReviewController extends BaseController {
throw new ServiceException("登记失效时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD);
}
});
List<HousesReview> list = BeanUtil.copyToList(volist, HousesReview.class);
//先获取到导入数据的身份证去购房一期数据库去查
//过滤出导入表中的身份证号码
@ -202,6 +205,17 @@ public class HousesReviewController extends BaseController {
.map(HousesReview::getCard)
.collect(Collectors.toList());
if (collect.size()>0 && list.size()>0) {
//判断同一个项目是否存在同一个身份证
List<HousesReview> housesReviewList = iHousesReviewService.selectListByCardList(collect,set);
if (housesReviewList.size()>0){
List<String> cardList = housesReviewList.stream().map(HousesReview::getCard).collect(Collectors.toList());
collect = CollectionUtil.subtract(collect, cardList).stream().collect(Collectors.toList());
}
if (collect.size()==0){
throw new ServiceException("当前所有数据已在"+set+"项目中导入,请核实之后再导入");
}
List<String> finalCollect = collect;
list = list.stream().filter(h -> finalCollect.contains(h.getCard())).collect(Collectors.toList());
LambdaQueryWrapper<BuyHouses> queryWrapper = new LambdaQueryWrapper<BuyHouses>()
.in(BuyHouses::getCardId, collect)
.eq(BuyHouses::getProcessStatus,Constants.SUCCEED);
@ -221,7 +235,7 @@ public class HousesReviewController extends BaseController {
}
}
iHousesReviewService.saveBatch(list);
return R.ok(result.getAnalysis());
return R.ok("恭喜您,全部读取成功!共"+volist.size()+"条,成功导入"+list.size()+"");
}
/**

View File

@ -85,7 +85,6 @@ public class SysLoginController {
/**
* 邮件登录
*
* @param body 登录信息
* @return 结果
*/
@ -100,7 +99,6 @@ public class SysLoginController {
/**
* 小程序登录(示例)
*
* @param xcxCode 小程序code
* @return 结果
*/
@ -141,7 +139,6 @@ public class SysLoginController {
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")

View File

@ -17,6 +17,7 @@ import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.DownloadGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BuyHouses;
import com.ruoyi.system.domain.bo.BuyHousesBo;
import com.ruoyi.system.service.IBuyHousesService;
@ -124,6 +125,8 @@ public class HouseController extends BaseController {
if (ObjectUtil.isNull(bo.getUserId())){
return R.fail("userId不可为空");
}
String cardId = bo.getCardId();
bo.setCardId(StringUtils.toUpperCase(cardId));
return iBuyHousesService.insertOpenBuyHouses(bo);
}

View File

@ -52,12 +52,12 @@ spring:
# url: jdbc:mysql://182.150.40.133:3309/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&useAffectedRows=true
# username: root
# password: 1234Qwer@
url: jdbc:mysql://182.138.107.22:3409/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: gxrc
password: 45Uuq5!aADGD
# url: jdbc:mysql://localhost:3306/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
# username: root
# password: 123456
# url: jdbc:mysql://182.138.107.22:3409/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
# username: gxrc
# password: 45Uuq5!aADGD
url: jdbc:mysql://localhost:3306/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root
password: 123456
# 从库数据源
slave:
lazy: true

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
@ -876,10 +877,16 @@ public class DemoUnitTest {
@Test
public void paChon() throws Exception {
Set<String> set = new HashSet<>();
set.add("1");
set.add("2");
set.add("1");
String collect = set.stream().collect(Collectors.joining(","));
System.out.println("collect = " + set);
// R rInfo = OpenUtils.getGaoXinCardInfo("510503199602214055");
// System.out.println("rInfo = " + rInfo);
String s = com.ruoyi.common.utils.StringUtils.toUpperCase("510503199602214055l");
System.out.println("s = " + s);
// String s = com.ruoyi.common.utils.StringUtils.toUpperCase("510503199602214055l");
// System.out.println("s = " + s);
// buyHousesService.logout("3184");
// R gaoXinCardInfo = OpenUtils.getGaoXinCardInfo("510503199602214055");
@ -919,11 +926,11 @@ public class DemoUnitTest {
// 星期天是1
//查询数据库中大于当前时间的所有节假日时间
DateTime nowDate = DateUtil.parse(dateStr);//开始时间
int i1 = DateTime.of(nowDate).dayOfWeek();
if (i1==1 || i1==7){
DateTime nowDate = DateUtil.parse(dateStr);//开始时间
int i1 = DateTime.of(nowDate).dayOfWeek();
if (i1==1 || i1==7){
}
}
System.out.println("i1 = " + i1);

View File

@ -36,7 +36,7 @@ import java.util.List;
public class DecodeRequestBodyAdvice implements RequestBodyAdvice {
private static final Logger logger = LoggerFactory.getLogger(DecodeRequestBodyAdvice.class);
private static final IRsaSecurityService2 rsaSecurityService= SpringUtils.getBean(IRsaSecurityService2.class);
private static final IRsaSecurityService2 rsaSecurityService2= SpringUtils.getBean(IRsaSecurityService2.class);
@Override
public boolean supports(MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
@ -54,7 +54,7 @@ public class DecodeRequestBodyAdvice implements RequestBodyAdvice {
String path = inputMessage.getHeaders().getFirst("path");
String method = inputMessage.getHeaders().getFirst("method");
if (ObjectUtil.isNotNull(path)) {
RsaSecurity info = rsaSecurityService.getInfo(path, StringUtils.toRootUpperCase(method));
RsaSecurity info = rsaSecurityService2.getInfo(path, StringUtils.toRootUpperCase(method));
if (ObjectUtil.isNotNull(info)) {
if ("1".equals(info.getRestricted())){
throw new ServerException("接口已限制请求");
@ -65,15 +65,6 @@ public class DecodeRequestBodyAdvice implements RequestBodyAdvice {
}
}
/*if (methodParameter.getMethod().isAnnotationPresent(RsaSecurityParameter.class)) {
//获取注解配置的包含和去除字段
RsaSecurityParameter serializedField = methodParameter.getMethodAnnotation(RsaSecurityParameter.class);
//入参是否需要解密
if (serializedField.inDecode()) {
logger.info("注解RsaSecurityParameter,对方法method :【" + methodParameter.getMethod().getName() + "】返回数据进行解密");
return new RsaHttpInputMessage(inputMessage);
}
}*/
return inputMessage;
} catch (Exception e) {
e.printStackTrace();

View File

@ -23,7 +23,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@ControllerAdvice
public class EncodeResponseBodyAdvice implements ResponseBodyAdvice {
private final static Logger logger = LoggerFactory.getLogger(EncodeResponseBodyAdvice.class);
private static final IRsaSecurityService2 rsaSecurityService=SpringUtils.getBean(IRsaSecurityService2.class);
private static final IRsaSecurityService2 rsaSecurityService2=SpringUtils.getBean(IRsaSecurityService2.class);
@Override
@ -36,7 +36,7 @@ public class EncodeResponseBodyAdvice implements ResponseBodyAdvice {
// 此处要用反射将字段中的注解解析出来
String method = serverHttpRequest.getMethod().name();
String path = serverHttpRequest.getURI().getPath();
RsaSecurity info = rsaSecurityService.getInfo(path,method);
RsaSecurity info = rsaSecurityService2.getInfo(path,method);
if (ObjectUtil.isNotNull(info)) {
if ("1".equals(info.getRestricted())){
return R.fail("接口已限制请求");
@ -48,25 +48,6 @@ public class EncodeResponseBodyAdvice implements ResponseBodyAdvice {
}
serverHttpResponse.getHeaders().add("isRsaencrypt","false");
return body;
/*if (methodParameter.getMethod().isAnnotationPresent(RsaSecurityParameter.class)) {
//获取注解配置的包含和去除字段
RsaSecurityParameter serializedField = methodParameter.getMethodAnnotation(RsaSecurityParameter.class);
//出参是否需要加密
if (serializedField.outEncode()) {
return encodeRsa(methodParameter, body,serializedField.outPublicKey());
}
}
JSONObject jsonObject = JSONUtil.parseObj(body);
Object code = jsonObject.get("code");
String num = "500";
String num2 ="401";
String num3 ="403";
if (ObjectUtil.isNotNull(code)){
if (num.equals(code.toString()) || num2.equals(code.toString()) || num3.equals(code.toString())){
return encodeRsa(methodParameter, body,"");
}
}
return body;*/
}
/**

View File

@ -123,6 +123,15 @@ public interface UserConstants {
*/
int PASSWORD_MIN_LENGTH = 8;
int PASSWORD_MAX_LENGTH = 20;
/**
* 手机号检验
*/
String CHECK_PHONE="^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$";
/**
* 密码强度校验
*/
String PASSWORD_Pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,18}$";
/**

View File

@ -53,6 +53,7 @@ public class GaoXinCardInfo implements Serializable {
private String education;
public String getType() {
return type;
}

View File

@ -21,6 +21,7 @@ public class LoginBody {
*/
@NotBlank(message = "{user.username.not.blank}",groups = {passwordLogin.class,smgLogin.class,forgetPasswordLogin.class,registerUser.class,userOpenLogin.class})
@Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}",groups = {passwordLogin.class,smgLogin.class,forgetPasswordLogin.class,registerUser.class})
// @Pattern(regexp =UserConstants.CHECK_PHONE,message = "{user.mobile.phone.number.not.valid}",groups = {registerUser.class,smgLogin.class})
private String username;
/**

View File

@ -220,7 +220,7 @@ public class BuyHousesBo extends BaseEntity {
/**
*工作地址
*/
@NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "工作地址不能为空", groups = { AddGroup.class, EditGroup.class })
private String workAddress;
/**

View File

@ -12,6 +12,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
/**
* 购房复审登记Service接口
@ -73,4 +75,6 @@ public interface IHousesReviewService {
void exportExcel(HousesReviewBo bo, HttpServletResponse response);
TableDataInfo<HousesReview> managerQueryPageList(HousesReviewBo bo, PageQuery pageQuery);
List<HousesReview> selectListByCardList(List<String> collect, Set<String> projectName);
}

View File

@ -105,7 +105,7 @@ public class SysLoginService {
public String smsLogin(String phonenumber, String smsCode) {
// 通过手机号查找用户
SysUser user = loadUserByPhonenumber(phonenumber);
// checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode,CacheConstants.CAPTCHA_CODE_KEY));
checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode,CacheConstants.CAPTCHA_CODE_KEY));
// 此处可根据登录用户的数据不同 自行创建 loginUser
LoginUser loginUser = buildLoginSysUser(user);
// 生成token

View File

@ -5,6 +5,7 @@ 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;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.PageQuery;
@ -44,6 +45,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -157,14 +159,14 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
lqw.orderByAsc(HousesReview::getProcessStatus);
lqw.orderByDesc(HousesReview::getUpdateTime);
lqw.eq(StringUtils.isNotBlank(bo.getCardType()), HousesReview::getCardType, bo.getCardType());
lqw.eq(StringUtils.isNotBlank(bo.getCard()), HousesReview::getCard, bo.getCard());
lqw.like(StringUtils.isNotBlank(bo.getCard()), HousesReview::getCard, bo.getCard());
lqw.like(StringUtils.isNotBlank(bo.getName()), HousesReview::getName, bo.getName());
lqw.eq(StringUtils.isNotBlank(bo.getQualification()), HousesReview::getQualification, bo.getQualification());
lqw.eq(StringUtils.isNotBlank(bo.getAuditTime()), HousesReview::getAuditTime, bo.getAuditTime());
lqw.eq(StringUtils.isNotBlank(bo.getPresellCard()), HousesReview::getPresellCard, bo.getPresellCard());
lqw.eq(StringUtils.isNotBlank(bo.getDealType()), HousesReview::getDealType, bo.getDealType());
lqw.eq(StringUtils.isNotBlank(bo.getProjectName()), HousesReview::getProjectName, bo.getProjectName());
lqw.eq(StringUtils.isNotBlank(bo.getProjectArea()), HousesReview::getProjectArea, bo.getProjectArea());
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), HousesReview::getProjectName, bo.getProjectName());
lqw.like(StringUtils.isNotBlank(bo.getProjectArea()), HousesReview::getProjectArea, bo.getProjectArea());
lqw.eq(StringUtils.isNotBlank(bo.getQualificationConfirmTime()), HousesReview::getQualificationConfirmTime, bo.getQualificationConfirmTime());
lqw.eq(StringUtils.isNotBlank(bo.getQualificationPreApplyTime()), HousesReview::getQualificationPreApplyTime, bo.getQualificationPreApplyTime());
lqw.eq(StringUtils.isNotBlank(bo.getFamilyType()), HousesReview::getFamilyType, bo.getFamilyType());
@ -472,6 +474,21 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
return TableDataInfo.build(result);
}
/**
* 根据身份证和项目名称查询
* @param collect
* @param projectName
* @return
*/
@Override
public List<HousesReview> selectListByCardList(List<String> collect, Set<String> projectName) {
List<HousesReview> housesReviewList = baseMapper.selectList(new LambdaQueryWrapper<>(HousesReview.class)
.in(HousesReview::getCard, collect)
.in(HousesReview::getProjectName,projectName));
return housesReviewList;
}
@Async
@EventListener
public void export(HousesReviewEvent event) throws IOException {

View File

@ -118,6 +118,8 @@ public class HousingConstructionBureauPushDto {
}
return result2;
} catch (Exception e) {
pushLogEvent.setResultData("接口推送超时:"+e);
SpringUtils.context().publishEvent(pushLogEvent);
throw new RuntimeException(e);
}
}

View File

@ -631,8 +631,8 @@ public class WorkComplyUtils {
List<AuditLog> auditLogs = auditLogMapper.selectList(new LambdaQueryWrapper<AuditLog>()
.eq(AuditLog::getProcessKey, processKey)
.eq(AuditLog::getOtherId, businessId)
.orderByAsc(AuditLog::getCreateTime));
.eq(AuditLog::getOtherId, businessId));
// .orderByAsc(AuditLog::getCreateTime));
List<ProcessVo> list1 = new ArrayList<>();
processVos.stream().forEach(e ->{
e.setAuditLogList1(auditLogs);
@ -834,7 +834,7 @@ public class WorkComplyUtils {
}else if (Constants.FAILD.equals(process_status.toString())){
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())){
if (e.getAudit1().equals(auditLog.getAudit()) && e.getStep().equals(auditLog.getStep()) && e.getCheckType().equals(auditLog.getAuditType())){
e.setChecked("2");
}
}
@ -926,8 +926,38 @@ public class WorkComplyUtils {
case "2":
a.setStatus(e.getDescription()+"成功");
break;
case "3":
a.setStatus("受理退件");
break;
case "4":
a.setStatus("受理驳回");
break;
case "5":
a.setStatus("受理成功");
break;
case "6":
a.setStatus("初审不通过");
break;
case "7":
a.setStatus("初审退件");
break;
case "8":
a.setStatus("初审成功");
break;
case "9":
a.setStatus("审定不通过");
break;
case "10":
a.setStatus("审定通过");
break;
case "11":
a.setStatus("审定退件");
break;
case "12":
a.setStatus("资格取消");
break;
default:
a.setStatus(e.getDescription()+"未知状态");
a.setStatus("未知状态");
break;
}
}