|
@@ -1,21 +1,25 @@
|
|
package cn.com.qmth.scancentral.service.impl;
|
|
package cn.com.qmth.scancentral.service.impl;
|
|
|
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.boot.core.collection.PageResult;
|
|
import com.qmth.boot.core.collection.PageResult;
|
|
|
|
+import com.qmth.boot.core.exception.ParameterException;
|
|
|
|
|
|
|
|
+import cn.com.qmth.scancentral.bean.User;
|
|
import cn.com.qmth.scancentral.dao.MarkSiteDao;
|
|
import cn.com.qmth.scancentral.dao.MarkSiteDao;
|
|
import cn.com.qmth.scancentral.entity.MarkSiteEntity;
|
|
import cn.com.qmth.scancentral.entity.MarkSiteEntity;
|
|
-import cn.com.qmth.scancentral.enums.ScanStatus;
|
|
|
|
import cn.com.qmth.scancentral.service.MarkSiteService;
|
|
import cn.com.qmth.scancentral.service.MarkSiteService;
|
|
import cn.com.qmth.scancentral.util.PageUtil;
|
|
import cn.com.qmth.scancentral.util.PageUtil;
|
|
|
|
+import cn.com.qmth.scancentral.vo.marksite.MarkSiteDomain;
|
|
import cn.com.qmth.scancentral.vo.marksite.MarkSitePageQuery;
|
|
import cn.com.qmth.scancentral.vo.marksite.MarkSitePageQuery;
|
|
import cn.com.qmth.scancentral.vo.marksite.MarkSitePageVo;
|
|
import cn.com.qmth.scancentral.vo.marksite.MarkSitePageVo;
|
|
-import cn.com.qmth.scancentral.vo.student.StudentPageVo;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class MarkSiteServiceImpl extends ServiceImpl<MarkSiteDao, MarkSiteEntity> implements MarkSiteService {
|
|
public class MarkSiteServiceImpl extends ServiceImpl<MarkSiteDao, MarkSiteEntity> implements MarkSiteService {
|
|
@@ -27,4 +31,58 @@ public class MarkSiteServiceImpl extends ServiceImpl<MarkSiteDao, MarkSiteEntity
|
|
return PageUtil.of(iPage);
|
|
return PageUtil.of(iPage);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private MarkSiteEntity findByExamSubjectPaperType(Long examId, String subjectCode, String paperType) {
|
|
|
|
+ QueryWrapper<MarkSiteEntity> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<MarkSiteEntity> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(MarkSiteEntity::getExamId, examId);
|
|
|
|
+ lw.eq(MarkSiteEntity::getSubjectCode, subjectCode);
|
|
|
|
+ lw.eq(MarkSiteEntity::getPaperType, paperType);
|
|
|
|
+ return this.getOne(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public void saveMarkSite(MarkSiteDomain domain, User user) {
|
|
|
|
+ MarkSiteEntity old = findByExamSubjectPaperType(domain.getExamId(), domain.getSubjectCode(),
|
|
|
|
+ domain.getPaperType());
|
|
|
|
+ if ((domain.getId() == null && old != null)
|
|
|
|
+ || (domain.getId() != null && !domain.getId().equals(old.getId()))) {
|
|
|
|
+ throw new ParameterException("评卷点信息已存在");
|
|
|
|
+ }
|
|
|
|
+ if (domain.getId() != null) {
|
|
|
|
+ // 修改
|
|
|
|
+ MarkSiteEntity e = this.getById(domain.getId());
|
|
|
|
+ if (e == null) {
|
|
|
|
+ throw new ParameterException("评卷点不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ LambdaUpdateWrapper<MarkSiteEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getUpdateTime, System.currentTimeMillis());
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getUpdaterId, user.getId());
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getSubjectCode, domain.getSubjectCode());
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getPaperType, domain.getPaperType());
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getOddNumber, domain.getOddNumber());
|
|
|
|
+ updateWrapper.set(MarkSiteEntity::getEvenNumber, domain.getEvenNumber());
|
|
|
|
+ updateWrapper.eq(MarkSiteEntity::getId, domain.getId());
|
|
|
|
+ this.update(updateWrapper);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ // 新增
|
|
|
|
+ MarkSiteEntity e = new MarkSiteEntity();
|
|
|
|
+ e.setExamId(domain.getExamId());
|
|
|
|
+ e.setSubjectCode(domain.getSubjectCode());
|
|
|
|
+ e.setPaperType(domain.getPaperType());
|
|
|
|
+ e.setOddNumber(domain.getOddNumber());
|
|
|
|
+ e.setEvenNumber(domain.getEvenNumber());
|
|
|
|
+ this.save(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public void delete(Long id) {
|
|
|
|
+ this.delete(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|