|
@@ -1,20 +1,24 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import com.ym.mec.common.exception.BizException;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
|
|
|
import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PROCESSING;
|
|
|
|
|
|
@Service
|
|
|
public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalenderDetail> implements MusicGroupPaymentCalenderDetailService {
|
|
@@ -29,19 +33,48 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateActualAmount(BigDecimal actualAmount, Long id) {
|
|
|
- if(actualAmount == null || id == null){
|
|
|
+ public void updateActualAmount(BigDecimal actualAmount,String ids) {
|
|
|
+ if(actualAmount == null || StringUtils.isEmpty(ids)){
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
|
- MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.get(id);
|
|
|
- if(calenderDetail == null){
|
|
|
+ String[] split = ids.split(",");
|
|
|
+ //获取缴费列表
|
|
|
+ List<MusicGroupPaymentCalenderDetail> calenderDetails = musicGroupPaymentCalenderDetailDao.queryListByIds(ids);
|
|
|
+ if(calenderDetails.size() == 0){
|
|
|
throw new BizException("缴费记录不存在");
|
|
|
}
|
|
|
- if(calenderDetail.getPaymentStatus() == null || calenderDetail.getPaymentStatus() != NON_PAYMENT){
|
|
|
- throw new BizException("修改失败,缴费状态异常");
|
|
|
+ Date date = new Date();
|
|
|
+ calenderDetails.forEach(e->{
|
|
|
+ if(e.getPaymentStatus() == null || e.getPaymentStatus() != NON_PAYMENT){
|
|
|
+ throw new BizException("修改失败,缴费状态不匹配");
|
|
|
+ }
|
|
|
+ e.setUpdateTime(date);
|
|
|
+ e.setActualAmount(actualAmount);
|
|
|
+ });
|
|
|
+ musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void openPayment(String ids) {
|
|
|
+ if(StringUtils.isEmpty(ids)){
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ //获取缴费列表
|
|
|
+ List<MusicGroupPaymentCalenderDetail> calenderDetails = musicGroupPaymentCalenderDetailDao.queryListByIds(ids);
|
|
|
+ if(calenderDetails.size() == 0){
|
|
|
+ throw new BizException("缴费记录不存在");
|
|
|
}
|
|
|
- calenderDetail.setActualAmount(actualAmount);
|
|
|
- calenderDetail.setUpdateTime(new Date());
|
|
|
- musicGroupPaymentCalenderDetailDao.update(calenderDetail);
|
|
|
+ Date date = new Date();
|
|
|
+ calenderDetails.forEach(e->{
|
|
|
+ if(e.getPaymentStatus() == null || e.getPaymentStatus() != NON_PAYMENT){
|
|
|
+ throw new BizException("修改失败,缴费状态不匹配");
|
|
|
+ }
|
|
|
+ e.setUpdateTime(date);
|
|
|
+ e.setPaymentStatus(PROCESSING);
|
|
|
+ });
|
|
|
+ musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
|
|
|
+ Set<Integer> studentIds = calenderDetails.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
+ //推送消息
|
|
|
}
|
|
|
}
|