Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 năm trước cách đây
mục cha
commit
ecd9df9c9f

+ 10 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java

@@ -1,14 +1,13 @@
 package com.ym.mec.biz.service;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 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;
-import java.util.List;
-
 public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long, MusicGroupPaymentCalenderDetail> {
 
     /**
@@ -46,6 +45,13 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
     void add(Long musicGroupPaymentCalenderId, Integer userId);
 
     /**
+     * 乐团缴费记录新增学员
+     * @param musicGroupPaymentCalenderId
+     * @param userIdList
+     */
+    void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList);
+
+    /**
      * 获取fee表学员列表
      * @param musicGroupId
      * @return

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

@@ -7,7 +7,6 @@ import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface MusicGroupPaymentCalenderService extends BaseService<Long, MusicGroupPaymentCalender> {
@@ -17,7 +16,7 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @param musicGroupPaymentCalender
 	 * @return
 	 */
-	boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender);
+	Long create(MusicGroupPaymentCalender musicGroupPaymentCalender);
 
 	/**
 	 * 获取明细

+ 47 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -4,6 +4,7 @@ import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_P
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
@@ -29,8 +31,10 @@ import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
 import com.ym.mec.biz.service.SysConfigService;
@@ -47,6 +51,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	
+	@Autowired
+	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
+	
 	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
@@ -245,6 +253,45 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	}
 
 	@Override
+	public void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList) {
+		
+		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
+		if(musicGroupPaymentCalender == null){
+			throw new BizException("查询缴费信息失败");
+		}
+		
+		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
+		
+		BigDecimal totalPrice = new BigDecimal(0);
+		for(MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList){
+			totalPrice.add(courseSettings.getCourseCurrentPrice());
+		}
+		
+		Date date = new Date();
+		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
+
+		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
+		//创建缴费明细
+		for(Integer studentId : userIdList){
+			musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
+			musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
+			musicGroupPaymentCalenderDetail.setCreateTime(date);
+			musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
+			musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
+			musicGroupPaymentCalenderDetail.setUpdateTime(date);
+			musicGroupPaymentCalenderDetail.setUserId(studentId);
+			musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
+			musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
+			
+			musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
+		}
+
+		if (musicGroupPaymentCalenderDetailList.size() > 0) {
+			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
+		}
+	}
+
+	@Override
 	public List<FeeStudentDto> queryFeeStudents(String musicGroupId,String search,Integer subjectId) {
 		return musicGroupStudentFeeDao.queryFeeStudents(musicGroupId,search,subjectId);
 	}

+ 6 - 34
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -55,6 +55,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
+
+	@Autowired
+	private MusicGroupOrganizationCourseSettingsDao musicGroupOrganizationCourseSettingsDao;
 	
 	@Autowired
 	private IdGeneratorService idGeneratorService;
@@ -79,7 +82,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+	public Long create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		
 		String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
 
@@ -94,7 +97,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		Date date = new Date();
 		Map<Integer, String> pushUserMap = new HashMap<>();
-		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
 		musicGroupPaymentCalender.setOperator(sysUser.getId());
 		musicGroupPaymentCalender.setCreateTime(date);
@@ -157,42 +159,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 
 		musicGroupPaymentCalender.setExpectNum(0);
-		if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
-			String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
-			musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
-			
-			if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
-				for(String studentId : sutdentIdList){
-					pushUserMap.put(Integer.parseInt(studentId), studentId);
-				}
-			}
-
-			BigDecimal totalPrice = new BigDecimal(0);
-			//相同类型的课程如果修改了课程费用,需要走审批
-			for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
-				totalPrice.add(entry.getValue());
-			}
-			//创建缴费明细
-			for(String studentId : sutdentIdList){
-				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-				musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-				musicGroupPaymentCalenderDetail.setCreateTime(date);
-				musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
-				musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
-				musicGroupPaymentCalenderDetail.setUpdateTime(date);
-				musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
-				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
-				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
-				
-				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
-			}
-		}
 		//设置批次号
 		musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId()+"");
 		musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
 		if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
-			MusicGroupPaymentCalenderCourseSettings courseSettings = musicGroupPaymentCalenderCourseSettingsDao.get(musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId());
+			MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId());
 			for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
 				musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
 				musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
@@ -211,7 +183,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE,
 					pushUserMap, null, 0, memo, "STUDENT", musicGroup.getName());
 		}
-		return true;
+		return musicGroupPaymentCalender.getId();
 	}
 
 	@Override

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml

@@ -119,7 +119,7 @@
 		LEFT JOIN music_group_payment_calender_course_settings mgpccs
 		ON mgpccs.music_group_payment_calender_id_ = mgpc.id_
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
-		AND mgpc.payment_type_ = 1
+		AND mgpc.payment_type_ = 'MUSIC_APPLY'
 	</select>
 
     <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

+ 7 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -11,12 +11,15 @@ import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 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.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
@@ -55,8 +58,10 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
     public Object add(@RequestBody MusicGroupPaymentCalender musicGroupPaymentCalender) {
-        musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
-        return succeed();
+        Long musicGroupPaymentCalenderId = musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
+        ModelMap map = new ModelMap();
+        map.put("musicGroupPaymentCalenderId", musicGroupPaymentCalenderId);
+        return succeed(map);
     }
 
     @ApiOperation(value = "删除乐团缴费日历")

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

@@ -1,11 +1,11 @@
 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 java.math.BigDecimal;
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,7 +13,10 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.math.BigDecimal;
+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;
 
 @RequestMapping("musicGroupPaymentCalenderDetail")
 @Api(tags = "乐团缴费明细")
@@ -53,6 +56,14 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "乐团缴费记录新增学员")
+    @PostMapping("/batchAdd")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchAdd')")
+    public Object batchAdd(Long musicGroupPaymentCalenderId,List<Integer> userIdList) {
+        musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalenderId,userIdList);
+        return succeed();
+    }
+
     @ApiOperation(value = "批量删除缴费信息")
     @PostMapping("/batchDel")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/batchDel')")