|
@@ -3,12 +3,17 @@ package com.ym.mec.biz.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
|
|
|
import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.enums.DegreeNewsTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.EDegreeStatus;
|
|
|
import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.vo.DegreeNewsVo;
|
|
|
+import com.ym.mec.biz.dal.wrapper.DegreeNewsWrapper;
|
|
|
+import com.ym.mec.biz.service.DegreeNewsService;
|
|
|
import com.ym.mec.biz.service.OrganizationService;
|
|
|
import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -53,12 +58,15 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
@Autowired
|
|
|
private OrganizationDao organizationDao;
|
|
|
|
|
|
- /**
|
|
|
+ @Autowired
|
|
|
+ private DegreeNewsService degreeNewsService;
|
|
|
+
|
|
|
+ /**
|
|
|
* 查询详情
|
|
|
* @param id 详情ID
|
|
|
* @return Degree
|
|
|
*/
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
public Degree detail(Long id) {
|
|
|
|
|
|
return baseMapper.selectById(id);
|
|
@@ -110,7 +118,7 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
return result.setRecords(degrees);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
* @param degree DegreeWrapper.Degree
|
|
@@ -121,12 +129,34 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
|
|
|
Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
degree.setTenantId(tenantId);
|
|
|
+
|
|
|
+ // 判断考级时间冲突
|
|
|
+ checkTime(degree);
|
|
|
+
|
|
|
updateDegreeStatus(degree);
|
|
|
|
|
|
|
|
|
return this.save(JSON.parseObject(degree.jsonString(), Degree.class));
|
|
|
}
|
|
|
|
|
|
+ private void checkTime(DegreeWrapper.Degree degree) {
|
|
|
+ List<Degree> list = this.lambdaQuery()
|
|
|
+ .eq(Degree::getTenantId, degree.getTenantId())
|
|
|
+ .le(Degree::getStartTime, degree.getEndTime())
|
|
|
+ .ge(Degree::getEndTime, degree.getStartTime())
|
|
|
+ .list();
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (list.size() == 1) {
|
|
|
+ Degree degree1 = list.get(0);
|
|
|
+ if (degree1.getId().equals(degree.getId())) return;
|
|
|
+ }
|
|
|
+ throw new BizException("考级时间冲突");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据时间设置状态
|
|
|
* @param degree DegreeWrapper.Degree
|
|
@@ -149,6 +179,13 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
*/
|
|
|
@Override
|
|
|
public Boolean update(DegreeWrapper.Degree degree){
|
|
|
+
|
|
|
+ Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
+ degree.setTenantId(tenantId);
|
|
|
+
|
|
|
+ // 判断考级时间冲突
|
|
|
+ checkTime(degree);
|
|
|
+
|
|
|
updateDegreeStatus(degree);
|
|
|
|
|
|
return this.updateById(JSON.parseObject(degree.jsonString(), Degree.class));
|
|
@@ -251,6 +288,26 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 考级最新简章消息ID
|
|
|
+ DegreeNewsWrapper.DegreeNewsQuery newsQuery = DegreeNewsWrapper.DegreeNewsQuery
|
|
|
+ .builder()
|
|
|
+ .page(1)
|
|
|
+ .rows(1)
|
|
|
+ .status(true)
|
|
|
+ .tenantId(wrapper.getTenantId())
|
|
|
+ .type(DegreeNewsTypeEnum.GRADE_EXAMINATION_BRIEF.getCode())
|
|
|
+ .sortedTime(true)
|
|
|
+ .build();
|
|
|
+ List<DegreeNewsVo> records = degreeNewsService.selectPage(QueryInfo.getPage(newsQuery), newsQuery).getRecords();
|
|
|
+ if (org.apache.commons.collections.CollectionUtils.isNotEmpty(records)) {
|
|
|
+ wrapper.setExaminationBriefId(records.get(0).getId());
|
|
|
+ }
|
|
|
+
|
|
|
return wrapper;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void degreeStatusChange() {
|
|
|
+ this.baseMapper.degreeStatusChange();
|
|
|
+ }
|
|
|
}
|