|
@@ -3,18 +3,22 @@ package com.ym.mec.biz.service.impl;
|
|
|
import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
|
|
|
import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
+import com.ym.mec.biz.dal.dto.PageInfoDegree;
|
|
|
+import com.ym.mec.biz.dal.dto.PageInfoOrder;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.page.DegreeQueryInfo;
|
|
|
import com.ym.mec.biz.service.DegreeRegistrationService;
|
|
|
import com.ym.mec.biz.service.PayService;
|
|
|
import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
-import com.ym.mec.biz.service.SysConfigService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import com.ym.mec.util.collection.MapUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -58,22 +62,22 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
if (chargeInfo == null) {
|
|
|
throw new BizException("你选的考试级别不存在");
|
|
|
}
|
|
|
- if(chargeInfo.getTitle().equals("二级") && StringUtils.isBlank(degreeRegistration.getTheoryCert())){
|
|
|
- throw new BizException(chargeInfo.getTitle()+"考试必须上传证书");
|
|
|
+ if (chargeInfo.getTitle().equals("二级") && StringUtils.isBlank(degreeRegistration.getTheoryCert())) {
|
|
|
+ throw new BizException(chargeInfo.getTitle() + "考试必须上传证书");
|
|
|
}
|
|
|
degreeRegistration.setLevel(chargeInfo.getTitle());
|
|
|
BigDecimal theoryMoney = BigDecimal.ZERO;
|
|
|
- if(degreeRegistration.getTheoryLevel().equals("一级")){
|
|
|
+ if (degreeRegistration.getTheoryLevel().equals("一级")) {
|
|
|
theoryMoney = new BigDecimal(200);
|
|
|
- }else if(degreeRegistration.getTheoryLevel().equals("二级")){
|
|
|
+ } else if (degreeRegistration.getTheoryLevel().equals("二级")) {
|
|
|
theoryMoney = new BigDecimal(240);
|
|
|
- }else if(degreeRegistration.getTheoryLevel().equals("三级")){
|
|
|
+ } else if (degreeRegistration.getTheoryLevel().equals("三级")) {
|
|
|
theoryMoney = new BigDecimal(280);
|
|
|
- }else if(degreeRegistration.getTheoryLevel().equals("四级")){
|
|
|
+ } else if (degreeRegistration.getTheoryLevel().equals("四级")) {
|
|
|
theoryMoney = new BigDecimal(320);
|
|
|
- }else if(degreeRegistration.getTheoryLevel().equals("免考")){
|
|
|
+ } else if (degreeRegistration.getTheoryLevel().equals("免考")) {
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new BizException("您选择的乐理级别不存在,请核对");
|
|
|
}
|
|
|
degreeRegistration.setTheoryMoney(theoryMoney);
|
|
@@ -84,9 +88,9 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
degreeRegistration.setCreateTime(nowDate);
|
|
|
degreeRegistration.setUpdateTime(nowDate);
|
|
|
degreeRegistrationDao.insert(degreeRegistration);
|
|
|
- }else if (degree.getStatus().equals(2)){
|
|
|
- throw new BizException("您本次已报名,请勿重复报名");
|
|
|
- }else {
|
|
|
+ } else if (degree.getStatus().equals(2)) {
|
|
|
+ throw new BizException("您本次已报名,请勿重复报名");
|
|
|
+ } else {
|
|
|
degreeRegistration.setId(degree.getId());
|
|
|
degreeRegistration.setStatus(1);
|
|
|
degreeRegistration.setUpdateTime(nowDate);
|
|
@@ -95,7 +99,6 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
degreeRegistrationDao.getLock(degreeRegistration.getId());
|
|
|
|
|
|
|
|
|
-
|
|
|
BigDecimal amount = chargeInfo.getAmount();
|
|
|
amount = amount.add(theoryMoney);
|
|
|
|
|
@@ -115,8 +118,8 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
studentPaymentOrder.setMusicGroupId(degreeRegistration.getSporadicId().toString());
|
|
|
studentPaymentOrder.setOrganId(chargeInfo.getOrganId());
|
|
|
studentPaymentOrder.setRoutingOrganId(chargeInfo.getOrganId());
|
|
|
- if(theoryMoney.compareTo(BigDecimal.ZERO) >0){
|
|
|
- studentPaymentOrder.setMemo("乐理"+degreeRegistration.getTheoryLevel()+",费用:"+theoryMoney);
|
|
|
+ if (theoryMoney.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ studentPaymentOrder.setMemo("乐理" + degreeRegistration.getTheoryLevel() + ",费用:" + theoryMoney);
|
|
|
}
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
studentPaymentOrder.setVersion(0);
|
|
@@ -178,4 +181,30 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfoDegree<DegreeRegistration> getPageList(DegreeQueryInfo queryInfo) {
|
|
|
+ PageInfoDegree<DegreeRegistration> pageInfo = new PageInfoDegree<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+
|
|
|
+ List<DegreeRegistration> dataList = new ArrayList<>();
|
|
|
+ int count = this.findCount(params);
|
|
|
+
|
|
|
+ if (count > 0) {
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ dataList = degreeRegistrationDao.queryPage(params);
|
|
|
+ DegreeRegistration degree = degreeRegistrationDao.getTotalAmount(params);
|
|
|
+ BigDecimal subjectLevelAmount = degree.getMoney() == null ? BigDecimal.ZERO : degree.getMoney();
|
|
|
+ BigDecimal theoryLevelAmount = degree.getTheoryMoney() == null ? BigDecimal.ZERO : degree.getTheoryMoney();
|
|
|
+ BigDecimal totalAmount = subjectLevelAmount.add(theoryLevelAmount);
|
|
|
+
|
|
|
+ pageInfo.setSubjectLevelAmount(subjectLevelAmount);
|
|
|
+ pageInfo.setTheoryLevelAmount(theoryLevelAmount);
|
|
|
+ pageInfo.setTotalAmount(totalAmount);
|
|
|
+ }
|
|
|
+ pageInfo.setRows(dataList);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
}
|