优化
This commit is contained in:
@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -58,15 +59,22 @@ public class UploadZipController {
|
|||||||
|
|
||||||
@ApiOperation("上传压缩文件")
|
@ApiOperation("上传压缩文件")
|
||||||
@PostMapping("/upload-zip")
|
@PostMapping("/upload-zip")
|
||||||
public AjaxResult<Void> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId, @RequestParam("userId") Long userId) {
|
public AjaxResult<Void> uploadZipFile(@RequestParam("file") MultipartFile file
|
||||||
|
, @RequestParam("recruitId")@NotNull(message = "招工不能为空") Long recruitId
|
||||||
|
, @RequestParam("userId")@NotNull(message = "用户不能为空") Long userId) {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
throw new BaseException("上传的文件为空!");
|
throw new BaseException("上传的文件为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String originalFilename = file.getOriginalFilename();
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
|
||||||
if (originalFilename == null || !originalFilename.toLowerCase().endsWith(".zip")) {
|
if (originalFilename == null || !originalFilename.toLowerCase().endsWith(".zip")) {
|
||||||
throw new BaseException("上传的文件不是有效的 ZIP 文件!");
|
throw new BaseException("上传的文件不是有效的 ZIP 文件!");
|
||||||
}
|
}
|
||||||
|
String[] split = originalFilename.split("_");
|
||||||
|
if(split.length != 2 || !split[0].equals(recruitId.toString())){
|
||||||
|
throw new BaseException("文件名与所选择招工不匹配");
|
||||||
|
}
|
||||||
|
|
||||||
if(recruitService.queryById(recruitId) == null){
|
if(recruitService.queryById(recruitId) == null){
|
||||||
throw new BaseException("招工信息不存在!");
|
throw new BaseException("招工信息不存在!");
|
||||||
@ -104,7 +112,7 @@ public class UploadZipController {
|
|||||||
asyncProcessRecordAndDeleteTemp(extractDir, zipFile, recruitId,username,userId);
|
asyncProcessRecordAndDeleteTemp(extractDir, zipFile, recruitId,username,userId);
|
||||||
|
|
||||||
return AjaxResult.success("文件上传并处理成功");
|
return AjaxResult.success("文件上传并处理成功");
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
// 删除临时文件和文件夹
|
// 删除临时文件和文件夹
|
||||||
File extractDir = new File(TEMP_DIR, firstLevelFolderName);
|
File extractDir = new File(TEMP_DIR, firstLevelFolderName);
|
||||||
deleteFolder(extractDir);
|
deleteFolder(extractDir);
|
||||||
@ -204,6 +212,9 @@ public class UploadZipController {
|
|||||||
String[] split = firstLevelFolderName.split("_");
|
String[] split = firstLevelFolderName.split("_");
|
||||||
String card = split[1];
|
String card = split[1];
|
||||||
WgzUser wgzUser = wgzUserService.findByIdentityCard(card);
|
WgzUser wgzUser = wgzUserService.findByIdentityCard(card);
|
||||||
|
if(wgzUser == null){
|
||||||
|
throw new BaseException("文件格式错误");
|
||||||
|
}
|
||||||
if (firstLevelFile.isDirectory()) {
|
if (firstLevelFile.isDirectory()) {
|
||||||
File[] secondLevelFiles = firstLevelFile.listFiles();
|
File[] secondLevelFiles = firstLevelFile.listFiles();
|
||||||
if (secondLevelFiles != null) {
|
if (secondLevelFiles != null) {
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.ruoyi.web.controller.fbs;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
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.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.zbf.bo.ZbfProjectSubcontractingQueryBo;
|
||||||
|
import com.ruoyi.zbf.domain.ZbfProjectSubcontracting;
|
||||||
|
import com.ruoyi.zbf.service.IZbfProjectSubcontractingService;
|
||||||
|
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-02-17
|
||||||
|
*/
|
||||||
|
@Api(value = "App分包商项目管理", tags = {"App分包商项目管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fbs/subcontracting")
|
||||||
|
public class AppFbsProjectSubcontractingController extends BaseController {
|
||||||
|
|
||||||
|
private final IZbfProjectSubcontractingService iZbfProjectSubcontractingService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询总包方项目分包列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询总包方项目分包列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<ZbfProjectSubcontracting> list(@Validated ZbfProjectSubcontractingQueryBo bo) {
|
||||||
|
return iZbfProjectSubcontractingService.queryPageList(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出总包方项目分包列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出总包方项目分包列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('common:subcontracting:export')")
|
||||||
|
@Log(title = "总包方项目分包", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult<ZbfProjectSubcontracting> export(@Validated ZbfProjectSubcontractingQueryBo bo) {
|
||||||
|
List<ZbfProjectSubcontracting> list = iZbfProjectSubcontractingService.queryList(bo);
|
||||||
|
ExcelUtil<ZbfProjectSubcontracting> util = new ExcelUtil<ZbfProjectSubcontracting>(ZbfProjectSubcontracting.class);
|
||||||
|
return util.exportExcel(list, "总包方项目分包");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取总包方项目分包详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取总包方项目分包详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('common:subcontracting:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AjaxResult<ZbfProjectSubcontracting> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(iZbfProjectSubcontractingService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增总包方项目分包
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增总包方项目分包")
|
||||||
|
@PreAuthorize("@ss.hasPermi('common:subcontracting:add')")
|
||||||
|
@Log(title = "总包方项目分包", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit
|
||||||
|
@PostMapping()
|
||||||
|
public AjaxResult<Void> add(@Validated @RequestBody ZbfProjectSubcontracting bo) {
|
||||||
|
return toAjax(iZbfProjectSubcontractingService.insert(bo) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改总包方项目分包
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改总包方项目分包")
|
||||||
|
@PreAuthorize("@ss.hasPermi('common:subcontracting:edit')")
|
||||||
|
@Log(title = "总包方项目分包", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit
|
||||||
|
@PutMapping()
|
||||||
|
public AjaxResult<Void> edit(@Validated @RequestBody ZbfProjectSubcontracting bo) {
|
||||||
|
return toAjax(iZbfProjectSubcontractingService.update(bo) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除总包方项目分包
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除总包方项目分包")
|
||||||
|
@PreAuthorize("@ss.hasPermi('common:subcontracting:remove')")
|
||||||
|
@Log(title = "总包方项目分包" , businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(iZbfProjectSubcontractingService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
@ -159,7 +159,7 @@ public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByUserIdAndRecruitIdAndType(List<Long> userIds, Long recruitId, String type) {
|
public void deleteByUserIdAndRecruitIdAndType(List<Long> userIds, Long recruitId, String type) {
|
||||||
baseMapper.delete(Wrappers.<Annex>lambdaQuery().in(Annex::getUserId,userIds)
|
baseMapper.delete(Wrappers.<Annex>lambdaUpdate().in(Annex::getUserId,userIds)
|
||||||
.eq(Annex::getRecruitId,recruitId).eq(Annex::getAnnexType,type).eq(Annex::getUserType,WGZ));
|
.eq(Annex::getRecruitId,recruitId).eq(Annex::getAnnexType,type).eq(Annex::getUserType,WGZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class BusinessTask
|
|||||||
public void recruitRefuse()
|
public void recruitRefuse()
|
||||||
{
|
{
|
||||||
Console.log("开始招工拒绝任务");
|
Console.log("开始招工拒绝任务");
|
||||||
List<String> status = Arrays.asList(RecruitApplyStatus.SIGN_UP.getCode(), RecruitApplyStatus.BGT_PASS.getCode());
|
List<String> status = Arrays.asList(RecruitApplyStatus.SIGN_UP.getCode(), RecruitApplyStatus.BGT_PASS.getCode(), RecruitApplyStatus.WGZ_PASS.getCode());
|
||||||
List<BgtProjectRecruit> recruitList = recruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
List<BgtProjectRecruit> recruitList = recruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
||||||
.lt(BgtProjectRecruit::getRecruitEndTime, LocalDate.now()));
|
.lt(BgtProjectRecruit::getRecruitEndTime, LocalDate.now()));
|
||||||
if(CollectionUtil.isNotEmpty(recruitList)){
|
if(CollectionUtil.isNotEmpty(recruitList)){
|
||||||
|
@ -3,7 +3,6 @@ package com.ruoyi.wgz.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
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;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.bgt.domain.vo.BgtQuestionResult;
|
import com.ruoyi.bgt.domain.vo.BgtQuestionResult;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
@ -386,8 +385,8 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
|
|||||||
long time= 0L;
|
long time= 0L;
|
||||||
|
|
||||||
for (WgzQuestionSave wgzQuestionSave : savaList){
|
for (WgzQuestionSave wgzQuestionSave : savaList){
|
||||||
score += wgzQuestionSave.getScore();
|
|
||||||
if(wgzQuestionSave.getCorrect().equals("1")){
|
if(wgzQuestionSave.getCorrect().equals("1")){
|
||||||
|
score += wgzQuestionSave.getScore();
|
||||||
successNum++;
|
successNum++;
|
||||||
}else{
|
}else{
|
||||||
errorNum++;
|
errorNum++;
|
||||||
|
1
ruoyi/uploadPath/appResource/html/index.css
Normal file
1
ruoyi/uploadPath/appResource/html/index.css
Normal file
File diff suppressed because one or more lines are too long
61667
ruoyi/uploadPath/appResource/html/index.full.js
Normal file
61667
ruoyi/uploadPath/appResource/html/index.full.js
Normal file
File diff suppressed because one or more lines are too long
@ -4,10 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>文件上传管理系统</title>
|
<title>文件上传管理系统</title>
|
||||||
<link
|
<link rel="stylesheet" href="./index.css" />
|
||||||
rel="stylesheet"
|
|
||||||
href="https://unpkg.com/element-plus/dist/index.css"
|
|
||||||
/>
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -116,7 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 右侧上传面板 -->
|
<!-- 右侧上传面板 -->
|
||||||
<div class="right-panel">
|
<div v-loading="uploadLoading" class="right-panel">
|
||||||
<h3 style="margin-bottom: 15px">文件上传区域</h3>
|
<h3 style="margin-bottom: 15px">文件上传区域</h3>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
@ -145,6 +142,7 @@
|
|||||||
class="submit-btn"
|
class="submit-btn"
|
||||||
@click="submitUpload"
|
@click="submitUpload"
|
||||||
:disabled="!uploadFile"
|
:disabled="!uploadFile"
|
||||||
|
:loading="uploadLoading"
|
||||||
>
|
>
|
||||||
确认上传
|
确认上传
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -152,8 +150,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
<script src="./vue.global.js"></script>
|
||||||
<script src="https://unpkg.com/element-plus/dist/index.full.js"></script>
|
<script src="./index.full.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const { createApp } = Vue;
|
const { createApp } = Vue;
|
||||||
@ -166,6 +164,7 @@
|
|||||||
currentList: [],
|
currentList: [],
|
||||||
userIds: [],
|
userIds: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
uploadLoading: false,
|
||||||
listStatusText: "请先选择主题",
|
listStatusText: "请先选择主题",
|
||||||
userId: "",
|
userId: "",
|
||||||
checkAll: false,
|
checkAll: false,
|
||||||
@ -180,7 +179,7 @@
|
|||||||
// 获取 URL 中的 userId 参数
|
// 获取 URL 中的 userId 参数
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
this.userId = urlParams.get("userId");
|
this.userId = urlParams.get("userId");
|
||||||
console.log("userId", this.userId);
|
// console.log("userId", this.userId);
|
||||||
|
|
||||||
this.getRecruitList();
|
this.getRecruitList();
|
||||||
},
|
},
|
||||||
@ -257,12 +256,15 @@
|
|||||||
// 提交上传
|
// 提交上传
|
||||||
async submitUpload() {
|
async submitUpload() {
|
||||||
if (!this.uploadFile) return;
|
if (!this.uploadFile) return;
|
||||||
|
if (this.themeOptions && this.themeOptions.length == 0) {
|
||||||
|
ElementPlus.ElMessage.error(`请先选择招工主题`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", this.uploadFile);
|
formData.append("file", this.uploadFile);
|
||||||
formData.append("recruitId", this.selectedTheme);
|
formData.append("recruitId", this.selectedTheme);
|
||||||
formData.append("userId", this.userId);
|
formData.append("userId", this.userId);
|
||||||
|
this.uploadLoading = true;
|
||||||
try {
|
try {
|
||||||
const res = await this.ajaxRequest({
|
const res = await this.ajaxRequest({
|
||||||
url: "/ruoyi/upload-zip",
|
url: "/ruoyi/upload-zip",
|
||||||
@ -278,6 +280,8 @@
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElementPlus.ElMessage.error(`${error}`);
|
ElementPlus.ElMessage.error(`${error}`);
|
||||||
|
} finally {
|
||||||
|
this.uploadLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
18096
ruoyi/uploadPath/appResource/html/vue.global.js
Normal file
18096
ruoyi/uploadPath/appResource/html/vue.global.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user