编写工资结算

This commit is contained in:
2025-02-21 16:15:49 +08:00
parent 1fa1862e77
commit 081f1f23d8
15 changed files with 240 additions and 8 deletions

View File

@ -34,6 +34,8 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -363,7 +365,46 @@ public class WgzAppController {
@ApiOperation("【首页】【项目进行中】 项目进行中") @ApiOperation("【首页】【项目进行中】 项目进行中")
@PreAuthorize("@ss.hasPermi('wgzApp:user:userUnderway')") @PreAuthorize("@ss.hasPermi('wgzApp:user:userUnderway')")
@GetMapping("/WgzAppUserUnderway") @GetMapping("/WgzAppUserUnderway")
public TableDataInfo<WgzAppRegisteredProjectRes> userUnderway(@Validated WgzAppUnderwayReq req) { public TableDataInfo<WgzAppUnderwayRes> userUnderway(@Validated WgzAppUnderwayReq req) {
return iBgtProjectRecruitApplyService.userUnderway(req);
}
/**
* 【首页】【项目进行中】 项目进行中·申请工资结算(查询)
*/
@ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(查询)")
@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementFind')")
@GetMapping("/WgzAppUserApplyForPayrollSettlementFind")
public AjaxResult<WgzApplyForPayrollSettlementFindRes> userApplyForPayrollSettlementFind(@Validated WgzApplyForPayrollSettlementFindReq req) {
Long appUserId = SecurityUtils.getAppUserId();
BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
//1、查询入场时间、退场时间、单天金额
BigDecimal recruitAmount = appById.getRecruitAmount();
//2、查询实际考勤时间只要有打卡就算出勤一条异常也视为正常出勤,也就是说只要有上班or下班至少有一个有数据那就证明出勤ok
Integer i = iWgzAttendanceService.attendanceDetail(appUserId, appById.getId(), 1);
if (i == 0){
throw new RuntimeException("您还未打卡");
}
//3、单天金额*实际考勤总天数=实际工资
BigDecimal totalAmount = recruitAmount.multiply(BigDecimal.valueOf(i));
WgzApplyForPayrollSettlementFindRes res = new WgzApplyForPayrollSettlementFindRes().
setEntryTime(by.getEntryTime()).
setLeaveTime(by.getLeaveTime()).
setAmount(recruitAmount).
setNum(i).
setTotalAmount(totalAmount);
return AjaxResult.success(res);
}
/**
* 【首页】【项目进行中】 项目进行中·申请工资结算(新增)
*/
@ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(新增)")
@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementAdd')")
@GetMapping("/WgzAppUserApplyForPayrollSettlementAdd")
public AjaxResult<WgzApplyForPayrollSettlementFindRes> userApplyForPayrollSettlementAdd(@Validated WgzApplyForPayrollSettlementFindReq req) {
return null; return null;
} }

View File

@ -1,10 +1,13 @@
package com.ruoyi.bgt.mapper; package com.ruoyi.bgt.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.bgt.domain.BgtProjectRecruitApply; import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyQueryDTO; import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyQueryDTO;
import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO; import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO;
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
import org.apache.ibatis.annotations.CacheNamespace; import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -21,4 +24,7 @@ import java.util.List;
public interface BgtProjectRecruitApplyMapper extends BaseMapperPlus<BgtProjectRecruitApply> { public interface BgtProjectRecruitApplyMapper extends BaseMapperPlus<BgtProjectRecruitApply> {
List<BgtProjectRecruitApplyVO> appQueryList(@Param("dto") BgtProjectRecruitApplyQueryDTO dto); List<BgtProjectRecruitApplyVO> appQueryList(@Param("dto") BgtProjectRecruitApplyQueryDTO dto);
// 获取指定项目下的所有成员(分页)
Page<WgzAppUnderwayRes> underwayPage (@Param("page") Page<WgzAppUnderwayReq> page, @Param("userId") Long userId);
} }

View File

@ -7,9 +7,11 @@ import com.ruoyi.bgt.domain.vo.BgtProjectRecruitVO;
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
import com.ruoyi.wgz.bo.req.WgzAppRegisteredProjectReq; import com.ruoyi.wgz.bo.req.WgzAppRegisteredProjectReq;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
import com.ruoyi.wgz.bo.res.WgzAppCancelRegistrationProjectDetailsRes; import com.ruoyi.wgz.bo.res.WgzAppCancelRegistrationProjectDetailsRes;
import com.ruoyi.wgz.bo.res.WgzAppProjectDetailsRes; import com.ruoyi.wgz.bo.res.WgzAppProjectDetailsRes;
import com.ruoyi.wgz.bo.res.WgzAppRegisteredProjectRes; import com.ruoyi.wgz.bo.res.WgzAppRegisteredProjectRes;
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
import com.ruoyi.wgz.bo.rests.WgzAppCancelRegistrationProjectDetailsTwo; import com.ruoyi.wgz.bo.rests.WgzAppCancelRegistrationProjectDetailsTwo;
import org.apache.ibatis.annotations.CacheNamespace; import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -30,7 +32,9 @@ public interface BgtProjectRecruitMapper extends BaseMapperPlus<BgtProjectRecrui
WgzAppProjectDetailsRes userProjectDetails(@Param("id") Long id); WgzAppProjectDetailsRes userProjectDetails(@Param("id") Long id);
// 获取指定用户已申请的项目信息
Page<WgzAppRegisteredProjectRes> userRegisteredProject(@Param("page") Page<WgzAppRegisteredProjectReq> page,@Param("userId") Long userId); Page<WgzAppRegisteredProjectRes> userRegisteredProject(@Param("page") Page<WgzAppRegisteredProjectReq> page,@Param("userId") Long userId);
// 获取指定项目下的所有成员
List<WgzAppCancelRegistrationProjectDetailsTwo> GetsTheMembersUnderTheCurrentProject (@Param("recruitId") Long recruitId); List<WgzAppCancelRegistrationProjectDetailsTwo> GetsTheMembersUnderTheCurrentProject (@Param("recruitId") Long recruitId);
} }

View File

@ -7,6 +7,9 @@ import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyQueryDTO;
import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO; import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
import org.springframework.validation.annotation.Validated;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -89,5 +92,10 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR
*/ */
Boolean userCancelRegistration(Long recruitId); Boolean userCancelRegistration(Long recruitId);
/**
* 项目进行中
*/
TableDataInfo<WgzAppUnderwayRes> userUnderway(@Validated WgzAppUnderwayReq req);
} }

View File

@ -20,6 +20,9 @@ import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.service.IAnnexService; import com.ruoyi.common.service.IAnnexService;
import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wgz.bo.req.WgzAppRegisteredProjectReq;
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -176,4 +179,14 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
return baseMapper.deleteById(new LambdaQueryWrapper<BgtProjectRecruitApply>().eq(BgtProjectRecruitApply::getRecruitId, recruitId)) >0; return baseMapper.deleteById(new LambdaQueryWrapper<BgtProjectRecruitApply>().eq(BgtProjectRecruitApply::getRecruitId, recruitId)) >0;
} }
@Override
public TableDataInfo<WgzAppUnderwayRes> userUnderway(WgzAppUnderwayReq req) {
Long userId = SecurityUtils.getAppUserId();
Page<WgzAppUnderwayReq> pe = new Page<>();
pe.setCurrent(req.getPageNum());
pe.setSize(req.getPageSize());
return PageUtils.buildDataInfo(baseMapper.underwayPage(pe, userId));
}
} }

View File

@ -2,15 +2,19 @@ package com.ruoyi.wgz.bo.req;
import com.ruoyi.common.bo.PageReq; import com.ruoyi.common.bo.PageReq;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("项目进行中请求对象") @ApiModel("项目进行中请求对象")
public class WgzAppUnderwayReq extends PageReq { public class WgzAppUnderwayReq extends PageReq {
} }

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 WgzApplyForPayrollSettlementFindReq implements Serializable {
@ApiModelProperty("招工ID")
private Long recruitId;
@ApiModelProperty("工资结算天数")
private int num;
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.wgz.bo.res;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("项目进行中返回对象")
public class WgzAppUnderwayRes implements Serializable {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("项目ID")
private Long projectId;
@ApiModelProperty("招工名称")
private String recruitName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("封面图(多个逗号分隔)")
private String coverPlan;
@ApiModelProperty("招工数量")
private Integer recruitStaffNum;
@ApiModelProperty("招工金额")
private BigDecimal recruitAmount;
@ApiModelProperty("任务ID")
private Long taskId;
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("任务地址")
private String taskAddress;
@ApiModelProperty("招工要求")
private String recruitRequirement;
@ApiModelProperty("已报名数量")
private Integer numberOfRegistered;
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.wgz.bo.res;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("工资结算查询返回")
public class WgzApplyForPayrollSettlementFindRes implements Serializable {
@ApiModelProperty("进场时间")
private LocalDate entryTime;
@ApiModelProperty("离场时间")
private LocalDate leaveTime;
@ApiModelProperty("单天金额")
private BigDecimal amount;
@ApiModelProperty("出勤天数")
private Integer num;
@ApiModelProperty("总的金额")
private BigDecimal TotalAmount;
}

View File

@ -0,0 +1,6 @@
package com.ruoyi.wgz.bo.rests;
import java.io.Serializable;
public class GetsTheMembersUnderTheCurrentProject implements Serializable {
}

View File

@ -21,6 +21,9 @@ public class WgzAppCancelRegistrationProjectDetailsTwo implements Serializable {
@ApiModelProperty("务工者ID") @ApiModelProperty("务工者ID")
private Long userId; private Long userId;
@ApiModelProperty("0报名 1包工同意 2包工头拒绝截止时间3务工者同意 4务工者拒绝 5进场 6离场")
private String status;
@ApiModelProperty("务工者名称") @ApiModelProperty("务工者名称")
private String username; private String username;

View File

@ -114,5 +114,9 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> {
*/ */
BgtAttendanceVO attendanceDetail(BgtAttendanceDTO dto); BgtAttendanceVO attendanceDetail(BgtAttendanceDTO dto);
/**
* 考勤详情,查询指定用户指定项目的指定天数考勤情况统计如若用户输入20但实际只有2天出勤
*/
Integer attendanceDetail(Long userId,Long recruitId, Integer num);
} }

View File

@ -309,6 +309,20 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
return null; return null;
} }
@Override
public Integer attendanceDetail(Long userId,Long recruitId, Integer num){
LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>().
eq(WgzAttendance::getUserId, userId).
eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper
.isNotNull(WgzAttendance::getClockInTime)
.or()
.isNotNull(WgzAttendance::getClockOutTime)
);
apply.orderByAsc(WgzAttendance::getDate);
apply.last("LIMIT " + num);
return baseMapper.selectCount(apply);
}
@Override @Override
public List<BgtAttendanceCountVO> countByTaskId(Long taskId, LocalDate beginDate, LocalDate endDate) { public List<BgtAttendanceCountVO> countByTaskId(Long taskId, LocalDate beginDate, LocalDate endDate) {
return baseMapper.countByTaskId(taskId, beginDate, endDate); return baseMapper.countByTaskId(taskId, beginDate, endDate);

View File

@ -29,4 +29,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="underwayPage" resultType="com.ruoyi.wgz.bo.res.WgzAppUnderwayRes">
SELECT
b.*,
c.task_name,
c.task_address,
c.task_img,
(SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = a.id) as numberOfRegistered
FROM
bgt_project_recruit_apply as a
LEFT JOIN bgt_project_recruit as b on(a.recruit_id = b.id and b.del_flag = 0 )
LEFT JOIN fbs_project_task as c ON (b.task_id = c.id AND c.del_flag = 0)
WHERE
a.user_id = #{userId} AND
a.status IN ('3', '5')AND
a.del_flag = 0
</select>
</mapper> </mapper>

View File

@ -56,21 +56,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="userRegisteredProject" resultType="com.ruoyi.wgz.bo.res.WgzAppRegisteredProjectRes"> <select id="userRegisteredProject" resultType="com.ruoyi.wgz.bo.res.WgzAppRegisteredProjectRes">
SELECT SELECT
a.*, b.*,
b.task_name, c.task_name,
b.task_address, c.task_address,
b.task_img, c.task_img,
(SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = a.id) as numberOfRegistered (SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = a.id) as numberOfRegistered
FROM FROM
bgt_project_recruit as a bgt_project_recruit_apply as a
LEFT JOIN fbs_project_task as b ON (a.task_id = b.id AND b.del_flag = 0) LEFT JOIN bgt_project_recruit as b on(a.recruit_id = b.id and b.del_flag = 0 )
LEFT JOIN fbs_project_task as c ON (b.task_id = c.id AND c.del_flag = 0)
WHERE WHERE
a.id = #{id} AND a.del_flag = 0 a.user_id = #{id} AND
(a.status = '0' or a.status = '1') AND
a.del_flag = 0
</select> </select>
<select id="GetsTheMembersUnderTheCurrentProject" resultType="com.ruoyi.wgz.bo.rests.WgzAppCancelRegistrationProjectDetailsTwo"> <select id="GetsTheMembersUnderTheCurrentProject" resultType="com.ruoyi.wgz.bo.rests.WgzAppCancelRegistrationProjectDetailsTwo">
SELECT SELECT
a.user_id, a.user_id,
a.status,
b.username, b.username,
b.avatar_name, b.avatar_name,
b.score b.score