This commit is contained in:
zt
2025-03-20 15:55:08 +08:00
parent 7fcb637b1e
commit 1dc93404b5
22 changed files with 755 additions and 39 deletions

View File

@ -93,6 +93,13 @@ public class AppBgtProjectRecruitApplyController extends BaseController {
return AjaxResult.success(iBgtProjectRecruitApplyService.confirm(id)); return AjaxResult.success(iBgtProjectRecruitApplyService.confirm(id));
} }
@ApiOperation("App检查材料")
@GetMapping("/check/{id}")
public AjaxResult<Boolean> check(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
return AjaxResult.success(false);
}
@ApiOperation("App务工者退场") @ApiOperation("App务工者退场")
@Log(title = "App务工者退场", businessType = BusinessType.UPDATE) @Log(title = "App务工者退场", businessType = BusinessType.UPDATE)

View File

@ -1,6 +1,15 @@
package com.ruoyi.web.controller.common; 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.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 com.ruoyi.wgz.service.IWgzUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -14,6 +23,10 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.nio.charset.Charset; 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.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
@ -27,13 +40,19 @@ import java.util.zip.ZipInputStream;
@RestController() @RestController()
public class UploadZipController { public class UploadZipController {
@Autowired
private IWgzUserService wgzUserService;
@Autowired private final IWgzUserService wgzUserService;
private IBgtProjectRecruitService recruitService;
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("上传压缩文件") @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); ensureDirectoryExists(extractDir);
extractZipFile(zipFile, extractDir); extractZipFile(zipFile, extractDir);
// 处理解压后的文件夹 // 处理解压后的文件夹
processExtractedFolder(extractDir, recruitId); processExtractedFolder(extractDir, recruitId);
// 将解压后的文件移动到 SAVE_DIR 和 RECORD_DIR
moveFilesToSaveDir(extractDir, recruitId);
// 删除临时文件和文件夹 // 删除临时文件和文件夹
deleteFolder(extractDir); deleteFolder(extractDir);
if (!zipFile.delete()) { if (!zipFile.delete()) {
@ -121,33 +145,26 @@ public class UploadZipController {
File[] firstLevelFiles = extractDir.listFiles(); File[] firstLevelFiles = extractDir.listFiles();
if (firstLevelFiles != null) { if (firstLevelFiles != null) {
for (File firstLevelFile : firstLevelFiles) { 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()) { if (firstLevelFile.isDirectory()) {
File[] secondLevelFiles = firstLevelFile.listFiles(); File[] secondLevelFiles = firstLevelFile.listFiles();
if (secondLevelFiles != null) { if (secondLevelFiles != null) {
for (File secondLevelFile : secondLevelFiles) { for (File secondLevelFile : secondLevelFiles) {
String secondLevelFolderName = secondLevelFile.getName();
System.out.println("第二层文件夹名称: " + secondLevelFolderName);
if (secondLevelFile.isDirectory()) { if (secondLevelFile.isDirectory()) {
File[] thirdLevelFiles = secondLevelFile.listFiles(); File[] thirdLevelFiles = secondLevelFile.listFiles();
if (thirdLevelFiles != null) { if (thirdLevelFiles != null) {
for (File thirdLevelFile : thirdLevelFiles) { //删除数据库里的附件
if (!thirdLevelFile.isDirectory()) { if("保险".equals(secondLevelFolderName)){
String fullPath = firstLevelFile.getName() + "/" + secondLevelFile.getName() + "/" + thirdLevelFile.getName(); annexService.deleteByUserIdAndRecruitIdAndType(wgzUser.getUserId(), recruitId, "2");
System.out.println("完整路径: " + fullPath); }
String thirdLevelFolderName = secondLevelFile.getName(); if("劳务合同".equals(secondLevelFolderName)){
System.out.println("第三层文件夹名称: " + thirdLevelFolderName); annexService.deleteByUserIdAndRecruitIdAndType(wgzUser.getUserId(), recruitId, "1");
// 这里可以添加你需要的处理逻辑,比如保存到数据库等
// 以下是数据库操作示例,根据实际情况修改
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);
}
}
} }
} }
} }
@ -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<Annex> 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<AnnexRecord> annexRecordList = new ArrayList<>();
moveFilesToRecordDirRecursively(sourceDir, recordDestDir, timeStamp,annexRecordList,recruitId);
if(CollectionUtil.isNotEmpty(annexRecordList)){
annexRecordService.saveBatch(annexRecordList);
}
}
private void moveFilesRecursively(File source, File destination,List<Annex> 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<AnnexRecord> 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) { private static void deleteFolder(File folder) {
if (folder.isDirectory()) { if (folder.isDirectory()) {

View File

@ -41,6 +41,6 @@ public class BgtMessageDetailDTO {
private String messageSmallType; private String messageSmallType;
@ApiModelProperty("是否待处理") @ApiModelProperty("是否待处理")
private Boolean isHandle; private Boolean isHandle = false;
} }

View File

@ -30,4 +30,7 @@ public class BgtMessageCountVO implements Serializable {
@ApiModelProperty("其他消息") @ApiModelProperty("其他消息")
private Integer otherMessageCount; private Integer otherMessageCount;
@ApiModelProperty("待处理消息")
private Integer handleMessageCount;
} }

View File

@ -2,8 +2,8 @@ package com.ruoyi.bgt.service;
import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.bo.BgtMessageQueryBo;
import com.ruoyi.bgt.domain.BgtMessage; 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.BgtMessageDetailDTO;
import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO;
import com.ruoyi.bgt.domain.vo.BgtMessageCountVO; import com.ruoyi.bgt.domain.vo.BgtMessageCountVO;
import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO;
import com.ruoyi.bgt.domain.vo.BgtMessageVO; import com.ruoyi.bgt.domain.vo.BgtMessageVO;
@ -84,4 +84,10 @@ public interface IBgtMessageService extends IServicePlus<BgtMessage> {
* 消息详情列表 * 消息详情列表
*/ */
TableDataInfo<BgtMessageDetailVO> queryDetailPageList(BgtMessageDetailDTO dto); TableDataInfo<BgtMessageDetailVO> queryDetailPageList(BgtMessageDetailDTO dto);
/**
* operation
*/
void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName);
} }

View File

@ -1,6 +1,7 @@
package com.ruoyi.bgt.service.impl; package com.ruoyi.bgt.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.domain.WgzReissueacard;
import com.ruoyi.wgz.service.*; import com.ruoyi.wgz.service.*;
import org.springframework.beans.factory.annotation.Autowired; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -44,6 +47,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.ruoyi.common.constants.BgtMessageConstant.*; 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; 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<BgtMessageMapper, BgtMessage> implements IBgtMessageService { public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, BgtMessage> implements IBgtMessageService {
@Autowired @Autowired
@Lazy
private IBgtProjectRecruitApplyService recruitApplyService; private IBgtProjectRecruitApplyService recruitApplyService;
@Autowired @Autowired
private IBgtProjectRecruitService recruitService; private IBgtProjectRecruitService recruitService;
@Autowired @Autowired
@Lazy
private IWgzPayCalculationService payCalculationService; private IWgzPayCalculationService payCalculationService;
@Autowired @Autowired
@Lazy
private IWgzLeaveService leaveService; private IWgzLeaveService leaveService;
@Autowired @Autowired
private IWgzUserService wgzUserService; private IWgzUserService wgzUserService;
@Autowired @Autowired
@Lazy
private IWgzReissueacardService reissueacardService; private IWgzReissueacardService reissueacardService;
@Autowired @Autowired
@Lazy
private IFbsProjectTaskService taskService; private IFbsProjectTaskService taskService;
@Autowired @Autowired
@Lazy
private IWgzDailyClockService dailyClockService; private IWgzDailyClockService dailyClockService;
@Autowired @Autowired
@Lazy
private IBgtWageApplicationService wageApplicationService; private IBgtWageApplicationService wageApplicationService;
@Override @Override
@ -170,6 +181,8 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
bgtMessageCountVO.setTaskMessageCount(map.getOrDefault(BgtMessageType.TASK.getCode(), 0L).intValue()); bgtMessageCountVO.setTaskMessageCount(map.getOrDefault(BgtMessageType.TASK.getCode(), 0L).intValue());
bgtMessageCountVO.setSettlementMessageCount(map.getOrDefault(BgtMessageType.SETTLEMENT.getCode(), 0L).intValue()); bgtMessageCountVO.setSettlementMessageCount(map.getOrDefault(BgtMessageType.SETTLEMENT.getCode(), 0L).intValue());
bgtMessageCountVO.setOtherMessageCount(map.getOrDefault(BgtMessageType.OTHER.getCode(), 0L).intValue()); bgtMessageCountVO.setOtherMessageCount(map.getOrDefault(BgtMessageType.OTHER.getCode(), 0L).intValue());
List<BgtMessage> handleList = bgtMessages.stream().filter(bgtMessage -> OPERATION_NEED.equals(bgtMessage.getIsOperation())).collect(Collectors.toList());
bgtMessageCountVO.setHandleMessageCount(handleList.size());
return bgtMessageCountVO; return bgtMessageCountVO;
} }
@ -251,4 +264,21 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
bgtMessageVOPage.setRecords(bgtMessageVOS); bgtMessageVOPage.setRecords(bgtMessageVOS);
return PageUtils.buildDataInfo(bgtMessageVOPage); return PageUtils.buildDataInfo(bgtMessageVOPage);
} }
@Override
@Async
public void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName) {
LambdaQueryWrapper<BgtMessage> 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<BgtMessage> 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();
}
}
} }

View File

@ -278,6 +278,10 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
.setMessageLargeType(LARGE_APPLY) .setMessageLargeType(LARGE_APPLY)
.setIsOperation(OPERATION_NEED); .setIsOperation(OPERATION_NEED);
iWgzMessageService.sendAMessage(wgzMessage); iWgzMessageService.sendAMessage(wgzMessage);
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, recruitApply.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), recruitApply.getId(),SqlHelper.table(BgtProjectRecruitApply.class).getTableName());
return updateById(recruitApply); return updateById(recruitApply);
} }

View File

@ -0,0 +1,62 @@
package com.ruoyi.common.bo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 附件上传记录分页查询对象 common_annex_record
*
* @author ruoyi
* @date 2025-03-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("附件上传记录分页查询对象")
public class AnnexRecordQueryBo extends BaseEntity {
/** 分页大小 */
@ApiModelProperty("分页大小")
private Integer pageSize;
/** 当前页数 */
@ApiModelProperty("当前页数")
private Integer pageNum;
/** 排序列 */
@ApiModelProperty("排序列")
private String orderByColumn;
/** 排序的方向desc或者asc */
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
private String isAsc;
/** 唯一标识 */
@ApiModelProperty("唯一标识")
private Long userId;
/** 用户类型 */
@ApiModelProperty("用户类型")
private String userType;
/** 招工任务ID */
@ApiModelProperty("招工任务ID")
private Long recruitId;
/** 附件类型 */
@ApiModelProperty("附件类型")
private String annexType;
/** 附件名 */
@ApiModelProperty("附件名")
private String annexName;
/** 附件地址 */
@ApiModelProperty("附件地址")
private String annexUrl;
/** 创建者唯一标识 */
@ApiModelProperty("创建者唯一标识")
private Long createUserId;
/** 创建者用户类型 */
@ApiModelProperty("创建者用户类型")
private String createUserType;
}

View File

@ -0,0 +1,109 @@
package com.ruoyi.common.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.bo.AnnexRecordQueryBo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.domain.AnnexRecord;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.service.IAnnexRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 附件上传记录Controller
*
* @author ruoyi
* @date 2025-03-20
*/
@Api(value = "附件上传记录控制器", tags = {"附件上传记录管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/common/record")
public class AnnexRecordController extends BaseController {
private final IAnnexRecordService iCommonAnnexRecordService;
/**
* 查询附件上传记录列表
*/
@ApiOperation("查询附件上传记录列表")
@PreAuthorize("@ss.hasPermi('common:record:list')")
@GetMapping("/list")
public TableDataInfo<AnnexRecord> list(@Validated AnnexRecordQueryBo bo) {
return iCommonAnnexRecordService.queryPageList(bo);
}
/**
* 导出附件上传记录列表
*/
@ApiOperation("导出附件上传记录列表")
@PreAuthorize("@ss.hasPermi('common:record:export')")
@Log(title = "附件上传记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult<AnnexRecord> export(@Validated AnnexRecordQueryBo bo) {
List<AnnexRecord> list = iCommonAnnexRecordService.queryList(bo);
ExcelUtil<AnnexRecord> util = new ExcelUtil<AnnexRecord>(AnnexRecord.class);
return util.exportExcel(list, "附件上传记录");
}
/**
* 获取附件上传记录详细信息
*/
@ApiOperation("获取附件上传记录详细信息")
@PreAuthorize("@ss.hasPermi('common:record:query')")
@GetMapping("/{id}")
public AjaxResult<AnnexRecord> 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<Void> 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<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(iCommonAnnexRecordService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
}

View File

@ -42,7 +42,7 @@ public class Annex implements Serializable {
private String userType; private String userType;
@ApiModelProperty("招工任务ID") @ApiModelProperty("招工任务ID")
private String recruitId; private Long recruitId;
/** 附件类型 */ /** 附件类型 */
@Excel(name = "附件类型") @Excel(name = "附件类型")

View File

@ -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;
}

View File

@ -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<AnnexRecord> {
}

View File

@ -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<AnnexRecord> {
/**
* 查询单个
* @return
*/
AnnexRecord queryById(Long id);
/**
* 查询列表
*/
TableDataInfo<AnnexRecord> queryPageList(AnnexRecordQueryBo bo);
/**
* 查询列表
*/
List<AnnexRecord> 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<Long> ids, Boolean isValid);
}

View File

@ -80,4 +80,10 @@ public interface IAnnexService extends IServicePlus<Annex> {
* 根据务工者唯一标识+招工标识 得到附件信息 * 根据务工者唯一标识+招工标识 得到附件信息
*/ */
List<Annex> findByUserIdAndRecruitId(Long userId,Long recruitId,String[] types); List<Annex> findByUserIdAndRecruitId(Long userId,Long recruitId,String[] types);
/**
* 根据务工者唯一标识+招工标识+附件类型 删除文件
*/
void deleteByUserIdAndRecruitIdAndType(Long userId,Long recruitId,String type);
} }

View File

@ -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<AnnexRecordMapper, AnnexRecord> implements IAnnexRecordService {
@Override
public AnnexRecord queryById(Long id){
return getById(id);
}
@Override
public TableDataInfo<AnnexRecord> queryPageList(AnnexRecordQueryBo bo) {
Page<AnnexRecord> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
return PageUtils.buildDataInfo(result);
}
@Override
public List<AnnexRecord> queryList(AnnexRecordQueryBo bo) {
return list(buildQueryWrapper(bo));
}
private LambdaQueryWrapper<AnnexRecord> buildQueryWrapper(AnnexRecordQueryBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<AnnexRecord> 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<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return removeByIds(ids);
}
}

View File

@ -158,4 +158,10 @@ public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implem
in(Annex::getAnnexType,types); in(Annex::getAnnexType,types);
return baseMapper.selectList(wra); return baseMapper.selectList(wra);
} }
@Override
public void deleteByUserIdAndRecruitIdAndType(Long userId, Long recruitId, String type) {
baseMapper.delete(Wrappers.<Annex>lambdaQuery().eq(Annex::getUserId,userId)
.eq(Annex::getRecruitId,recruitId).eq(Annex::getAnnexType,type).eq(Annex::getUserType,WGZ));
}
} }

View File

@ -97,4 +97,9 @@ public interface IWgzUserService extends IServicePlus<WgzUser> {
* 根据务工者唯一标识获取数据 * 根据务工者唯一标识获取数据
*/ */
WgzUser findByUserId(Long userId); WgzUser findByUserId(Long userId);
/**
* 根据务工者身份证获取数据
*/
WgzUser findByIdentityCard(String identityCard);
} }

View File

@ -390,6 +390,9 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
.setMessageLargeType(LARGE_OTHER) .setMessageLargeType(LARGE_OTHER)
.setMessageSmallType(SMALL_DAILY); .setMessageSmallType(SMALL_DAILY);
iWgzMessageService.sendAMessage(wgzMessage); iWgzMessageService.sendAMessage(wgzMessage);
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, dailyClock.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), dailyClock.getId(),SqlHelper.table(WgzDailyClock.class).getTableName());
} }
} }

View File

@ -330,6 +330,10 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
attendanceService.save(wgzAttendance); attendanceService.save(wgzAttendance);
} }
} }
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, wgzLeave.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), wgzLeave.getId(),SqlHelper.table(WgzLeave.class).getTableName());
return updateById(wgzLeave); return updateById(wgzLeave);
} }

View File

@ -414,6 +414,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
BeanUtil.copyProperties(dto, payCalculation); BeanUtil.copyProperties(dto, payCalculation);
boolean isPass = AuditStatus.PASS.getCode().equals(dto.getAuditorType()); boolean isPass = AuditStatus.PASS.getCode().equals(dto.getAuditorType());
payCalculation.setAuditorTime(LocalDateTime.now()); payCalculation.setAuditorTime(LocalDateTime.now());
payCalculation.setAuditorUserName(SecurityUtils.getUsername());
if(!isPass){ if(!isPass){
List<WgzPayCalculationMiddle> list = iWgzPayCalculationMiddleService.list(Wrappers.<WgzPayCalculationMiddle>lambdaQuery() List<WgzPayCalculationMiddle> list = iWgzPayCalculationMiddleService.list(Wrappers.<WgzPayCalculationMiddle>lambdaQuery()
.eq(WgzPayCalculationMiddle::getCalculationId, dto.getId())); .eq(WgzPayCalculationMiddle::getCalculationId, dto.getId()));
@ -445,6 +446,10 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
.setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()) .setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName())
.setMessageLargeType(LARGE_SALARY); .setMessageLargeType(LARGE_SALARY);
wgzMessageService.sendAMessage(wgzMessage); wgzMessageService.sendAMessage(wgzMessage);
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, payCalculation.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), payCalculation.getId(),SqlHelper.table(WgzPayCalculation.class).getTableName());
return updateById(payCalculation); return updateById(payCalculation);
} }

View File

@ -27,10 +27,7 @@ import com.ruoyi.wgz.bo.req.WgzAppCardReplacementApplicationReq;
import com.ruoyi.wgz.bo.req.WgzAppReplacementCardRecordReq; import com.ruoyi.wgz.bo.req.WgzAppReplacementCardRecordReq;
import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes; import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes;
import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes; import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes;
import com.ruoyi.wgz.domain.WgzAttendance; import com.ruoyi.wgz.domain.*;
import com.ruoyi.wgz.domain.WgzMessage;
import com.ruoyi.wgz.domain.WgzReissueacard;
import com.ruoyi.wgz.domain.WgzUser;
import com.ruoyi.wgz.mapper.WgzReissueacardMapper; import com.ruoyi.wgz.mapper.WgzReissueacardMapper;
import com.ruoyi.wgz.service.IWgzAttendanceService; import com.ruoyi.wgz.service.IWgzAttendanceService;
import com.ruoyi.wgz.service.IWgzMessageService; import com.ruoyi.wgz.service.IWgzMessageService;
@ -292,6 +289,9 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
.setMessageLargeType(LARGE_OTHER) .setMessageLargeType(LARGE_OTHER)
.setMessageSmallType(SMALL_CARD); .setMessageSmallType(SMALL_CARD);
wgzMessageService.sendAMessage(wgzMessage); wgzMessageService.sendAMessage(wgzMessage);
//处理消息
iBgtMessageService.operation(USERTYPE_WGZ, byId.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), byId.getId(),SqlHelper.table(WgzReissueacard.class).getTableName());
return b; return b;
} }

View File

@ -8,8 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.domain.Annex;
import com.ruoyi.common.domain.dto.AnnexDTO;
import com.ruoyi.common.service.IAnnexService; import com.ruoyi.common.service.IAnnexService;
import com.ruoyi.common.util.DataUtil; import com.ruoyi.common.util.DataUtil;
import com.ruoyi.common.util.ValidUtil; import com.ruoyi.common.util.ValidUtil;
@ -31,10 +29,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.Collection;
import java.util.stream.Collectors; import java.util.List;
import java.util.Map;
import static com.ruoyi.common.constant.Constants.WGZ;
/** /**
@ -240,4 +237,8 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
return baseMapper.selectOne(new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getUserId, userId)); return baseMapper.selectOne(new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getUserId, userId));
} }
@Override
public WgzUser findByIdentityCard(String identityCard) {
return baseMapper.selectOne(new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getIdentityCard, identityCard));
}
} }