This commit is contained in:
zt
2025-04-22 16:30:37 +08:00
parent d99eaafd4c
commit a2e8712808
8 changed files with 108 additions and 47 deletions

View File

@ -29,10 +29,10 @@ public class ZbfMessageConstant {
//任务审批
public static final String ZBF_SIGN_UP_APPLY_HEADLINE = "您申请的【%s】项目【%s】分包已得到回复";
public static final String ZBF_SIGN_UP_APPLY_SUBHEADING = "您申请的【%s】任务【%s】分包,审核人【%s】已%s";
public static final String ZBF_SIGN_UP_APPLY_SUBHEADING = "您申请的【%s】项目【%s】分包,审核人【%s】已%s";
//工资审批
public static final String ZBF_PAY_APPLY_HEADLINE = "您【%s】任务【%s】分包工资申请已审批";
public static final String ZBF_PAY_APPLY_SUBHEADING = "您申请的【%s】任务【%s】分包工资,审核人【%s】已%s";
public static final String ZBF_PAY_APPLY_HEADLINE = "您【%s】项目【%s】分包工资申请已审批";
public static final String ZBF_PAY_APPLY_SUBHEADING = "您申请的【%s】项目【%s】分包工资,审核人【%s】已%s";
//分包商->包工头 消息类型

View File

@ -1,6 +1,8 @@
package com.ruoyi.common.util;
import java.util.regex.Pattern;
import cn.hutool.core.util.CreditCodeUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.PhoneUtil;
/**
* 校验工具类
@ -9,49 +11,79 @@ import java.util.regex.Pattern;
*/
public class ValidUtil {
//身份证校验
public static boolean isValidIdentityCard(String identityCard) {
// 允许15位纯数字或者18位身份证18位身份证最后一位可以是数字或字母X/x
return identityCard != null && identityCard.matches("\\d{15}|\\d{17}[\\dXx]");
return IdcardUtil.isValidCard(identityCard);
}
//银行卡号校验
public static boolean isValidBankCard(String bankCard) {
// 简单的银行卡号校验逻辑,可以根据需要进行更复杂的校验
return bankCard != null && bankCard.matches("\\d{16,19}");
return checkBankCard(bankCard);
}
// 定义中国大陆手机号码的正则表达式
private static final String MOBILE_REGEX = "^1[3-9]\\d{9}$";
private static final Pattern MOBILE_PATTERN = Pattern.compile(MOBILE_REGEX);
//手机校验
public static boolean isValidChineseMobile(String phoneNumber) {
if (phoneNumber == null) {
return false;
}
// 使用正则表达式进行匹配
return MOBILE_PATTERN.matcher(phoneNumber).matches();
return PhoneUtil.isMobile(phoneNumber);
}
private static final String BASE_CODE_STRING = "0123456789ABCDEFGHJKLMNPQRTUWXY";
private static final char[] BASE_CODE_ARRAY = BASE_CODE_STRING.toCharArray();
private static final int[] WEIGHT = {1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28};
//统一社会信用代码校验
public static boolean verifyCreditCode(String code) {
if (code == null || code.length() != 18) {
return CreditCodeUtil.isCreditCode(code);
}
/**
* 校验银行卡号方法
* @param bankCard
* @return
*/
public static boolean checkBankCard(String bankCard) {
if(bankCard == null) {
return false;
}
char[] inputCodeArray = code.toCharArray();
char checkCode = inputCodeArray[17];
int sum = 0;
for (int i = 0; i < 17; i++) {
int idx = BASE_CODE_STRING.indexOf(inputCodeArray[i]);
if (idx == -1) {
return false;
}
sum += idx * WEIGHT[i];
if(bankCard.length() < 15 || bankCard.length() > 19) {
return false;
}
int modulus = sum % 31;
int index = (31 - modulus) % 31;
return checkCode == BASE_CODE_ARRAY[index];
char bit = getBankCardCheckCode(bankCard.substring(0, bankCard.length() - 1));
if(bit == 'N'){
return false;
}
return bankCard.charAt(bankCard.length() - 1) == bit;
}
/**
* 从不含校验位的银行卡卡号采用 Luhm 校验算法获得校验位
* @param nonCheckCodeBankCard
* @return
*/
public static char getBankCardCheckCode(String nonCheckCodeBankCard){
if(nonCheckCodeBankCard == null || nonCheckCodeBankCard.trim().length() == 0
|| !nonCheckCodeBankCard.matches("\\d+")) {
//如果传的不是数据返回N
return 'N';
}
char[] chs = nonCheckCodeBankCard.trim().toCharArray();
int luhmSum = 0;
for(int i = chs.length - 1, j = 0; i >= 0; i--, j++) {
int k = chs[i] - '0';
if(j % 2 == 0) {
k *= 2;
k = k / 10 + k % 10;
}
luhmSum += k;
}
return (luhmSum % 10 == 0) ? '0' : (char)((10 - luhmSum % 10) + '0');
}
public static void main(String[] args) {
System.out.println(isValidIdentityCard("511622198907061135"));
System.out.println(isValidBankCard("6217857000014152765"));
System.out.println(isValidChineseMobile("15086914548"));
System.out.println(verifyCreditCode("91441900678347132K"));
}
}

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.ruoyi.bgt.domain.BgtProjectTaskProgress;
import com.ruoyi.common.core.domain.entity.ZbfUser;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
@ -215,7 +214,7 @@ public class FbsWageApplicationServiceImpl extends ServicePlusImpl<FbsWageApplic
.setMessageLargeType(FBS_LARGE_SETTLEMENT)
.setIsOperation(OPERATION_NO);
fbsMessageService.sendAMessage(fbsMessage);
zbfMessageService.operation(USERTYPE_BGT, bo.getUserId(), USERTYPE_FBS, SecurityUtils.getAppUserId(), bo.getId(), SqlHelper.table(BgtProjectTaskProgress.class).getTableName());
zbfMessageService.operation(USERTYPE_FBS, bo.getUserId(), USERTYPE_ZBF, SecurityUtils.getAppUserId(), bo.getId(), SqlHelper.table(FbsWageApplication.class).getTableName());
return b;
}

View File

@ -127,14 +127,14 @@ public interface IZbfProjectService extends IServicePlus<ZbfProject> {
*/
FbsProjectTaskDetailWageVO fbsWage(Long projectId);
/**
* 总包方新增项目
*/
Boolean add(ZbfProjectAddDTO dto);
/**
* 总包方编辑项目
*/
Boolean edit(ZbfProjectAddDTO dto);
/**

View File

@ -74,4 +74,9 @@ public interface IZbfProjectSubcontractingApplyService extends IServicePlus<ZbfP
* 根据项目Id查询申请
*/
List<ZbfProjectSubcontractingApply> queryByProjectId(Long projectId);
/**
* 分包商取消项目分包申请
*/
Boolean cancel(Long subId);
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
@ -268,4 +269,24 @@ public class ZbfProjectSubcontractingApplyServiceImpl extends ServicePlusImpl<Zb
wrapper.eq(ZbfProjectSubcontractingApply::getProjectId, projectId);
return baseMapper.selectList(wrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean cancel(Long subId) {
LambdaUpdateWrapper<ZbfProjectSubcontractingApply> wrapper = Wrappers.<ZbfProjectSubcontractingApply>lambdaUpdate()
.eq(ZbfProjectSubcontractingApply::getSubId, subId)
.eq(ZbfProjectSubcontractingApply::getFbsUserId, SecurityUtils.getAppUserId())
.eq(ZbfProjectSubcontractingApply::getApplyStatus, SubcontractingApplyStatus.APPLY.getCode());
List<ZbfProjectSubcontractingApply> list = list(wrapper);
if(CollectionUtil.isEmpty(list)){
throw new BaseException("您还未申请过该分包");
}
ZbfProjectSubcontractingApply zbfProjectSubcontractingApply = list.get(0);
zbfProjectSubcontractingApply.setApplyStatus(SubcontractingApplyStatus.CANCEL.getCode());
ZbfProject project = projectService.getById(zbfProjectSubcontractingApply.getProjectId());
zbfMessageService.operation(USERTYPE_FBS, SecurityUtils.getAppUserId(), USERTYPE_ZBF, project.getUserId(), zbfProjectSubcontractingApply.getId(),SqlHelper.table(ZbfProjectSubcontractingApply.class).getTableName());
return updateById(zbfProjectSubcontractingApply);
}
}