包头bug修复
This commit is contained in:
parent
2580e777eb
commit
a1feaf56fa
@ -34,10 +34,7 @@ import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||
import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper;
|
||||
import com.zhgd.xmgl.modules.xz.mapper.XzTaskProgressContentMapper;
|
||||
import com.zhgd.xmgl.modules.xz.special.service.CountApiService;
|
||||
import com.zhgd.xmgl.util.FlowSeviceUtil;
|
||||
import com.zhgd.xmgl.util.FlowUtil;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
@ -227,7 +224,6 @@ public class QualityProblemServiceImpl extends ServiceImpl<QualityProblemMapper,
|
||||
String picUrl = FlowUtil.getJSONString(formData, "field6081631595560");
|
||||
String fileUrl = FlowUtil.getJSONString(formData, "field9809831597710");
|
||||
String deliveryLevel = FlowUtil.getString(formData, "field1119531519328");
|
||||
Integer technology = FlowUtil.getPullDownInteger(formData, "field5714131333262");
|
||||
Date inspectTime = FlowUtil.getDate(formData, "field7006700270795");
|
||||
Date changeLimitTime = FlowUtil.getDate(formData, "field1956800274157");
|
||||
QualityProblem record = new QualityProblem();
|
||||
@ -240,7 +236,13 @@ public class QualityProblemServiceImpl extends ServiceImpl<QualityProblemMapper,
|
||||
record.setConstructionUnitId(constructionUnitId);
|
||||
record.setDesignEnterpriseId(designEnterpriseId);
|
||||
record.setDepartment(department);
|
||||
record.setTechnology(technology);
|
||||
List<String> tes = Arrays.asList("土建",
|
||||
"管道",
|
||||
"动设备",
|
||||
"静设备",
|
||||
"电气",
|
||||
"仪表");
|
||||
record.setTechnology(tes.indexOf(MapUtils.getString(formData, "field7713001899028")) + 1);
|
||||
record.setConstructionId(constructionId);
|
||||
record.setQualityStatement(qualityStatement);
|
||||
record.setQualityRequire(qualityRequire);
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.wflow.bean.entity.WflowModelHistorys;
|
||||
import com.wflow.mapper.WflowModelHistorysMapper;
|
||||
import com.wflow.mapper.WflowModelsMapper;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseAuthority;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseRoleService;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -48,6 +51,21 @@ public class BaseMenuController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IBaseRoleService baseRoleService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WflowModelsMapper wflowModelsMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WflowModelHistorysMapper wflowModelHistorysMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IBaseRoleUserService baseRoleUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private DictionaryItemServiceImpl dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -192,4 +210,139 @@ public class BaseMenuController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询角色参与哪些发起工作流和审批工作流", notes = "查询角色参与哪些发起工作流和审批工作流", httpMethod = "POST")
|
||||
@PostMapping(value = "/getRoleFlow")
|
||||
public Result getRoleFlow(@RequestBody Map<String, Object> param) {
|
||||
/*
|
||||
(idList)=>{
|
||||
{
|
||||
"userType:roleName":{"发起":[formName],"审批":[formName]}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//"userType:roleName":{"发起":[formName],"审批":[formName]}
|
||||
List<DictionaryItem> userTypes = dictionaryItemService.getDictList("user_type", null);
|
||||
Map<String, JSONObject> roleMap = new TreeMap<>();
|
||||
List<WflowModelHistorys> wflowModelHistorys = wflowModelHistorysMapper.selectList(Wrappers.<WflowModelHistorys>lambdaQuery()
|
||||
.in(WflowModelHistorys::getFormId, (List) param.get("idList")));
|
||||
for (WflowModelHistorys model : wflowModelHistorys) {
|
||||
//发起人:流程名称
|
||||
Map<String, String> launchUserIdMap = new HashMap<>();
|
||||
Map<String, String> approveUserIdMap = new HashMap<>();
|
||||
JSONObject process = JSONObject.parseObject(model.getProcess());
|
||||
//发起人
|
||||
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
|
||||
String formName = model.getFormName();
|
||||
if (assignedUser1 != null) {
|
||||
for (int i = 0; i < assignedUser1.size(); i++) {
|
||||
JSONObject jsonObject = assignedUser1.getJSONObject(i);
|
||||
if (jsonObject.getString("type").equals("user")) {
|
||||
//账号
|
||||
launchUserIdMap.put(jsonObject.getString("id"), formName);
|
||||
} else {
|
||||
//部门
|
||||
List<Long> userIds = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
|
||||
.eq(SystemUser::getXzProjectOrgId, jsonObject.getString("id"))).stream().map(SystemUser::getUserId).collect(Collectors.toList());
|
||||
userIds.forEach(aLong -> {
|
||||
launchUserIdMap.put(aLong + "", formName);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
//审批人
|
||||
addApproveUser(launchUserIdMap, approveUserIdMap, process.getJSONObject("children"), formName);
|
||||
//构造"userType:roleName":{"发起":[formName],"审批":[formName]}
|
||||
addRoleMap(launchUserIdMap, userTypes, roleMap, "发起", formName);
|
||||
addRoleMap(approveUserIdMap, userTypes, roleMap, "审批", formName);
|
||||
}
|
||||
|
||||
return Result.success(roleMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加 "userType:roleName":{"发起":[formName],"审批":[formName]}
|
||||
*
|
||||
* @param approveUserIdMap
|
||||
* @param userTypes
|
||||
* @param roleMap
|
||||
* @param approve
|
||||
* @param formName
|
||||
*/
|
||||
private void addRoleMap(Map<String, String> approveUserIdMap, List<DictionaryItem> userTypes, Map<String, JSONObject> roleMap, String approve, String formName) {
|
||||
if (CollUtil.isNotEmpty(approveUserIdMap)) {
|
||||
List<Long> roleIds = baseRoleUserService.list(new LambdaQueryWrapper<BaseRoleUser>()
|
||||
.in(BaseRoleUser::getUserId, new ArrayList<>(approveUserIdMap.keySet()))).stream().map(BaseRoleUser::getRoleId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(roleIds)) {
|
||||
List<BaseRole> roles = baseRoleService.list(new LambdaQueryWrapper<BaseRole>()
|
||||
.in(BaseRole::getRoleId, roleIds));
|
||||
for (BaseRole role : roles) {
|
||||
String userTypeName = userTypes.stream().filter(o -> o.getData().equals(role.getUserType())).findFirst().map(o -> o).orElse(null).getName();
|
||||
roleMap.compute(userTypeName + ":" + role.getRoleName(), (k, v) -> {
|
||||
if (v == null) {
|
||||
v = new JSONObject();
|
||||
}
|
||||
v.compute(approve, (k1, v1) -> {
|
||||
if (v1 == null) {
|
||||
v1 = new HashSet<>();
|
||||
}
|
||||
((Set) v1).add(formName);
|
||||
return v1;
|
||||
});
|
||||
return v;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加审批人
|
||||
*
|
||||
* @param launchUserIdMap
|
||||
* @param approveUserIdMap 添加审批人
|
||||
* @param children
|
||||
* @param formName
|
||||
*/
|
||||
private void addApproveUser(Map<String, String> launchUserIdMap, Map<String, String> approveUserIdMap, JSONObject children, String formName) {
|
||||
if (children == null) {
|
||||
return;
|
||||
}
|
||||
String type = children.getString("type");
|
||||
if (Objects.equals("CONDITIONS", type)) {
|
||||
JSONArray array = children.getJSONArray("branchs");
|
||||
Iterator<Object> iterator = array.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
addApproveUser(launchUserIdMap, approveUserIdMap, (JSONObject) iterator.next(), formName);
|
||||
}
|
||||
}
|
||||
addApproveUser(launchUserIdMap, approveUserIdMap, children.getJSONObject("children"), formName);
|
||||
//添加审批人
|
||||
JSONObject props = children.getJSONObject("props");
|
||||
if (props == null) {
|
||||
return;
|
||||
}
|
||||
JSONArray assignedUser = props.getJSONArray("assignedUser");
|
||||
if (assignedUser != null) {
|
||||
for (int i = 0; i < assignedUser.size(); i++) {
|
||||
JSONObject jsonObject = assignedUser.getJSONObject(i);
|
||||
String id = jsonObject.getString("id");
|
||||
if (jsonObject.getString("type").equals("user")) {
|
||||
//账号
|
||||
if (!launchUserIdMap.containsKey(id)) {
|
||||
approveUserIdMap.put(id, formName);
|
||||
}
|
||||
} else {
|
||||
//部门
|
||||
List<Long> userIds = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
|
||||
.eq(SystemUser::getXzProjectOrgId, id)).stream().map(SystemUser::getUserId).collect(Collectors.toList());
|
||||
userIds.forEach(aLong -> {
|
||||
if (!launchUserIdMap.containsKey(id)) {
|
||||
approveUserIdMap.put(aLong + "", formName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -226,13 +226,15 @@ public class ExamPaperController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "试卷ID", paramType = "body", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "workerCard", value = "人员证件号", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "examRecordId", value = "考试记录id", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/queryQuestionById")
|
||||
public Result<List<ExamQuestionBankVo>> queryQuestionById(@RequestBody Map<String, Object> param) {
|
||||
String workerCard = MapUtils.getString(param, "workerCard");
|
||||
Long id = MapUtils.getLong(param, "id");
|
||||
Long examRecordId = MapUtils.getLong(param, "examRecordId");
|
||||
Result<List<ExamQuestionBankVo>> result = new Result<List<ExamQuestionBankVo>>();
|
||||
result.setResult(examPaperService.queryQuestionByPaperIdAndIdCard(id, workerCard));
|
||||
result.setResult(examPaperService.queryQuestionByPaperIdAndExamRecordId(id, workerCard, examRecordId));
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
@ -248,12 +250,14 @@ public class ExamPaperController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "试题ID", paramType = "body", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "workerCard", value = "人员证件号", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "examRecordId", value = "考试记录id", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/queryStatInfo")
|
||||
public Result<Object> queryStatInfo(@RequestBody Map<String, Object> param) {
|
||||
String workerCard = MapUtils.getString(param, "workerCard");
|
||||
Long id = MapUtils.getLong(param, "id");
|
||||
return Result.success(examPaperService.queryStatInfo(id, workerCard));
|
||||
Long examRecordId = MapUtils.getLong(param, "examRecordId");
|
||||
return Result.success(examPaperService.queryStatInfo(id, workerCard, examRecordId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -283,17 +283,17 @@ public class ExamTrainRecordController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交考试结果
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "考试记录管理", operType = "查询", operDesc = "提交考试结果")
|
||||
@ApiOperation(value = "提交考试结果", notes = "提交考试结果", httpMethod = "POST")
|
||||
@PostMapping(value = "/submit")
|
||||
public Result<Object> submit(@RequestBody List<ExamAnswerQuestion> examAnswerQuestionList) {
|
||||
return Result.success(examTrainRecordService.submit(examAnswerQuestionList));
|
||||
}
|
||||
// /**
|
||||
// * 提交考试结果
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// @OperLog(operModul = "考试记录管理", operType = "查询", operDesc = "提交考试结果")
|
||||
// @ApiOperation(value = "提交考试结果", notes = "提交考试结果", httpMethod = "POST")
|
||||
// @PostMapping(value = "/submit")
|
||||
// public Result<Object> submit(@RequestBody List<ExamAnswerQuestion> examAnswerQuestionList) {
|
||||
// return Result.success(examTrainRecordService.submit(examAnswerQuestionList));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@ -136,13 +137,16 @@ public class ExamWorkerController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "paperId", value = "试卷ID", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "workerCard", value = "人员证件号", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "examRecordId", value = "考试记录id", paramType = "body", required = true, dataType = "String"),
|
||||
|
||||
})
|
||||
@PostMapping(value = "/queryQuestionById")
|
||||
public Result<List<ExamQuestionBankVo>> queryQuestionById(@RequestBody @ApiIgnore Map<String, Object> map) {
|
||||
Result<List<ExamQuestionBankVo>> result = new Result<List<ExamQuestionBankVo>>();
|
||||
Long paperId = MapUtils.getLong(map, "paperId");
|
||||
String idCard = MapUtils.getString(map, "workerCard");
|
||||
result.setResult(examPaperService.queryQuestionByPaperIdAndIdCard(paperId, idCard));
|
||||
Long examRecordId = MapUtils.getLong(map, "examRecordId");
|
||||
result.setResult(examPaperService.queryQuestionByPaperIdAndExamRecordId(paperId, idCard, examRecordId));
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
@ -156,8 +160,7 @@ public class ExamWorkerController {
|
||||
@ApiOperation(value = "开始考试", notes = "开始考试", httpMethod = "POST")
|
||||
@PostMapping(value = "/startExam")
|
||||
public Result startExam(@RequestBody Map<String, Object> param) {
|
||||
examTrainRecordService.doStartExam(param);
|
||||
return Result.ok();
|
||||
return Result.success(examTrainRecordService.doStartExam(param));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -503,4 +506,108 @@ public class ExamWorkerController {
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据分数分配正确的题目", notes = "根据分数分配正确的题目", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
})
|
||||
@GetMapping(value = "/updateBankByScore")
|
||||
public Result updateBankByScore(@RequestParam HashMap<String, Object> param) {
|
||||
String projectSn = "5B8B3DB047214AE188F2C7916DD08203";
|
||||
Map<Long, ExamQuestionBank> bankMap = examQuestionBankService.list(new LambdaQueryWrapper<ExamQuestionBank>()
|
||||
.eq(ExamQuestionBank::getProjectSn, projectSn)).stream().collect(Collectors.toMap(ExamQuestionBank::getId, Function.identity(), (o1, o2) -> o1));
|
||||
List<ExamTrainRecord> records = examTrainRecordService.list(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.eq(ExamTrainRecord::getProjectSn, projectSn));
|
||||
for (ExamTrainRecord record : records) {
|
||||
int errSingle = 0;
|
||||
int errJudge = 0;
|
||||
if (record.getScore() != null) {
|
||||
if (NumberUtil.isGreaterOrEqual(record.getScore(), new BigDecimal("80"))) {
|
||||
if (NumberUtil.equals(record.getScore(), new BigDecimal("80"))) {
|
||||
errSingle = 4;
|
||||
errJudge = 0;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("81"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 7;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("82"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 9;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("83"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 6;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("84"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 8;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("85"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 5;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("86"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 7;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("87"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 4;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("88"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 6;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("89"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 3;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("90"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 5;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("91"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 2;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("92"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 4;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("93"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 1;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("94"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 3;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("95"))) {
|
||||
errSingle = 1;
|
||||
errJudge = 0;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("96"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 2;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("98"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 1;
|
||||
} else if (NumberUtil.equals(record.getScore(), new BigDecimal("100"))) {
|
||||
errSingle = 0;
|
||||
errJudge = 0;
|
||||
}
|
||||
int[] ints = {0, 0};
|
||||
int finalErrSingle = errSingle;
|
||||
int finalErrJudge = errJudge;
|
||||
record.setSelectOptions(StrUtil.join(",", StrUtil.split(record.getQuestions(), ",").stream().map(s -> {
|
||||
//10、6、13
|
||||
ExamQuestionBank examQuestionBank = bankMap.get(Convert.toLong(s));
|
||||
String options = examQuestionBank.getOptions();
|
||||
if (examQuestionBank.getType() == 1) {
|
||||
if (finalErrSingle > ints[0]) {
|
||||
if (options.equals("A")) {
|
||||
options = "B";
|
||||
}
|
||||
ints[0] = ints[0] + 1;
|
||||
}
|
||||
} else if (examQuestionBank.getType() == 3) {
|
||||
if (finalErrJudge > ints[1]) {
|
||||
if (options.equals("对")) {
|
||||
options = "错";
|
||||
}
|
||||
ints[1] = ints[1] + 1;
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}).collect(Collectors.toList())));
|
||||
}
|
||||
}
|
||||
}
|
||||
examTrainRecordService.updateBatchById(records);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,5 +102,7 @@ public class ExamAnswerQuestion implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "申请id")
|
||||
private Long applicationId;
|
||||
@TableField(exist = false)
|
||||
private Long workerId;
|
||||
|
||||
}
|
||||
|
||||
@ -51,20 +51,24 @@ public interface IExamPaperService extends IService<ExamPaper> {
|
||||
ExamPaperVo queryDetailById(Long examId);
|
||||
|
||||
/**
|
||||
*通过id查询详细信息
|
||||
* 通过id查询详细信息
|
||||
*
|
||||
* @param examId
|
||||
* @param idCard
|
||||
* @param examRecordId
|
||||
* @return
|
||||
*/
|
||||
List<ExamQuestionBankVo> queryQuestionByPaperIdAndIdCard(Long examId, String idCard);
|
||||
List<ExamQuestionBankVo> queryQuestionByPaperIdAndExamRecordId(Long examId, String idCard, Long examRecordId);
|
||||
|
||||
/**
|
||||
* 查询试题总分、参考人数和缺考人数
|
||||
*
|
||||
* @param examId
|
||||
* @param workerCard
|
||||
* @param examRecordId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryStatInfo(Long examId, String workerCard);
|
||||
Map<String, Object> queryStatInfo(Long examId, String workerCard, Long examRecordId);
|
||||
|
||||
ExamPaper queryById(Long id);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public interface IExamTrainRecordService extends IService<ExamTrainRecord> {
|
||||
*/
|
||||
List<ExamTrainRecordVo> getTrainRecordsByWorkerId(String projectSn, String workerId);
|
||||
|
||||
void doStartExam(Map<String, Object> param);
|
||||
ExamTrainRecord doStartExam(Map<String, Object> param);
|
||||
|
||||
IPage<SpecialWorkerVo> countSpecialPageList(Page<SpecialWorkerVo> page, QueryWrapper<SpecialWorkerVo> queryWrapper, Map<String, Object> param);
|
||||
|
||||
|
||||
@ -136,17 +136,17 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal getTotalScore(List<RandomQuery> randomQueries, Integer subjectType) {
|
||||
//入场培训和复工培训:单选题10道 3分、多选题 5道 4分、判断题 10道 5分
|
||||
//入场培训和复工培训:单选题10道 5分、多选题 6道 4分、判断题 13道 2分
|
||||
//专项培训:单选 10道 5分、多选10道 5分
|
||||
BigDecimal sum = randomQueries.stream().map(e -> {
|
||||
int s = 0;
|
||||
if (subjectType != 3) {
|
||||
if (e.getType() == 1) {
|
||||
s = 3;
|
||||
s = 5;
|
||||
} else if (e.getType() == 2) {
|
||||
s = 4;
|
||||
} else {
|
||||
s = 5;
|
||||
s = 2;
|
||||
}
|
||||
} else {
|
||||
if (e.getType() == 1) {
|
||||
@ -198,16 +198,12 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamQuestionBankVo> queryQuestionByPaperIdAndIdCard(Long examId, String idCard) {
|
||||
public List<ExamQuestionBankVo> queryQuestionByPaperIdAndExamRecordId(Long examId, String idCard, Long examRecordId) {
|
||||
ExamPaper examPaper = this.getById(examId);
|
||||
if (examPaper != null) {
|
||||
String questions;
|
||||
if (Objects.equals(examPaper.getCheckQuestionType(), 2)) {
|
||||
ExamTrainRecord trainRecord = examTrainRecordService.getOne(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.eq(ExamTrainRecord::getWorkerCard, idCard)
|
||||
.eq(ExamTrainRecord::getExamPaperId, examId)
|
||||
.last("limit 1")
|
||||
);
|
||||
ExamTrainRecord trainRecord = examTrainRecordService.getById(examRecordId);
|
||||
questions = trainRecord.getQuestions();
|
||||
} else {
|
||||
questions = examPaper.getQuestions();
|
||||
@ -223,9 +219,9 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryStatInfo(Long examId, String workerCard) {
|
||||
public Map<String, Object> queryStatInfo(Long examId, String workerCard, Long examRecordId) {
|
||||
Map<String, Object> result = new HashMap<>(16);
|
||||
List<ExamQuestionBankVo> examQuestionBankVos = queryQuestionByPaperIdAndIdCard(examId, workerCard);
|
||||
List<ExamQuestionBankVo> examQuestionBankVos = queryQuestionByPaperIdAndExamRecordId(examId, workerCard, examRecordId);
|
||||
BigDecimal totalScore = examQuestionBankVos.stream().map(ExamQuestionBank::getScore).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
List<ExamRecord> examRecords = examRecordService.list(Wrappers.<ExamRecord>lambdaQuery().eq(ExamRecord::getExamId, examId));
|
||||
int examNum = examRecords.stream().filter(e -> e.getScore() != null).collect(Collectors.toList()).size();
|
||||
|
||||
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.redis.lock.redisson.DistributedLock;
|
||||
@ -38,11 +39,13 @@ import com.zhgd.xmgl.modules.xz.service.IXzDeductScoreRecordService;
|
||||
import com.zhgd.xmgl.util.IdCardUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.NumberUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@ -57,6 +60,8 @@ import java.util.stream.Collectors;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMapper, ExamTrainRecord> implements IExamTrainRecordService {
|
||||
|
||||
public static final String ADD_SIGN = "+";
|
||||
@ -130,37 +135,27 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
|
||||
@Override
|
||||
public ExamTrainRecord submit(List<ExamAnswerQuestion> examAnswerQuestionList) {
|
||||
String card = examAnswerQuestionList.get(0).getWorkerCard();
|
||||
if (StrUtil.isBlank(card)) {
|
||||
throw new OpenAlertException("workerCard不能为空");
|
||||
log.info("提交考试:{}", JSON.toJSONString(examAnswerQuestionList));
|
||||
Long examRecordId = examAnswerQuestionList.get(0).getExamRecordId();
|
||||
if (examRecordId == null) {
|
||||
throw new OpenAlertException("examRecordId不能为空");
|
||||
}
|
||||
Long paperId = examAnswerQuestionList.get(0).getTrainRecordId();
|
||||
Long applicationId = examAnswerQuestionList.get(0).getApplicationId();
|
||||
List<ExamTrainRecord> rs = baseMapper.selectList(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.eq(ExamTrainRecord::getWorkerCard, card)
|
||||
.eq(ExamTrainRecord::getApplicationId, applicationId));
|
||||
ExamTrainRecord notSubmit = rs.stream().filter(o -> Objects.equals(o.getSubmit(), 0)).sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())).findFirst().map(o -> o).orElse(null);
|
||||
if (notSubmit == null) {
|
||||
ExamTrainRecord submit = baseMapper.selectById(examRecordId);
|
||||
Long applicationId = submit.getApplicationId();
|
||||
Long paperId = submit.getExamPaperId();
|
||||
if (submit.getSubmit() == 1) {
|
||||
//您已提交试卷
|
||||
return rs.stream().filter(o -> Objects.equals(o.getSubmit(), 1)).sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())).findFirst().map(o -> o).orElse(null);
|
||||
return submit;
|
||||
}
|
||||
ExamTrainRecord submit = rs.stream().filter(o -> Objects.equals(o.getSubmit(), 1) && Objects.equals(o.getIsNewBatch(), 1)).sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())).findFirst().map(o -> o).orElse(null);
|
||||
if (submit == null) {
|
||||
submit = new ExamTrainRecord();
|
||||
BeanUtil.copyProperties(notSubmit, submit);
|
||||
submit.setSubmit(1);
|
||||
submit.setIsNewBatch(1);
|
||||
} else {
|
||||
//删除未提交的试卷
|
||||
examTrainRecordService.remove(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.eq(ExamTrainRecord::getWorkerCard, card)
|
||||
.eq(ExamTrainRecord::getApplicationId, applicationId)
|
||||
.eq(ExamTrainRecord::getSubmit, 0)
|
||||
);
|
||||
}
|
||||
submit.setStartExamTime(notSubmit.getStartExamTime());
|
||||
submit.setSubmit(1);
|
||||
submit.setIsNewBatch(1);
|
||||
//同批次删除以前提交的试卷
|
||||
examTrainRecordService.remove(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.ne(ExamTrainRecord::getId, examRecordId)
|
||||
.eq(ExamTrainRecord::getWorkerId, submit.getWorkerId())
|
||||
.eq(ExamTrainRecord::getApplicationId, applicationId)
|
||||
);
|
||||
submit.setExamCount(submit.getExamCount() + 1);
|
||||
submit.setQuestions(notSubmit.getQuestions());
|
||||
ExamPaper examPaper = examPaperService.getById(paperId);
|
||||
BigDecimal score = BigDecimal.ZERO;
|
||||
BigDecimal totalScore = BigDecimal.ZERO;
|
||||
@ -314,7 +309,7 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
|
||||
@Override
|
||||
@DistributedLock(keyPrefix = "doStartExam:", key = "#param.idCard", tryLok = true, lockTime = 0)
|
||||
public void doStartExam(Map<String, Object> param) {
|
||||
public ExamTrainRecord doStartExam(Map<String, Object> param) {
|
||||
//《入场培训》:人员入场和违章再教育
|
||||
//《复工培训》:实名制人员
|
||||
//《专项培训》:高处作业,动火作业,吊装作业,受限作业,临时用电,脚手架搭设/拆除:实名制人员
|
||||
@ -427,18 +422,6 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
throw new OpenAlertException("您已没有考试的次数!");
|
||||
}
|
||||
}
|
||||
// if (trainRecord != null) {
|
||||
// if (trainRecord.getExamCount() > paper.getRetakeNum()) {
|
||||
// throw new OpenAlertException("您已没有考试的次数!");
|
||||
// }
|
||||
// this.setQuestionsIf(paper, trainRecord);
|
||||
// trainRecord.setStartExamTime(new Date());
|
||||
// trainRecord.setExamCount(trainRecord.getExamCount() + 1);
|
||||
// trainRecord.setFromType(fromType);
|
||||
// baseMapper.updateById(trainRecord);
|
||||
// baseMapper.update(trainRecord, new LambdaUpdateWrapper<ExamTrainRecord>().set(ExamTrainRecord::getIsPass, null).eq(ExamTrainRecord::getId, trainRecord.getId()));
|
||||
// typeName = trainRecord.getWorkerType();
|
||||
// } else {
|
||||
Long id;
|
||||
String wn;
|
||||
String teamName;
|
||||
@ -470,7 +453,6 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
trainRecord.setWorkerType(typeName);
|
||||
trainRecord.setWorkerCard(idCard);
|
||||
trainRecord.setEntryTime(entryTime);
|
||||
trainRecord.setExamCount(0);
|
||||
trainRecord.setIsPass(null);
|
||||
trainRecord.setProjectSn(projectSn);
|
||||
trainRecord.setCreateTime(new Date());
|
||||
@ -484,10 +466,15 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
trainRecord.setApplicationType(applicationType);
|
||||
trainRecord.setIsNewBatch(0);
|
||||
trainRecord.setSubmit(0);
|
||||
// baseMapper.updateOldBatch(idCard, examPaperId);
|
||||
//重考需要获取考试次数
|
||||
ExamTrainRecord record = examTrainRecordService.getOne(new LambdaQueryWrapper<ExamTrainRecord>()
|
||||
.eq(ExamTrainRecord::getWorkerId, trainRecord.getWorkerId())
|
||||
.eq(ExamTrainRecord::getApplicationId, trainRecord.getApplicationId())
|
||||
.eq(ExamTrainRecord::getSubmit, 1)
|
||||
.last("order by update_time limit 1")
|
||||
);
|
||||
trainRecord.setExamCount(record == null ? 0 : record.getExamCount());
|
||||
baseMapper.insert(trainRecord);
|
||||
// }
|
||||
|
||||
ExamScanCode scanCode = new ExamScanCode();
|
||||
scanCode.setExamPaperId(paper.getId());
|
||||
scanCode.setEnterpriseName(info != null ? info.getEnterpriseName() : workerAdmissionDetailService.queryById(admissionDetail.getId() + "").getEnterpriseName());
|
||||
@ -497,6 +484,7 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
scanCode.setCreateTime(new Date());
|
||||
scanCode.setPostWorkTypeName(typeName);
|
||||
examScanCodeService.save(scanCode);
|
||||
return trainRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -567,6 +555,7 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
}
|
||||
}
|
||||
List<ExamQuestionBank> random = examQuestionBankServie.random(randomQueryList);
|
||||
random = random.stream().sorted(Comparator.comparing(ExamQuestionBank::getType)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(random)) {
|
||||
String bankIds = StrUtil.join(",", random.stream().map(ExamQuestionBank::getId).collect(Collectors.toList()));
|
||||
trainRecord.setQuestions(bankIds);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user