优化
This commit is contained in:
@ -84,7 +84,6 @@ public class BgtProjectRecruit implements Serializable {
|
||||
*/
|
||||
@Excel(name = "招工金额")
|
||||
@ApiModelProperty("招工金额")
|
||||
@Pattern(regexp = "^[0-9]+(\\.[0-9]{1,2})?$",message = "只能两位小数的数字")
|
||||
private BigDecimal recruitAmount;
|
||||
|
||||
/**
|
||||
@ -92,7 +91,6 @@ public class BgtProjectRecruit implements Serializable {
|
||||
*/
|
||||
@Excel(name = "招工数量")
|
||||
@ApiModelProperty("招工数量")
|
||||
@Pattern(regexp = "^[0-9]+$",message = "只能是整数")
|
||||
private Integer recruitStaffNum;
|
||||
|
||||
/**
|
||||
|
@ -61,13 +61,11 @@ public class FbsProjectTask implements Serializable {
|
||||
/** 任务金额 */
|
||||
@Excel(name = "任务金额")
|
||||
@ApiModelProperty("任务金额")
|
||||
@Pattern(regexp = "^[0-9]+(\\.[0-9]{1,2})?$",message = "只能两位小数的数字")
|
||||
private BigDecimal taskAmount;
|
||||
|
||||
/** 用工数量 */
|
||||
@Excel(name = "用工数量")
|
||||
@ApiModelProperty("用工数量")
|
||||
@Pattern(regexp = "^[0-9]+$",message = "只能是整数")
|
||||
private Integer taskStaffNum;
|
||||
|
||||
/** 任务开始时间 */
|
||||
|
@ -28,4 +28,7 @@ public class AppTaskDetailWageVO {
|
||||
@ApiModelProperty("任务金额")
|
||||
private BigDecimal taskAmount;
|
||||
|
||||
@ApiModelProperty("付款总金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
}
|
||||
|
@ -253,6 +253,9 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl<FbsProjectTaskMap
|
||||
//付款金额
|
||||
BigDecimal payByTaskAndBgt = payCalculationService.getPayByTaskAndBgt(id, SecurityUtils.getAppUserId());
|
||||
appTaskDetailVO.setTaskPaymentAmount(payByTaskAndBgt);
|
||||
|
||||
BigDecimal taskPay = attendanceService.getTaskPay(id, SecurityUtils.getAppUserId());
|
||||
appTaskDetailVO.setPayAmount(taskPay);
|
||||
return appTaskDetailVO;
|
||||
}
|
||||
|
||||
|
@ -78,4 +78,11 @@ public class WgzAppPersonalBasicInformationRes implements Serializable {
|
||||
|
||||
@ApiModelProperty("是否被选择")
|
||||
private Boolean isChoose;
|
||||
|
||||
@ApiModelProperty("工作状态")
|
||||
private String workStatus;
|
||||
|
||||
@ApiModelProperty("是否工资结清")
|
||||
private Boolean isPay;
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import com.ruoyi.wgz.domain.WgzAttendance;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -158,4 +159,14 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> {
|
||||
*/
|
||||
List<WgzAttendance> findByDateGetDateList(Long userId, Long recruitId,LocalDate date);
|
||||
|
||||
/**
|
||||
* 根据招工申请获取这一次申请的总工资
|
||||
*/
|
||||
BigDecimal getAllPay(Long userId, Long recruitApplyId, BigDecimal recruitAmount);
|
||||
|
||||
/**
|
||||
* 获取任务下所有招工的工资
|
||||
*/
|
||||
BigDecimal getTaskPay(Long taskId,Long userId);
|
||||
|
||||
}
|
||||
|
@ -138,4 +138,9 @@ public interface IWgzPayCalculationService extends IServicePlus<WgzPayCalculatio
|
||||
* 是否还有在审核的申请
|
||||
*/
|
||||
Boolean isThereAnyApplicationsInReview(Long recruitId,Long userId);
|
||||
|
||||
/**
|
||||
* 根据招工申请获取这一次已结算完毕的工资
|
||||
*/
|
||||
BigDecimal getAlreadyPay(Long userId, Long recruitApplyId);
|
||||
}
|
||||
|
@ -871,4 +871,46 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
List<WgzAttendance> wgzAttendances = baseMapper.selectList(wra);
|
||||
return wgzAttendances;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getAllPay(Long userId, Long recruitApplyId, BigDecimal recruitAmount) {
|
||||
|
||||
int i = count(
|
||||
new LambdaQueryWrapper<WgzAttendance>().
|
||||
eq(WgzAttendance::getUserId, userId)
|
||||
.eq(WgzAttendance::getApplyKey,recruitApplyId)
|
||||
.and(wrapper -> wrapper
|
||||
.isNotNull(WgzAttendance::getClockInTime)
|
||||
.or()
|
||||
.isNotNull(WgzAttendance::getClockOutTime)
|
||||
)
|
||||
);
|
||||
return recruitAmount.multiply(BigDecimal.valueOf(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getTaskPay(Long taskId,Long userId) {
|
||||
BigDecimal allPay= BigDecimal.ZERO;
|
||||
//获取任务下的所有招工
|
||||
List<BgtProjectRecruit> bgtProjectRecruits = iBgtProjectRecruitService.getBaseMapper().selectList(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
||||
.eq(BgtProjectRecruit::getTaskId, taskId).eq(BgtProjectRecruit::getUserId, userId));
|
||||
List<Long> recruitIds = bgtProjectRecruits.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList());
|
||||
//获取招工下的所有工资
|
||||
for (Long recruitId : recruitIds){
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
||||
//考勤天数
|
||||
int i = count(
|
||||
new LambdaQueryWrapper<WgzAttendance>()
|
||||
.eq(WgzAttendance::getRecruitId,recruitId)
|
||||
.and(wrapper -> wrapper
|
||||
.isNotNull(WgzAttendance::getClockInTime)
|
||||
.or()
|
||||
.isNotNull(WgzAttendance::getClockOutTime)
|
||||
)
|
||||
);
|
||||
BigDecimal multiply = recruit.getRecruitAmount().multiply(BigDecimal.valueOf(i));
|
||||
allPay = allPay.add(multiply);
|
||||
}
|
||||
return allPay;
|
||||
}
|
||||
}
|
||||
|
@ -469,50 +469,36 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
@Override
|
||||
public BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitApplyId) {
|
||||
BgtPayCalculationDetailBaseVO vo = new BgtPayCalculationDetailBaseVO();
|
||||
//务工者信息
|
||||
WgzUser wgzUser = wgzUserService.findByUserId(userId);
|
||||
vo.setUserId(userId);
|
||||
vo.setScore(wgzUser.getScore());
|
||||
vo.setUsername(wgzUser.getUsername());
|
||||
vo.setAvatarName(wgzUser.getAvatarName());
|
||||
vo.setIdentityCard(wgzUser.getIdentityCard());
|
||||
|
||||
//招工信息
|
||||
//招工申请信息
|
||||
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
||||
vo.setEntryTime(apply.getEntryTime());
|
||||
|
||||
//招工信息
|
||||
Long recruitId = apply.getRecruitId();
|
||||
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
||||
vo.setRecruitId(recruitId);
|
||||
vo.setRecruitName(recruit.getRecruitName());
|
||||
|
||||
//任务信息
|
||||
FbsProjectTask task = taskService.getById(recruit.getTaskId());
|
||||
vo.setTaskId(recruit.getTaskId());
|
||||
vo.setTaskName(task.getTaskName());
|
||||
|
||||
vo.setUserId(userId);
|
||||
vo.setRecruitId(recruitId);
|
||||
vo.setTaskId(recruit.getTaskId());
|
||||
//获取个人总工资
|
||||
BigDecimal allPay = iWgzAttendanceService.getAllPay(userId, recruitApplyId, recruit.getRecruitAmount());
|
||||
vo.setAllAmount(allPay);
|
||||
|
||||
int i = iWgzAttendanceService.count(
|
||||
new LambdaQueryWrapper<WgzAttendance>().
|
||||
eq(WgzAttendance::getUserId, userId).
|
||||
eq(WgzAttendance::getApplyKey,recruitApplyId).
|
||||
eq(WgzAttendance::getRecruitId,recruitId).and(wrapper -> wrapper
|
||||
.isNotNull(WgzAttendance::getClockInTime)
|
||||
.or()
|
||||
.isNotNull(WgzAttendance::getClockOutTime)
|
||||
)
|
||||
);
|
||||
// Integer i = attendanceService.attendanceDetail(userId, recruitId, null);
|
||||
BigDecimal totalAmount = recruit.getRecruitAmount().multiply(BigDecimal.valueOf(i));
|
||||
vo.setAllAmount(totalAmount);
|
||||
|
||||
List<WgzPayCalculation> gzs = findByUserIdRecruitIdNewestData(userId, recruitId);
|
||||
BigDecimal addSum = new BigDecimal(0);
|
||||
for (WgzPayCalculation gz : gzs) {
|
||||
//金额*天数=实际工资
|
||||
BigDecimal multiply = gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum()));
|
||||
addSum = addSum.add(multiply);
|
||||
}
|
||||
vo.setPayAmount(addSum);
|
||||
//获取个人已结算工资
|
||||
BigDecimal alreadyPay = getAlreadyPay(userId, recruitApplyId);
|
||||
vo.setPayAmount(alreadyPay);
|
||||
vo.setResidueAmount(vo.getAllAmount().subtract(vo.getPayAmount()));
|
||||
|
||||
//未结算天数
|
||||
@ -640,4 +626,21 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
.in(WgzPayCalculation::getAuditorType, AuditStatus.getToAudit()));
|
||||
return CollectionUtil.isNotEmpty(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getAlreadyPay(Long userId, Long recruitApplyId) {
|
||||
LambdaQueryWrapper<WgzPayCalculation> eq = new LambdaQueryWrapper<WgzPayCalculation>().
|
||||
eq(WgzPayCalculation::getUserId, userId).
|
||||
eq(WgzPayCalculation::getApplyKey, recruitApplyId).
|
||||
eq(WgzPayCalculation::getAuditorType, "2");
|
||||
List<WgzPayCalculation> gzs = baseMapper.selectList(eq);
|
||||
|
||||
BigDecimal addSum = new BigDecimal(0);
|
||||
for (WgzPayCalculation gz : gzs) {
|
||||
//金额*天数=实际工资
|
||||
BigDecimal multiply = gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum()));
|
||||
addSum = addSum.add(multiply);
|
||||
}
|
||||
return addSum;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user