修改工资结算

This commit is contained in:
2025-02-25 15:06:17 +08:00
parent 89a92e0b8a
commit cffc1422b0
10 changed files with 77 additions and 18 deletions

View File

@ -336,6 +336,16 @@ public class WgzAppController {
return AjaxResult.success(iBgtProjectRecruitApplyService.userApplyForRegistration(id));
}
/**
* 【首页】【项目详情】 项目详情·确认|拒绝报名
*/
@ApiOperation("【首页】【项目详情】 项目详情·确认|拒绝报名)")
//@PreAuthorize("@ss.hasPermi('wgzApp:user:userConfirmRegistration')")
@GetMapping("/WgzAppUserConfirmRegistration/{id}")
public AjaxResult<Boolean> userConfirmRegistration(@Validated WgzAppConfirmRegistrationReq req) {
return AjaxResult.success(iBgtProjectRecruitApplyService.userConfirmRegistration(req));
}
/**
* 【首页】【已报名项目】 已报名项目
*/
@ -407,16 +417,19 @@ public class WgzAppController {
res.setEntryTime(by.getEntryTime()).
setLeaveTime(by.getLeaveTime()).
setAmount(recruitAmount);
//3、查询当前进行中的项目是否有工资结算
WgzPayCalculation gz = iWgzPayCalculationService.findByUserIdRecruitIdNewestData(appUserId, appById.getId());
if (gz != null){
//3、查询当前进行中的项目是否有工资结算(多次追加)
List<WgzPayCalculation> gzs = iWgzPayCalculationService.findByUserIdRecruitIdNewestData(appUserId, appById.getId());
BigDecimal addSum = new BigDecimal(0);
for (WgzPayCalculation gz : gzs) {
//金额*天数=实际工资
res.setAppliedAmount(gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum())));
res.setNameOfApplicant(gz.getUserName());
BigDecimal multiply = gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum()));
addSum = addSum.add(multiply);
}
res.setAppliedAmount(addSum);
res.setNameOfApplicant(gzs.get(0).getUserName());
if(i!=0){
//总的金额/结算的金额=百分比
BigDecimal divide = res.getTotalAmount().divide(res.getAmount(), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal divide = res.getAppliedAmount().divide(res.getTotalAmount(), 2, BigDecimal.ROUND_HALF_UP);
res.setPercentage(divide.doubleValue());
}
return AjaxResult.success(res);

View File

@ -9,6 +9,7 @@ import com.ruoyi.bgt.domain.dto.BgtScoreDTO;
import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
@ -115,5 +116,8 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR
*/
TableDataInfo<WgzAppUnderwayRes> userUnderway(@Validated WgzAppUnderwayReq req);
/**
* 项目详情·确认|拒绝报名
*/
Boolean userConfirmRegistration(@Validated WgzAppConfirmRegistrationReq req);
}

View File

@ -85,7 +85,7 @@ public interface IBgtProjectRecruitService extends IServicePlus<BgtProjectRecrui
/**
* 根据招工id获取到具体招工信息
*/
BgtProjectRecruit getAppById(Long id);
BgtProjectRecruit getAppById(Long userId);
/**
* 1、首页-项目详情

View File

@ -27,6 +27,7 @@ import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.service.IAnnexService;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
import com.ruoyi.wgz.domain.WgzMessage;
@ -173,6 +174,9 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
if (bgtProjectRecruitApplies.size()>1){
throw new RuntimeException("异常,查询到用户同时在多个工地务工!");
}
if (bgtProjectRecruitApplies.isEmpty()){
return null;
}
return bgtProjectRecruitApplies.get(0);
}
@ -181,18 +185,18 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
public Boolean userApplyForRegistration(Long id) {
//1、获取当前用户
Long appUserId = SecurityUtils.getAppUserId();
BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
//2、检查当前用户是否已经有工地了、检查当前用户是否满足对应工种
//2、当前申请报名的工地信息
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(id);
//3、检查当前用户是否已经有工地了、检查当前用户是否满足对应工种
Integer i = baseMapper.selectCount(
new LambdaQueryWrapper<BgtProjectRecruitApply>().
eq(BgtProjectRecruitApply::getUserId, appUserId).
eq(BgtProjectRecruitApply::getStatus, "3")
in(BgtProjectRecruitApply::getStatus, "3","5")
);
if (i>0){
throw new RuntimeException("已有工地!不可再次申请!");
}
WgzUser byId = wgzUserService.getById(appUserId);
WgzUser byId = wgzUserService.findByUserId(appUserId);
if (!Objects.equals(appById.getTypeOfWork(), byId.getTypeOfWork())){
throw new RuntimeException("工种不匹配!");
}
@ -284,4 +288,12 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
return PageUtils.buildDataInfo(baseMapper.underwayPage(pe));
}
@Override
public Boolean userConfirmRegistration(WgzAppConfirmRegistrationReq req) {
//1、获取当前用户
Long appUserId = SecurityUtils.getAppUserId();
//2、当前用户+项目ID确认
return null;
}
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.wgz.bo.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("确认|拒绝报名请求对象")
public class WgzAppConfirmRegistrationReq implements Serializable {
@ApiModelProperty("招工ID")
private Long recruitId;
@ApiModelProperty("0拒绝 1确认")
private String status;
}

View File

@ -81,7 +81,7 @@ public interface IWgzPayCalculationService extends IServicePlus<WgzPayCalculatio
/**
* 根据务工者id和招工id得到最新的数据
*/
WgzPayCalculation findByUserIdRecruitIdNewestData(Long userId, Long recruitId);
List<WgzPayCalculation> findByUserIdRecruitIdNewestData(Long userId, Long recruitId);
/**
* 查询列表

View File

@ -92,4 +92,9 @@ public interface IWgzUserService extends IServicePlus<WgzUser> {
* 务工者APP实名认证
*/
Boolean userRealNameAuthentication(@Validated @RequestBody WgzAppRealNameAuthenticationReq req);
/**
* 根据务工者唯一标识获取数据
*/
WgzUser findByUserId(Long userId);
}

View File

@ -161,13 +161,12 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
}
@Override
public WgzPayCalculation findByUserIdRecruitIdNewestData(Long userId, Long recruitId) {
public List<WgzPayCalculation> findByUserIdRecruitIdNewestData(Long userId, Long recruitId) {
LambdaQueryWrapper<WgzPayCalculation> eq = new LambdaQueryWrapper<WgzPayCalculation>().
eq(WgzPayCalculation::getUserId, userId).
eq(WgzPayCalculation::getRecruitId, recruitId).
orderByDesc(WgzPayCalculation::getCreateTime).
last("limit 1");
return baseMapper.selectOne(eq);
eq(WgzPayCalculation::getAuditorType, "2");
return baseMapper.selectList(eq);
}
@Override

View File

@ -190,4 +190,9 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
return true;
}
@Override
public WgzUser findByUserId(Long userId) {
return baseMapper.selectOne(new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getUserId, userId));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB