施工人员日报打卡、补卡记录相关接口
This commit is contained in:
		| @ -1,26 +1,25 @@ | ||||
| package org.dromara.project.controller; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import jakarta.servlet.http.HttpServletResponse; | ||||
| import jakarta.validation.constraints.*; | ||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.dromara.common.idempotent.annotation.RepeatSubmit; | ||||
| import org.dromara.common.log.annotation.Log; | ||||
| import org.dromara.common.web.core.BaseController; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import jakarta.servlet.http.HttpServletResponse; | ||||
| import jakarta.validation.constraints.NotEmpty; | ||||
| import jakarta.validation.constraints.NotNull; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import org.dromara.common.core.domain.R; | ||||
| import org.dromara.common.core.validate.AddGroup; | ||||
| import org.dromara.common.core.validate.EditGroup; | ||||
| import org.dromara.common.log.enums.BusinessType; | ||||
| import org.dromara.common.excel.utils.ExcelUtil; | ||||
| import org.dromara.project.domain.vo.BusWorkerDailyReportVo; | ||||
| import org.dromara.project.domain.bo.BusWorkerDailyReportBo; | ||||
| import org.dromara.project.service.IBusWorkerDailyReportService; | ||||
| import org.dromara.common.log.annotation.Log; | ||||
| import org.dromara.common.log.enums.BusinessType; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.common.web.core.BaseController; | ||||
| import org.dromara.project.domain.req.workerdailyreport.WorkerDailyReportQueryReq; | ||||
| import org.dromara.project.domain.resp.workerdailyreport.WorkerDailyReportReissueResp; | ||||
| import org.dromara.project.domain.vo.BusWorkerDailyReportVo; | ||||
| import org.dromara.project.service.IBusWorkerDailyReportService; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 施工人员日报 | ||||
| @ -41,8 +40,17 @@ public class BusWorkerDailyReportController extends BaseController { | ||||
|      */ | ||||
|     @SaCheckPermission("project:workerDailyReport:list") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo<BusWorkerDailyReportVo> list(BusWorkerDailyReportBo bo, PageQuery pageQuery) { | ||||
|         return busWorkerDailyReportService.queryPageList(bo, pageQuery); | ||||
|     public TableDataInfo<BusWorkerDailyReportVo> list(WorkerDailyReportQueryReq req, PageQuery pageQuery) { | ||||
|         return busWorkerDailyReportService.queryPageList(req, pageQuery); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询施工人员补交日报列表 | ||||
|      */ | ||||
|     @SaCheckPermission("project:workerDailyReport:list") | ||||
|     @GetMapping("/list/reissue") | ||||
|     public TableDataInfo<WorkerDailyReportReissueResp> listReissue(WorkerDailyReportQueryReq req, PageQuery pageQuery) { | ||||
|         return busWorkerDailyReportService.queryReissuePageList(req, pageQuery); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -51,8 +59,8 @@ public class BusWorkerDailyReportController extends BaseController { | ||||
|     @SaCheckPermission("project:workerDailyReport:export") | ||||
|     @Log(title = "施工人员日报", businessType = BusinessType.EXPORT) | ||||
|     @PostMapping("/export") | ||||
|     public void export(BusWorkerDailyReportBo bo, HttpServletResponse response) { | ||||
|         List<BusWorkerDailyReportVo> list = busWorkerDailyReportService.queryList(bo); | ||||
|     public void export(WorkerDailyReportQueryReq req, HttpServletResponse response) { | ||||
|         List<BusWorkerDailyReportVo> list = busWorkerDailyReportService.queryList(req); | ||||
|         ExcelUtil.exportExcel(list, "施工人员日报", BusWorkerDailyReportVo.class, response); | ||||
|     } | ||||
|  | ||||
| @ -64,30 +72,20 @@ public class BusWorkerDailyReportController extends BaseController { | ||||
|     @SaCheckPermission("project:workerDailyReport:query") | ||||
|     @GetMapping("/{id}") | ||||
|     public R<BusWorkerDailyReportVo> getInfo(@NotNull(message = "主键不能为空") | ||||
|                                      @PathVariable Long id) { | ||||
|                                              @PathVariable Long id) { | ||||
|         return R.ok(busWorkerDailyReportService.queryById(id)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增施工人员日报 | ||||
|      * 获取施工人员补交日报详细信息 | ||||
|      * | ||||
|      * @param id 主键 | ||||
|      */ | ||||
|     @SaCheckPermission("project:workerDailyReport:add") | ||||
|     @Log(title = "施工人员日报", businessType = BusinessType.INSERT) | ||||
|     @RepeatSubmit() | ||||
|     @PostMapping() | ||||
|     public R<Void> add(@Validated(AddGroup.class) @RequestBody BusWorkerDailyReportBo bo) { | ||||
|         return toAjax(busWorkerDailyReportService.insertByBo(bo)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 修改施工人员日报 | ||||
|      */ | ||||
|     @SaCheckPermission("project:workerDailyReport:edit") | ||||
|     @Log(title = "施工人员日报", businessType = BusinessType.UPDATE) | ||||
|     @RepeatSubmit() | ||||
|     @PutMapping() | ||||
|     public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusWorkerDailyReportBo bo) { | ||||
|         return toAjax(busWorkerDailyReportService.updateByBo(bo)); | ||||
|     @SaCheckPermission("project:workerDailyReport:query") | ||||
|     @GetMapping("/reissue/{id}") | ||||
|     public R<WorkerDailyReportReissueResp> getReissueInfo(@NotNull(message = "主键不能为空") | ||||
|                                                           @PathVariable Long id) { | ||||
|         return R.ok(busWorkerDailyReportService.queryReissueById(id)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -102,4 +100,5 @@ public class BusWorkerDailyReportController extends BaseController { | ||||
|                           @PathVariable Long[] ids) { | ||||
|         return toAjax(busWorkerDailyReportService.deleteWithValidByIds(List.of(ids), true)); | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -65,6 +65,11 @@ public class BusAttendance extends BaseEntity { | ||||
|      */ | ||||
|     private String clockStatus; | ||||
|  | ||||
|     /** | ||||
|      * 请假id | ||||
|      */ | ||||
|     private Long leaveId; | ||||
|  | ||||
|     /** | ||||
|      * 代打人员id | ||||
|      */ | ||||
|  | ||||
| @ -3,10 +3,10 @@ package org.dromara.project.domain; | ||||
| import com.baomidou.mybatisplus.annotation.TableId; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import org.dromara.common.mybatis.core.domain.BaseEntity; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| import java.util.Date; | ||||
|  | ||||
| /** | ||||
|  * 施工人员日报计件信息对象 bus_daily_piece_item | ||||
| @ -15,9 +15,8 @@ import java.io.Serial; | ||||
|  * @date 2025-04-09 | ||||
|  */ | ||||
| @Data | ||||
| @EqualsAndHashCode(callSuper = true) | ||||
| @TableName("bus_daily_piece_item") | ||||
| public class BusDailyPieceItem extends BaseEntity { | ||||
| public class BusDailyPieceItem implements Serializable { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = 1L; | ||||
| @ -53,4 +52,14 @@ public class BusDailyPieceItem extends BaseEntity { | ||||
|      */ | ||||
|     private String remark; | ||||
|  | ||||
|     /** | ||||
|      * 创建时间 | ||||
|      */ | ||||
|     private Date createTime; | ||||
|  | ||||
|     /** | ||||
|      * 更新时间 | ||||
|      */ | ||||
|     private Date updateTime; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -45,6 +45,11 @@ public class BusWorkerDailyReport extends BaseEntity { | ||||
|      */ | ||||
|     private Long userId; | ||||
|  | ||||
|     /** | ||||
|      * 日报日期 | ||||
|      */ | ||||
|     private Date reportDate; | ||||
|  | ||||
|     /** | ||||
|      * 申请人名字 | ||||
|      */ | ||||
| @ -70,6 +75,16 @@ public class BusWorkerDailyReport extends BaseEntity { | ||||
|      */ | ||||
|     private String coordinationHelp; | ||||
|  | ||||
|     /** | ||||
|      * 是否为补卡(1不是 2是) | ||||
|      */ | ||||
|     private Long isResubmit; | ||||
|  | ||||
|     /** | ||||
|      * 补交理由 | ||||
|      */ | ||||
|     private String resubmitReason; | ||||
|  | ||||
|     /** | ||||
|      * 附件 | ||||
|      */ | ||||
|  | ||||
| @ -0,0 +1,24 @@ | ||||
| package org.dromara.project.domain.enums; | ||||
|  | ||||
| import lombok.Getter; | ||||
|  | ||||
| /** | ||||
|  * @author lcj | ||||
|  * @date 2025/4/9 17:23 | ||||
|  */ | ||||
| @Getter | ||||
| public enum WorkerDailyReportReissueEnum { | ||||
|  | ||||
|     UNREISSUE("不是补卡", 1), | ||||
|     REISSUE("是补卡", 2); | ||||
|  | ||||
|     private final String text; | ||||
|  | ||||
|     private final int value; | ||||
|  | ||||
|     WorkerDailyReportReissueEnum(String text, int value) { | ||||
|         this.text = text; | ||||
|         this.value = value; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -1,5 +1,6 @@ | ||||
| package org.dromara.project.domain.req.leave; | ||||
|  | ||||
| import jakarta.validation.constraints.NotNull; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serial; | ||||
| @ -58,6 +59,7 @@ public class LeaveQueryReq implements Serializable { | ||||
|     /** | ||||
|      * 项目id | ||||
|      */ | ||||
|     @NotNull(message = "项目id不能为空") | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package org.dromara.project.domain.req.reissuecard; | ||||
|  | ||||
| import jakarta.validation.constraints.NotNull; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serial; | ||||
| @ -53,6 +54,7 @@ public class ReissueCardQueryReq implements Serializable { | ||||
|     /** | ||||
|      * 项目id | ||||
|      */ | ||||
|     @NotNull(message = "项目id不能为空") | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -0,0 +1,51 @@ | ||||
| package org.dromara.project.domain.req.workerdailyreport; | ||||
|  | ||||
| import lombok.Data; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| import java.util.Date; | ||||
|  | ||||
| /** | ||||
|  * @author lcj | ||||
|  * @date 2025/4/9 15:44 | ||||
|  */ | ||||
| @Data | ||||
| public class WorkerDailyReportQueryReq implements Serializable { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = -8919309843260665154L; | ||||
|  | ||||
|     /** | ||||
|      * 主键id | ||||
|      */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** | ||||
|      * 项目id | ||||
|      */ | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 班组id | ||||
|      */ | ||||
|     private Long teamId; | ||||
|  | ||||
|     /** | ||||
|      * 申请人id | ||||
|      */ | ||||
|     private Long userId; | ||||
|  | ||||
|     /** | ||||
|      * 申请人名字 | ||||
|      */ | ||||
|     private String userName; | ||||
|  | ||||
|     /** | ||||
|      * 日报日期 | ||||
|      */ | ||||
|     @DateTimeFormat(pattern = "yyyy-MM-dd") | ||||
|     private Date reportDate; | ||||
|  | ||||
| } | ||||
| @ -21,7 +21,7 @@ public class ConstructionUserAttendanceByDay { | ||||
|     /** | ||||
|      * 上班打卡时间 | ||||
|      */ | ||||
|     private Date upClockDate; | ||||
|     private Date upClockTime; | ||||
|  | ||||
|     /** | ||||
|      * 上班打卡图片id | ||||
| @ -45,7 +45,7 @@ public class ConstructionUserAttendanceByDay { | ||||
|     /** | ||||
|      * 下班打卡时间 | ||||
|      */ | ||||
|     private Date downClockDate; | ||||
|     private Date downClockTime; | ||||
|  | ||||
|     public static ConstructionUserAttendanceByDay build(List<BusAttendance> attendanceList) { | ||||
|         if (attendanceList == null) { | ||||
| @ -54,12 +54,12 @@ public class ConstructionUserAttendanceByDay { | ||||
|         ConstructionUserAttendanceByDay constructionUserAttendanceByDay = new ConstructionUserAttendanceByDay(); | ||||
|         for (BusAttendance attendance : attendanceList) { | ||||
|             if (attendance.getCommuter().equals(AttendanceCommuterEnum.CLOCKIN.getValue())) { | ||||
|                 constructionUserAttendanceByDay.setUpClockDate(attendance.getClockDate()); | ||||
|                 constructionUserAttendanceByDay.setUpClockTime(attendance.getClockTime()); | ||||
|                 if (attendance.getFacePic() != null) { | ||||
|                     constructionUserAttendanceByDay.setUpClockPicId(Long.valueOf(attendance.getFacePic())); | ||||
|                 } | ||||
|             } else if (attendance.getCommuter().equals(AttendanceCommuterEnum.CLOCKOUT.getValue())) { | ||||
|                 constructionUserAttendanceByDay.setDownClockDate(attendance.getClockDate()); | ||||
|                 constructionUserAttendanceByDay.setDownClockTime(attendance.getClockTime()); | ||||
|                 if (attendance.getFacePic() != null) { | ||||
|                     constructionUserAttendanceByDay.setDownClockPicId(Long.valueOf(attendance.getFacePic())); | ||||
|                 } | ||||
|  | ||||
| @ -61,4 +61,9 @@ public class ConstructionUserAttendanceTotalResp implements Serializable { | ||||
|      */ | ||||
|     private Integer unClockDays; | ||||
|  | ||||
|     /** | ||||
|      * 请假天数 | ||||
|      */ | ||||
|     private Integer leaveDays; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,79 @@ | ||||
| package org.dromara.project.domain.resp.workerdailyreport; | ||||
|  | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import lombok.Data; | ||||
| import org.dromara.project.domain.vo.BusDailyPieceItemVo; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @author lcj | ||||
|  * @date 2025/4/9 17:10 | ||||
|  */ | ||||
| @Data | ||||
| public class WorkerDailyReportReissueResp implements Serializable { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = -7808587129621015440L; | ||||
|  | ||||
|     /** | ||||
|      * 主键id | ||||
|      */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** | ||||
|      * 班组id | ||||
|      */ | ||||
|     private Long teamId; | ||||
|  | ||||
|     /** | ||||
|      * 班组名字 | ||||
|      */ | ||||
|     private String teamName; | ||||
|  | ||||
|     /** | ||||
|      * 申请人id | ||||
|      */ | ||||
|     private Long userId; | ||||
|  | ||||
|     /** | ||||
|      * 申请人名字 | ||||
|      */ | ||||
|     private String userName; | ||||
|  | ||||
|     /** | ||||
|      * 今日完成工作 | ||||
|      */ | ||||
|     private String todayCompletedWork; | ||||
|  | ||||
|     /** | ||||
|      * 未完成工作 | ||||
|      */ | ||||
|     private String unfinishedWork; | ||||
|  | ||||
|     /** | ||||
|      * 补交理由 | ||||
|      */ | ||||
|     private String resubmitReason; | ||||
|  | ||||
|     /** | ||||
|      * 日报日期 | ||||
|      */ | ||||
|     @JsonFormat(shape = JsonFormat.Shape.STRING, | ||||
|             pattern = "yyyy-MM-dd", | ||||
|             timezone = "GMT+8") | ||||
|     private Date reportDate; | ||||
|  | ||||
|     /** | ||||
|      * 附件 | ||||
|      */ | ||||
|     private String file; | ||||
|  | ||||
|     /** | ||||
|      * 日报明细 | ||||
|      */ | ||||
|     private List<BusDailyPieceItemVo> dailyPieceItemVoList; | ||||
| } | ||||
| @ -1,19 +1,16 @@ | ||||
| package org.dromara.project.domain.vo; | ||||
|  | ||||
| import java.util.Date; | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import org.dromara.project.domain.BusWorkerDailyReport; | ||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
| import org.dromara.common.excel.annotation.ExcelDictFormat; | ||||
| import org.dromara.common.excel.convert.ExcelDictConvert; | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import io.github.linpeilie.annotations.AutoMapper; | ||||
| import lombok.Data; | ||||
| import org.dromara.project.domain.BusWorkerDailyReport; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| import java.util.Date; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
|  | ||||
| /** | ||||
| @ -30,6 +27,26 @@ public class BusWorkerDailyReportVo implements Serializable { | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** | ||||
|      * 主键id | ||||
|      */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** | ||||
|      * 班组id | ||||
|      */ | ||||
|     private Long teamId; | ||||
|  | ||||
|     /** | ||||
|      * 班组名字 | ||||
|      */ | ||||
|     private String teamName; | ||||
|  | ||||
|     /** | ||||
|      * 申请人id | ||||
|      */ | ||||
|     private Long userId; | ||||
|  | ||||
|     /** | ||||
|      * 申请人名字 | ||||
|      */ | ||||
| @ -60,5 +77,29 @@ public class BusWorkerDailyReportVo implements Serializable { | ||||
|     @ExcelProperty(value = "需协调与帮助") | ||||
|     private String coordinationHelp; | ||||
|  | ||||
|     /** | ||||
|      * 补交理由 | ||||
|      */ | ||||
|     @ExcelProperty(value = "补交理由") | ||||
|     private String resubmitReason; | ||||
|  | ||||
|     /** | ||||
|      * 日报日期 | ||||
|      */ | ||||
|     @JsonFormat(shape = JsonFormat.Shape.STRING, | ||||
|         pattern = "yyyy-MM-dd", | ||||
|         timezone = "GMT+8") | ||||
|     @ExcelProperty(value = "打卡日期") | ||||
|     private Date reportDate; | ||||
|  | ||||
|     /** | ||||
|      * 附件 | ||||
|      */ | ||||
|     private String file; | ||||
|  | ||||
|     /** | ||||
|      * 日报明细 | ||||
|      */ | ||||
|     private List<BusDailyPieceItemVo> dailyPieceItemVoList; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -2,6 +2,9 @@ package org.dromara.project.service; | ||||
|  | ||||
| import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import org.dromara.project.domain.BusDailyPieceItem; | ||||
| import org.dromara.project.domain.vo.BusDailyPieceItemVo; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 施工人员日报计件信息Service接口 | ||||
| @ -11,4 +14,20 @@ import org.dromara.project.domain.BusDailyPieceItem; | ||||
|  */ | ||||
| public interface IBusDailyPieceItemService extends IService<BusDailyPieceItem> { | ||||
|  | ||||
|     /** | ||||
|      * 施工人员日报计件信息封装 | ||||
|      * | ||||
|      * @param dailyPieceItem 施工人员日报计件信息 | ||||
|      * @return 施工人员日报计件信息封装 | ||||
|      */ | ||||
|     BusDailyPieceItemVo getVo(BusDailyPieceItem dailyPieceItem); | ||||
|  | ||||
|     /** | ||||
|      * 施工人员日报计件信息列表封装 | ||||
|      * | ||||
|      * @param dailyPieceItemList 施工人员日报计件信息列表 | ||||
|      * @return 施工人员日报计件信息列表封装 | ||||
|      */ | ||||
|     List<BusDailyPieceItemVo> getListVo(List<BusDailyPieceItem> dailyPieceItemList); | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -1,10 +1,13 @@ | ||||
| package org.dromara.project.service; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.project.domain.BusWorkerDailyReport; | ||||
| import org.dromara.project.domain.bo.BusWorkerDailyReportBo; | ||||
| import org.dromara.project.domain.req.workerdailyreport.WorkerDailyReportQueryReq; | ||||
| import org.dromara.project.domain.resp.workerdailyreport.WorkerDailyReportReissueResp; | ||||
| import org.dromara.project.domain.vo.BusWorkerDailyReportVo; | ||||
|  | ||||
| import java.util.Collection; | ||||
| @ -26,38 +29,39 @@ public interface IBusWorkerDailyReportService extends IService<BusWorkerDailyRep | ||||
|      */ | ||||
|     BusWorkerDailyReportVo queryById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 查询施工人员日报补报 | ||||
|      * | ||||
|      * @param id 主键 | ||||
|      * @return 施工人员日报补报 | ||||
|      */ | ||||
|     WorkerDailyReportReissueResp queryReissueById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 分页查询施工人员日报列表 | ||||
|      * | ||||
|      * @param bo        查询条件 | ||||
|      * @param req       查询条件 | ||||
|      * @param pageQuery 分页参数 | ||||
|      * @return 施工人员日报分页列表 | ||||
|      */ | ||||
|     TableDataInfo<BusWorkerDailyReportVo> queryPageList(BusWorkerDailyReportBo bo, PageQuery pageQuery); | ||||
|     TableDataInfo<BusWorkerDailyReportVo> queryPageList(WorkerDailyReportQueryReq req, PageQuery pageQuery); | ||||
|  | ||||
|     /** | ||||
|      * 分页查询施工人员日报补报列表 | ||||
|      * | ||||
|      * @param req       查询条件 | ||||
|      * @param pageQuery 分页参数 | ||||
|      * @return 施工人员日报补报分页列表 | ||||
|      */ | ||||
|     TableDataInfo<WorkerDailyReportReissueResp> queryReissuePageList(WorkerDailyReportQueryReq req, PageQuery pageQuery); | ||||
|  | ||||
|     /** | ||||
|      * 查询符合条件的施工人员日报列表 | ||||
|      * | ||||
|      * @param bo 查询条件 | ||||
|      * @param req 查询条件 | ||||
|      * @return 施工人员日报列表 | ||||
|      */ | ||||
|     List<BusWorkerDailyReportVo> queryList(BusWorkerDailyReportBo bo); | ||||
|  | ||||
|     /** | ||||
|      * 新增施工人员日报 | ||||
|      * | ||||
|      * @param bo 施工人员日报 | ||||
|      * @return 是否新增成功 | ||||
|      */ | ||||
|     Boolean insertByBo(BusWorkerDailyReportBo bo); | ||||
|  | ||||
|     /** | ||||
|      * 修改施工人员日报 | ||||
|      * | ||||
|      * @param bo 施工人员日报 | ||||
|      * @return 是否修改成功 | ||||
|      */ | ||||
|     Boolean updateByBo(BusWorkerDailyReportBo bo); | ||||
|     List<BusWorkerDailyReportVo> queryList(WorkerDailyReportQueryReq req); | ||||
|  | ||||
|     /** | ||||
|      * 校验并批量删除施工人员日报信息 | ||||
| @ -67,4 +71,45 @@ public interface IBusWorkerDailyReportService extends IService<BusWorkerDailyRep | ||||
|      * @return 是否删除成功 | ||||
|      */ | ||||
|     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表视图对象 | ||||
|      * | ||||
|      * @param workerDailyReport 施工人员日报列表对象 | ||||
|      * @return 施工人员日报列表视图对象 | ||||
|      */ | ||||
|     BusWorkerDailyReportVo getVo(BusWorkerDailyReport workerDailyReport); | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报补报视图对象 | ||||
|      * | ||||
|      * @param workerDailyReport 施工人员日报对象 | ||||
|      * @return 施工人员日报补报视图对象 | ||||
|      */ | ||||
|     WorkerDailyReportReissueResp getReissueVo(BusWorkerDailyReport workerDailyReport); | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表查询条件封装 | ||||
|      * | ||||
|      * @param req 施工人员日报列表查询条件 | ||||
|      * @return 施工人员日报列表查询条件封装 | ||||
|      */ | ||||
|     LambdaQueryWrapper<BusWorkerDailyReport> buildQueryWrapper(WorkerDailyReportQueryReq req); | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表分页对象视图 | ||||
|      * | ||||
|      * @param workerDailyReportPage 施工人员日报列表分页对象 | ||||
|      * @return 施工人员日报列表分页对象视图 | ||||
|      */ | ||||
|     Page<BusWorkerDailyReportVo> getVoPage(Page<BusWorkerDailyReport> workerDailyReportPage); | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报补报分页对象视图 | ||||
|      * | ||||
|      * @param workerDailyReportPage 施工人员日报列表分页对象 | ||||
|      * @return 施工人员日报列表分页对象视图 | ||||
|      */ | ||||
|     Page<WorkerDailyReportReissueResp> getReissueVoPage(Page<BusWorkerDailyReport> workerDailyReportPage); | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -249,7 +249,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | ||||
|             } | ||||
|             // 统计当天考勤状态 | ||||
|             if (AttendanceClockStatusEnum.LEAVE.getValue().equals(clockAllDayStatus)) { | ||||
|                 status = AttendanceStatusEnum.LEAVE.getValue(); | ||||
|                 return; | ||||
|             } else if (AttendanceClockStatusEnum.NORMAL.getValue().equals(clockInStatus) | ||||
|                 && AttendanceClockStatusEnum.NORMAL.getValue().equals(clockOutStatus)) { | ||||
|                 status = AttendanceStatusEnum.NORMAL.getValue(); | ||||
| @ -327,6 +327,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(projectId), BusAttendance::getProjectId, projectId); | ||||
|         lqw.eq(StringUtils.isNotBlank(clockStatus), BusAttendance::getClockStatus, clockStatus); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(clockDate), BusAttendance::getClockDate, clockDate); | ||||
|         // 不包含请假的考勤记录 | ||||
|         lqw.ne(BusAttendance::getClockStatus, AttendanceClockStatusEnum.LEAVE.getValue()); | ||||
|         return lqw; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -854,6 +854,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU | ||||
|             int lateDays = 0; | ||||
|             int leaveEarlyDays = 0; | ||||
|             int unClockDays = 0; | ||||
|             int leaveDays = 0; | ||||
|             if (userIdBusAttendanceListMap.containsKey(id)) { | ||||
|                 List<BusAttendance> attendanceList = userIdBusAttendanceListMap.get(id); | ||||
|                 if (CollUtil.isNotEmpty(attendanceList)) { | ||||
| @ -864,12 +865,15 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU | ||||
|                     for (List<BusAttendance> dailyList : dailyMap.values()) { | ||||
|                         String clockInStatus = null; | ||||
|                         String clockOutStatus = null; | ||||
|                         String clockAllDayStatus = null; | ||||
|                         // 获取上下班状态 | ||||
|                         for (BusAttendance attendance : dailyList) { | ||||
|                             if (AttendanceCommuterEnum.CLOCKIN.getValue().equals(attendance.getCommuter())) { | ||||
|                                 clockInStatus = attendance.getClockStatus(); | ||||
|                             } else if (AttendanceCommuterEnum.CLOCKOUT.getValue().equals(attendance.getCommuter())) { | ||||
|                                 clockOutStatus = attendance.getClockStatus(); | ||||
|                             } else { | ||||
|                                 clockAllDayStatus = attendance.getClockStatus(); | ||||
|                             } | ||||
|                         } | ||||
|                         // 统计考勤状态 | ||||
| @ -879,20 +883,25 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU | ||||
|                         if (AttendanceClockStatusEnum.LEAVEEARLY.getValue().equals(clockOutStatus)) { | ||||
|                             leaveEarlyDays++; | ||||
|                         } | ||||
|                         if (clockInStatus == null || AttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockInStatus)) { | ||||
|                             unClockDays++; | ||||
|                         } | ||||
|                         if (clockOutStatus == null || AttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockOutStatus)) { | ||||
|                             unClockDays++; | ||||
|                         if (AttendanceClockStatusEnum.LEAVE.getValue().equals(clockAllDayStatus)) { | ||||
|                             leaveDays++; | ||||
|                         } else { | ||||
|                             if (clockInStatus == null || AttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockInStatus)) { | ||||
|                                 unClockDays++; | ||||
|                             } | ||||
|                             if (clockOutStatus == null || AttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockOutStatus)) { | ||||
|                                 unClockDays++; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     attendanceDays = dailyMap.size(); | ||||
|                     attendanceDays = dailyMap.size() - leaveDays; | ||||
|                 } | ||||
|             } | ||||
|             constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays); | ||||
|             constructionUserAttendanceTotalResp.setLateDays(lateDays); | ||||
|             constructionUserAttendanceTotalResp.setLeaveEarlyDays(leaveEarlyDays); | ||||
|             constructionUserAttendanceTotalResp.setUnClockDays(unClockDays); | ||||
|             constructionUserAttendanceTotalResp.setLeaveDays(leaveDays); | ||||
|             // 关联班组信息 | ||||
|             Long userTeamId = constructionUser.getTeamId(); | ||||
|             String teamName = null; | ||||
|  | ||||
| @ -1,11 +1,16 @@ | ||||
| package org.dromara.project.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import org.dromara.project.domain.BusDailyPieceItem; | ||||
| import org.dromara.project.domain.vo.BusDailyPieceItemVo; | ||||
| import org.dromara.project.mapper.BusDailyPieceItemMapper; | ||||
| import org.dromara.project.service.IBusDailyPieceItemService; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 施工人员日报计件信息Service业务层处理 | ||||
|  * | ||||
| @ -16,4 +21,33 @@ import org.springframework.stereotype.Service; | ||||
| public class BusDailyPieceItemServiceImpl extends ServiceImpl<BusDailyPieceItemMapper, BusDailyPieceItem> | ||||
|     implements IBusDailyPieceItemService { | ||||
|  | ||||
|     /** | ||||
|      * 施工人员日报计件信息封装 | ||||
|      * | ||||
|      * @param dailyPieceItem 施工人员日报计件信息 | ||||
|      * @return 施工人员日报计件信息封装 | ||||
|      */ | ||||
|     @Override | ||||
|     public BusDailyPieceItemVo getVo(BusDailyPieceItem dailyPieceItem) { | ||||
|         BusDailyPieceItemVo dailyPieceItemVo = new BusDailyPieceItemVo(); | ||||
|         if (dailyPieceItem == null) { | ||||
|             return dailyPieceItemVo; | ||||
|         } | ||||
|         BeanUtils.copyProperties(dailyPieceItem, dailyPieceItemVo); | ||||
|         return dailyPieceItemVo; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 施工人员日报计件信息列表封装 | ||||
|      * | ||||
|      * @param dailyPieceItemList 施工人员日报计件信息列表 | ||||
|      * @return 施工人员日报计件信息列表封装 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<BusDailyPieceItemVo> getListVo(List<BusDailyPieceItem> dailyPieceItemList) { | ||||
|         if (CollUtil.isEmpty(dailyPieceItemList)) { | ||||
|             return List.of(); | ||||
|         } | ||||
|         return dailyPieceItemList.stream().map(this::getVo).toList(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -7,24 +7,32 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.dromara.common.core.constant.HttpStatus; | ||||
| import org.dromara.common.core.exception.ServiceException; | ||||
| import org.dromara.common.core.utils.DateUtils; | ||||
| import org.dromara.common.core.utils.ObjectUtils; | ||||
| import org.dromara.common.core.utils.StringUtils; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.project.domain.BusAttendance; | ||||
| import org.dromara.project.domain.BusLeave; | ||||
| import org.dromara.project.domain.BusProjectTeam; | ||||
| import org.dromara.project.domain.enums.AttendanceClockStatusEnum; | ||||
| import org.dromara.project.domain.enums.AttendanceCommuterEnum; | ||||
| import org.dromara.project.domain.enums.OpinionStatusEnum; | ||||
| import org.dromara.project.domain.enums.ReviewStatusEnum; | ||||
| import org.dromara.project.domain.req.leave.LeaveManagerReviewReq; | ||||
| import org.dromara.project.domain.req.leave.LeaveQueryReq; | ||||
| import org.dromara.project.domain.vo.BusLeaveVo; | ||||
| import org.dromara.project.mapper.BusLeaveMapper; | ||||
| import org.dromara.project.service.IBusAttendanceService; | ||||
| import org.dromara.project.service.IBusLeaveService; | ||||
| import org.dromara.project.service.IBusProjectTeamService; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| /** | ||||
| @ -40,6 +48,10 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave> | ||||
|     @Resource | ||||
|     private IBusProjectTeamService projectTeamService; | ||||
|  | ||||
|     @Lazy | ||||
|     @Resource | ||||
|     private IBusAttendanceService attendanceService; | ||||
|  | ||||
|     /** | ||||
|      * 查询施工人员请假申请 | ||||
|      * | ||||
| @ -83,6 +95,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave> | ||||
|      * @return 是否审核成功 | ||||
|      */ | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public Boolean managerReview(LeaveManagerReviewReq req) { | ||||
|         Long id = req.getId(); | ||||
|         String managerOpinion = req.getManagerOpinion(); | ||||
| @ -92,7 +105,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave> | ||||
|             throw new ServiceException("施工人员请假申请不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         // 如果已经审核过,则返回 | ||||
|         if (!OpinionStatusEnum.UNREAD.getValue().equals(managerOpinion)) { | ||||
|         if (!OpinionStatusEnum.UNREAD.getValue().equals(oldLeave.getManagerOpinion())) { | ||||
|             throw new ServiceException("该请假已审核,请勿重复操作", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 判断班组长是否审核通过 | ||||
| @ -112,6 +125,33 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave> | ||||
|         if (!result) { | ||||
|             throw new ServiceException("更新管理员审核操作失败", HttpStatus.ERROR); | ||||
|         } | ||||
|         // 更新考勤表记录 | ||||
|         Date startTime = oldLeave.getStartTime(); | ||||
|         Date endTime = oldLeave.getEndTime(); | ||||
|         // 计算相差的时间 | ||||
|         long diffInMillis = endTime.getTime() - startTime.getTime(); | ||||
|         long day = TimeUnit.MILLISECONDS.toDays(diffInMillis) + 1; | ||||
|         Long userId = oldLeave.getUserId(); | ||||
|         String userName = oldLeave.getUserName(); | ||||
|         Long projectId = oldLeave.getProjectId(); | ||||
|         // 遍历每一天 | ||||
|         List<BusAttendance> attendanceList = new ArrayList<>(); | ||||
|         for (long i = 0; i < day; i++) { | ||||
|             BusAttendance attendance = new BusAttendance(); | ||||
|             attendance.setUserId(userId); | ||||
|             attendance.setUserName(userName); | ||||
|             attendance.setProjectId(projectId); | ||||
|             Date date = DateUtils.addDays(startTime, (int) i); | ||||
|             attendance.setLeaveId(id); | ||||
|             attendance.setClockDate(date); | ||||
|             attendance.setClockStatus(AttendanceClockStatusEnum.LEAVE.getValue()); | ||||
|             attendance.setCommuter(AttendanceCommuterEnum.ALLDAY.getValue()); | ||||
|             attendanceList.add(attendance); | ||||
|         } | ||||
|         boolean saveBatch = attendanceService.saveBatch(attendanceList); | ||||
|         if (!saveBatch) { | ||||
|             throw new ServiceException("更新考勤记录失败", HttpStatus.ERROR); | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -1,23 +1,33 @@ | ||||
| package org.dromara.project.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| 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.service.impl.ServiceImpl; | ||||
| import org.dromara.common.core.utils.MapstructUtils; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.dromara.common.core.constant.HttpStatus; | ||||
| import org.dromara.common.core.exception.ServiceException; | ||||
| import org.dromara.common.core.utils.ObjectUtils; | ||||
| import org.dromara.common.core.utils.StringUtils; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.project.domain.BusDailyPieceItem; | ||||
| import org.dromara.project.domain.BusProjectTeam; | ||||
| import org.dromara.project.domain.BusWorkerDailyReport; | ||||
| import org.dromara.project.domain.bo.BusWorkerDailyReportBo; | ||||
| import org.dromara.project.domain.enums.WorkerDailyReportReissueEnum; | ||||
| import org.dromara.project.domain.req.workerdailyreport.WorkerDailyReportQueryReq; | ||||
| import org.dromara.project.domain.resp.workerdailyreport.WorkerDailyReportReissueResp; | ||||
| import org.dromara.project.domain.vo.BusDailyPieceItemVo; | ||||
| import org.dromara.project.domain.vo.BusWorkerDailyReportVo; | ||||
| import org.dromara.project.mapper.BusWorkerDailyReportMapper; | ||||
| import org.dromara.project.service.IBusDailyPieceItemService; | ||||
| import org.dromara.project.service.IBusProjectTeamService; | ||||
| import org.dromara.project.service.IBusWorkerDailyReportService; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.*; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| /** | ||||
|  * 施工人员日报Service业务层处理 | ||||
| @ -29,6 +39,12 @@ import java.util.Map; | ||||
| public class BusWorkerDailyReportServiceImpl extends ServiceImpl<BusWorkerDailyReportMapper, BusWorkerDailyReport> | ||||
|     implements IBusWorkerDailyReportService { | ||||
|  | ||||
|     @Resource | ||||
|     private IBusDailyPieceItemService dailyPieceItemService; | ||||
|  | ||||
|     @Resource | ||||
|     private IBusProjectTeamService projectTeamService; | ||||
|  | ||||
|     /** | ||||
|      * 查询施工人员日报 | ||||
|      * | ||||
| @ -37,83 +53,71 @@ public class BusWorkerDailyReportServiceImpl extends ServiceImpl<BusWorkerDailyR | ||||
|      */ | ||||
|     @Override | ||||
|     public BusWorkerDailyReportVo queryById(Long id) { | ||||
|         return baseMapper.selectVoById(id); | ||||
|         BusWorkerDailyReport workerDailyReport = this.getById(id); | ||||
|         if (workerDailyReport == null) { | ||||
|             throw new ServiceException("施工人员日报信息不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         return this.getVo(workerDailyReport); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询施工人员日报补报 | ||||
|      * | ||||
|      * @param id 主键 | ||||
|      * @return 施工人员日报补报 | ||||
|      */ | ||||
|     @Override | ||||
|     public WorkerDailyReportReissueResp queryReissueById(Long id) { | ||||
|         BusWorkerDailyReport workerDailyReport = this.getById(id); | ||||
|         if (workerDailyReport == null) { | ||||
|             throw new ServiceException("施工人员日报信息不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         return this.getReissueVo(workerDailyReport); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 分页查询施工人员日报列表 | ||||
|      * | ||||
|      * @param bo        查询条件 | ||||
|      * @param req       查询条件 | ||||
|      * @param pageQuery 分页参数 | ||||
|      * @return 施工人员日报分页列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public TableDataInfo<BusWorkerDailyReportVo> queryPageList(BusWorkerDailyReportBo bo, PageQuery pageQuery) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = buildQueryWrapper(bo); | ||||
|         Page<BusWorkerDailyReportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); | ||||
|         return TableDataInfo.build(result); | ||||
|     public TableDataInfo<BusWorkerDailyReportVo> queryPageList(WorkerDailyReportQueryReq req, PageQuery pageQuery) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = this.buildQueryWrapper(req); | ||||
|         lqw.eq(BusWorkerDailyReport::getIsResubmit, WorkerDailyReportReissueEnum.UNREISSUE.getValue()); | ||||
|         Page<BusWorkerDailyReport> result = this.page(pageQuery.build(), lqw); | ||||
|         return TableDataInfo.build(this.getVoPage(result)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 分页查询施工人员日报补报列表 | ||||
|      * | ||||
|      * @param req       查询条件 | ||||
|      * @param pageQuery 分页参数 | ||||
|      * @return 施工人员日报补报分页列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public TableDataInfo<WorkerDailyReportReissueResp> queryReissuePageList(WorkerDailyReportQueryReq req, PageQuery pageQuery) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = this.buildQueryWrapper(req); | ||||
|         lqw.eq(BusWorkerDailyReport::getIsResubmit, WorkerDailyReportReissueEnum.REISSUE.getValue()); | ||||
|         Page<BusWorkerDailyReport> result = this.page(pageQuery.build(), lqw); | ||||
|         return TableDataInfo.build(this.getReissueVoPage(result)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询符合条件的施工人员日报列表 | ||||
|      * | ||||
|      * @param bo 查询条件 | ||||
|      * @param req 查询条件 | ||||
|      * @return 施工人员日报列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<BusWorkerDailyReportVo> queryList(BusWorkerDailyReportBo bo) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = buildQueryWrapper(bo); | ||||
|     public List<BusWorkerDailyReportVo> queryList(WorkerDailyReportQueryReq req) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = buildQueryWrapper(req); | ||||
|         return baseMapper.selectVoList(lqw); | ||||
|     } | ||||
|  | ||||
|     private LambdaQueryWrapper<BusWorkerDailyReport> buildQueryWrapper(BusWorkerDailyReportBo bo) { | ||||
|         Map<String, Object> params = bo.getParams(); | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = Wrappers.lambdaQuery(); | ||||
|         lqw.orderByAsc(BusWorkerDailyReport::getId); | ||||
|         lqw.eq(bo.getProjectId() != null, BusWorkerDailyReport::getProjectId, bo.getProjectId()); | ||||
|         lqw.eq(bo.getTeamId() != null, BusWorkerDailyReport::getTeamId, bo.getTeamId()); | ||||
|         lqw.eq(bo.getUserId() != null, BusWorkerDailyReport::getUserId, bo.getUserId()); | ||||
|         lqw.like(StringUtils.isNotBlank(bo.getUserName()), BusWorkerDailyReport::getUserName, bo.getUserName()); | ||||
|         return lqw; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增施工人员日报 | ||||
|      * | ||||
|      * @param bo 施工人员日报 | ||||
|      * @return 是否新增成功 | ||||
|      */ | ||||
|     @Override | ||||
|     public Boolean insertByBo(BusWorkerDailyReportBo bo) { | ||||
|         BusWorkerDailyReport add = MapstructUtils.convert(bo, BusWorkerDailyReport.class); | ||||
|         validEntityBeforeSave(add); | ||||
|         boolean flag = baseMapper.insert(add) > 0; | ||||
|         if (flag) { | ||||
|             bo.setId(add.getId()); | ||||
|         } | ||||
|         return flag; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 修改施工人员日报 | ||||
|      * | ||||
|      * @param bo 施工人员日报 | ||||
|      * @return 是否修改成功 | ||||
|      */ | ||||
|     @Override | ||||
|     public Boolean updateByBo(BusWorkerDailyReportBo bo) { | ||||
|         BusWorkerDailyReport update = MapstructUtils.convert(bo, BusWorkerDailyReport.class); | ||||
|         validEntityBeforeSave(update); | ||||
|         return baseMapper.updateById(update) > 0; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(BusWorkerDailyReport entity) { | ||||
|         //TODO 做一些数据校验,如唯一约束 | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 校验并批量删除施工人员日报信息 | ||||
|      * | ||||
| @ -128,4 +132,184 @@ public class BusWorkerDailyReportServiceImpl extends ServiceImpl<BusWorkerDailyR | ||||
|         } | ||||
|         return baseMapper.deleteByIds(ids) > 0; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表视图对象 | ||||
|      * | ||||
|      * @param workerDailyReport 施工人员日报列表对象 | ||||
|      * @return 施工人员日报列表视图对象 | ||||
|      */ | ||||
|     @Override | ||||
|     public BusWorkerDailyReportVo getVo(BusWorkerDailyReport workerDailyReport) { | ||||
|         // 对象转封装类 | ||||
|         BusWorkerDailyReportVo workerDailyReportVo = new BusWorkerDailyReportVo(); | ||||
|         if (workerDailyReport == null) { | ||||
|             return workerDailyReportVo; | ||||
|         } | ||||
|         BeanUtils.copyProperties(workerDailyReport, workerDailyReportVo); | ||||
|         // 获取日报计件详情信息 | ||||
|         List<BusDailyPieceItem> dailyPieceItemList = dailyPieceItemService.lambdaQuery() | ||||
|             .eq(BusDailyPieceItem::getReportId, workerDailyReport.getId()).list(); | ||||
|         workerDailyReportVo.setDailyPieceItemVoList(dailyPieceItemService.getListVo(dailyPieceItemList)); | ||||
|         // 获取班组详情信息 | ||||
|         workerDailyReportVo.setTeamName(projectTeamService.getById(workerDailyReport.getTeamId()).getTeamName()); | ||||
|         return workerDailyReportVo; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报补报视图对象 | ||||
|      * | ||||
|      * @param workerDailyReport 施工人员日报对象 | ||||
|      * @return 施工人员日报补报视图对象 | ||||
|      */ | ||||
|     @Override | ||||
|     public WorkerDailyReportReissueResp getReissueVo(BusWorkerDailyReport workerDailyReport) { | ||||
|         // 对象转封装类 | ||||
|         WorkerDailyReportReissueResp workerDailyReportReissueResp = new WorkerDailyReportReissueResp(); | ||||
|         if (workerDailyReport == null) { | ||||
|             return workerDailyReportReissueResp; | ||||
|         } | ||||
|         BeanUtils.copyProperties(workerDailyReport, workerDailyReportReissueResp); | ||||
|         // 获取日报计件详情信息 | ||||
|         List<BusDailyPieceItem> dailyPieceItemList = dailyPieceItemService.lambdaQuery() | ||||
|             .eq(BusDailyPieceItem::getReportId, workerDailyReport.getId()).list(); | ||||
|         workerDailyReportReissueResp.setDailyPieceItemVoList(dailyPieceItemService.getListVo(dailyPieceItemList)); | ||||
|         // 获取班组详情信息 | ||||
|         workerDailyReportReissueResp.setTeamName(projectTeamService.getById(workerDailyReport.getTeamId()).getTeamName()); | ||||
|         return workerDailyReportReissueResp; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表查询条件封装 | ||||
|      * | ||||
|      * @param req 施工人员日报列表查询条件 | ||||
|      * @return 施工人员日报列表查询条件封装 | ||||
|      */ | ||||
|     @Override | ||||
|     public LambdaQueryWrapper<BusWorkerDailyReport> buildQueryWrapper(WorkerDailyReportQueryReq req) { | ||||
|         LambdaQueryWrapper<BusWorkerDailyReport> lqw = new LambdaQueryWrapper<>(); | ||||
|         if (req == null) { | ||||
|             return lqw; | ||||
|         } | ||||
|         Long id = req.getId(); | ||||
|         Long projectId = req.getProjectId(); | ||||
|         Long teamId = req.getTeamId(); | ||||
|         Long userId = req.getUserId(); | ||||
|         String userName = req.getUserName(); | ||||
|         Date reportDate = req.getReportDate(); | ||||
|         // 模糊查询 | ||||
|         lqw.like(StringUtils.isNotBlank(userName), BusWorkerDailyReport::getUserName, userName); | ||||
|         // 精确查询 | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(id), BusWorkerDailyReport::getId, id); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(projectId), BusWorkerDailyReport::getProjectId, projectId); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(teamId), BusWorkerDailyReport::getTeamId, teamId); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(userId), BusWorkerDailyReport::getUserId, userId); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(reportDate), BusWorkerDailyReport::getReportDate, reportDate); | ||||
|         return lqw; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报列表分页对象视图 | ||||
|      * | ||||
|      * @param workerDailyReportPage 施工人员日报列表分页对象 | ||||
|      * @return 施工人员日报列表分页对象视图 | ||||
|      */ | ||||
|     @Override | ||||
|     public Page<BusWorkerDailyReportVo> getVoPage(Page<BusWorkerDailyReport> workerDailyReportPage) { | ||||
|         // 对象列表 => 封装对象列表 | ||||
|         List<BusWorkerDailyReport> workerDailyReportList = workerDailyReportPage.getRecords(); | ||||
|         Page<BusWorkerDailyReportVo> workerDailyReportVoPage = new Page<>( | ||||
|             workerDailyReportPage.getCurrent(), | ||||
|             workerDailyReportPage.getSize(), | ||||
|             workerDailyReportPage.getTotal()); | ||||
|         if (CollUtil.isEmpty(workerDailyReportList)) { | ||||
|             return workerDailyReportVoPage; | ||||
|         } | ||||
|         // 获取日报计件详情信息 | ||||
|         List<Long> idList = workerDailyReportList.stream().map(BusWorkerDailyReport::getId).toList(); | ||||
|         Map<Long, List<BusDailyPieceItem>> reportIdDailyPieceItemMap = dailyPieceItemService.lambdaQuery() | ||||
|             .in(BusDailyPieceItem::getReportId, idList).list() | ||||
|             .stream().collect(Collectors.groupingBy(BusDailyPieceItem::getReportId)); | ||||
|         // 获取班组详情信息 | ||||
|         List<Long> teamIdList = workerDailyReportList.stream().map(BusWorkerDailyReport::getTeamId).toList(); | ||||
|         Map<Long, List<BusProjectTeam>> teamIdProjectTeamMap = projectTeamService.lambdaQuery() | ||||
|             .in(BusProjectTeam::getId, teamIdList).list() | ||||
|             .stream().collect(Collectors.groupingBy(BusProjectTeam::getId)); | ||||
|         // 封装对象 | ||||
|         List<BusWorkerDailyReportVo> workerDailyReportVoList = workerDailyReportList.stream().map(workerDailyReport -> { | ||||
|             BusWorkerDailyReportVo workerDailyReportVo = new BusWorkerDailyReportVo(); | ||||
|             BeanUtils.copyProperties(workerDailyReport, workerDailyReportVo); | ||||
|             Long id = workerDailyReport.getId(); | ||||
|             // 获取日报计件详情信息 | ||||
|             List<BusDailyPieceItemVo> dailyPieceItemVoList = new ArrayList<>(); | ||||
|             if (reportIdDailyPieceItemMap.containsKey(id)) { | ||||
|                 List<BusDailyPieceItem> dailyPieceItemList = reportIdDailyPieceItemMap.get(id); | ||||
|                 dailyPieceItemVoList = dailyPieceItemService.getListVo(dailyPieceItemList); | ||||
|             } | ||||
|             workerDailyReportVo.setDailyPieceItemVoList(dailyPieceItemVoList); | ||||
|             // 获取班组详情信息 | ||||
|             String teamName = null; | ||||
|             if (teamIdProjectTeamMap.containsKey(workerDailyReport.getTeamId())) { | ||||
|                 BusProjectTeam projectTeam = teamIdProjectTeamMap.get(workerDailyReport.getTeamId()).get(0); | ||||
|                 teamName = projectTeam.getTeamName(); | ||||
|             } | ||||
|             workerDailyReportVo.setTeamName(teamName); | ||||
|             return workerDailyReportVo; | ||||
|         }).toList(); | ||||
|         workerDailyReportVoPage.setRecords(workerDailyReportVoList); | ||||
|         return workerDailyReportVoPage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取施工人员日报补报分页对象视图 | ||||
|      * | ||||
|      * @param workerDailyReportPage 施工人员日报列表分页对象 | ||||
|      * @return 施工人员日报列表分页对象视图 | ||||
|      */ | ||||
|     @Override | ||||
|     public Page<WorkerDailyReportReissueResp> getReissueVoPage(Page<BusWorkerDailyReport> workerDailyReportPage) { | ||||
|         // 对象列表 => 封装对象列表 | ||||
|         List<BusWorkerDailyReport> workerDailyReportList = workerDailyReportPage.getRecords(); | ||||
|         Page<WorkerDailyReportReissueResp> respPage = new Page<>( | ||||
|             workerDailyReportPage.getCurrent(), | ||||
|             workerDailyReportPage.getSize(), | ||||
|             workerDailyReportPage.getTotal()); | ||||
|         if (CollUtil.isEmpty(workerDailyReportList)) { | ||||
|             return respPage; | ||||
|         } | ||||
|         // 获取日报计件详情信息 | ||||
|         List<Long> idList = workerDailyReportList.stream().map(BusWorkerDailyReport::getId).toList(); | ||||
|         Map<Long, List<BusDailyPieceItem>> reportIdDailyPieceItemMap = dailyPieceItemService.lambdaQuery() | ||||
|             .in(BusDailyPieceItem::getReportId, idList).list() | ||||
|             .stream().collect(Collectors.groupingBy(BusDailyPieceItem::getReportId)); | ||||
|         // 获取班组详情信息 | ||||
|         List<Long> teamIdList = workerDailyReportList.stream().map(BusWorkerDailyReport::getTeamId).toList(); | ||||
|         Map<Long, List<BusProjectTeam>> teamIdProjectTeamMap = projectTeamService.lambdaQuery() | ||||
|             .in(BusProjectTeam::getId, teamIdList).list() | ||||
|             .stream().collect(Collectors.groupingBy(BusProjectTeam::getId)); | ||||
|         // 封装对象 | ||||
|         List<WorkerDailyReportReissueResp> workerDailyReportVoList = workerDailyReportList.stream().map(workerDailyReport -> { | ||||
|             WorkerDailyReportReissueResp workerDailyReportVo = new WorkerDailyReportReissueResp(); | ||||
|             BeanUtils.copyProperties(workerDailyReport, workerDailyReportVo); | ||||
|             Long id = workerDailyReport.getId(); | ||||
|             // 获取日报计件详情信息 | ||||
|             List<BusDailyPieceItemVo> dailyPieceItemVoList = new ArrayList<>(); | ||||
|             if (reportIdDailyPieceItemMap.containsKey(id)) { | ||||
|                 List<BusDailyPieceItem> dailyPieceItemList = reportIdDailyPieceItemMap.get(id); | ||||
|                 dailyPieceItemVoList = dailyPieceItemService.getListVo(dailyPieceItemList); | ||||
|             } | ||||
|             workerDailyReportVo.setDailyPieceItemVoList(dailyPieceItemVoList); | ||||
|             // 获取班组详情信息 | ||||
|             String teamName = null; | ||||
|             if (teamIdProjectTeamMap.containsKey(workerDailyReport.getTeamId())) { | ||||
|                 BusProjectTeam projectTeam = teamIdProjectTeamMap.get(workerDailyReport.getTeamId()).get(0); | ||||
|                 teamName = projectTeam.getTeamName(); | ||||
|             } | ||||
|             workerDailyReportVo.setTeamName(teamName); | ||||
|             return workerDailyReportVo; | ||||
|         }).toList(); | ||||
|         respPage.setRecords(workerDailyReportVoList); | ||||
|         return respPage; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user