增加施工人员文件相关接口,增加施工人员相关接口
This commit is contained in:
@ -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<BusConstructionUserVo> list = busConstructionUserService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "施工人员", BusConstructionUserVo.class, response);
|
||||
List<BusConstructionUserExportVo> 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<Void> 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<Void> 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<Void> 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<Void> batchUpdateClock(@Validated(EditGroup.class) @RequestBody ConstructionUserBatchUpdateClockReq req) {
|
||||
return toAjax(busConstructionUserService.batchUpdateClockByProjectId(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 施工人员迁移
|
||||
*/
|
||||
@SaCheckPermission("project:constructionUser:edit")
|
||||
@Log(title = "施工人员", businessType = BusinessType.UPDATE)
|
||||
|
@ -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<BusConstructionUserFileVo>> 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<BusConstructionUserFileVo> list = busConstructionUserFileService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "施工人员文件存储", BusConstructionUserFileVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取施工人员文件存储详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("project:constructionUserFile:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusConstructionUserFileVo> 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<Boolean> save(@RequestBody ConstructionUserFileSaveReq req) {
|
||||
return R.ok(busConstructionUserFileService.saveFileList(req));
|
||||
}
|
||||
|
||||
}
|
@ -145,6 +145,11 @@ public class BusConstructionUser extends BaseEntity {
|
||||
*/
|
||||
private String typeOfWork;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 特种工作证图片
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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<Long> idList;
|
||||
|
||||
/**
|
||||
* 状态(0在职 1离职)
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
private String status;
|
||||
|
||||
}
|
@ -7,6 +7,8 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 施工人员迁移请求对象
|
||||
*
|
||||
* @author lcj
|
||||
* @date 2025/3/31 14:50
|
||||
*/
|
||||
|
@ -125,6 +125,11 @@ public class ConstructionUserCreateReq implements Serializable {
|
||||
*/
|
||||
private String typeOfWork;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 特种工作证图片
|
||||
*/
|
||||
|
@ -100,6 +100,11 @@ public class ConstructionUserQueryReq implements Serializable {
|
||||
*/
|
||||
private String typeOfWork;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 打卡(0启用打卡 1禁止打卡)
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* 特种工作证图片
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<ConstructionUserFileReq> fileList;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* 薪水
|
||||
*/
|
||||
|
@ -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<BusConstructionUserFile, BusConstructionUserFileVo> {
|
||||
|
||||
}
|
@ -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<BusConstructionUserFile> {
|
||||
|
||||
/**
|
||||
* 查询施工人员文件存储
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 施工人员文件存储
|
||||
*/
|
||||
BusConstructionUserFileVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询符合条件的施工人员文件存储列表
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 施工人员文件存储列表
|
||||
*/
|
||||
List<BusConstructionUserFileVo> queryList(ConstructionUserFileQueryReq req);
|
||||
|
||||
/**
|
||||
* 保存施工人员文件存储
|
||||
*
|
||||
* @param req 保存参数
|
||||
* @return 是否保存成功
|
||||
*/
|
||||
Boolean saveFileList(ConstructionUserFileSaveReq req);
|
||||
|
||||
/**
|
||||
* 获取施工人员文件存储查询条件封装
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 查询条件封装
|
||||
*/
|
||||
LambdaQueryWrapper<BusConstructionUserFile> buildQueryWrapper(ConstructionUserFileQueryReq req);
|
||||
|
||||
}
|
@ -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<BusConstructionUse
|
||||
* @param req 查询条件
|
||||
* @return 施工人员列表
|
||||
*/
|
||||
List<BusConstructionUserVo> queryList(ConstructionUserQueryReq req);
|
||||
List<BusConstructionUserExportVo> queryList(ConstructionUserQueryReq req);
|
||||
|
||||
/**
|
||||
* 新增施工人员
|
||||
@ -64,6 +62,22 @@ public interface IBusConstructionUserService extends IService<BusConstructionUse
|
||||
*/
|
||||
Boolean updateByBo(ConstructionUserUpdateReq req);
|
||||
|
||||
/**
|
||||
* 修改施工人员工资
|
||||
*
|
||||
* @param req 修改施工人员工资对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateSalary(ConstructionUserUpdateSalaryReq req);
|
||||
|
||||
/**
|
||||
* 修改施工人员打卡状态
|
||||
*
|
||||
* @param req 修改施工人员打卡状态对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateClock(ConstructionUserUpdateClockReq req);
|
||||
|
||||
/**
|
||||
* 修改施工人员项目(人员迁移)
|
||||
*
|
||||
@ -72,6 +86,22 @@ public interface IBusConstructionUserService extends IService<BusConstructionUse
|
||||
*/
|
||||
Boolean changeUserProject(ConstructionUserChangeProjectReq req);
|
||||
|
||||
/**
|
||||
* 批量修改施工人员状态
|
||||
*
|
||||
* @param req 批量修改施工人员状态对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean batchUpdateStatus(ConstructionUserBatchUpdateStatusReq req);
|
||||
|
||||
/**
|
||||
* 根据项目id批量修改施工人员打卡状态
|
||||
*
|
||||
* @param req 批量修改施工人员打卡状态对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean batchUpdateClockByProjectId(ConstructionUserBatchUpdateClockReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除施工人员信息
|
||||
*
|
||||
|
@ -0,0 +1,176 @@
|
||||
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.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.domain.BusConstructionUser;
|
||||
import org.dromara.project.domain.BusConstructionUserFile;
|
||||
import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileQueryReq;
|
||||
import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileReq;
|
||||
import org.dromara.project.domain.req.constructionuserfile.ConstructionUserFileSaveReq;
|
||||
import org.dromara.project.domain.vo.BusConstructionUserFileVo;
|
||||
import org.dromara.project.mapper.BusConstructionUserFileMapper;
|
||||
import org.dromara.project.service.IBusConstructionUserFileService;
|
||||
import org.dromara.project.service.IBusConstructionUserService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 施工人员文件存储Service业务层处理
|
||||
*
|
||||
* @author lcj
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BusConstructionUserFileServiceImpl extends ServiceImpl<BusConstructionUserFileMapper, BusConstructionUserFile>
|
||||
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<BusConstructionUserFileVo> queryList(ConstructionUserFileQueryReq req) {
|
||||
LambdaQueryWrapper<BusConstructionUserFile> 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<ConstructionUserFileReq> 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<BusConstructionUserFile> lqw = Wrappers.lambdaQuery(BusConstructionUserFile.class)
|
||||
.eq(BusConstructionUserFile::getUserId, userId);
|
||||
List<BusConstructionUserFile> constructionUserFileList = this.list(lqw);
|
||||
// 3. 构建 Map<fileType, BusConstructionUserFile> 方便查找
|
||||
Map<String, BusConstructionUserFile> existingFileMap = constructionUserFileList.stream()
|
||||
.collect(Collectors.toMap(BusConstructionUserFile::getFileType, Function.identity()));
|
||||
// 4. 处理新增或更新的数据
|
||||
List<BusConstructionUserFile> saveOrUpdateList = new ArrayList<>();
|
||||
// 处理删除的数据
|
||||
List<Long> 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<BusConstructionUserFile> buildQueryWrapper(ConstructionUserFileQueryReq req) {
|
||||
LambdaQueryWrapper<BusConstructionUserFile> 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;
|
||||
}
|
||||
}
|
@ -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<BusConstructionU
|
||||
@Resource
|
||||
private IBusConstructionBlacklistService constructionBlacklistService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IBusWorkWageService workWageService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IBusConstructionUserFileService constructionUserFileService;
|
||||
|
||||
/**
|
||||
* 查询施工人员
|
||||
*
|
||||
@ -104,10 +106,34 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
* @return 施工人员列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusConstructionUserVo> queryList(ConstructionUserQueryReq req) {
|
||||
public List<BusConstructionUserExportVo> queryList(ConstructionUserQueryReq req) {
|
||||
LambdaQueryWrapper<BusConstructionUser> lqw = this.buildQueryWrapper(req);
|
||||
List<BusConstructionUser> list = this.list(lqw);
|
||||
return list.stream().map(this::getVo).toList();
|
||||
List<BusConstructionUserVo> constructionUserVoList = this.list(lqw).stream().map(this::getVo).toList();
|
||||
// 关联项目信息
|
||||
Set<Long> projectIdList = constructionUserVoList.stream().map(BusConstructionUserVo::getProjectId)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<BusProject>> projectIdProjectMap = projectService.listByIds(projectIdList).stream()
|
||||
.collect(Collectors.groupingBy(BusProject::getId));
|
||||
List<BusConstructionUserExportVo> 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<BusConstructionU
|
||||
BeanUtils.copyProperties(req, constructionUser);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(constructionUser, true);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
projectService.validAuth(req.getProjectId(), userId);
|
||||
// 操作数据库
|
||||
boolean save = this.save(constructionUser);
|
||||
if (!save) {
|
||||
@ -149,10 +177,66 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
if (oldConstructionUser == null) {
|
||||
throw new ServiceException("修改施工人员失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 判断当前操作用户是否有权限
|
||||
Long userId = LoginHelper.getUserId();
|
||||
projectService.validAuth(oldConstructionUser.getProjectId(), userId);
|
||||
// 操作数据库
|
||||
return this.updateById(constructionUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改施工人员工资
|
||||
*
|
||||
* @param req 修改施工人员工资对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateSalary(ConstructionUserUpdateSalaryReq req) {
|
||||
Long id = req.getId();
|
||||
Long salary = req.getSalary();
|
||||
// 判断对应施工人员是否存在
|
||||
BusConstructionUser oldConstructionUser = this.getById(id);
|
||||
if (oldConstructionUser == null) {
|
||||
throw new ServiceException("施工人员信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 判断当前操作用户是否有权限
|
||||
Long userId = LoginHelper.getUserId();
|
||||
projectService.validAuth(oldConstructionUser.getProjectId(), userId);
|
||||
BusConstructionUser constructionUser = new BusConstructionUser();
|
||||
constructionUser.setId(id);
|
||||
// 修改薪水
|
||||
constructionUser.setSalary(Objects.requireNonNullElse(salary, 0L));
|
||||
// 操作数据库
|
||||
return this.updateById(constructionUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改施工人员打卡状态
|
||||
*
|
||||
* @param req 修改施工人员打卡状态对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateClock(ConstructionUserUpdateClockReq req) {
|
||||
Long id = req.getId();
|
||||
String clock = req.getClock();
|
||||
// 判断对应施工人员是否存在
|
||||
BusConstructionUser oldConstructionUser = this.getById(id);
|
||||
if (oldConstructionUser == null) {
|
||||
throw new ServiceException("施工人员信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
// 判断当前操作用户是否有权限
|
||||
Long userId = LoginHelper.getUserId();
|
||||
projectService.validAuth(oldConstructionUser.getProjectId(), userId);
|
||||
if (clock.equals(oldConstructionUser.getClock())) {
|
||||
return true;
|
||||
}
|
||||
BusConstructionUser constructionUser = new BusConstructionUser();
|
||||
constructionUser.setId(id);
|
||||
constructionUser.setClock(clock);
|
||||
return this.updateById(constructionUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改施工人员项目(人员迁移)
|
||||
*
|
||||
@ -193,6 +277,86 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
return this.update(lambdaUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改施工人员状态
|
||||
*
|
||||
* @param req 批量修改施工人员状态对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchUpdateStatus(ConstructionUserBatchUpdateStatusReq req) {
|
||||
List<Long> idList = req.getIdList();
|
||||
String status = req.getStatus();
|
||||
// 查询对应数据是否存在
|
||||
if (CollUtil.isEmpty(idList)) {
|
||||
throw new ServiceException("施工人员 id 不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
List<BusConstructionUser> constructionUserList = this.listByIds(idList);
|
||||
// 判断对应数据是否都存在
|
||||
if (constructionUserList.size() != idList.size()) {
|
||||
throw new ServiceException("修改施工人员状态失败,数据缺失", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 判断当前操作用户是否有权限
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<Long> projectIdList = constructionUserList.stream()
|
||||
.map(BusConstructionUser::getProjectId)
|
||||
.distinct().toList();
|
||||
projectService.validAuth(projectIdList, userId);
|
||||
// 批量修改
|
||||
List<BusConstructionUser> 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<BusConstructionUser> 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<BusConstructionU
|
||||
Long projectId = entity.getProjectId();
|
||||
// 校验分包公司id和对应项目是否存在
|
||||
Long contractorId = entity.getContractorId();
|
||||
String typeOfWork = entity.getTypeOfWork();
|
||||
String wageMeasureUnit = entity.getWageMeasureUnit();
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (create) {
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (contractorId == null) {
|
||||
throw new ServiceException("分包公司 id 不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isEmpty(typeOfWork)) {
|
||||
throw new ServiceException("工种不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isEmpty(wageMeasureUnit)) {
|
||||
throw new ServiceException("工资计量单位不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
if (projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
if (contractorId != null && contractorService.getById(contractorId) == null) {
|
||||
throw new ServiceException("对应分包公司不存在", HttpStatus.NOT_FOUND);
|
||||
if (contractorId != null) {
|
||||
BusContractor contractor = contractorService.getById(contractorId);
|
||||
if (contractor == null) {
|
||||
throw new ServiceException("分包单位信息不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long contractorProjectId = contractor.getProjectId();
|
||||
if (!projectId.equals(contractorProjectId)) {
|
||||
throw new ServiceException("分包单位不属于当前项目,请重新选择", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(wageMeasureUnit) && StringUtils.isNotEmpty(typeOfWork)) {
|
||||
LambdaQueryWrapper<BusWorkWage> 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<BusConstructionU
|
||||
// 判断是否有权限操作对应项目下的内容
|
||||
projectService.validAuth(projectIdList, userId);
|
||||
// 判断待删除的人员是否存在于班组
|
||||
QueryWrapper<BusProjectTeamMember> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("member_id", ids);
|
||||
if (projectTeamMemberService.count(queryWrapper) > 0) {
|
||||
throw new ServiceException("删除施工人员失败,施工人员存在于班组中", HttpStatus.BAD_REQUEST);
|
||||
LambdaQueryWrapper<BusProjectTeamMember> 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<BusConstructionUserFile> 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<BusConstructionU
|
||||
if (teamId != null) {
|
||||
constructionUserVo.setTeamVo(projectTeamService.queryById(teamId));
|
||||
}
|
||||
// 关联查询薪水标准
|
||||
Long projectId = constructionUser.getProjectId();
|
||||
String typeOfWork = constructionUser.getTypeOfWork();
|
||||
String wageMeasureUnit = constructionUser.getWageMeasureUnit();
|
||||
if (projectId != null && StringUtils.isNotEmpty(typeOfWork) && StringUtils.isNotEmpty(wageMeasureUnit)) {
|
||||
LambdaQueryWrapper<BusWorkWage> 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<BusConstructionU
|
||||
String yhkOpeningBank = req.getYhkOpeningBank();
|
||||
String yhkCardholder = req.getYhkCardholder();
|
||||
String typeOfWork = req.getTypeOfWork();
|
||||
String wageMeasureUnit = req.getWageMeasureUnit();
|
||||
String clock = req.getClock();
|
||||
Long salary = req.getSalary();
|
||||
String remark = req.getRemark();
|
||||
@ -336,6 +548,7 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), BusConstructionUser::getTypeOfWork, typeOfWork);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(clock), BusConstructionUser::getClock, clock);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(salary), BusConstructionUser::getSalary, salary);
|
||||
lqw.eq(StringUtils.isNotBlank(wageMeasureUnit), BusConstructionUser::getWageMeasureUnit, wageMeasureUnit);
|
||||
// 精准查询,不等于
|
||||
if (ObjectUtils.isNotEmpty(notTeamId)) {
|
||||
lqw.and(wrapper -> wrapper
|
||||
@ -382,6 +595,16 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<BusProjectTeam>> teamIdTeamMap = projectTeamService.listByIds(teamIdSet).stream()
|
||||
.collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
// 关联查询工资标准
|
||||
LambdaQueryWrapper<BusWorkWage> 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<String, Long> workWageMap = workWageService.list(workWageLqw).stream().collect(Collectors.toMap(
|
||||
workWage -> workWage.getWorkType() + "_" + workWage.getWageMeasureUnit(),
|
||||
BusWorkWage::getWage,
|
||||
(wage1, wage2) -> wage1
|
||||
));
|
||||
// 填充信息
|
||||
List<BusConstructionUserVo> constructionUserVoList = constructionUserList.stream().map(constructionUser -> {
|
||||
BusConstructionUserVo constructionUserVo = new BusConstructionUserVo();
|
||||
@ -400,6 +623,13 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
team = projectTeamService.getVo(teamIdTeamMap.get(teamId).get(0));
|
||||
}
|
||||
constructionUserVo.setTeamVo(team);
|
||||
// 关联工资标准
|
||||
// 构造相应的 key
|
||||
String key = constructionUser.getTypeOfWork() + "_" + constructionUser.getWageMeasureUnit();
|
||||
// 如果映射中存在对应的数据,则设置工资
|
||||
if (workWageMap.containsKey(key)) {
|
||||
constructionUserVo.setStandardSalary(workWageMap.get(key));
|
||||
}
|
||||
return constructionUserVo;
|
||||
}).toList();
|
||||
constructionUserVoPage.setRecords(constructionUserVoList);
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.project.mapper.BusConstructionUserFileMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user