优化
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.web.controller.bgt;
|
package com.ruoyi.web.controller.bgt;
|
||||||
|
|
||||||
import com.ruoyi.bgt.domain.BgtMessage;
|
import com.ruoyi.bgt.domain.BgtMessage;
|
||||||
|
import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
||||||
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
|
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
|
||||||
import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO;
|
import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO;
|
||||||
import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO;
|
import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO;
|
||||||
@ -10,12 +11,15 @@ import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO;
|
|||||||
import com.ruoyi.bgt.domain.vo.BgtMessageVO;
|
import com.ruoyi.bgt.domain.vo.BgtMessageVO;
|
||||||
import com.ruoyi.bgt.service.IBgtMessageService;
|
import com.ruoyi.bgt.service.IBgtMessageService;
|
||||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
|
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
|
||||||
|
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.RecruitApplyStatus;
|
import com.ruoyi.common.enums.RecruitApplyStatus;
|
||||||
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
||||||
import com.ruoyi.wgz.bo.res.WgzAppPersonalBasicInformationRes;
|
import com.ruoyi.wgz.bo.res.WgzAppPersonalBasicInformationRes;
|
||||||
|
import com.ruoyi.wgz.service.IWgzAttendanceService;
|
||||||
|
import com.ruoyi.wgz.service.IWgzPayCalculationService;
|
||||||
import com.ruoyi.wgz.service.IWgzUserService;
|
import com.ruoyi.wgz.service.IWgzUserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -23,6 +27,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息Controller
|
* 消息Controller
|
||||||
*
|
*
|
||||||
@ -41,6 +47,12 @@ public class AppBgtMessageController extends BaseController {
|
|||||||
|
|
||||||
private final IWgzUserService wgzUserService;
|
private final IWgzUserService wgzUserService;
|
||||||
|
|
||||||
|
private final IWgzAttendanceService iWgzAttendanceService;
|
||||||
|
|
||||||
|
private final IWgzPayCalculationService iWgzPayCalculationService;
|
||||||
|
|
||||||
|
private final IBgtProjectRecruitService iBgtProjectRecruitService;
|
||||||
|
|
||||||
@ApiOperation("未读消息统计")
|
@ApiOperation("未读消息统计")
|
||||||
@GetMapping("/countUnread")
|
@GetMapping("/countUnread")
|
||||||
public AjaxResult<BgtMessageCountVO> count() {
|
public AjaxResult<BgtMessageCountVO> count() {
|
||||||
@ -85,10 +97,18 @@ public class AppBgtMessageController extends BaseController {
|
|||||||
WgzAppPersonalBasicInformationRes res = wgzUserService.userPersonalBasicInformation(req);
|
WgzAppPersonalBasicInformationRes res = wgzUserService.userPersonalBasicInformation(req);
|
||||||
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
||||||
res.setIsChoose(!apply.getStatus().equals(RecruitApplyStatus.SIGN_UP.getCode()));
|
res.setIsChoose(!apply.getStatus().equals(RecruitApplyStatus.SIGN_UP.getCode()));
|
||||||
|
res.setWorkStatus(apply.getStatus());
|
||||||
|
if(RecruitApplyStatus.getWorkStatus().contains(apply.getStatus())){
|
||||||
|
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(apply.getRecruitId());
|
||||||
|
//获取个人总工资
|
||||||
|
BigDecimal allPay = iWgzAttendanceService.getAllPay(userId, recruitApplyId, recruit.getRecruitAmount());
|
||||||
|
//获取个人已结算工资
|
||||||
|
BigDecimal alreadyPay = iWgzPayCalculationService.getAlreadyPay(userId, recruitApplyId);
|
||||||
|
res.setIsPay(allPay.equals(alreadyPay));
|
||||||
|
}
|
||||||
return AjaxResult.success(res);
|
return AjaxResult.success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("未审批消息详情列表")
|
@ApiOperation("未审批消息详情列表")
|
||||||
@GetMapping("/unAuditList")
|
@GetMapping("/unAuditList")
|
||||||
public TableDataInfo<BgtMessageDetailVO> unAuditList(BgtMessageUnAuditDetailDTO dto) {
|
public TableDataInfo<BgtMessageDetailVO> unAuditList(BgtMessageUnAuditDetailDTO dto) {
|
||||||
|
@ -3,12 +3,13 @@ package com.ruoyi.web.controller.common;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
||||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
||||||
|
import com.ruoyi.bgt.service.IBgtUserService;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||||
import com.ruoyi.common.domain.Annex;
|
import com.ruoyi.common.domain.Annex;
|
||||||
import com.ruoyi.common.domain.AnnexRecord;
|
import com.ruoyi.common.domain.AnnexRecord;
|
||||||
import com.ruoyi.common.service.IAnnexRecordService;
|
import com.ruoyi.common.service.IAnnexRecordService;
|
||||||
import com.ruoyi.common.service.IAnnexService;
|
import com.ruoyi.common.service.IAnnexService;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
|
||||||
import com.ruoyi.wgz.domain.WgzUser;
|
import com.ruoyi.wgz.domain.WgzUser;
|
||||||
import com.ruoyi.wgz.service.IWgzUserService;
|
import com.ruoyi.wgz.service.IWgzUserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -48,6 +49,7 @@ public class UploadZipController {
|
|||||||
private final IBgtProjectRecruitService recruitService;
|
private final IBgtProjectRecruitService recruitService;
|
||||||
private final IAnnexService annexService;
|
private final IAnnexService annexService;
|
||||||
private final IAnnexRecordService annexRecordService;
|
private final IAnnexRecordService annexRecordService;
|
||||||
|
private final IBgtUserService bgtUserService;
|
||||||
|
|
||||||
private static final String TEMP_DIR = "ruoyi/uploadPath/temporaryZip";
|
private static final String TEMP_DIR = "ruoyi/uploadPath/temporaryZip";
|
||||||
private static final String SAVE_DIR = "ruoyi/uploadPath/recruit";
|
private static final String SAVE_DIR = "ruoyi/uploadPath/recruit";
|
||||||
@ -55,7 +57,7 @@ public class UploadZipController {
|
|||||||
|
|
||||||
@ApiOperation("上传压缩文件")
|
@ApiOperation("上传压缩文件")
|
||||||
@PostMapping("/upload-zip")
|
@PostMapping("/upload-zip")
|
||||||
public ResponseEntity<String> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId) {
|
public ResponseEntity<String> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId, @RequestParam("userId") Long userId) {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
return ResponseEntity.badRequest().body("上传的文件为空");
|
return ResponseEntity.badRequest().body("上传的文件为空");
|
||||||
}
|
}
|
||||||
@ -64,6 +66,12 @@ public class UploadZipController {
|
|||||||
return ResponseEntity.badRequest().body("招工信息不存在");
|
return ResponseEntity.badRequest().body("招工信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BgtUser bgtUser = bgtUserService.selectUserByUserId(userId);
|
||||||
|
if (bgtUser == null){
|
||||||
|
return ResponseEntity.badRequest().body("当前用户不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String username = bgtUser.getUsername();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 保存上传的压缩文件
|
// 保存上传的压缩文件
|
||||||
@ -84,10 +92,10 @@ public class UploadZipController {
|
|||||||
processExtractedFolder(extractDir, recruitId);
|
processExtractedFolder(extractDir, recruitId);
|
||||||
|
|
||||||
// 将解压后的文件移动到 SAVE_DIR
|
// 将解压后的文件移动到 SAVE_DIR
|
||||||
moveFilesToSaveDir(extractDir, recruitId);
|
moveFilesToSaveDir(extractDir, recruitId, username);
|
||||||
|
|
||||||
// 异步执行 RECORD_DIR 操作和删除临时文件操作
|
// 异步执行 RECORD_DIR 操作和删除临时文件操作
|
||||||
asyncProcessRecordAndDeleteTemp(extractDir, zipFile, recruitId,SecurityUtils.getUsername(),SecurityUtils.getAppUserId());
|
asyncProcessRecordAndDeleteTemp(extractDir, zipFile, recruitId,username,userId);
|
||||||
|
|
||||||
return ResponseEntity.ok("文件上传并处理成功");
|
return ResponseEntity.ok("文件上传并处理成功");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -218,7 +226,7 @@ public class UploadZipController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveFilesToSaveDir(File sourceDir, Long recruitId) throws IOException {
|
private void moveFilesToSaveDir(File sourceDir, Long recruitId,String username) throws IOException {
|
||||||
// 移动到 SAVE_DIR
|
// 移动到 SAVE_DIR
|
||||||
File saveDestDir = new File(SAVE_DIR);
|
File saveDestDir = new File(SAVE_DIR);
|
||||||
ensureDirectoryExists(saveDestDir);
|
ensureDirectoryExists(saveDestDir);
|
||||||
@ -239,7 +247,7 @@ public class UploadZipController {
|
|||||||
// 删除和解压出来的二级目录同名字的目录
|
// 删除和解压出来的二级目录同名字的目录
|
||||||
deleteFolder(secondLevelDestDir);
|
deleteFolder(secondLevelDestDir);
|
||||||
}
|
}
|
||||||
moveFilesRecursively(firstLevelFile, firstLevelDestDir, annexList, recruitId);
|
moveFilesRecursively(firstLevelFile, firstLevelDestDir, annexList, recruitId,username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,14 +256,14 @@ public class UploadZipController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveFilesRecursively(File source, File destination, List<Annex> annexList, Long recruitId) throws IOException {
|
private void moveFilesRecursively(File source, File destination, List<Annex> annexList, Long recruitId,String username) throws IOException {
|
||||||
if (source.isDirectory()) {
|
if (source.isDirectory()) {
|
||||||
File newDir = new File(destination, source.getName());
|
File newDir = new File(destination, source.getName());
|
||||||
ensureDirectoryExists(newDir);
|
ensureDirectoryExists(newDir);
|
||||||
File[] files = source.listFiles();
|
File[] files = source.listFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
moveFilesRecursively(file, newDir, annexList, recruitId);
|
moveFilesRecursively(file, newDir, annexList, recruitId,username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -295,8 +303,8 @@ public class UploadZipController {
|
|||||||
annex.setUserType(Constants.WGZ);
|
annex.setUserType(Constants.WGZ);
|
||||||
annex.setUserId(wgzUser.getUserId());
|
annex.setUserId(wgzUser.getUserId());
|
||||||
annex.setRecruitId(recruitId);
|
annex.setRecruitId(recruitId);
|
||||||
annex.setCreateBy(SecurityUtils.getUsername());
|
annex.setCreateBy(username);
|
||||||
annex.setUpdateBy(SecurityUtils.getUsername());
|
annex.setUpdateBy(username);
|
||||||
annexList.add(annex);
|
annexList.add(annex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,6 @@ public class BgtProjectRecruit implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "招工金额")
|
@Excel(name = "招工金额")
|
||||||
@ApiModelProperty("招工金额")
|
@ApiModelProperty("招工金额")
|
||||||
@Pattern(regexp = "^[0-9]+(\\.[0-9]{1,2})?$",message = "只能两位小数的数字")
|
|
||||||
private BigDecimal recruitAmount;
|
private BigDecimal recruitAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,7 +91,6 @@ public class BgtProjectRecruit implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "招工数量")
|
@Excel(name = "招工数量")
|
||||||
@ApiModelProperty("招工数量")
|
@ApiModelProperty("招工数量")
|
||||||
@Pattern(regexp = "^[0-9]+$",message = "只能是整数")
|
|
||||||
private Integer recruitStaffNum;
|
private Integer recruitStaffNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,13 +61,11 @@ public class FbsProjectTask implements Serializable {
|
|||||||
/** 任务金额 */
|
/** 任务金额 */
|
||||||
@Excel(name = "任务金额")
|
@Excel(name = "任务金额")
|
||||||
@ApiModelProperty("任务金额")
|
@ApiModelProperty("任务金额")
|
||||||
@Pattern(regexp = "^[0-9]+(\\.[0-9]{1,2})?$",message = "只能两位小数的数字")
|
|
||||||
private BigDecimal taskAmount;
|
private BigDecimal taskAmount;
|
||||||
|
|
||||||
/** 用工数量 */
|
/** 用工数量 */
|
||||||
@Excel(name = "用工数量")
|
@Excel(name = "用工数量")
|
||||||
@ApiModelProperty("用工数量")
|
@ApiModelProperty("用工数量")
|
||||||
@Pattern(regexp = "^[0-9]+$",message = "只能是整数")
|
|
||||||
private Integer taskStaffNum;
|
private Integer taskStaffNum;
|
||||||
|
|
||||||
/** 任务开始时间 */
|
/** 任务开始时间 */
|
||||||
|
@ -28,4 +28,7 @@ public class AppTaskDetailWageVO {
|
|||||||
@ApiModelProperty("任务金额")
|
@ApiModelProperty("任务金额")
|
||||||
private BigDecimal taskAmount;
|
private BigDecimal taskAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("付款总金额")
|
||||||
|
private BigDecimal payAmount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,9 @@ public class FbsProjectTaskServiceImpl extends ServicePlusImpl<FbsProjectTaskMap
|
|||||||
//付款金额
|
//付款金额
|
||||||
BigDecimal payByTaskAndBgt = payCalculationService.getPayByTaskAndBgt(id, SecurityUtils.getAppUserId());
|
BigDecimal payByTaskAndBgt = payCalculationService.getPayByTaskAndBgt(id, SecurityUtils.getAppUserId());
|
||||||
appTaskDetailVO.setTaskPaymentAmount(payByTaskAndBgt);
|
appTaskDetailVO.setTaskPaymentAmount(payByTaskAndBgt);
|
||||||
|
|
||||||
|
BigDecimal taskPay = attendanceService.getTaskPay(id, SecurityUtils.getAppUserId());
|
||||||
|
appTaskDetailVO.setPayAmount(taskPay);
|
||||||
return appTaskDetailVO;
|
return appTaskDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,4 +78,11 @@ public class WgzAppPersonalBasicInformationRes implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("是否被选择")
|
@ApiModelProperty("是否被选择")
|
||||||
private Boolean isChoose;
|
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.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -158,4 +159,14 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> {
|
|||||||
*/
|
*/
|
||||||
List<WgzAttendance> findByDateGetDateList(Long userId, Long recruitId,LocalDate date);
|
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);
|
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);
|
List<WgzAttendance> wgzAttendances = baseMapper.selectList(wra);
|
||||||
return wgzAttendances;
|
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
|
@Override
|
||||||
public BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitApplyId) {
|
public BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitApplyId) {
|
||||||
BgtPayCalculationDetailBaseVO vo = new BgtPayCalculationDetailBaseVO();
|
BgtPayCalculationDetailBaseVO vo = new BgtPayCalculationDetailBaseVO();
|
||||||
|
//务工者信息
|
||||||
WgzUser wgzUser = wgzUserService.findByUserId(userId);
|
WgzUser wgzUser = wgzUserService.findByUserId(userId);
|
||||||
|
vo.setUserId(userId);
|
||||||
vo.setScore(wgzUser.getScore());
|
vo.setScore(wgzUser.getScore());
|
||||||
vo.setUsername(wgzUser.getUsername());
|
vo.setUsername(wgzUser.getUsername());
|
||||||
vo.setAvatarName(wgzUser.getAvatarName());
|
vo.setAvatarName(wgzUser.getAvatarName());
|
||||||
vo.setIdentityCard(wgzUser.getIdentityCard());
|
vo.setIdentityCard(wgzUser.getIdentityCard());
|
||||||
|
|
||||||
//招工信息
|
//招工申请信息
|
||||||
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
||||||
vo.setEntryTime(apply.getEntryTime());
|
vo.setEntryTime(apply.getEntryTime());
|
||||||
|
|
||||||
|
//招工信息
|
||||||
Long recruitId = apply.getRecruitId();
|
Long recruitId = apply.getRecruitId();
|
||||||
|
|
||||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
||||||
|
vo.setRecruitId(recruitId);
|
||||||
vo.setRecruitName(recruit.getRecruitName());
|
vo.setRecruitName(recruit.getRecruitName());
|
||||||
|
|
||||||
|
//任务信息
|
||||||
FbsProjectTask task = taskService.getById(recruit.getTaskId());
|
FbsProjectTask task = taskService.getById(recruit.getTaskId());
|
||||||
|
vo.setTaskId(recruit.getTaskId());
|
||||||
vo.setTaskName(task.getTaskName());
|
vo.setTaskName(task.getTaskName());
|
||||||
|
|
||||||
vo.setUserId(userId);
|
//获取个人总工资
|
||||||
vo.setRecruitId(recruitId);
|
BigDecimal allPay = iWgzAttendanceService.getAllPay(userId, recruitApplyId, recruit.getRecruitAmount());
|
||||||
vo.setTaskId(recruit.getTaskId());
|
vo.setAllAmount(allPay);
|
||||||
|
|
||||||
int i = iWgzAttendanceService.count(
|
//获取个人已结算工资
|
||||||
new LambdaQueryWrapper<WgzAttendance>().
|
BigDecimal alreadyPay = getAlreadyPay(userId, recruitApplyId);
|
||||||
eq(WgzAttendance::getUserId, userId).
|
vo.setPayAmount(alreadyPay);
|
||||||
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);
|
|
||||||
vo.setResidueAmount(vo.getAllAmount().subtract(vo.getPayAmount()));
|
vo.setResidueAmount(vo.getAllAmount().subtract(vo.getPayAmount()));
|
||||||
|
|
||||||
//未结算天数
|
//未结算天数
|
||||||
@ -640,4 +626,21 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
|||||||
.in(WgzPayCalculation::getAuditorType, AuditStatus.getToAudit()));
|
.in(WgzPayCalculation::getAuditorType, AuditStatus.getToAudit()));
|
||||||
return CollectionUtil.isNotEmpty(list);
|
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