zouxuan 5 年之前
父节点
当前提交
a1f5fd68c6

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.service.BaseService;
 
 import java.math.BigDecimal;
@@ -21,7 +22,7 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
      * 开启缴费
      * @param ids
      */
-    void openPayment(String ids);
+    String openPayment(String ids);
 
     /**
      * 根据声部获取乐团下完成缴费的学员

+ 6 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -111,15 +111,16 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void openPayment(String ids) {
+	public String openPayment(String ids) {
 		if(StringUtils.isEmpty(ids)){
 			throw new BizException("参数校验失败");
 		}
 		//获取可开启缴费列表
 		List<MusicGroupPaymentCalenderDetail> calenderDetails = musicGroupPaymentCalenderDetailDao.queryCanOpenList(ids);
 		if(calenderDetails.size() == 0){
-			return;
+			return "开启失败,没有可操作的数据";
 		}
+		int length = ids.split(",").length;
 		Date date = new Date();
 		Iterator<MusicGroupPaymentCalenderDetail> iterator = calenderDetails.iterator();
 		MusicGroupPaymentCalenderDetail next;
@@ -132,7 +133,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			}
 		}
 		if(calenderDetails.size() == 0){
-			return;
+			return "开启失败,学员有未完成的订单";
 		}
 		String musicGroupId = calenderDetails.get(0).getMusicGroupId();
 		calenderDetails.forEach(e->{
@@ -158,6 +159,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			// 发送续费通知
 			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push, null, 0, memo,"STUDENT",musicGroup.getName());
 		}
+		StringBuffer append = new StringBuffer("操作成功: 成功开启").append(studentIds.size()).append("条,失败").append(length - studentIds.size()).append("条");
+		return append.toString();
 	}
 
 	@Override

+ 5 - 3
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,8 +49,9 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
     @ApiOperation(value = "开启缴费")
     @PostMapping("/openPayment")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/openPayment')")
-    public Object openPayment(String ids) {
-        musicGroupPaymentCalenderDetailService.openPayment(ids);
-        return succeed();
+    public HttpResponseResult openPayment(String ids) {
+        HttpResponseResult<Object> succeed = succeed();
+        succeed.setMsg(musicGroupPaymentCalenderDetailService.openPayment(ids));
+        return succeed;
     }
 }