人员修改

This commit is contained in:
pengjie 2024-06-05 18:31:33 +08:00
parent 35b4f5425a
commit ccdc9ca8ab
4 changed files with 45 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.exam.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.modules.exam.entity.ExamQuestionBank;
import com.zhgd.xmgl.modules.exam.vo.ExamPaperVo;
import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankVo;
import com.zhgd.xmgl.util.PageUtil;
@ -76,11 +77,13 @@ public class ExamPaperController {
public Result<IPage<ExamPaper>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<ExamPaper> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamPaper.class, map);
Page<ExamPaper> page = PageUtil.getPage(map);
queryWrapper.orderByDesc("create_time");
IPage<ExamPaper> pageList = examPaperService.pageList(page, queryWrapper);
return Result.success(pageList);
}
/**
*
* 列表查询
*
* @param examPaper
@ -91,6 +94,7 @@ public class ExamPaperController {
@PostMapping(value = "/list")
public Result<List<ExamPaper>> queryList(@RequestBody ExamPaper examPaper) {
QueryWrapper<ExamPaper> queryWrapper = QueryGenerator.initQueryWrapper(examPaper);
queryWrapper.lambda().orderByDesc(ExamPaper::getCreateTime);
List<ExamPaper> list = examPaperService.list(queryWrapper);
return Result.success(list);
}

View File

@ -24,6 +24,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.sql.Array;
import java.util.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -101,6 +102,7 @@ public class ExamQuestionBankController {
public Result<IPage<ExamQuestionBank>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<ExamQuestionBank> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamQuestionBank.class, map);
Page<ExamQuestionBank> page = PageUtil.getPage(map);
queryWrapper.lambda().orderByDesc(ExamQuestionBank::getCreateTime);
IPage<ExamQuestionBank> pageList = examQuestionBankService.page(page, queryWrapper);
return Result.success(pageList);
}
@ -120,6 +122,7 @@ public class ExamQuestionBankController {
@PostMapping(value = "/list")
public Result<List<ExamQuestionBank>> queryList(@ApiIgnore @RequestBody ExamQuestionBank examQuestionBank) {
QueryWrapper<ExamQuestionBank> queryWrapper = QueryGenerator.initQueryWrapper(examQuestionBank);
queryWrapper.lambda().orderByDesc(ExamQuestionBank::getCreateTime);
List<ExamQuestionBank> list = examQuestionBankService.list(queryWrapper);
return Result.success(list);
}
@ -321,6 +324,7 @@ public class ExamQuestionBankController {
QueryWrapper<ExamQuestionBank> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamQuestionBank.class, map);
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
queryWrapper.lambda().orderByDesc(ExamQuestionBank::getCreateTime);
List<ExamQuestionBank> pageList = examQuestionBankService.list(queryWrapper);
List<ExamSubject> subList = examSubjectService.list();
List<ExamQuestionBankImport> resultList = new ArrayList<>();
@ -375,6 +379,9 @@ public class ExamQuestionBankController {
params.setNeedSave(true);
try {
List<Map<String, String>> examQuestionBankImports = ExcelUtils.jxlExlToList(file.getInputStream(), 0);
if (examQuestionBankImports.size() == 0) {
throw new CustomException("未识别到有效数据!", HttpStatus.INTERNAL_SERVER_ERROR);
}
List<ExamQuestionBank> examQuestionBankList = new ArrayList<>();
List<ExamQuestionOption> examQuestionOptionList = new ArrayList<>();
int index = 0;
@ -391,7 +398,14 @@ public class ExamQuestionBankController {
examQuestionBank.setQuestionName(examQuestionBankImport.get("*试题名称").trim());
examQuestionBank.setType(getType(examQuestionBankImport.get("*试题类型").trim()));
examQuestionBank.setDifficulty(getDifficulty(examQuestionBankImport.get("*难易程度").trim()));
examQuestionBank.setOptions(examQuestionBankImport.get("*试题答案").trim());
String options = examQuestionBankImport.get("*试题答案").trim();
String [] option = new String[options.length()];
for (int i = 0; i < options.length(); i++) {
option[i] = options.substring(i, i + 1);
}
List<String> list = Arrays.asList(option);
Collections.sort(list);
examQuestionBank.setOptions(list.stream().collect(Collectors.joining()));
examQuestionBank.setIsEnable(examQuestionBankImport.get("*是否应用").trim().equals("") ? 1 : 0);
try {
examQuestionBank.setScore(Integer.parseInt(examQuestionBankImport.get("*作答正确得分").trim()));
@ -426,7 +440,7 @@ public class ExamQuestionBankController {
return Result.ok("文件导入成功!数据行数:" + examQuestionBankImports.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
return Result.error(e.getMessage());
} finally {
try {
file.getInputStream().close();

View File

@ -260,14 +260,33 @@ public class XzWorkerInfoAuditRecordController {
workerIds.add(workerId);
WorkerInfoAuditRecord infoAuditRecord = workerInfoAuditRecordService.getById(workerId);
List<WorkerContract> contractList = new ArrayList<>();
JSONArray contract = object.getJSONArray("contract");
if (contract != null) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < contract.size(); i++) {
if (i > 0) {
builder.append(",");
}
builder.append(contract.getJSONObject(i).getString("name") + "*" + object.getJSONArray("contract").getJSONObject(0).getString("url"));
}
WorkerContract workerContract = new WorkerContract();
workerContract.setImageUrl(object.getJSONArray("contract").getJSONObject(0).getString("name") + "*" + object.getJSONArray("contract").getJSONObject(0).getString("url"));
workerContract.setImageUrl(builder.toString());
contractList.add(workerContract);
}
infoAuditRecord.setContractInfo(JSON.toJSONString(contractList));
List<WorkerInsurance> insuranceList = new ArrayList<>();
JSONArray insurance = object.getJSONArray("insurance");
if (insurance != null) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < insurance.size(); i++) {
if (i > 0) {
builder.append(",");
}
builder.append(insurance.getJSONObject(i).getString("name") + "*" + object.getJSONArray("insurance").getJSONObject(0).getString("url"));
}
WorkerInsurance workerInsurance = new WorkerInsurance();
workerInsurance.setPhotoUrl(object.getJSONArray("insurance").getJSONObject(0).getString("name") + "*" + object.getJSONArray("insurance").getJSONObject(0).getString("url"));
insuranceList.add(workerInsurance);
workerInsurance.setPhotoUrl(builder.toString());
}
infoAuditRecord.setInsuranceInfo(JSON.toJSONString(insuranceList));
List<WorkerCertificate> certificateList = new ArrayList<>();
JSONArray certificate = object.getJSONArray("certificate");