From eec844bf51df19775011f115381774bdae578829 Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Wed, 2 Apr 2025 15:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=BD=E5=B7=A5=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E6=96=87=E4=BB=B6=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=96=BD=E5=B7=A5=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusConstructionUserController.java | 56 +++- .../BusConstructionUserFileController.java | 77 +++++ .../project/domain/BusConstructionUser.java | 5 + .../domain/BusConstructionUserFile.java | 61 ++++ .../exportvo/BusConstructionUserExportVo.java | 127 ++++++++ .../ConstructionUserBatchUpdateClockReq.java | 32 ++ .../ConstructionUserBatchUpdateStatusReq.java | 34 +++ .../ConstructionUserChangeProjectReq.java | 2 + .../ConstructionUserCreateReq.java | 5 + .../ConstructionUserQueryReq.java | 5 + .../ConstructionUserUpdateClockReq.java | 32 ++ .../ConstructionUserUpdateReq.java | 12 + .../ConstructionUserUpdateSalaryReq.java | 30 ++ .../ConstructionUserFileQueryReq.java | 38 +++ .../ConstructionUserFileReq.java | 26 ++ .../ConstructionUserFileSaveReq.java | 29 ++ .../domain/vo/BusConstructionUserFileVo.java | 60 ++++ .../domain/vo/BusConstructionUserVo.java | 13 + .../mapper/BusConstructionUserFileMapper.java | 15 + .../IBusConstructionUserFileService.java | 52 ++++ .../service/IBusConstructionUserService.java | 40 ++- .../BusConstructionUserFileServiceImpl.java | 176 +++++++++++ .../impl/BusConstructionUserServiceImpl.java | 274 ++++++++++++++++-- .../project/BusConstructionUserFileMapper.xml | 7 + 24 files changed, 1174 insertions(+), 34 deletions(-) create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserFileController.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUserFile.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/exportvo/BusConstructionUserExportVo.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateClockReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateStatusReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateClockReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateSalaryReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileQueryReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileSaveReq.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserFileVo.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusConstructionUserFileMapper.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserFileService.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserFileServiceImpl.java create mode 100644 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/resources/mapper/project/BusConstructionUserFileMapper.xml diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserController.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserController.java index 4e88644c..48c64bda 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserController.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserController.java @@ -15,10 +15,8 @@ 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.constructionuser.ConstructionUserChangeProjectReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserCreateReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserQueryReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserUpdateReq; +import org.dromara.project.domain.exportvo.BusConstructionUserExportVo; +import org.dromara.project.domain.req.constructionuser.*; import org.dromara.project.domain.vo.BusConstructionUserVo; import org.dromara.project.service.IBusConstructionUserService; import org.springframework.validation.annotation.Validated; @@ -56,8 +54,8 @@ public class BusConstructionUserController extends BaseController { @Log(title = "施工人员", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(ConstructionUserQueryReq req, HttpServletResponse response) { - List list = busConstructionUserService.queryList(req); - ExcelUtil.exportExcel(list, "施工人员", BusConstructionUserVo.class, response); + List list = busConstructionUserService.queryList(req); + ExcelUtil.exportExcel(list, "施工人员", BusConstructionUserExportVo.class, response); } /** @@ -95,7 +93,51 @@ public class BusConstructionUserController extends BaseController { } /** - * 人员迁移 + * 修改施工人员工资 + */ + @SaCheckPermission("project:constructionUser:edit") + @Log(title = "施工人员", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/salary") + public R editSalary(@Validated(EditGroup.class) @RequestBody ConstructionUserUpdateSalaryReq req) { + return toAjax(busConstructionUserService.updateSalary(req)); + } + + /** + * 修改施工人员打卡状态 + */ + @SaCheckPermission("project:constructionUser:edit") + @Log(title = "施工人员", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/clock") + public R editClock(@Validated(EditGroup.class) @RequestBody ConstructionUserUpdateClockReq req) { + return toAjax(busConstructionUserService.updateClock(req)); + } + + /** + * 批量修改施工人员状态 + */ + @SaCheckPermission("project:constructionUser:edit") + @Log(title = "施工人员", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/batch/status") + public R batchUpdateStatus(@Validated(EditGroup.class) @RequestBody ConstructionUserBatchUpdateStatusReq req) { + return toAjax(busConstructionUserService.batchUpdateStatus(req)); + } + + /** + * 根据项目id批量修改施工人员打卡状态 + */ + @SaCheckPermission("project:constructionUser:edit") + @Log(title = "施工人员", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/batch/clock") + public R batchUpdateClock(@Validated(EditGroup.class) @RequestBody ConstructionUserBatchUpdateClockReq req) { + return toAjax(busConstructionUserService.batchUpdateClockByProjectId(req)); + } + + /** + * 施工人员迁移 */ @SaCheckPermission("project:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserFileController.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserFileController.java new file mode 100644 index 00000000..f82134d9 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusConstructionUserFileController.java @@ -0,0 +1,77 @@ +package org.dromara.project.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.domain.R; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.web.core.BaseController; +import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileQueryReq; +import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileSaveReq; +import org.dromara.project.domain.vo.BusConstructionUserFileVo; +import org.dromara.project.service.IBusConstructionUserFileService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 施工人员文件存储 + * + * @author lcj + * @date 2025-04-01 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/project/constructionUserFile") +public class BusConstructionUserFileController extends BaseController { + + private final IBusConstructionUserFileService busConstructionUserFileService; + + /** + * 查询施工人员文件存储列表 + */ + @SaCheckPermission("project:constructionUserFile:list") + @GetMapping("/list") + public R> list(ConstructionUserFileQueryReq req) { + return R.ok(busConstructionUserFileService.queryList(req)); + } + + /** + * 导出施工人员文件存储列表 + */ + @SaCheckPermission("project:constructionUserFile:export") + @Log(title = "施工人员文件存储", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ConstructionUserFileQueryReq req, HttpServletResponse response) { + List list = busConstructionUserFileService.queryList(req); + ExcelUtil.exportExcel(list, "施工人员文件存储", BusConstructionUserFileVo.class, response); + } + + /** + * 获取施工人员文件存储详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("project:constructionUserFile:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(busConstructionUserFileService.queryById(id)); + } + + /** + * 保存施工人员文件存储详情信息 + */ + @SaCheckPermission("project:constructionUserFile:edit") + @Log(title = "施工人员文件存储", businessType = BusinessType.INSERT) + @PostMapping("/save") + public R save(@RequestBody ConstructionUserFileSaveReq req) { + return R.ok(busConstructionUserFileService.saveFileList(req)); + } + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUser.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUser.java index 4c095371..e15065d8 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUser.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUser.java @@ -145,6 +145,11 @@ public class BusConstructionUser extends BaseEntity { */ private String typeOfWork; + /** + * 工资计量单位 + */ + private String wageMeasureUnit; + /** * 特种工作证图片 */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUserFile.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUserFile.java new file mode 100644 index 00000000..524a1de8 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusConstructionUserFile.java @@ -0,0 +1,61 @@ +package org.dromara.project.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * 施工人员文件存储对象 bus_construction_user_file + * + * @author lcj + * @date 2025-04-01 + */ +@Data +@TableName("bus_construction_user_file") +public class BusConstructionUserFile implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 文件类型 + */ + private String fileType; + + /** + * 文件路径 + */ + private String path; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/exportvo/BusConstructionUserExportVo.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/exportvo/BusConstructionUserExportVo.java new file mode 100644 index 00000000..a2bf63a9 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/exportvo/BusConstructionUserExportVo.java @@ -0,0 +1,127 @@ +package org.dromara.project.domain.exportvo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import org.dromara.project.domain.BusConstructionUser; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author lcj + * @date 2025/4/2 14:46 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BusConstructionUser.class) +public class BusConstructionUserExportVo implements Serializable { + + @Serial + private static final long serialVersionUID = -7147024838012426821L; + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + private String userName; + + /** + * 项目名称 + */ + @ExcelProperty(value = "项目") + private String projectName; + + /** + * 分包公司 + */ + @ExcelProperty(value = "分包公司") + private String contractorName; + + /** + * 班组 + */ + @ExcelProperty(value = "班组") + private String teamName; + + /** + * 状态(0在职 1离职) + */ + @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "0=在职,1=离职") + private String status; + + /** + * 联系电话 + */ + @ExcelProperty(value = "联系电话") + private String phone; + + /** + * 0:保密 1:男 2女 + */ + @ExcelProperty(value = "性别", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "user_sex_type") + private String sex; + + /** + * 民族 + */ + @ExcelProperty(value = "民族") + private String nation; + + /** + * 身份证号码 + */ + @ExcelProperty(value = "身份证号码") + private String sfzNumber; + + /** + * 身份证地址 + */ + @ExcelProperty(value = "身份证地址") + private String sfzSite; + + /** + * 银行卡号 + */ + @ExcelProperty(value = "银行卡号") + private String yhkNumber; + + /** + * 工种 + */ + @ExcelProperty(value = "工种", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "type_of_work") + private String typeOfWork; + + /** + * 工资计量单位 + */ + @ExcelProperty(value = "工资计量单位", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "wage_measure_unit_type") + private String wageMeasureUnit; + + /** + * 入场时间 + */ + @ExcelProperty(value = "入场时间") + private Date entryDate; + + /** + * 离场时间 + */ + @ExcelProperty(value = "离场时间") + private Date leaveDate; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateClockReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateClockReq.java new file mode 100644 index 00000000..8a4dc60a --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateClockReq.java @@ -0,0 +1,32 @@ +package org.dromara.project.domain.req.constructionuser; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 根据项目id一键开关施工人员打卡状态 + * + * @author lcj + * @date 2025/4/2 9:14 + */ +@Data +public class ConstructionUserBatchUpdateClockReq implements Serializable { + + @Serial + private static final long serialVersionUID = -5803749609177642435L; + + /** + * 项目id + */ + @NotNull(message = "项目id不能为空") + private Long projectId; + + /** + * 打卡(0启用打卡 1禁止打卡) + */ + @NotNull(message = "打卡状态不能为空") + private String clock; +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateStatusReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateStatusReq.java new file mode 100644 index 00000000..ed0fd542 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserBatchUpdateStatusReq.java @@ -0,0 +1,34 @@ +package org.dromara.project.domain.req.constructionuser; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * 批量修改施工人员状态请求对象 + * + * @author lcj + * @date 2025/4/1 17:11 + */ +@Data +public class ConstructionUserBatchUpdateStatusReq implements Serializable { + + @Serial + private static final long serialVersionUID = -3756685899069233313L; + + /** + * 主键id列表 + */ + @NotNull(message = "主键id列表不能为空") + private List idList; + + /** + * 状态(0在职 1离职) + */ + @NotNull(message = "状态不能为空") + private String status; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserChangeProjectReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserChangeProjectReq.java index 390897a1..04b2672e 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserChangeProjectReq.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserChangeProjectReq.java @@ -7,6 +7,8 @@ import java.io.Serial; import java.io.Serializable; /** + * 施工人员迁移请求对象 + * * @author lcj * @date 2025/3/31 14:50 */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserCreateReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserCreateReq.java index 06c10127..5d84393a 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserCreateReq.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserCreateReq.java @@ -125,6 +125,11 @@ public class ConstructionUserCreateReq implements Serializable { */ private String typeOfWork; + /** + * 工资计量单位 + */ + private String wageMeasureUnit; + /** * 特种工作证图片 */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserQueryReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserQueryReq.java index 0b849722..18a1e4ca 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserQueryReq.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserQueryReq.java @@ -100,6 +100,11 @@ public class ConstructionUserQueryReq implements Serializable { */ private String typeOfWork; + /** + * 工资计量单位 + */ + private String wageMeasureUnit; + /** * 打卡(0启用打卡 1禁止打卡) */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateClockReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateClockReq.java new file mode 100644 index 00000000..7ca7b5b2 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateClockReq.java @@ -0,0 +1,32 @@ +package org.dromara.project.domain.req.constructionuser; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 更新施工人员打卡状态 + * + * @author lcj + * @date 2025/4/2 9:14 + */ +@Data +public class ConstructionUserUpdateClockReq implements Serializable { + + @Serial + private static final long serialVersionUID = -5803749609177642435L; + + /** + * 用户id + */ + @NotNull(message = "用户id不能为空") + private Long id; + + /** + * 打卡(0启用打卡 1禁止打卡) + */ + @NotNull(message = "打卡状态不能为空") + private String clock; +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateReq.java index b3c9ca1c..37f95097 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateReq.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateReq.java @@ -1,5 +1,6 @@ package org.dromara.project.domain.req.constructionuser; +import jakarta.validation.constraints.NotNull; import lombok.Data; import java.io.Serial; @@ -18,6 +19,7 @@ public class ConstructionUserUpdateReq implements Serializable { /** * 主键id */ + @NotNull(message = "主键id不能为空") private Long id; /** @@ -30,6 +32,11 @@ public class ConstructionUserUpdateReq implements Serializable { */ private String userName; + /** + * 项目id + */ + private Long projectId; + /** * 分包公司id */ @@ -125,6 +132,11 @@ public class ConstructionUserUpdateReq implements Serializable { */ private String typeOfWork; + /** + * 工资计量单位 + */ + private String wageMeasureUnit; + /** * 特种工作证图片 */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateSalaryReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateSalaryReq.java new file mode 100644 index 00000000..3492165a --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuser/ConstructionUserUpdateSalaryReq.java @@ -0,0 +1,30 @@ +package org.dromara.project.domain.req.constructionuser; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/4/2 11:35 + */ +@Data +public class ConstructionUserUpdateSalaryReq implements Serializable { + + @Serial + private static final long serialVersionUID = -1300674086812422523L; + + /** + * 主键id + */ + @NotNull(message = "主键不能为空") + private Long id; + + /** + * 薪水 + */ + private Long salary; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileQueryReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileQueryReq.java new file mode 100644 index 00000000..b2300b8f --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileQueryReq.java @@ -0,0 +1,38 @@ +package org.dromara.project.domain.req.constructionuserfile; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/4/1 10:06 + */ +@Data +public class ConstructionUserFileQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = 552027602186820020L; + + /** + * 主键id + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 文件类型 + */ + private String fileType; + + /** + * 备注 + */ + private String remark; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileReq.java new file mode 100644 index 00000000..df05dc32 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileReq.java @@ -0,0 +1,26 @@ +package org.dromara.project.domain.req.constructionuserfile; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author lcj + * @date 2025/4/1 15:21 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ConstructionUserFileReq{ + + /** + * 文件类型 + */ + private String fileType; + + /** + * 文件id + */ + private String fileId; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileSaveReq.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileSaveReq.java new file mode 100644 index 00000000..4dbb3fd4 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/req/constructionuserfile/ConstructionUserFileSaveReq.java @@ -0,0 +1,29 @@ +package org.dromara.project.domain.req.constructionuserfile; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @author lcj + * @date 2025/4/1 10:01 + */ +@Data +public class ConstructionUserFileSaveReq implements Serializable { + + @Serial + private static final long serialVersionUID = 4319620202781413796L; + + /** + * 用户id + */ + private Long userId; + + /** + * 文件列表 + */ + private List fileList; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserFileVo.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserFileVo.java new file mode 100644 index 00000000..db4d86f6 --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserFileVo.java @@ -0,0 +1,60 @@ +package org.dromara.project.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import org.dromara.project.domain.BusConstructionUserFile; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 施工人员文件存储视图对象 bus_construction_user_file + * + * @author lcj + * @date 2025-04-01 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BusConstructionUserFile.class) +public class BusConstructionUserFileVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ExcelProperty(value = "主键id") + private Long id; + + /** + * 用户id + */ + @ExcelProperty(value = "用户id") + private Long userId; + + /** + * 文件类型 + */ + @ExcelProperty(value = "文件类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "user_file_type") + private String fileType; + + /** + * 文件路径 + */ + @ExcelProperty(value = "文件路径") + private String path; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserVo.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserVo.java index 0cb531e6..5a35fd97 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserVo.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusConstructionUserVo.java @@ -190,6 +190,13 @@ public class BusConstructionUserVo implements Serializable { @ExcelDictFormat(dictType = "type_of_work") private String typeOfWork; + /** + * 工资计量单位 + */ + @ExcelProperty(value = "工资计量单位", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "wage_measure_unit_type") + private String wageMeasureUnit; + /** * 特种工作证图片 */ @@ -214,6 +221,12 @@ public class BusConstructionUserVo implements Serializable { @ExcelProperty(value = "离场时间") private Date leaveDate; + /** + * 标准薪水 + */ + @ExcelProperty(value = "标准薪水") + private Long standardSalary; + /** * 薪水 */ diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusConstructionUserFileMapper.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusConstructionUserFileMapper.java new file mode 100644 index 00000000..0edf1fdb --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusConstructionUserFileMapper.java @@ -0,0 +1,15 @@ +package org.dromara.project.mapper; + +import org.dromara.project.domain.BusConstructionUserFile; +import org.dromara.project.domain.vo.BusConstructionUserFileVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 施工人员文件存储Mapper接口 + * + * @author lcj + * @date 2025-04-01 + */ +public interface BusConstructionUserFileMapper extends BaseMapperPlus { + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserFileService.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserFileService.java new file mode 100644 index 00000000..51ca1f9b --- /dev/null +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserFileService.java @@ -0,0 +1,52 @@ +package org.dromara.project.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import org.dromara.project.domain.BusConstructionUserFile; +import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileQueryReq; +import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileSaveReq; +import org.dromara.project.domain.vo.BusConstructionUserFileVo; + +import java.util.List; + +/** + * 施工人员文件存储Service接口 + * + * @author lcj + * @date 2025-04-01 + */ +public interface IBusConstructionUserFileService extends IService { + + /** + * 查询施工人员文件存储 + * + * @param id 主键 + * @return 施工人员文件存储 + */ + BusConstructionUserFileVo queryById(Long id); + + /** + * 查询符合条件的施工人员文件存储列表 + * + * @param req 查询条件 + * @return 施工人员文件存储列表 + */ + List queryList(ConstructionUserFileQueryReq req); + + /** + * 保存施工人员文件存储 + * + * @param req 保存参数 + * @return 是否保存成功 + */ + Boolean saveFileList(ConstructionUserFileSaveReq req); + + /** + * 获取施工人员文件存储查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + LambdaQueryWrapper buildQueryWrapper(ConstructionUserFileQueryReq req); + +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserService.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserService.java index 035fa239..f4048786 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserService.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusConstructionUserService.java @@ -6,10 +6,8 @@ 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.BusConstructionUser; -import org.dromara.project.domain.req.constructionuser.ConstructionUserChangeProjectReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserCreateReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserQueryReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserUpdateReq; +import org.dromara.project.domain.exportvo.BusConstructionUserExportVo; +import org.dromara.project.domain.req.constructionuser.*; import org.dromara.project.domain.vo.BusConstructionUserVo; import java.util.Collection; @@ -46,7 +44,7 @@ public interface IBusConstructionUserService extends IService queryList(ConstructionUserQueryReq req); + List queryList(ConstructionUserQueryReq req); /** * 新增施工人员 @@ -64,6 +62,22 @@ public interface IBusConstructionUserService extends IService + implements IBusConstructionUserFileService { + + @Resource + private IBusProjectService projectService; + + @Resource + private IBusConstructionUserService constructionUserService; + + /** + * 查询施工人员文件存储 + * + * @param id 主键 + * @return 施工人员文件存储 + */ + @Override + public BusConstructionUserFileVo queryById(Long id) { + return baseMapper.selectVoById(id); + } + + /** + * 查询符合条件的施工人员文件存储列表 + * + * @param req 查询条件 + * @return 施工人员文件存储列表 + */ + @Override + public List queryList(ConstructionUserFileQueryReq req) { + LambdaQueryWrapper lqw = buildQueryWrapper(req); + return baseMapper.selectVoList(lqw); + } + + /** + * 保存施工人员文件存储 + * + * @param req 保存参数 + * @return 是否保存成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean saveFileList(ConstructionUserFileSaveReq req) { + // 1. 参数校验 + // 判断参数是否为空 + Long userId = req.getUserId(); + List fileList = req.getFileList(); + if (userId == null || CollUtil.isEmpty(fileList)) { + throw new ServiceException("施工人员文件存储参数错误", HttpStatus.BAD_REQUEST); + } + // 校验修改用户是否存在 + BusConstructionUser constructionUser = constructionUserService.getById(userId); + if (constructionUser == null) { + throw new ServiceException("施工人员不存在", HttpStatus.NOT_FOUND); + } + // 判断登录用户是否有用户所在项目的操作权限 + Long projectId = constructionUser.getProjectId(); + Long loginUser = LoginHelper.getUserId(); + projectService.validAuth(projectId, loginUser); + // 2. 查询当前用户的所有文件记录(一次性查询,避免多次访问数据库) + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(BusConstructionUserFile.class) + .eq(BusConstructionUserFile::getUserId, userId); + List constructionUserFileList = this.list(lqw); + // 3. 构建 Map 方便查找 + Map existingFileMap = constructionUserFileList.stream() + .collect(Collectors.toMap(BusConstructionUserFile::getFileType, Function.identity())); + // 4. 处理新增或更新的数据 + List saveOrUpdateList = new ArrayList<>(); + // 处理删除的数据 + List deleteList = new ArrayList<>(); + for (ConstructionUserFileReq fileReq : fileList) { + String fileType = fileReq.getFileType(); + String fileId = fileReq.getFileId(); + if (existingFileMap.containsKey(fileType)) { + // 如果存在,则更新 + BusConstructionUserFile existingFile = existingFileMap.get(fileType); + // 如果文件id相同,则不更新 + if (StringUtils.equals(existingFile.getPath(), fileId)) { + continue; + } + // 如果文件id为空,则删除 + if (StringUtils.isBlank(fileId)) { + deleteList.add(existingFile.getId()); + continue; + } + existingFile.setPath(fileId); + saveOrUpdateList.add(existingFile); + } else { + // 如果不存在,则新增 + BusConstructionUserFile newFile = new BusConstructionUserFile(); + newFile.setUserId(userId); + newFile.setFileType(fileType); + newFile.setPath(fileId); + saveOrUpdateList.add(newFile); + } + } + // 5. 批量保存或更新 + if (CollUtil.isNotEmpty(saveOrUpdateList)) { + boolean result = this.saveOrUpdateBatch(saveOrUpdateList); + if (!result) { + throw new ServiceException("保存或更新施工人员文件存储失败", HttpStatus.ERROR); + } + } + // 6. 批量删除 + if (CollUtil.isNotEmpty(deleteList)) { + boolean result = this.removeBatchByIds(deleteList); + if (!result) { + throw new ServiceException("删除施工人员文件存储失败", HttpStatus.ERROR); + } + } + return true; + } + + /** + * 获取施工人员文件存储查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + @Override + public LambdaQueryWrapper buildQueryWrapper(ConstructionUserFileQueryReq req) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + if (req == null) { + return lqw; + } + Long id = req.getId(); + Long userId = req.getUserId(); + String fileType = req.getFileType(); + String remark = req.getRemark(); + // 模糊查询 + lqw.like(StringUtils.isNotBlank(remark), BusConstructionUserFile::getRemark, remark); + // 精确查询 + lqw.eq(ObjectUtils.isNotEmpty(id), BusConstructionUserFile::getId, id); + lqw.eq(ObjectUtils.isNotEmpty(userId), BusConstructionUserFile::getUserId, userId); + lqw.eq(StringUtils.isNotBlank(fileType), BusConstructionUserFile::getFileType, fileType); + return lqw; + } +} diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserServiceImpl.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserServiceImpl.java index 47c62495..4a546ace 100644 --- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserServiceImpl.java +++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserServiceImpl.java @@ -2,7 +2,6 @@ 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.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -16,10 +15,8 @@ import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.project.domain.*; -import org.dromara.project.domain.req.constructionuser.ConstructionUserChangeProjectReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserCreateReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserQueryReq; -import org.dromara.project.domain.req.constructionuser.ConstructionUserUpdateReq; +import org.dromara.project.domain.exportvo.BusConstructionUserExportVo; +import org.dromara.project.domain.req.constructionuser.*; import org.dromara.project.domain.vo.BusConstructionUserVo; import org.dromara.project.domain.vo.BusContractorVo; import org.dromara.project.domain.vo.BusProjectTeamVo; @@ -31,10 +28,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -68,6 +62,14 @@ public class BusConstructionUserServiceImpl extends ServiceImpl queryList(ConstructionUserQueryReq req) { + public List queryList(ConstructionUserQueryReq req) { LambdaQueryWrapper lqw = this.buildQueryWrapper(req); - List list = this.list(lqw); - return list.stream().map(this::getVo).toList(); + List constructionUserVoList = this.list(lqw).stream().map(this::getVo).toList(); + // 关联项目信息 + Set projectIdList = constructionUserVoList.stream().map(BusConstructionUserVo::getProjectId) + .collect(Collectors.toSet()); + Map> projectIdProjectMap = projectService.listByIds(projectIdList).stream() + .collect(Collectors.groupingBy(BusProject::getId)); + List constructionUserExportVoList = new ArrayList<>(); + if (CollUtil.isNotEmpty(constructionUserVoList)) { + constructionUserExportVoList = constructionUserVoList.stream().map(constructionUserVo -> { + BusConstructionUserExportVo constructionUserExportVo = new BusConstructionUserExportVo(); + BeanUtils.copyProperties(constructionUserVo, constructionUserExportVo); + // 关联分包公司信息 + constructionUserExportVo.setContractorName(constructionUserVo.getContractorVo().getName()); + // 关联班组信息 + constructionUserExportVo.setTeamName(constructionUserVo.getTeamVo().getTeamName()); + // 关联项目信息 + Long projectId = constructionUserVo.getProjectId(); + String projectName = null; + if (projectIdProjectMap.containsKey(projectId)) { + projectName = projectService.getVo(projectIdProjectMap.get(projectId).get(0)).getProjectName(); + } + constructionUserExportVo.setProjectName(projectName); + return constructionUserExportVo; + }).toList(); + } + return constructionUserExportVoList; } /** @@ -123,6 +149,8 @@ public class BusConstructionUserServiceImpl extends ServiceImpl idList = req.getIdList(); + String status = req.getStatus(); + // 查询对应数据是否存在 + if (CollUtil.isEmpty(idList)) { + throw new ServiceException("施工人员 id 不能为空", HttpStatus.BAD_REQUEST); + } + List constructionUserList = this.listByIds(idList); + // 判断对应数据是否都存在 + if (constructionUserList.size() != idList.size()) { + throw new ServiceException("修改施工人员状态失败,数据缺失", HttpStatus.BAD_REQUEST); + } + // 判断当前操作用户是否有权限 + Long userId = LoginHelper.getUserId(); + List projectIdList = constructionUserList.stream() + .map(BusConstructionUser::getProjectId) + .distinct().toList(); + projectService.validAuth(projectIdList, userId); + // 批量修改 + List list = constructionUserList.stream() + .filter(user -> !status.equals(user.getStatus())) + .map(user -> { + BusConstructionUser constructionUser = new BusConstructionUser(); + constructionUser.setId(user.getId()); + constructionUser.setStatus(status); + return constructionUser; + }) + .toList(); + if (CollUtil.isNotEmpty(list)) { + boolean result = this.updateBatchById(list); + if (!result) { + throw new ServiceException("修改施工人员状态失败,数据库异常", HttpStatus.ERROR); + } + } + return true; + } + + /** + * 根据项目id批量修改施工人员打卡状态 + * + * @param req 批量修改施工人员打卡状态对象 + * @return 是否修改成功 + */ + @Override + public Boolean batchUpdateClockByProjectId(ConstructionUserBatchUpdateClockReq req) { + Long projectId = req.getProjectId(); + String clock = req.getClock(); + // 校验打卡状态是否为空 + if (StringUtils.isEmpty(clock)) { + throw new ServiceException("打卡状态不能为空", HttpStatus.BAD_REQUEST); + } + // 校验项目id和对应项目是否存在 + if (projectId == null) { + throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); + } + if (projectService.getById(projectId) == null) { + throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); + } + // 权限校验 + Long userId = LoginHelper.getUserId(); + projectService.validAuth(projectId, userId); + // 操作数据库,批量修改 + LambdaUpdateWrapper lambdaUpdate = Wrappers.lambdaUpdate(BusConstructionUser.class) + .eq(BusConstructionUser::getProjectId, projectId) + .set(BusConstructionUser::getClock, clock); + boolean update = this.update(lambdaUpdate); + if (!update) { + throw new ServiceException("修改施工人员打卡状态失败,数据库异常", HttpStatus.ERROR); + } + return true; + } + /** * 保存前的数据校验 */ @@ -202,19 +366,44 @@ public class BusConstructionUserServiceImpl extends ServiceImpl lqw = Wrappers.lambdaQuery(BusWorkWage.class) + .eq(BusWorkWage::getProjectId, projectId) + .eq(BusWorkWage::getWorkType, typeOfWork) + .eq(BusWorkWage::getWageMeasureUnit, wageMeasureUnit); + long count = workWageService.count(lqw); + if (count <= 0) { + throw new ServiceException("当前工种没有定义工资标准,请前往工种薪水设置进行设置后再选择", HttpStatus.BAD_REQUEST); + } } } @@ -237,16 +426,24 @@ public class BusConstructionUserServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.in("member_id", ids); - if (projectTeamMemberService.count(queryWrapper) > 0) { - throw new ServiceException("删除施工人员失败,施工人员存在于班组中", HttpStatus.BAD_REQUEST); + LambdaQueryWrapper projectTeamMemberLqw = Wrappers.lambdaQuery(BusProjectTeamMember.class) + .in(BusProjectTeamMember::getMemberId, ids); + if (projectTeamMemberService.count(projectTeamMemberLqw) > 0) { + throw new ServiceException("删除施工人员信息失败,施工人员存在于班组中", HttpStatus.BAD_REQUEST); } } // 判断对应数据是否都存在 if (constructionUserList.size() != ids.size()) { throw new ServiceException("删除施工人员信息失败,数据缺失", HttpStatus.BAD_REQUEST); } + // 批量删除施工人员下的文件信息 + LambdaQueryWrapper constructionUserFileLqw = Wrappers.lambdaQuery(BusConstructionUserFile.class) + .in(BusConstructionUserFile::getUserId, ids); + boolean removeFile = constructionUserFileService.remove(constructionUserFileLqw); + if (!removeFile) { + throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR); + } + // 批量删除施工人员信息 return this.removeBatchByIds(ids); } @@ -279,6 +476,20 @@ public class BusConstructionUserServiceImpl extends ServiceImpl lqw = Wrappers.lambdaQuery(BusWorkWage.class) + .eq(BusWorkWage::getProjectId, projectId) + .eq(BusWorkWage::getWorkType, typeOfWork) + .eq(BusWorkWage::getWageMeasureUnit, wageMeasureUnit); + BusWorkWage workWage = workWageService.getOne(lqw); + if (workWage != null) { + constructionUserVo.setStandardSalary(workWage.getWage()); + } + } return constructionUserVo; } @@ -312,6 +523,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl wrapper @@ -382,6 +595,16 @@ public class BusConstructionUserServiceImpl extends ServiceImpl> teamIdTeamMap = projectTeamService.listByIds(teamIdSet).stream() .collect(Collectors.groupingBy(BusProjectTeam::getId)); + // 关联查询工资标准 + LambdaQueryWrapper workWageLqw = Wrappers.lambdaQuery(BusWorkWage.class) + .in(BusWorkWage::getProjectId, constructionUserList.stream().map(BusConstructionUser::getProjectId).toList()) + .in(BusWorkWage::getWorkType, constructionUserList.stream().map(BusConstructionUser::getTypeOfWork).toList()) + .in(BusWorkWage::getWageMeasureUnit, constructionUserList.stream().map(BusConstructionUser::getWageMeasureUnit).toList()); + Map workWageMap = workWageService.list(workWageLqw).stream().collect(Collectors.toMap( + workWage -> workWage.getWorkType() + "_" + workWage.getWageMeasureUnit(), + BusWorkWage::getWage, + (wage1, wage2) -> wage1 + )); // 填充信息 List constructionUserVoList = constructionUserList.stream().map(constructionUser -> { BusConstructionUserVo constructionUserVo = new BusConstructionUserVo(); @@ -400,6 +623,13 @@ public class BusConstructionUserServiceImpl extends ServiceImpl + + + +