总包方

This commit is contained in:
zt
2025-04-10 09:31:24 +08:00
parent 069529f78c
commit f1814f781c
52 changed files with 1119 additions and 98 deletions

View File

@ -100,7 +100,7 @@ public class BgtWageApplicationServiceImpl extends ServicePlusImpl<BgtWageApplic
//判断申请金额
List<BgtWageApplication> list = list(Wrappers.<BgtWageApplication>lambdaQuery().eq(BgtWageApplication::getTaskId, bo.getTaskId())
.eq(BgtWageApplication::getUserId, SecurityUtils.getAppUserId())
.eq(BgtWageApplication::getAuditStatus, AuditStatus.getUse()));
.in(BgtWageApplication::getAuditStatus, AuditStatus.getUse()));
//收款金额
int taskUseAmount = list.stream()
.map(BgtWageApplication::getApplicantAmount)
@ -138,6 +138,7 @@ public class BgtWageApplicationServiceImpl extends ServicePlusImpl<BgtWageApplic
HashMap<String, String> fmp = new HashMap<>();
fmp.put("projectName", task.getTaskName());
fmp.put("auditor", SecurityUtils.getUsername());
fmp.put("amount", bo.getApplicantAmount().toString());
Map<String, String> fmap = bgtMessage(fmp, BGT_TYPE_SETTLEMENT_TO_FBS, true);
FbsMessage fbsMessage = new FbsMessage()
.setSenderType(USERTYPE_BGT)

View File

@ -17,7 +17,7 @@ public class BgtMessageConstant {
public static final String BGT_SMALL_LEAVE = "3"; //小类型-请假
public static final String BGT_SMALL_MAKE_UP = "4"; //小类型-补卡
public static final String BGT_SMALL_REPORT_MAKE_UP = "5"; //小类型-日报补卡
public static final String BGT_SMALL_PROGRESS = "5"; //小类型-任务进度
public static final String BGT_SMALL_PROGRESS = "6"; //小类型-任务进度
public static final List<String> AUDIT_TYPE = Arrays.asList("2", "3", "4", "5");
/**

View File

@ -11,7 +11,7 @@ import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING;
public class FbsMessageConstant {
// 公共常量
public static final String FBS_LARGE_TASK = "1"; //大类型-任务
public static final String FBS_LARGE_TASK = "1"; //大类型-项目
public static final String FBS_LARGE_SETTLEMENT = "2"; //大类型-结算
public static final String FBS_LARGE_OTHER = "3"; //大类型-其它

View File

@ -57,4 +57,9 @@ public interface ICompanyService extends IServicePlus<Company> {
* 获取公司的名称
*/
String getCompanyNameById(Long id);
/**
* 根据信用码获取公司
*/
Company getCompanyByCreditCode(String creditCode);
}

View File

@ -98,4 +98,9 @@ public class CompanyServiceImpl extends ServicePlusImpl<CommonCompanyMapper, Com
Company byId = getById(id);
return byId.getCompanyName();
}
@Override
public Company getCompanyByCreditCode(String creditCode) {
return getOne(Wrappers.lambdaQuery(Company.class).eq(Company::getCreditCode, creditCode));
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.common.util;
import java.util.regex.Pattern;
/**
* 校验工具类
* @author zhangqiao
@ -16,4 +18,40 @@ public class ValidUtil {
// 简单的银行卡号校验逻辑,可以根据需要进行更复杂的校验
return bankCard != null && bankCard.matches("\\d{16,19}");
}
// 定义中国大陆手机号码的正则表达式
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();
}
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 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];
}
int modulus = sum % 31;
int index = (31 - modulus) % 31;
return checkCode == BASE_CODE_ARRAY[index];
}
}

View File

@ -88,6 +88,9 @@ public class FbsWageApplication implements Serializable {
@ApiModelProperty("联系电话")
private String phone;
@ApiModelProperty("申请单位")
private String companyName;
/** 申请金额 */
@Excel(name = "申请金额")
@ApiModelProperty("申请金额")
@ -114,6 +117,13 @@ public class FbsWageApplication implements Serializable {
@ApiModelProperty("任务情况")
private String taskSituation;
@ApiModelProperty("收方单")
private String receipt;
@ApiModelProperty("请款单")
private String payroll;
/** 审核状态1审核中 2已审核 3未通过 */
@Excel(name = "审核状态" , readConverterExp = "1=审核中,2=已审核,3=未通过")
@ApiModelProperty("审核状态1审核中 2已审核 3未通过")

View File

@ -34,10 +34,10 @@ public class FbsMessageDetailDTO {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate date;
@ApiModelProperty("大类型(字典bgt_message_large_type")
@ApiModelProperty("大类型(字典fbs_message_large_type")
private String messageLargeType;
@ApiModelProperty("小类型(字典bgt_message_small_type")
@ApiModelProperty("小类型(字典fbs_message_small_type")
private String messageSmallType;
@ApiModelProperty("是否待处理")

View File

@ -0,0 +1,16 @@
package com.ruoyi.fbs.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel("分包商修改用户信息")
public class FbsUserInfoUpdateDTO {
@ApiModelProperty("头像")
@NotBlank(message = "头像不能为空")
private String avatarName;
}

View File

@ -25,5 +25,8 @@ public class FbsWageApplicationListDTO {
@ApiModelProperty("类型0-申请中 1-已结算")
private Integer type;
@ApiModelProperty("项目Id")
private Long projectId;
}

View File

@ -85,6 +85,7 @@ public class AppTaskDetailVO {
private String status;
@ApiModelProperty("创建者ID")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long createId;
/** 备注 */

View File

@ -40,10 +40,10 @@ public class FbsMessageDetailVO implements Serializable {
@ApiModelProperty("副标题")
private String subheading;
@ApiModelProperty("大类型(字典bgt_message_large_type")
@ApiModelProperty("大类型(字典fbs_message_large_type")
private String messageLargeType;
@ApiModelProperty("小类型(字典bgt_message_small_type")
@ApiModelProperty("小类型(字典fbs_message_small_type")
private String messageSmallType;
@ApiModelProperty("读状态0未读 1已读")

View File

@ -40,10 +40,10 @@ public class FbsMessageVO implements Serializable {
@ApiModelProperty("副标题")
private String subheading;
@ApiModelProperty("大类型(字典bgt_message_large_type")
@ApiModelProperty("大类型(字典fbs_message_large_type")
private String messageLargeType;
@ApiModelProperty("小类型(字典bgt_message_small_type")
@ApiModelProperty("小类型(字典fbs_message_small_type")
private String messageSmallType;
@ApiModelProperty("读状态0未读 1已读")

View File

@ -65,7 +65,23 @@ public interface IFbsUserService extends IServicePlus<FbsUser> {
Long authenticate(CompanyAuthenticateDTO dto);
/**
* 企业认证
* 根据用户id查询用户
*/
FbsUser selectUserByUserId(Long userId);
/**
* 根据信用代码查询用户
*/
FbsUser selectUserByCreditCode(String creditCode);
/**
* 登录查询
*/
FbsUser loginSelect(String key);
/**
* 修改头像
*/
Boolean editAvatar(String avatarName);
}

View File

@ -1,10 +1,11 @@
package com.ruoyi.fbs.service;
import com.ruoyi.fbs.domain.FbsWageApplication;
import com.ruoyi.fbs.bo.FbsWageApplicationQueryBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.fbs.bo.FbsWageApplicationQueryBo;
import com.ruoyi.fbs.domain.FbsWageApplication;
import com.ruoyi.fbs.domain.dto.FbsWageApplicationListDTO;
import com.ruoyi.zbf.domain.dto.ZbfWageApplicationListDTO;
import java.util.Collection;
import java.util.List;
@ -54,6 +55,11 @@ public interface IFbsWageApplicationService extends IServicePlus<FbsWageApplicat
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 分包商提交自己的工资申请
*/
Boolean insertApply(FbsWageApplication bo);
/**
* 查询列表
*/
@ -63,4 +69,14 @@ public interface IFbsWageApplicationService extends IServicePlus<FbsWageApplicat
* 获取分包下先已审核通过的数据
*/
List<FbsWageApplication> getPassListBySubIds(List<Long> subIds);
/**
* 总包方查询列表
*/
TableDataInfo<FbsWageApplication> zbfWageList(ZbfWageApplicationListDTO dto);
/**
* 总包方审核
*/
Boolean zbfAudit(FbsWageApplication bo);
}

View File

@ -10,7 +10,9 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.domain.Company;
import com.ruoyi.common.domain.dto.CompanyAuthenticateDTO;
import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.service.ICompanyService;
import com.ruoyi.common.util.ValidUtil;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.fbs.bo.FbsUserQueryBo;
@ -116,6 +118,26 @@ public class FbsUserServiceImpl extends ServicePlusImpl<FbsUserMapper, FbsUser>
@Override
@Transactional(rollbackFor = Exception.class)
public Long authenticate(CompanyAuthenticateDTO dto) {
// 校验银行卡号
if (!ValidUtil.isValidBankCard(dto.getCardNo())) {
throw new BaseException("银行卡号格式不正确");
}
//校验电话
if (!ValidUtil.isValidChineseMobile(dto.getContactPhone())) {
throw new BaseException("手机号格式不正确");
}
boolean b = ValidUtil.verifyCreditCode(dto.getCreditCode());
if (!b) {
throw new BaseException("统一社会信用代码格式不正确");
}
Company companyByCreditCode = companyService.getCompanyByCreditCode(dto.getCreditCode());
if (companyByCreditCode != null) {
throw new RuntimeException("该企业已认证");
}
Company company = BeanUtil.copyProperties(dto, Company.class);
companyService.save(company);
FbsUser fbsUser = selectUserByUserId(SecurityUtils.getAppUserId());
@ -128,4 +150,30 @@ public class FbsUserServiceImpl extends ServicePlusImpl<FbsUserMapper, FbsUser>
public FbsUser selectUserByUserId(Long userId) {
return baseMapper.selectOne(new LambdaQueryWrapper<FbsUser>().eq(FbsUser::getUserId, userId));
}
@Override
public FbsUser selectUserByCreditCode(String creditCode) {
Company company = companyService.getCompanyByCreditCode(creditCode);
if (company != null) {
return baseMapper.selectOne(new LambdaQueryWrapper<FbsUser>().eq(FbsUser::getCompanyId, company.getId()));
}
return null;
}
@Override
public FbsUser loginSelect(String key) {
FbsUser fbsUser = selectUserByPhone(key);
if(fbsUser != null){
return fbsUser;
}
fbsUser = selectUserByCreditCode(key);
return fbsUser;
}
@Override
public Boolean editAvatar(String avatarName) {
FbsUser fbsUser = selectUserByUserId(SecurityUtils.getAppUserId());
fbsUser.setAvatarName(avatarName);
return updateById(fbsUser);
}
}

View File

@ -1,37 +1,50 @@
package com.ruoyi.fbs.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
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;
import com.ruoyi.common.enums.AuditStatus;
import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.fbs.bo.FbsWageApplicationQueryBo;
import com.ruoyi.fbs.domain.FbsMessage;
import com.ruoyi.fbs.domain.FbsWageApplication;
import com.ruoyi.fbs.domain.dto.FbsWageApplicationListDTO;
import com.ruoyi.fbs.mapper.FbsWageApplicationMapper;
import com.ruoyi.fbs.service.IFbsMessageService;
import com.ruoyi.fbs.service.IFbsWageApplicationService;
import com.ruoyi.zbf.domain.ZbfMessage;
import com.ruoyi.zbf.domain.ZbfProject;
import com.ruoyi.zbf.domain.ZbfProjectSubcontracting;
import com.ruoyi.zbf.domain.dto.ZbfWageApplicationListDTO;
import com.ruoyi.zbf.service.IZbfMessageService;
import com.ruoyi.zbf.service.IZbfProjectService;
import com.ruoyi.zbf.service.IZbfProjectSubcontractingService;
import com.ruoyi.zbf.service.IZbfUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.ruoyi.common.constants.BgtMessageConstant.HEADLINE;
import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING;
import static com.ruoyi.common.constants.FbsMessageConstant.FBS_TYPE_SETTLEMENT_TO_ZBF;
import static com.ruoyi.common.constants.FbsMessageConstant.fbsMessage;
import static com.ruoyi.common.constants.FbsMessageConstant.*;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
import static com.ruoyi.common.constants.ZbfMessageConstant.ZBF_LARGE_SETTLEMENT;
import static com.ruoyi.common.constants.ZbfMessageConstant.*;
/**
* 分包商工资申请Service业务层处理
@ -48,6 +61,12 @@ public class FbsWageApplicationServiceImpl extends ServicePlusImpl<FbsWageApplic
private IZbfProjectService projectService;
@Autowired
private IZbfProjectSubcontractingService projectSubcontractingService;
@Autowired
private IFbsMessageService fbsMessageService;
@Autowired
private IZbfUserService iZbfUserService;
@Autowired
private IZbfProjectService iZbfProjectService;
@Override
public FbsWageApplication queryById(Long id){
@ -145,8 +164,11 @@ public class FbsWageApplicationServiceImpl extends ServicePlusImpl<FbsWageApplic
public TableDataInfo<FbsWageApplication> record(FbsWageApplicationListDTO dto) {
LambdaQueryWrapper<FbsWageApplication> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FbsWageApplication::getUserId, SecurityUtils.getAppUserId())
.eq(dto.getType() == 0, FbsWageApplication::getAuditStatus, AuditStatus.AUDIT.getCode())
.in(dto.getType() == 1, FbsWageApplication::getAuditStatus, AuditStatus.getAudit());
.eq(dto.getProjectId()!=null,FbsWageApplication::getProjectId, dto.getProjectId())
.eq(ObjectUtil.equal(dto.getType(),0), FbsWageApplication::getAuditStatus, AuditStatus.AUDIT.getCode())
.in(ObjectUtil.equal(dto.getType(),1), FbsWageApplication::getAuditStatus, AuditStatus.getAudit())
.orderByDesc(FbsWageApplication::getId)
;
Page<FbsWageApplication> result = page(PageUtils.buildPage(), wrapper);
return PageUtils.buildDataInfo(result);
}
@ -158,4 +180,96 @@ public class FbsWageApplicationServiceImpl extends ServicePlusImpl<FbsWageApplic
.eq(FbsWageApplication::getAuditStatus, AuditStatus.PASS.getCode());
return list(wrapper);
}
@Override
public TableDataInfo<FbsWageApplication> zbfWageList(ZbfWageApplicationListDTO dto) {
LambdaQueryWrapper<FbsWageApplication> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FbsWageApplication::getReviewerId, SecurityUtils.getAppUserId())
.eq(ObjectUtil.equal(dto.getType(),0), FbsWageApplication::getAuditStatus, AuditStatus.AUDIT.getCode())
.in(ObjectUtil.equal(dto.getType(),1), FbsWageApplication::getAuditStatus, AuditStatus.getAudit())
.eq(dto.getProjectId()!=null,FbsWageApplication::getProjectId, dto.getProjectId())
.eq(dto.getSubId()!=null,FbsWageApplication::getSubId, dto.getSubId())
;
Page<FbsWageApplication> result = page(PageUtils.buildPage(), wrapper);
return PageUtils.buildDataInfo(result);
}
@Override
public Boolean zbfAudit(FbsWageApplication bo) {
boolean b = updateById(bo);
ZbfProject project = projectService.getById(bo.getProjectId());
ZbfProjectSubcontracting subcontracting = projectSubcontractingService.getById(bo.getSubId());
//总包方发消息到分包商
HashMap<String, String> mp = new HashMap<>();
mp.put("projectName", project.getProjectName());
mp.put("subName", subcontracting.getSubName());
mp.put("auditor", SecurityUtils.getUsername());
Map<String, String> map = zbfMessage(mp, ZBF_TYPE_PAY,AuditStatus.PASS.getCode().equals(bo.getAuditStatus()));
FbsMessage fbsMessage = new FbsMessage()
.setSenderType(USERTYPE_ZBF)
.setSenderId(SecurityUtils.getAppUserId())
.setRecipientType(USERTYPE_FBS)
.setRecipientId(bo.getUserId())
.setHeadline(map.get(HEADLINE))
.setSubheading(map.get(SUBHEADING))
.setTableId(bo.getId())
.setTableName(SqlHelper.table(FbsWageApplication.class).getTableName())
.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());
return b;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertApply(FbsWageApplication bo) {
FbsWageApplication add = BeanUtil.toBean(bo, FbsWageApplication.class);
//判断申请金额
List<FbsWageApplication> list = list(Wrappers.<FbsWageApplication>lambdaQuery()
.eq(FbsWageApplication::getSubId, bo.getSubId())
.eq(FbsWageApplication::getUserId, SecurityUtils.getAppUserId())
.in(FbsWageApplication::getAuditStatus, AuditStatus.getUse()));
//收款金额
int taskUseAmount = list.stream()
.map(FbsWageApplication::getApplicantAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add).intValue();
//任务金额单位是万元,工资申请金额单位是元
ZbfProjectSubcontracting subcontracting = projectSubcontractingService.getById(bo.getSubId());
BigDecimal subAmount = subcontracting.getSubAmount();
subAmount = subAmount.multiply(new BigDecimal(10000));
BigDecimal subtract = subAmount.subtract(new BigDecimal(String.valueOf(taskUseAmount)));
if(subtract.compareTo(bo.getApplicantAmount()) < 0){
throw new BaseException("申请金额已超出,剩余申请金额:"+subtract+"");
}
ZbfProject project = iZbfProjectService.getById(bo.getProjectId());
ZbfUser zbfUser = iZbfUserService.selectUserByUserId(project.getUserId());
add.setReviewerName(zbfUser.getUsername());
add.setReviewerId(zbfUser.getUserId());
add.setProjectName(project.getProjectName());
add.setProjectAddress(project.getProjectAddress());
boolean save = save(add);
//分包商发消息到总包方
HashMap<String, String> fmp = new HashMap<>();
fmp.put("auditor", SecurityUtils.getUsername());
fmp.put("amount", bo.getApplicantAmount().toString());
Map<String, String> fmap = fbsMessage(fmp, FBS_TYPE_SETTLEMENT_TO_ZBF, true);
ZbfMessage zbfMessage = new ZbfMessage()
.setSenderType(USERTYPE_FBS)
.setSenderId(SecurityUtils.getAppUserId())
.setRecipientType(USERTYPE_ZBF)
.setRecipientId(add.getReviewerId())
.setHeadline(fmap.get(HEADLINE))
.setSubheading(fmap.get(SUBHEADING))
.setTableId(add.getId())
.setTableName(SqlHelper.table(FbsWageApplication.class).getTableName())
.setMessageLargeType(ZBF_LARGE_SETTLEMENT)
.setIsOperation(OPERATION_NEED);
zbfMessageService.sendAMessage(zbfMessage);
return save;
}
}

View File

@ -13,7 +13,6 @@ import com.ruoyi.bgt.service.IBgtProjectRecruitService;
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
import com.ruoyi.common.enums.RecruitApplyStatus;
import com.ruoyi.common.enums.RecruitStatus;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.fbs.domain.FbsProjectTask;
import com.ruoyi.fbs.service.IFbsProjectTaskService;
import com.ruoyi.wgz.domain.WgzAttendance;
@ -28,7 +27,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.reactive.TransactionalOperator;
import java.math.BigDecimal;
import java.time.LocalDate;
@ -319,10 +317,6 @@ public class BusinessTask
*/
@Transactional
public void leave(){
System.out.println("????????????????");
System.out.println("????????????????");
System.out.println("????????????????");
System.out.println("????????????????");
List<WgzLeave> updataList = new ArrayList<>();
List<WgzAttendance> attendanceList = new ArrayList<>();
List<WgzMessage> messagesList = new ArrayList<>();

View File

@ -143,4 +143,9 @@ public interface IWgzPayCalculationService extends IServicePlus<WgzPayCalculatio
* 根据招工申请获取这一次已结算完毕的工资
*/
BigDecimal getAlreadyPay(Long userId, Long recruitApplyId);
/**
* 获取任务下已审核通过的数据
*/
List<WgzPayCalculation> getPassListByTaskIds(List<Long> taskIds);
}

View File

@ -336,8 +336,8 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, wgzLeave.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), wgzLeave.getId(),SqlHelper.table(WgzLeave.class).getTableName());
// if(AuditStatus.PASS.getCode().equals(dto.getAuditorType())){
// //考勤信息
if(AuditStatus.PASS.getCode().equals(dto.getAuditorType())){
//考勤信息
// List<WgzAttendance> list = attendanceService.list(Wrappers.<WgzAttendance>lambdaQuery()
// .eq(WgzAttendance::getRecruitId, recruit.getId())
// .eq(WgzAttendance::getUserId, wgzLeave.getUserId())
@ -348,16 +348,17 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
// wgzAttendance.setExceptionType("7");
// attendanceService.updateById(wgzAttendance);
// }else {
// WgzAttendance wgzAttendance = new WgzAttendance();
// wgzAttendance.setRecruitId(recruit.getId());
// wgzAttendance.setUserId(wgzLeave.getUserId());
// wgzAttendance.setLeaveMarkId(wgzLeave.getId());
// wgzAttendance.setDailyWage(recruit.getRecruitAmount());
// wgzAttendance.setDate(wgzLeave.getStartTime().toLocalDate());
// wgzAttendance.setExceptionType("7");
// attendanceService.save(wgzAttendance);
WgzAttendance wgzAttendance = new WgzAttendance();
wgzAttendance.setApplyKey(wgzLeave.getApplyKey());
wgzAttendance.setRecruitId(recruit.getId());
wgzAttendance.setUserId(wgzLeave.getUserId());
wgzAttendance.setLeaveMarkId(wgzLeave.getId());
wgzAttendance.setDailyWage(recruit.getRecruitAmount());
wgzAttendance.setDate(wgzLeave.getStartTime().toLocalDate());
wgzAttendance.setExceptionType("7");
attendanceService.save(wgzAttendance);
// }
// }
}
}
return updateById(wgzLeave);
}

View File

@ -657,4 +657,12 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
}
return addSum;
}
@Override
public List<WgzPayCalculation> getPassListByTaskIds(List<Long> taskIds) {
LambdaQueryWrapper<WgzPayCalculation> wrapper = new LambdaQueryWrapper<>();
wrapper.in(WgzPayCalculation::getTaskId, taskIds)
.eq(WgzPayCalculation::getAuditorType, AuditStatus.PASS.getCode());
return list(wrapper);
}
}

View File

@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@Data
@Accessors(chain = true)
@ApiModel("总包方任务进度列表查询对象")
@ -16,6 +18,7 @@ public class ZbfProgressListDTO {
@ApiModelProperty("当前页数")
private Integer pageNum;
@ApiModelProperty("项目ID")
private Long projectId;
@ApiModelProperty("项目分包Id")
@NotNull(message = "项目分包Id不能为空")
private Long subId;
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.zbf.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("总包方分包详情班组长列表查询条件")
public class ZbfSubBgtListDTO {
@ApiModelProperty("分页大小")
private Integer pageSize;
/** 当前页数 */
@ApiModelProperty("当前页数")
private Integer pageNum;
@ApiModelProperty("分包ID")
@NotNull(message = "分包ID不能为空")
private Long subId;
}

View File

@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("分包商项目分包切换列表查询条件")
@ApiModel("总包方项目分包切换列表查询条件")
public class ZbfSubSwitchListDTO {
@ApiModelProperty("分页大小")

View File

@ -0,0 +1,35 @@
package com.ruoyi.zbf.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 分包商工资申请分页查询对象 fbs_wage_application
*
* @author ruoyi
* @date 2025-03-26
*/
@Data
@ApiModel("总包方工资审核查询对象")
public class ZbfWageApplicationListDTO {
/** 分页大小 */
@ApiModelProperty("分页大小")
private Integer pageSize;
/** 当前页数 */
@ApiModelProperty("当前页数")
private Integer pageNum;
@ApiModelProperty("类型0-申请中 1-已结算")
private Integer type;
@ApiModelProperty("项目Id")
private Long projectId;
@ApiModelProperty("项目分包Id")
private Long subId;
}

View File

@ -0,0 +1,28 @@
package com.ruoyi.zbf.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 包工头工资申请分页查询对象 bgt_wage_application
*
* @author ruoyi
* @date 2025-02-20
*/
@Data
@ApiModel("App包工头工资申请分页查询对象")
public class ZbfWageAuditDTO {
@ApiModelProperty("主键ID")
@NotNull(message = "主键ID不能为空")
private Long id;
@ApiModelProperty("审核状态1审核中 2已审核 3未通过")
private String auditStatus;
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.zbf.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel("分包商修改用户信息")
public class ZfbUserInfoUpdateDTO {
@ApiModelProperty("头像")
@NotBlank(message = "头像不能为空")
private String avatarName;
}

View File

@ -16,6 +16,6 @@ public class ZbfProgressListVO {
@ApiModelProperty("进度")
private Integer progress;
@ApiModelProperty("项目名称")
@ApiModelProperty("任务名称")
private String taskName;
}

View File

@ -16,7 +16,7 @@ import lombok.experimental.Accessors;
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("App总包方项目详情-任务进度视图对象")
public class ZbfProjectDetailProgressVO {
public class ZbfProgressVO {
@ApiModelProperty("总进度")
private Integer totalProgress = 0;

View File

@ -0,0 +1,29 @@
package com.ruoyi.zbf.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("总包方分包详情班组长列表视图对象")
public class ZbfSubBgtListVO {
@ApiModelProperty("主键ID")
private String id;
@ApiModelProperty("唯一标识")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long userId;
@ApiModelProperty("姓名")
private String username;
@ApiModelProperty("联系电话")
private String phone;
@ApiModelProperty("头像地址")
private String avatarName;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.zbf.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("总包方分包用工数量统计")
public class ZbfSubPersonCountVO {
@ApiModelProperty("人员总数")
private Integer totalCount;
@ApiModelProperty("进场总数")
private Integer entryCount;
@ApiModelProperty("退场总数")
private Integer leaveCount;
}

View File

@ -1,10 +1,13 @@
package com.ruoyi.zbf.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
import com.ruoyi.zbf.domain.ZbfProjectSubcontracting;
import com.ruoyi.zbf.domain.dto.ZbfSubBgtListDTO;
import com.ruoyi.zbf.domain.vo.ZbfSubBgtListVO;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;
/**
* 总包方项目分包Mapper接口
@ -16,4 +19,5 @@ import org.apache.ibatis.annotations.CacheNamespace;
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
public interface ZbfProjectSubcontractingMapper extends BaseMapperPlus<ZbfProjectSubcontracting> {
Page<ZbfSubBgtListVO> bgtList(@Param("page") Page<ZbfSubBgtListDTO> page, @Param("dto") ZbfSubBgtListDTO dto);
}

View File

@ -57,4 +57,16 @@ public interface IZbfMessageService extends IServicePlus<ZbfMessage> {
* 发送消息
*/
Boolean sendAMessage(ZbfMessage bo);
/**
* 已操作
*/
void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName);
/**
* 批量已操作
*/
void operationBatch(String recipientType,Long recipientId,List<Long> tableIds,String tableName);
}

View File

@ -172,7 +172,7 @@ public interface IZbfProjectService extends IServicePlus<ZbfProject> {
/**
* 总包方项目详情-用工进度
*/
ZbfProjectDetailProgressVO zbfProgress(Long projectId);
ZbfProgressVO zbfProgress(Long projectId);
/**
* 总包方项目详情-用工进度列表
@ -184,10 +184,6 @@ public interface IZbfProjectService extends IServicePlus<ZbfProject> {
*/
ZbfProjectDetailWageVO zbfWage(Long projectId);
/**
* 总包方项目详情-付款情况查看更多
*/
TableDataInfo<ZbfWageApplicationVO> zbfWageList(Long projectId);
/**
* 总包方项目详情-项目切换
*/

View File

@ -5,6 +5,10 @@ import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.zbf.bo.ZbfProjectSubcontractingQueryBo;
import com.ruoyi.zbf.domain.ZbfProjectSubcontracting;
import com.ruoyi.zbf.domain.dto.ZbfProgressListDTO;
import com.ruoyi.zbf.domain.dto.ZbfSubBgtListDTO;
import com.ruoyi.zbf.domain.vo.*;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
@ -54,4 +58,28 @@ public interface IZbfProjectSubcontractingService extends IServicePlus<ZbfProjec
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 总包方项目分包详情-分包商人员总数
*/
ZbfSubPersonCountVO subPersonCount(Long subId);
/**
* 总包方项目分包详情-班组长列表
*/
TableDataInfo<ZbfSubBgtListVO> bgtList(ZbfSubBgtListDTO dto);
/**
* 总包方项目分包详情-用工进度
*/
ZbfProgressVO zbfSubProgress(Long subId);
/**
* 总包方项目分包详情-用工进度列表
*/
TableDataInfo<ZbfProgressListVO> zbfSubProgressList(@Validated ZbfProgressListDTO dto);
/**
* 总包方项目详情-付款情况
*/
ZbfProjectDetailWageVO zbfSubWage(Long subId);
}

View File

@ -68,4 +68,19 @@ public interface IZbfUserService extends IServicePlus<ZbfUser> {
* 企业认证
*/
Long authenticate(CompanyAuthenticateDTO dto);
/**
* 根据信用代码查询用户
*/
ZbfUser selectUserByCreditCode(String creditCode);
/**
* 登录查询
*/
ZbfUser loginSelect(String key);
/**
* 修改头像
*/
Boolean editAvatar(String avatarName);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.zbf.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
@ -18,6 +19,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_ALREADY;
/**
* 消息Service业务层处理
*
@ -96,4 +99,29 @@ public class ZbfMessageServiceImpl extends ServicePlusImpl<ZbfMessageMapper, Zbf
public Boolean sendAMessage(ZbfMessage bo) {
return save(bo);
}
@Override
public void operation(String senderType, Long senderId, String recipientType, Long recipientId, Long tableId, String tableName) {
LambdaUpdateWrapper<ZbfMessage> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(ZbfMessage::getRecipientId, recipientId);
wrapper.eq(ZbfMessage::getRecipientType, recipientType);
wrapper.eq(ZbfMessage::getSenderId, senderId);
wrapper.eq(ZbfMessage::getSenderType, senderType);
wrapper.eq(ZbfMessage::getTableId, tableId);
wrapper.eq(ZbfMessage::getTableName, tableName);
wrapper.set(ZbfMessage::getIsOperation, OPERATION_ALREADY);
update(wrapper);
}
@Override
public void operationBatch(String recipientType, Long recipientId, List<Long> tableIds, String tableName) {
LambdaUpdateWrapper<ZbfMessage> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(ZbfMessage::getRecipientId, recipientId);
wrapper.eq(ZbfMessage::getRecipientType, recipientType);
wrapper.in(ZbfMessage::getTableId, tableIds);
wrapper.eq(ZbfMessage::getTableName, tableName);
wrapper.set(ZbfMessage::getIsOperation, OPERATION_ALREADY);
update(wrapper);
}
}

View File

@ -27,7 +27,9 @@ import com.ruoyi.fbs.domain.dto.FbsProjectListDTO;
import com.ruoyi.fbs.domain.vo.*;
import com.ruoyi.fbs.service.IFbsProjectTaskService;
import com.ruoyi.fbs.service.IFbsWageApplicationService;
import com.ruoyi.wgz.domain.WgzPayCalculation;
import com.ruoyi.wgz.service.IWgzAttendanceService;
import com.ruoyi.wgz.service.IWgzPayCalculationService;
import com.ruoyi.zbf.bo.ZbfProjectQueryBo;
import com.ruoyi.zbf.domain.ZbfProject;
import com.ruoyi.zbf.domain.ZbfProjectSection;
@ -77,6 +79,8 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
private IBgtProjectRecruitApplyService bgtProjectRecruitApplyService;
@Autowired
private IWgzAttendanceService wgzAttendanceService;
@Autowired
private IWgzPayCalculationService wgzPayCalculationService;
@Override
@ -519,7 +523,7 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
//查询所有创建的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getCreateId, SecurityUtils.getAppUserId())
.eq(FbsProjectTask::getProjectId, dto)
.eq(FbsProjectTask::getProjectId, dto.getProjectId())
);
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(taskIds)){
@ -728,12 +732,12 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
}
@Override
public ZbfProjectDetailProgressVO zbfProgress(Long projectId) {
public ZbfProgressVO zbfProgress(Long projectId) {
//查询所有创建的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getProjectId, projectId)
);
ZbfProjectDetailProgressVO vo = new ZbfProjectDetailProgressVO();
ZbfProgressVO vo = new ZbfProgressVO();
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(taskIds)){
List<BgtProjectTaskProgress> progressByTaskIds = bgtProjectTaskProgressService.getProgressByTaskIds(taskIds);
@ -772,20 +776,32 @@ public class ZbfProjectServiceImpl extends ServicePlusImpl<ZbfProjectMapper, Zbf
BigDecimal totalAmount = subList.stream().map(ZbfProjectSubcontracting::getSubAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setTotalAmount(totalAmount);
//接收金额
//已结算金额
vo.setPayAmount(BigDecimal.ZERO);
BigDecimal wgzAmount = BigDecimal.ZERO;
if(CollectionUtil.isNotEmpty(subIds)){
List<FbsWageApplication> passList= fbsWageApplicationService.getPassListBySubIds(subIds);
BigDecimal payAmount = passList.stream().map(FbsWageApplication::getApplicantAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setPayAmount(payAmount);
//查询分包下的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.in(FbsProjectTask::getSubId, subIds)
);
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(taskIds)){
List<WgzPayCalculation> passListByTaskIds = wgzPayCalculationService.getPassListByTaskIds(taskIds);
for (WgzPayCalculation wgzPayCalculation : passListByTaskIds){
BigDecimal multiply = wgzPayCalculation.getRecruitAmount().multiply(new BigDecimal(wgzPayCalculation.getNum()));
wgzAmount = wgzAmount.add(multiply);
}
}
}
vo.setWgzAmount(wgzAmount);
return vo;
}
@Override
public TableDataInfo<ZbfWageApplicationVO> zbfWageList(Long projectId) {
return null;
}
@Override
public TableDataInfo<ZbfProject> zbfSwitchList(ZbfProjectSwitchListDTO dto) {

View File

@ -1,22 +1,38 @@
package com.ruoyi.zbf.service.impl;
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
import com.ruoyi.bgt.domain.BgtProjectTaskProgress;
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
import com.ruoyi.bgt.service.IBgtProjectTaskProgressService;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.RecruitApplyStatus;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.fbs.domain.FbsProjectTask;
import com.ruoyi.fbs.domain.FbsWageApplication;
import com.ruoyi.fbs.service.IFbsProjectTaskService;
import com.ruoyi.fbs.service.IFbsWageApplicationService;
import com.ruoyi.wgz.domain.WgzPayCalculation;
import com.ruoyi.wgz.service.IWgzPayCalculationService;
import com.ruoyi.zbf.bo.ZbfProjectSubcontractingQueryBo;
import com.ruoyi.zbf.domain.ZbfProjectSubcontracting;
import com.ruoyi.zbf.domain.dto.ZbfProgressListDTO;
import com.ruoyi.zbf.domain.dto.ZbfSubBgtListDTO;
import com.ruoyi.zbf.domain.vo.*;
import com.ruoyi.zbf.mapper.ZbfProjectSubcontractingMapper;
import com.ruoyi.zbf.service.IZbfProjectSubcontractingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 总包方项目分包Service业务层处理
@ -27,6 +43,17 @@ import java.util.Map;
@Service
public class ZbfProjectSubcontractingServiceImpl extends ServicePlusImpl<ZbfProjectSubcontractingMapper, ZbfProjectSubcontracting> implements IZbfProjectSubcontractingService {
@Autowired
private IFbsProjectTaskService fbsProjectTaskService;
@Autowired
private IBgtProjectRecruitApplyService bgtProjectRecruitApplyService;
@Autowired
private IBgtProjectTaskProgressService bgtProjectTaskProgressService;
@Autowired
private IFbsWageApplicationService fbsWageApplicationService;
@Autowired
private IWgzPayCalculationService wgzPayCalculationService;
@Override
public ZbfProjectSubcontracting queryById(Long id){
return getById(id);
@ -86,4 +113,102 @@ public class ZbfProjectSubcontractingServiceImpl extends ServicePlusImpl<ZbfProj
}
return removeByIds(ids);
}
@Override
public ZbfSubPersonCountVO subPersonCount(Long subId) {
//查询分包下的所有任务
int entryCount = 0;
int leaveCount = 0;
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getSubId, subId));
if (CollectionUtil.isNotEmpty(taskList)){
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
List<BgtProjectRecruitApply> recruitApplyList = bgtProjectRecruitApplyService.list(Wrappers.<BgtProjectRecruitApply>lambdaQuery()
.in(BgtProjectRecruitApply::getTaskId, taskIds)
.in(BgtProjectRecruitApply::getStatus, RecruitApplyStatus.getWorkStatus()));
entryCount = (int) recruitApplyList.stream().filter(recruitApply -> RecruitApplyStatus.WORKING.getCode().equals(recruitApply.getStatus())).count();
leaveCount = (int) recruitApplyList.stream().filter(recruitApply -> RecruitApplyStatus.OUT_WORK.getCode().equals(recruitApply.getStatus())).count();
}
ZbfSubPersonCountVO vo = new ZbfSubPersonCountVO();
vo.setEntryCount(entryCount);
vo.setLeaveCount(leaveCount);
vo.setTotalCount(entryCount+leaveCount);
return vo;
}
@Override
public TableDataInfo<ZbfSubBgtListVO> bgtList(ZbfSubBgtListDTO dto) {
Page<ZbfSubBgtListDTO> queryDTOPage = new Page<>();
queryDTOPage.setCurrent(dto.getPageNum());
queryDTOPage.setSize(dto.getPageSize());
Page<ZbfSubBgtListVO> page = baseMapper.bgtList(queryDTOPage, dto);
return PageUtils.buildDataInfo(page);
}
@Override
public ZbfProgressVO zbfSubProgress(Long subId) {
//查询所有创建的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getSubId, subId)
);
ZbfProgressVO vo = new ZbfProgressVO();
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(taskIds)){
List<BgtProjectTaskProgress> progressByTaskIds = bgtProjectTaskProgressService.getProgressByTaskIds(taskIds);
vo.setProgress(progressByTaskIds.stream().mapToInt(BgtProjectTaskProgress::getProgress).sum());
vo.setTotalProgress(taskList.size() * 100);
}
return vo;
}
@Override
public TableDataInfo<ZbfProgressListVO> zbfSubProgressList(ZbfProgressListDTO dto) {
Page<ZbfProgressListVO> voPage = new Page<>();
//查询所有创建的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getSubId, dto.getSubId())
);
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(taskIds)){
TableDataInfo<BgtProjectTaskProgress> progressByTaskIds = bgtProjectTaskProgressService.getProgressByTaskIds(dto.getPageSize(), dto.getPageNum(), taskIds);
voPage.setTotal(progressByTaskIds.getTotal());
voPage.setRecords(BeanUtil.copyToList(progressByTaskIds.getRows(), ZbfProgressListVO.class));
}
return PageUtils.buildDataInfo(voPage);
}
@Override
public ZbfProjectDetailWageVO zbfSubWage(Long subId) {
ZbfProjectDetailWageVO vo = new ZbfProjectDetailWageVO();
ZbfProjectSubcontracting subcontracting = getById(subId);
//总金额
vo.setTotalAmount(subcontracting.getSubAmount());
//已结算金额
vo.setPayAmount(BigDecimal.ZERO);
BigDecimal wgzAmount = BigDecimal.ZERO;
List<FbsWageApplication> passList = fbsWageApplicationService.getPassListBySubIds(Collections.singletonList(subId));
BigDecimal payAmount = passList.stream().map(FbsWageApplication::getApplicantAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setPayAmount(payAmount);
//查询分包下的任务
List<FbsProjectTask> taskList = fbsProjectTaskService.list(Wrappers.<FbsProjectTask>lambdaQuery()
.eq(FbsProjectTask::getSubId, subId)
);
List<Long> taskIds = taskList.stream().map(FbsProjectTask::getId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(taskIds)) {
List<WgzPayCalculation> passListByTaskIds = wgzPayCalculationService.getPassListByTaskIds(taskIds);
for (WgzPayCalculation wgzPayCalculation : passListByTaskIds) {
BigDecimal multiply = wgzPayCalculation.getRecruitAmount().multiply(new BigDecimal(wgzPayCalculation.getNum()));
wgzAmount = wgzAmount.add(multiply);
}
}
vo.setWgzAmount(wgzAmount);
return vo;
}
}

View File

@ -10,7 +10,9 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.domain.Company;
import com.ruoyi.common.domain.dto.CompanyAuthenticateDTO;
import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.service.ICompanyService;
import com.ruoyi.common.util.ValidUtil;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.zbf.bo.ZbfUserQueryBo;
@ -118,6 +120,26 @@ public class ZbfUserServiceImpl extends ServicePlusImpl<ZbfUserMapper, ZbfUser>
@Override
public Long authenticate(CompanyAuthenticateDTO dto) {
// 校验银行卡号
if (!ValidUtil.isValidBankCard(dto.getCardNo())) {
throw new BaseException("银行卡号格式不正确");
}
//校验电话
if (!ValidUtil.isValidChineseMobile(dto.getContactPhone())) {
throw new BaseException("手机号格式不正确");
}
boolean b = ValidUtil.verifyCreditCode(dto.getCreditCode());
if (!b) {
throw new BaseException("统一社会信用代码格式不正确");
}
Company companyByCreditCode = companyService.getCompanyByCreditCode(dto.getCreditCode());
if (companyByCreditCode != null) {
throw new RuntimeException("该企业已认证");
}
Company company = BeanUtil.copyProperties(dto, Company.class);
companyService.save(company);
ZbfUser zbfUser = selectUserByUserId(SecurityUtils.getAppUserId());
@ -125,4 +147,30 @@ public class ZbfUserServiceImpl extends ServicePlusImpl<ZbfUserMapper, ZbfUser>
updateById(zbfUser);
return company.getId();
}
@Override
public ZbfUser selectUserByCreditCode(String creditCode) {
Company company = companyService.getCompanyByCreditCode(creditCode);
if (company != null) {
return baseMapper.selectOne(new LambdaQueryWrapper<ZbfUser>().eq(ZbfUser::getCompanyId, company.getId()));
}
return null;
}
@Override
public ZbfUser loginSelect(String key) {
ZbfUser zbfUser = selectUserByPhone(key);
if(zbfUser != null){
return zbfUser;
}
zbfUser = selectUserByCreditCode(key);
return zbfUser;
}
@Override
public Boolean editAvatar(String avatarName) {
ZbfUser zbfUser = selectUserByUserId(SecurityUtils.getAppUserId());
zbfUser.setAvatarName(avatarName);
return updateById(zbfUser);
}
}

View File

@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and bptp.task_id = #{dto.taskId}
</if>
</where>
order by bptp.id desc
</select>
<select id="getProgressByTaskIds" resultType="com.ruoyi.bgt.domain.BgtProjectTaskProgress">

View File

@ -21,5 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark"/>
</resultMap>
<select id="bgtList" resultType="com.ruoyi.zbf.domain.vo.ZbfSubBgtListVO">
SELECT u.id,
u.user_id,
u.username,
u.phone,
u.avatar_name
FROM fbs_project_task s
LEFT JOIN bgt_user u ON s.user_id = u.user_id
where s.sub_id = #{dto.subId} and s.user_id is not null
</select>
</mapper>