消息,确认进场
This commit is contained in:
@ -84,6 +84,15 @@ public class AppBgtProjectRecruitApplyController extends BaseController {
|
||||
return AjaxResult.success(iBgtProjectRecruitApplyService.consent(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("App确认进场")
|
||||
@Log(title = "App确认进场", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping("/confirm/{id}")
|
||||
public AjaxResult<Boolean> confirm(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iBgtProjectRecruitApplyService.confirm(id));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("App务工者退场")
|
||||
@Log(title = "App务工者退场", businessType = BusinessType.UPDATE)
|
||||
|
@ -0,0 +1,175 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(value = "网页模板上传", tags = {"网页模板上传"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController()
|
||||
public class UploadZipController {
|
||||
|
||||
@Autowired
|
||||
private IWgzUserService wgzUserService;
|
||||
|
||||
@Autowired
|
||||
private IBgtProjectRecruitService recruitService;
|
||||
|
||||
private static final String TEMP_DIR = "ruoyi/uploadPath/temporary";
|
||||
|
||||
|
||||
@ApiOperation("上传压缩文件")
|
||||
@PostMapping("/upload-zip")
|
||||
public ResponseEntity<String> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId) {
|
||||
if (file.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body("上传的文件为空");
|
||||
}
|
||||
|
||||
try {
|
||||
// 保存上传的压缩文件
|
||||
File zipFile = new File(TEMP_DIR, file.getOriginalFilename());
|
||||
ensureDirectoryExists(zipFile.getParentFile());
|
||||
try (OutputStream os = new FileOutputStream(zipFile)) {
|
||||
os.write(file.getBytes());
|
||||
}
|
||||
|
||||
// 解压压缩文件
|
||||
File extractDir = new File(TEMP_DIR, "extracted");
|
||||
ensureDirectoryExists(extractDir);
|
||||
extractZipFile(zipFile, extractDir);
|
||||
|
||||
// 处理解压后的文件夹
|
||||
processExtractedFolder(extractDir, recruitId);
|
||||
|
||||
// 删除临时文件和文件夹
|
||||
deleteFolder(extractDir);
|
||||
if (!zipFile.delete()) {
|
||||
System.err.println("无法删除压缩文件: " + zipFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
return ResponseEntity.ok("文件上传并处理成功");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(500).body("文件处理过程中出现错误: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureDirectoryExists(File directory) throws IOException {
|
||||
if (!directory.exists()) {
|
||||
if (!directory.mkdirs()) {
|
||||
throw new IOException("无法创建目录: " + directory.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void extractZipFile(File zipFile, File extractDir) throws IOException {
|
||||
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile), Charset.forName("GBK"))) {
|
||||
ZipEntry zipEntry;
|
||||
while ((zipEntry = zis.getNextEntry()) != null) {
|
||||
File newFile = newFile(extractDir, zipEntry);
|
||||
if (zipEntry.isDirectory()) {
|
||||
ensureDirectoryExists(newFile);
|
||||
} else {
|
||||
// 为文件创建父目录
|
||||
ensureDirectoryExists(newFile.getParentFile());
|
||||
|
||||
// 写入文件内容
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(newFile))) {
|
||||
byte[] bytesIn = new byte[4096];
|
||||
int read;
|
||||
while ((read = zis.read(bytesIn)) != -1) {
|
||||
bos.write(bytesIn, 0, read);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private File newFile(File destinationDir, ZipEntry zipEntry) throws IOException {
|
||||
File destFile = new File(destinationDir, zipEntry.getName());
|
||||
|
||||
String destDirPath = destinationDir.getCanonicalPath();
|
||||
String destFilePath = destFile.getCanonicalPath();
|
||||
|
||||
if (!destFilePath.startsWith(destDirPath + File.separator)) {
|
||||
throw new IOException("Entry is outside of the target dir: " + zipEntry.getName());
|
||||
}
|
||||
|
||||
return destFile;
|
||||
}
|
||||
|
||||
private void processExtractedFolder(File extractDir, Long recruitId) {
|
||||
File[] firstLevelFiles = extractDir.listFiles();
|
||||
if (firstLevelFiles != null) {
|
||||
for (File firstLevelFile : firstLevelFiles) {
|
||||
if (firstLevelFile.isDirectory()) {
|
||||
File[] secondLevelFiles = firstLevelFile.listFiles();
|
||||
if (secondLevelFiles != null) {
|
||||
for (File secondLevelFile : secondLevelFiles) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void deleteFolder(File folder) {
|
||||
if (folder.isDirectory()) {
|
||||
File[] files = folder.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
deleteFolder(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!folder.delete()) {
|
||||
System.err.println("无法删除文件夹: " + folder.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ public enum AuditStatus
|
||||
AUDIT("1", "待审核"),
|
||||
PASS("2", "已同意"),
|
||||
REFUSE("3", "已拒绝"),
|
||||
READ("5","已读(针对日报的筛选实际数据库中的值为1)"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
@ -40,4 +40,7 @@ public class BgtMessageDetailDTO {
|
||||
@ApiModelProperty("小类型(字典bgt_message_small_type)")
|
||||
private String messageSmallType;
|
||||
|
||||
@ApiModelProperty("是否待处理")
|
||||
private Boolean isHandle;
|
||||
|
||||
}
|
||||
|
@ -109,6 +109,10 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR
|
||||
*/
|
||||
Boolean consent(BgtProjectRecruitApplyConsentDTO dto);
|
||||
|
||||
/**
|
||||
* 确认进场
|
||||
*/
|
||||
Boolean confirm(Long id);
|
||||
/**
|
||||
* 指定日期所有人员出勤情况
|
||||
*/
|
||||
|
@ -44,6 +44,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_NEED;
|
||||
|
||||
/**
|
||||
* 消息Service业务层处理
|
||||
@ -190,6 +191,7 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
|
||||
wrapper.eq(BgtMessage::getRecipientId, SecurityUtils.getAppUserId());
|
||||
wrapper.eq(StrUtil.isNotBlank(dto.getMessageLargeType()), BgtMessage::getMessageLargeType, dto.getMessageLargeType());
|
||||
wrapper.eq(StrUtil.isNotBlank(dto.getMessageSmallType()), BgtMessage::getMessageSmallType, dto.getMessageSmallType());
|
||||
wrapper.eq(dto.getIsHandle(), BgtMessage::getIsOperation,OPERATION_NEED);
|
||||
if(dto.getDate() != null) {
|
||||
wrapper.between(BgtMessage::getCreateTime, dto.getDate().atStartOfDay(), dto.getDate().atStartOfDay().with(LocalTime.MAX));
|
||||
}
|
||||
|
@ -281,6 +281,17 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
return updateById(recruitApply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean confirm(Long id) {
|
||||
BgtProjectRecruitApply recruitApply = getById(id);
|
||||
if(recruitApply == null){
|
||||
throw new BaseException("该申请人员不存在");
|
||||
}
|
||||
recruitApply.setEntryTime(LocalDate.now());
|
||||
recruitApply.setStatus(RecruitApplyStatus.WORKING.getCode());
|
||||
|
||||
return updateById(recruitApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* LC-APP相关
|
||||
@ -387,7 +398,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
setTableId(bgtProjectRecruitApply.getId()).
|
||||
setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
|
||||
setMessageLargeType(BGT_LARGE_OTHER).
|
||||
setMessageSmallType(BGT_TYPE_SIGN_UP);
|
||||
setMessageSmallType(BGT_TYPE_SIGN_UP).setIsOperation(OPERATION_NEED);
|
||||
if (!iBgtMessageService.sendAMessage(bgtMessage)) {
|
||||
throw new RuntimeException("发送消息失败!");
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
|
||||
setTableId(dc.getId()).
|
||||
setTableName(SqlHelper.table(WgzDailyClock.class).getTableName()).
|
||||
setMessageLargeType(BGT_LARGE_OTHER).
|
||||
setMessageSmallType(BGT_SMALL_REPORT_MAKE_UP);
|
||||
setMessageSmallType(BGT_SMALL_REPORT_MAKE_UP).setIsOperation(OPERATION_NEED);
|
||||
if (!iBgtMessageService.sendAMessage(bgtMessage)){
|
||||
throw new RuntimeException("发送日报补卡消息失败!");
|
||||
}
|
||||
@ -336,10 +336,10 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
|
||||
Page<BgtDailyClockListDTO> queryDTOPage = new Page<>();
|
||||
queryDTOPage.setCurrent(dto.getPageNum());
|
||||
queryDTOPage.setSize(dto.getPageSize());
|
||||
if( "5".equals(dto.getAuditorType()) ){
|
||||
if( AuditStatus.READ.getCode().equals(dto.getAuditorType()) ){
|
||||
dto.setIsRead(true);
|
||||
}
|
||||
if( "1".equals(dto.getAuditorType()) ){
|
||||
if( AuditStatus.AUDIT.getCode().equals(dto.getAuditorType()) ){
|
||||
dto.setIsAudit(true);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
setTableId(wgzLeave.getId()).
|
||||
setTableName(SqlHelper.table(WgzLeave.class).getTableName()).
|
||||
setMessageLargeType(BGT_LARGE_OTHER).
|
||||
setMessageSmallType(BGT_SMALL_LEAVE);
|
||||
setMessageSmallType(BGT_SMALL_LEAVE).setIsOperation(OPERATION_NEED);
|
||||
if (!iBgtMessageService.sendAMessage(bgtMessage)) {
|
||||
throw new RuntimeException("发送请假申请消息失败!");
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import com.ruoyi.wgz.domain.*;
|
||||
import com.ruoyi.wgz.mapper.WgzPayCalculationMapper;
|
||||
import com.ruoyi.wgz.service.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.xmlbeans.impl.validator.ValidatingXMLStreamReader;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -270,7 +269,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
setTableId(wgzPayCalculation.getId()).
|
||||
setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
|
||||
setMessageLargeType(BGT_LARGE_OTHER).
|
||||
setMessageSmallType(BGT_SMALL_PAY);
|
||||
setMessageSmallType(BGT_SMALL_PAY).setIsOperation(OPERATION_NEED);
|
||||
if (!iBgtMessageService.sendAMessage(bgtMessage)){
|
||||
throw new RuntimeException("发送补卡消息失败!");
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
|
||||
setTableId(wgzReissueacard.getId()).
|
||||
setTableName(SqlHelper.table(WgzReissueacard.class).getTableName()).
|
||||
setMessageLargeType(BGT_LARGE_OTHER).
|
||||
setMessageSmallType(BGT_SMALL_MAKE_UP);
|
||||
setMessageSmallType(BGT_SMALL_MAKE_UP).setIsOperation(OPERATION_NEED);
|
||||
if (!iBgtMessageService.sendAMessage(bgtMessage)) {
|
||||
throw new RuntimeException("发送补卡消息失败!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user