diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java index 7b30964..76b767b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java @@ -93,6 +93,13 @@ public class AppBgtProjectRecruitApplyController extends BaseController { return AjaxResult.success(iBgtProjectRecruitApplyService.confirm(id)); } + @ApiOperation("App检查材料") + @GetMapping("/check/{id}") + public AjaxResult check(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(false); + } + @ApiOperation("App务工者退场") @Log(title = "App务工者退场", businessType = BusinessType.UPDATE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/UploadZipController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/UploadZipController.java index 3ad9717..042c47e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/UploadZipController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/UploadZipController.java @@ -1,6 +1,15 @@ package com.ruoyi.web.controller.common; +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.service.IBgtProjectRecruitService; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.domain.Annex; +import com.ruoyi.common.domain.AnnexRecord; +import com.ruoyi.common.service.IAnnexRecordService; +import com.ruoyi.common.service.IAnnexService; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.wgz.domain.WgzUser; import com.ruoyi.wgz.service.IWgzUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -14,6 +23,10 @@ import org.springframework.web.multipart.MultipartFile; import java.io.*; import java.nio.charset.Charset; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -27,13 +40,19 @@ import java.util.zip.ZipInputStream; @RestController() public class UploadZipController { - @Autowired - private IWgzUserService wgzUserService; - @Autowired - private IBgtProjectRecruitService recruitService; + private final IWgzUserService wgzUserService; - private static final String TEMP_DIR = "ruoyi/uploadPath/temporary"; + private final IBgtProjectRecruitService recruitService; + + private final IAnnexService annexService; + + private final IAnnexRecordService annexRecordService; + + private static final String TEMP_DIR = "ruoyi/uploadPath/temporaryZip"; + + private static final String SAVE_DIR = "ruoyi/uploadPath/recruit"; + private static final String RECORD_DIR = "ruoyi/uploadPath/record"; @ApiOperation("上传压缩文件") @@ -52,13 +71,18 @@ public class UploadZipController { } // 解压压缩文件 - File extractDir = new File(TEMP_DIR, "extracted"); + BgtProjectRecruit recruit = recruitService.queryById(recruitId); + String firstLevelFolderName = recruit.getId() + "_" + recruit.getRecruitName(); + File extractDir = new File(TEMP_DIR, firstLevelFolderName); ensureDirectoryExists(extractDir); extractZipFile(zipFile, extractDir); // 处理解压后的文件夹 processExtractedFolder(extractDir, recruitId); + // 将解压后的文件移动到 SAVE_DIR 和 RECORD_DIR + moveFilesToSaveDir(extractDir, recruitId); + // 删除临时文件和文件夹 deleteFolder(extractDir); if (!zipFile.delete()) { @@ -121,33 +145,26 @@ public class UploadZipController { File[] firstLevelFiles = extractDir.listFiles(); if (firstLevelFiles != null) { for (File firstLevelFile : firstLevelFiles) { + String firstLevelFolderName = firstLevelFile.getName(); + System.out.println("第一层文件夹名称: " + firstLevelFolderName); + String[] split = firstLevelFolderName.split("_"); + String card = split[1]; + WgzUser wgzUser = wgzUserService.findByIdentityCard(card); if (firstLevelFile.isDirectory()) { File[] secondLevelFiles = firstLevelFile.listFiles(); if (secondLevelFiles != null) { for (File secondLevelFile : secondLevelFiles) { + String secondLevelFolderName = secondLevelFile.getName(); + System.out.println("第二层文件夹名称: " + secondLevelFolderName); if (secondLevelFile.isDirectory()) { File[] thirdLevelFiles = secondLevelFile.listFiles(); if (thirdLevelFiles != null) { - for (File thirdLevelFile : thirdLevelFiles) { - if (!thirdLevelFile.isDirectory()) { - String fullPath = firstLevelFile.getName() + "/" + secondLevelFile.getName() + "/" + thirdLevelFile.getName(); - System.out.println("完整路径: " + fullPath); - String thirdLevelFolderName = secondLevelFile.getName(); - System.out.println("第三层文件夹名称: " + thirdLevelFolderName); - // 这里可以添加你需要的处理逻辑,比如保存到数据库等 - // 以下是数据库操作示例,根据实际情况修改 - String folderName = secondLevelFile.getName(); - String[] parts = folderName.split("_"); - if (parts.length > 1) { - String idCard = parts[1]; - System.out.println("身份证: " + idCard); - // 新增逻辑,根据实际情况实现 - // WgzUser user = new WgzUser(); - // user.setRecruitId(recruitId); - // user.setIdentityCard(idCard); - // wgzUserService.save(user); - } - } + //删除数据库里的附件 + if("保险".equals(secondLevelFolderName)){ + annexService.deleteByUserIdAndRecruitIdAndType(wgzUser.getUserId(), recruitId, "2"); + } + if("劳务合同".equals(secondLevelFolderName)){ + annexService.deleteByUserIdAndRecruitIdAndType(wgzUser.getUserId(), recruitId, "1"); } } } @@ -158,6 +175,180 @@ public class UploadZipController { } } + private void moveFilesToSaveDir(File sourceDir, Long recruitId) throws IOException { + // 移动到 SAVE_DIR + File saveDestDir = new File(SAVE_DIR); + ensureDirectoryExists(saveDestDir); + + BgtProjectRecruit recruit = recruitService.queryById(recruitId); + String firstLevelFolderName = recruit.getId() + "_" + recruit.getRecruitName(); + File firstLevelDestDir = new File(saveDestDir, firstLevelFolderName); + ensureDirectoryExists(firstLevelDestDir); + + File[] firstLevelFiles = sourceDir.listFiles(); + List annexList = new ArrayList<>(); + if (firstLevelFiles != null) { + for (File firstLevelFile : firstLevelFiles) { + if (firstLevelFile.isDirectory()) { + String secondLevelName = firstLevelFile.getName(); + File secondLevelDestDir = new File(firstLevelDestDir, secondLevelName); + if (secondLevelDestDir.exists()) { + // 删除和解压出来的二级目录同名字的目录 + deleteFolder(secondLevelDestDir); + } + moveFilesRecursively(firstLevelFile, firstLevelDestDir,annexList,recruitId); + } + } + } + if(CollectionUtil.isNotEmpty(annexList)){ + annexService.saveBatch(annexList); + } + + // 移动到 RECORD_DIR + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); + String timeStamp = LocalDateTime.now().format(formatter); + File recordDestDir = new File(RECORD_DIR, firstLevelFolderName); + ensureDirectoryExists(recordDestDir); + + List annexRecordList = new ArrayList<>(); + moveFilesToRecordDirRecursively(sourceDir, recordDestDir, timeStamp,annexRecordList,recruitId); + + if(CollectionUtil.isNotEmpty(annexRecordList)){ + annexRecordService.saveBatch(annexRecordList); + } + } + + private void moveFilesRecursively(File source, File destination,List annexList,Long recruitId) throws IOException { + if (source.isDirectory()) { + File newDir = new File(destination, source.getName()); + ensureDirectoryExists(newDir); + File[] files = source.listFiles(); + if (files != null) { + for (File file : files) { + moveFilesRecursively(file, newDir,annexList,recruitId); + } + } + } else { + File destFile = new File(destination, source.getName()); + ensureDirectoryExists(destFile.getParentFile()); + try (InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(destFile)) { + byte[] buffer = new byte[4096]; + int length; + while ((length = in.read(buffer)) > 0) { + out.write(buffer, 0, length); + } + } + String relativePath = SAVE_DIR + File.separator + getRelativePath(source, new File(TEMP_DIR)); + relativePath = relativePath.replace("\\", "/").replace("ruoyi/uploadPath", "/profile"); + System.out.println("文件在项目里的相对目录: " + relativePath); + //存到数据库 + String parentName= destination.getParentFile().getName(); + System.out.println("上上一级文件名: "+parentName); + String[] split = parentName.split("_"); + String card = split[1]; + WgzUser wgzUser = wgzUserService.findByIdentityCard(card); + + String name = destination.getName(); + System.out.println("上一级文件名: "+name); + String type = ""; + if("保险".equals(name)){ + type= "2"; + } + if("劳务合同".equals(name)){ + type="1"; + } + Annex annex = new Annex(); + annex.setAnnexName(destFile.getName()); + annex.setAnnexUrl(relativePath); + annex.setAnnexType(type); + annex.setUserType(Constants.WGZ); + annex.setUserId(wgzUser.getUserId()); + annex.setRecruitId(recruitId); + annex.setCreateBy(SecurityUtils.getUsername()); + annex.setUpdateBy(SecurityUtils.getUsername()); + annexList.add(annex); + + } + } + + private void moveFilesToRecordDirRecursively(File source, File destination, String timeStamp, List annexRecordList, Long recruitId) throws IOException { + if (source.isDirectory()) { + String folderName = source.getName(); + String[] parts = folderName.split("_"); + if (parts.length > 0 && parts[0].matches("\\d+") && parts.length > 1) { + // 如果parts第一部分是数字并且长度大于1,跳过这一级目录的创建,直接处理下一级目录 + File[] files = source.listFiles(); + if (files != null) { + for (File file : files) { + moveFilesToRecordDirRecursively(file, destination, timeStamp,annexRecordList,recruitId); + } + } + } else { + if (parts.length > 1) { + folderName = folderName + "_" + timeStamp; + } + File newDir = new File(destination, folderName); + ensureDirectoryExists(newDir); + File[] files = source.listFiles(); + if (files != null) { + for (File file : files) { + moveFilesToRecordDirRecursively(file, newDir, timeStamp,annexRecordList,recruitId); + } + } + } + } else { + File destFile = new File(destination, source.getName()); + ensureDirectoryExists(destFile.getParentFile()); + try (InputStream in = new FileInputStream(source); + OutputStream out = new FileOutputStream(destFile)) { + byte[] buffer = new byte[4096]; + int length; + while ((length = in.read(buffer)) > 0) { + out.write(buffer, 0, length); + } + } + String relativePath = RECORD_DIR + File.separator + getRelativePath(source, new File(TEMP_DIR)); + relativePath = relativePath.replace("\\", "/").replace("ruoyi/uploadPath", "/profile"); + System.out.println("文件在记录目录里的相对目录: " + relativePath); + + //存到数据库作为记录 + String parentName= destination.getParentFile().getName(); + System.out.println("上上一级文件名: "+parentName); + String[] split = parentName.split("_"); + String card = split[1]; + WgzUser wgzUser = wgzUserService.findByIdentityCard(card); + + String name = destination.getName(); + System.out.println("上一级文件名: "+name); + String type = ""; + if("保险".equals(name)){ + type= "2"; + } + if("劳务合同".equals(name)){ + type="1"; + } + AnnexRecord annex = new AnnexRecord(); + annex.setAnnexName(destFile.getName()); + annex.setAnnexUrl(relativePath); + annex.setAnnexType(type); + annex.setUserType(Constants.WGZ); + annex.setUserId(wgzUser.getUserId()); + annex.setRecruitId(recruitId); + annex.setCreateBy(SecurityUtils.getUsername()); + annex.setUpdateBy(SecurityUtils.getUsername()); + annex.setCreateUserId(SecurityUtils.getAppUserId()); + annex.setCreateUserType(Constants.BGT); + annexRecordList.add(annex); + + } + } + + private String getRelativePath(File file, File baseDir) { + String filePath = file.getAbsolutePath(); + String basePath = baseDir.getAbsolutePath(); + return filePath.substring(basePath.length() + 1); + } private static void deleteFolder(File folder) { if (folder.isDirectory()) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java index 3e4acd8..82b8934 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java @@ -41,6 +41,6 @@ public class BgtMessageDetailDTO { private String messageSmallType; @ApiModelProperty("是否待处理") - private Boolean isHandle; + private Boolean isHandle = false; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageCountVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageCountVO.java index 1e8a3e7..e1ff636 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageCountVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageCountVO.java @@ -30,4 +30,7 @@ public class BgtMessageCountVO implements Serializable { @ApiModelProperty("其他消息") private Integer otherMessageCount; + + @ApiModelProperty("待处理消息") + private Integer handleMessageCount; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java index 7c54be4..21de93a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java @@ -2,8 +2,8 @@ package com.ruoyi.bgt.service; import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.domain.BgtMessage; -import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; +import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; import com.ruoyi.bgt.domain.vo.BgtMessageCountVO; import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.bgt.domain.vo.BgtMessageVO; @@ -84,4 +84,10 @@ public interface IBgtMessageService extends IServicePlus { * 消息详情列表 */ TableDataInfo queryDetailPageList(BgtMessageDetailDTO dto); + + /** + * operation + */ + void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java index dad0304..537d334 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.bgt.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -33,6 +34,8 @@ import com.ruoyi.wgz.domain.WgzPayCalculation; import com.ruoyi.wgz.domain.WgzReissueacard; import com.ruoyi.wgz.service.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +47,7 @@ import java.util.Map; import java.util.stream.Collectors; import static com.ruoyi.common.constants.BgtMessageConstant.*; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_ALREADY; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_NEED; /** @@ -56,30 +60,37 @@ import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_NEED public class BgtMessageServiceImpl extends ServicePlusImpl implements IBgtMessageService { @Autowired + @Lazy private IBgtProjectRecruitApplyService recruitApplyService; @Autowired private IBgtProjectRecruitService recruitService; @Autowired + @Lazy private IWgzPayCalculationService payCalculationService; @Autowired + @Lazy private IWgzLeaveService leaveService; @Autowired private IWgzUserService wgzUserService; @Autowired + @Lazy private IWgzReissueacardService reissueacardService; @Autowired + @Lazy private IFbsProjectTaskService taskService; @Autowired + @Lazy private IWgzDailyClockService dailyClockService; @Autowired + @Lazy private IBgtWageApplicationService wageApplicationService; @Override @@ -170,6 +181,8 @@ public class BgtMessageServiceImpl extends ServicePlusImpl handleList = bgtMessages.stream().filter(bgtMessage -> OPERATION_NEED.equals(bgtMessage.getIsOperation())).collect(Collectors.toList()); + bgtMessageCountVO.setHandleMessageCount(handleList.size()); return bgtMessageCountVO; } @@ -251,4 +264,21 @@ public class BgtMessageServiceImpl extends ServicePlusImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BgtMessage::getRecipientId, recipientId); + wrapper.eq(BgtMessage::getRecipientType, recipientType); + wrapper.eq(BgtMessage::getSenderId, senderId); + wrapper.eq(BgtMessage::getSenderType, senderType); + wrapper.eq(BgtMessage::getTableId, tableId); + wrapper.eq(BgtMessage::getTableName, tableName); + List list = list(wrapper); + if (CollUtil.isNotEmpty(list)) { + lambdaUpdate().in(BgtMessage::getId, list.stream().map(BgtMessage::getId).collect(Collectors.toList())) + .set(BgtMessage::getIsOperation, OPERATION_ALREADY).update(); + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java index ede47fc..cc4b23c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java @@ -278,6 +278,10 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl list(@Validated AnnexRecordQueryBo bo) { + return iCommonAnnexRecordService.queryPageList(bo); + } + + /** + * 导出附件上传记录列表 + */ + @ApiOperation("导出附件上传记录列表") + @PreAuthorize("@ss.hasPermi('common:record:export')") + @Log(title = "附件上传记录", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(@Validated AnnexRecordQueryBo bo) { + List list = iCommonAnnexRecordService.queryList(bo); + ExcelUtil util = new ExcelUtil(AnnexRecord.class); + return util.exportExcel(list, "附件上传记录"); + } + + /** + * 获取附件上传记录详细信息 + */ + @ApiOperation("获取附件上传记录详细信息") + @PreAuthorize("@ss.hasPermi('common:record:query')") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iCommonAnnexRecordService.queryById(id)); + } + + /** + * 新增附件上传记录 + */ + @ApiOperation("新增附件上传记录") + @PreAuthorize("@ss.hasPermi('common:record:add')") + @Log(title = "附件上传记录", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping() + public AjaxResult add(@Validated @RequestBody AnnexRecord bo) { + return toAjax(iCommonAnnexRecordService.insert(bo) ? 1 : 0); + } + + /** + * 修改附件上传记录 + */ + @ApiOperation("修改附件上传记录") + @PreAuthorize("@ss.hasPermi('common:record:edit')") + @Log(title = "附件上传记录", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody AnnexRecord bo) { + return toAjax(iCommonAnnexRecordService.update(bo) ? 1 : 0); + } + + /** + * 删除附件上传记录 + */ + @ApiOperation("删除附件上传记录") + @PreAuthorize("@ss.hasPermi('common:record:remove')") + @Log(title = "附件上传记录" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iCommonAnnexRecordService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/domain/Annex.java b/ruoyi-system/src/main/java/com/ruoyi/common/domain/Annex.java index 31c9db8..2567daf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/domain/Annex.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/domain/Annex.java @@ -42,7 +42,7 @@ public class Annex implements Serializable { private String userType; @ApiModelProperty("招工任务ID") - private String recruitId; + private Long recruitId; /** 附件类型 */ @Excel(name = "附件类型") diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/domain/AnnexRecord.java b/ruoyi-system/src/main/java/com/ruoyi/common/domain/AnnexRecord.java new file mode 100644 index 0000000..258e256 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/common/domain/AnnexRecord.java @@ -0,0 +1,111 @@ +package com.ruoyi.common.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 附件上传记录对象 common_annex_record + * + * @author ruoyi + * @date 2025-03-20 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("common_annex_record") +@ApiModel("附件上传记录视图对象") +public class AnnexRecord implements Serializable { + + private static final long serialVersionUID=1L; + + /** 主键ID */ + @ApiModelProperty("主键ID") + @TableId(value = "id") + private Long id; + + /** 唯一标识 */ + @Excel(name = "唯一标识") + @ApiModelProperty("唯一标识") + private Long userId; + + /** 用户类型 */ + @Excel(name = "用户类型") + @ApiModelProperty("用户类型") + private String userType; + + /** 招工任务ID */ + @Excel(name = "招工任务ID") + @ApiModelProperty("招工任务ID") + private Long recruitId; + + /** 附件类型 */ + @Excel(name = "附件类型") + @ApiModelProperty("附件类型") + private String annexType; + + /** 附件名 */ + @Excel(name = "附件名") + @ApiModelProperty("附件名") + private String annexName; + + /** 附件地址 */ + @Excel(name = "附件地址") + @ApiModelProperty("附件地址") + private String annexUrl; + + /** 创建者唯一标识 */ + @Excel(name = "创建者唯一标识") + @ApiModelProperty("创建者唯一标识") + private Long createUserId; + + /** 创建者用户类型 */ + @Excel(name = "创建者用户类型") + @ApiModelProperty("创建者用户类型") + private String createUserType; + + /** 删除标志(0代表存在 2代表删除) */ + @Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除") + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + /** 创建者 */ + @Excel(name = "创建者") + @ApiModelProperty("创建者") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** 更新者 */ + @Excel(name = "更新者") + @ApiModelProperty("更新者") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 更新时间 */ + @Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** 备注 */ + @Excel(name = "备注") + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/mapper/AnnexRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/common/mapper/AnnexRecordMapper.java new file mode 100644 index 0000000..a1b0bc9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/common/mapper/AnnexRecordMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.mapper; + +import com.ruoyi.common.domain.AnnexRecord; +import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; +import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; +import org.apache.ibatis.annotations.CacheNamespace; + +/** + * 附件上传记录Mapper接口 + * + * @author ruoyi + * @date 2025-03-20 + */ +// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象 +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) +public interface AnnexRecordMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexRecordService.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexRecordService.java new file mode 100644 index 0000000..9bf7299 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexRecordService.java @@ -0,0 +1,55 @@ +package com.ruoyi.common.service; + +import com.ruoyi.common.domain.AnnexRecord; +import com.ruoyi.common.bo.AnnexRecordQueryBo; +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; + +import java.util.Collection; +import java.util.List; + +/** + * 附件上传记录Service接口 + * + * @author ruoyi + * @date 2025-03-20 + */ +public interface IAnnexRecordService extends IServicePlus { + /** + * 查询单个 + * @return + */ + AnnexRecord queryById(Long id); + + /** + * 查询列表 + */ + TableDataInfo queryPageList(AnnexRecordQueryBo bo); + + /** + * 查询列表 + */ + List queryList(AnnexRecordQueryBo bo); + + /** + * 根据新增业务对象插入附件上传记录 + * @param bo 附件上传记录新增业务对象 + * @return + */ + Boolean insert(AnnexRecord bo); + + /** + * 根据编辑业务对象修改附件上传记录 + * @param bo 附件上传记录编辑业务对象 + * @return + */ + Boolean update(AnnexRecord bo); + + /** + * 校验并删除数据 + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexService.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexService.java index 1932f03..aae3a6a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/IAnnexService.java @@ -80,4 +80,10 @@ public interface IAnnexService extends IServicePlus { * 根据务工者唯一标识+招工标识 得到附件信息 */ List findByUserIdAndRecruitId(Long userId,Long recruitId,String[] types); + + /** + * 根据务工者唯一标识+招工标识+附件类型 删除文件 + */ + void deleteByUserIdAndRecruitIdAndType(Long userId,Long recruitId,String type); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexRecordServiceImpl.java new file mode 100644 index 0000000..fce8514 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexRecordServiceImpl.java @@ -0,0 +1,90 @@ +package com.ruoyi.common.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.bo.AnnexRecordQueryBo; +import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.domain.AnnexRecord; +import com.ruoyi.common.mapper.AnnexRecordMapper; +import com.ruoyi.common.service.IAnnexRecordService; +import com.ruoyi.common.utils.PageUtils; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 附件上传记录Service业务层处理 + * + * @author ruoyi + * @date 2025-03-20 + */ +@Service +public class AnnexRecordServiceImpl extends ServicePlusImpl implements IAnnexRecordService { + + @Override + public AnnexRecord queryById(Long id){ + return getById(id); + } + + @Override + public TableDataInfo queryPageList(AnnexRecordQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List queryList(AnnexRecordQueryBo bo) { + return list(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper buildQueryWrapper(AnnexRecordQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getUserId() != null, AnnexRecord::getUserId, bo.getUserId()); + lqw.eq(StrUtil.isNotBlank(bo.getUserType()), AnnexRecord::getUserType, bo.getUserType()); + lqw.eq(bo.getRecruitId() != null, AnnexRecord::getRecruitId, bo.getRecruitId()); + lqw.eq(StrUtil.isNotBlank(bo.getAnnexType()), AnnexRecord::getAnnexType, bo.getAnnexType()); + lqw.like(StrUtil.isNotBlank(bo.getAnnexName()), AnnexRecord::getAnnexName, bo.getAnnexName()); + lqw.eq(StrUtil.isNotBlank(bo.getAnnexUrl()), AnnexRecord::getAnnexUrl, bo.getAnnexUrl()); + lqw.eq(bo.getCreateUserId() != null, AnnexRecord::getCreateUserId, bo.getCreateUserId()); + lqw.eq(StrUtil.isNotBlank(bo.getCreateUserType()), AnnexRecord::getCreateUserType, bo.getCreateUserType()); + return lqw; + } + + @Override + public Boolean insert(AnnexRecord bo) { + AnnexRecord add = BeanUtil.toBean(bo, AnnexRecord.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean update(AnnexRecord bo) { + AnnexRecord update = BeanUtil.toBean(bo, AnnexRecord.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(AnnexRecord entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexServiceImpl.java index 0650ae3..359505e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/service/impl/AnnexServiceImpl.java @@ -158,4 +158,10 @@ public class AnnexServiceImpl extends ServicePlusImpl implem in(Annex::getAnnexType,types); return baseMapper.selectList(wra); } + + @Override + public void deleteByUserIdAndRecruitIdAndType(Long userId, Long recruitId, String type) { + baseMapper.delete(Wrappers.lambdaQuery().eq(Annex::getUserId,userId) + .eq(Annex::getRecruitId,recruitId).eq(Annex::getAnnexType,type).eq(Annex::getUserType,WGZ)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzUserService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzUserService.java index 62258cf..c692b4c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzUserService.java @@ -97,4 +97,9 @@ public interface IWgzUserService extends IServicePlus { * 根据务工者唯一标识获取数据 */ WgzUser findByUserId(Long userId); + + /** + * 根据务工者身份证获取数据 + */ + WgzUser findByIdentityCard(String identityCard); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java index 96c095b..c2f970a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java @@ -390,6 +390,9 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl list = iWgzPayCalculationMiddleService.list(Wrappers.lambdaQuery() .eq(WgzPayCalculationMiddle::getCalculationId, dto.getId())); @@ -445,6 +446,10 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl return baseMapper.selectOne(new LambdaQueryWrapper().eq(WgzUser::getUserId, userId)); } + @Override + public WgzUser findByIdentityCard(String identityCard) { + return baseMapper.selectOne(new LambdaQueryWrapper().eq(WgzUser::getIdentityCard, identityCard)); + } }