|
@@ -21,13 +21,13 @@ import cn.com.qmth.examcloud.core.print.service.ExamStructureService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.examstructure.ExamStructureConvert;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.examstructure.ExamStructureInfo;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.examstructure.ExamStructureQuery;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
-import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
/**
|
|
@@ -41,8 +41,6 @@ public class ExamStructureServiceImpl implements ExamStructureService {
|
|
|
private static final Logger log = LoggerFactory.getLogger(ExamStructureServiceImpl.class);
|
|
|
@Autowired
|
|
|
private ExamStructureRepository examStructureRepository;
|
|
|
- @Autowired
|
|
|
- private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Override
|
|
|
public Page<ExamStructureInfo> getExamStructureList(ExamStructureQuery query) {
|
|
@@ -63,6 +61,18 @@ public class ExamStructureServiceImpl implements ExamStructureService {
|
|
|
return ExamStructureConvert.ofPage(page);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ExamStructureInfo getExamStructure(ExamStructureQuery query) {
|
|
|
+ Check.isNull(query, "查询参数不能为空!");
|
|
|
+ Check.isEmpty(query.getOrgId(), "学校ID不能为空!");
|
|
|
+ Check.isEmpty(query.getExamId(), "考试ID不能为空!");
|
|
|
+ ExamStructure entity = examStructureRepository.findByExamIdAndOrgId(query.getExamId(), query.getOrgId());
|
|
|
+ if (entity == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return ExamStructureConvert.of(entity);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void saveExamStructure(ExamStructureInfo info) {
|
|
|
Check.isNull(info.getOrgId(), "学校ID不能为空!");
|
|
@@ -115,7 +125,6 @@ public class ExamStructureServiceImpl implements ExamStructureService {
|
|
|
if (oldStructure == null) {
|
|
|
throw new StatusException(Constants.PRT_CODE_500, "原结构信息不存在!");
|
|
|
}
|
|
|
-
|
|
|
newStructure = new ExamStructure();
|
|
|
newStructure.setId(null);
|
|
|
newStructure.setOrgId(info.getNewOrgId());
|
|
@@ -128,21 +137,19 @@ public class ExamStructureServiceImpl implements ExamStructureService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncExamStructureExamName(Long examId, String examName) {
|
|
|
- String updateSql = String.format("UPDATE ec_prt_exam_structure SET exam_name = '%s' WHERE exam_id = %s", examName, examId);
|
|
|
- jdbcTemplate.update(updateSql);
|
|
|
+ public void syncOrgNameByOrgId(Long orgId, String orgName) {
|
|
|
+ if (orgId == null || StringUtils.isBlank(orgName)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ examStructureRepository.updateOrgNameByOrgId(orgId, orgName);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ExamStructureInfo getExamStructure(ExamStructureQuery query) {
|
|
|
- Check.isNull(query, "查询参数不能为空!");
|
|
|
- Check.isEmpty(query.getOrgId(), "学校ID不能为空!");
|
|
|
- Check.isEmpty(query.getExamId(), "考试ID不能为空!");
|
|
|
- ExamStructure entity = examStructureRepository.findByExamIdAndOrgId(query.getExamId(), query.getOrgId());
|
|
|
- if (entity == null) {
|
|
|
- return null;
|
|
|
+ public void syncExamNameByExamId(Long examId, String examName) {
|
|
|
+ if (examId == null || StringUtils.isBlank(examName)) {
|
|
|
+ return;
|
|
|
}
|
|
|
- return ExamStructureConvert.of(entity);
|
|
|
+ examStructureRepository.updateExamNameByExamId(examId, examName);
|
|
|
}
|
|
|
|
|
|
}
|