Browse Source

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into saas

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java
yonge 3 years ago
parent
commit
5e89de535d
17 changed files with 220 additions and 157 deletions
  1. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantInfoDao.java
  2. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderAddStudent.java
  3. 17 17
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroupSellPrice.java
  4. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TenantInfoInfoPageVo.java
  5. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java
  6. 0 9
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  7. 58 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  8. 47 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java
  9. 6 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  10. 13 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  11. 5 42
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  12. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java
  13. 15 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  14. 1 2
      mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml
  15. 8 32
      mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml
  16. 8 0
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  17. 2 1
      mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantInfoDao.java

@@ -15,6 +15,8 @@ public interface TenantInfoDao extends BaseMapper<TenantInfo> {
 
     <T> IPage<T> queryPage(Page<T> page, @Param("param") Map<String, Object> param);
 
+    <T> List<T> queryPage(@Param("param") Map<String, Object> param);
+
     TenantProductSumm queryTenantInfoProductSumm(Integer tenantId);
 
     TenantInfo getOpenTenant(Integer tenantId);
@@ -23,7 +25,5 @@ public interface TenantInfoDao extends BaseMapper<TenantInfo> {
 
     void updatePhone(@Param("newPhone")String newPhone, @Param("oldPhone")String oldPhone);
 
-    List<TenantInfo> queryExpiryTenant(@Param("expiryDate") Date expiryDate);
-
     Integer queryUserByTenantId(@Param("tenantId") Integer tenantId);
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderAddStudent.java

@@ -5,7 +5,7 @@ public class CalenderAddStudent {
 
     private String classGroupIds;
 
-    private String studentIds;
+    private Integer studentIds;
 
     public String getClassGroupIds() {
         return classGroupIds;
@@ -15,11 +15,11 @@ public class CalenderAddStudent {
         this.classGroupIds = classGroupIds;
     }
 
-    public String getStudentIds() {
+    public Integer getStudentIds() {
         return studentIds;
     }
 
-    public void setStudentIds(String studentIds) {
+    public void setStudentIds(Integer studentIds) {
         this.studentIds = studentIds;
     }
 }

+ 17 - 17
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroupSellPrice.java

@@ -15,39 +15,39 @@ public class PracticeGroupSellPrice extends BaseEntity {
 
     private String organName;
 
-    private BigDecimal onceOriginalPrice;
+    private BigDecimal onceOriginalPrice = BigDecimal.ZERO;
 
-    private BigDecimal onceActivityPrice;
+    private BigDecimal onceActivityPrice = BigDecimal.ZERO;
 
-    private BigDecimal onceQuartActivityPrice;
+    private BigDecimal onceQuartActivityPrice = BigDecimal.ZERO;
 
-    private BigDecimal twiceOriginalPrice;
+    private BigDecimal twiceOriginalPrice = BigDecimal.ZERO;
 
-    private BigDecimal twiceActivityPrice;
+    private BigDecimal twiceActivityPrice = BigDecimal.ZERO;
 
-    private BigDecimal twiceQuartActivityPrice;
+    private BigDecimal twiceQuartActivityPrice = BigDecimal.ZERO;
 
-    private BigDecimal vipOneStudentTwelveCourseOriginalPriceWithNewUser;
+    private BigDecimal vipOneStudentTwelveCourseOriginalPriceWithNewUser = BigDecimal.ZERO;
 
-    private BigDecimal vipOneStudentTwelveCourseActivityPriceWithNewUser;
+    private BigDecimal vipOneStudentTwelveCourseActivityPriceWithNewUser = BigDecimal.ZERO;
 
-    private BigDecimal vipOneStudentTwelveCourseOriginalPriceWithOldUser;
+    private BigDecimal vipOneStudentTwelveCourseOriginalPriceWithOldUser = BigDecimal.ZERO;
 
-    private BigDecimal vipOneStudentTwelveCourseActivityPriceWithOldUser;
+    private BigDecimal vipOneStudentTwelveCourseActivityPriceWithOldUser = BigDecimal.ZERO;
 
-    private BigDecimal highOnlineTenCourseOriginalPriceWithNewUser;
+    private BigDecimal highOnlineTenCourseOriginalPriceWithNewUser = BigDecimal.ZERO;
 
-    private BigDecimal highOnlineTenCourseActivityPriceWithNewUser;
+    private BigDecimal highOnlineTenCourseActivityPriceWithNewUser = BigDecimal.ZERO;
 
-    private BigDecimal highOnlineTenCourseOriginalPriceWithOldUser;
+    private BigDecimal highOnlineTenCourseOriginalPriceWithOldUser = BigDecimal.ZERO;
 
-    private BigDecimal highOnlineTenCourseActivityPriceWithOldUser;
+    private BigDecimal highOnlineTenCourseActivityPriceWithOldUser = BigDecimal.ZERO;
 
-    private BigDecimal carePackagePrice;
+    private BigDecimal carePackagePrice = BigDecimal.ZERO;
 
-    private BigDecimal comeOnPackagePrice;
+    private BigDecimal comeOnPackagePrice = BigDecimal.ZERO;
 
-    private BigDecimal singleClassMinutesPrice;
+    private BigDecimal singleClassMinutesPrice = BigDecimal.ZERO;
 
     private Date createTime;
 

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TenantInfoInfoPageVo.java

@@ -26,6 +26,9 @@ public class TenantInfoInfoPageVo implements Serializable {
     @ApiModelProperty(value = "机构联系人电话")
     private String phone;
 
+    @ApiModelProperty(value = "机构email")
+    private String email;
+
     @ApiModelProperty(value = "缴费状态 0未缴费  1已缴费")
     private Integer payState;
 
@@ -52,6 +55,9 @@ public class TenantInfoInfoPageVo implements Serializable {
     @ApiModelProperty(value = "到期时间")
     private Date expireDate;
 
+    @ApiModelProperty(value = "学员上限")
+    private Integer userId;
+
     public Integer getId() {
         return id;
     }
@@ -84,6 +90,14 @@ public class TenantInfoInfoPageVo implements Serializable {
         this.phone = phone;
     }
 
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
     public Integer getPayState() {
         return payState;
     }
@@ -147,4 +161,12 @@ public class TenantInfoInfoPageVo implements Serializable {
     public void setStudentCount(Integer studentCount) {
         this.studentCount = studentCount;
     }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java

@@ -87,6 +87,9 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
 
     void queryOrderStatus() throws Exception;
 
+    //退优惠券和余额
+    void quitCouponAndBalance(StudentPaymentOrder order);
+
     void updateOrder(Map<String, String> rpMap) throws Exception;
 
     List<StudentPaymentOrderExportDto> ExportQueryPage(Map<String, Object> params);
@@ -195,6 +198,15 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
      */
     HttpResponseResult checkRepeatPay(StudentPaymentOrder order, Boolean repeatPay) throws Exception;
 
+    /**
+    * @description: 订单关闭时需要更改已缴费学员数
+     * @param order
+    * @return void
+    * @author zx
+    * @date 2022/1/18 13:39
+    */
+    void cutSubjectPlan(StudentPaymentOrder order);
+
     PageInfo<StudentPaymentOrderVo> queryOrder(Map<String, Object> param) throws Exception;
 
     StudentPaymentOrderVo queryOrderDetail(String orderNo);

+ 0 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -400,15 +400,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     PageInfoReg<RegisterDto> getRegisterOrPreList(RegistrationOrPreQueryInfo queryInfo);
 
-
-    /**
-     * 设置不需要云教练
-     *
-     * @param id
-     * @return
-     */
-    Boolean setNoneCloudTeacher(Long id);
-
     /**
      * 已付费解除审核增加缴费人数和0元缴费人数
      *

+ 58 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -38,6 +38,9 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.*;
 import java.util.Map.Entry;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Predicate;
@@ -417,7 +420,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 			if (paymentType == PaymentType.ADD_STUDENT) {
 				musicGroupPaymentCalender.setPayUserType(STUDENT);
-//				musicGroupPaymentCalender.setIsGiveMusicNetwork(false);
 				if (musicGroupPaymentCalender.getStatus() != AUDITING) {
 					musicGroupPaymentCalender.setExpectNum(1);
 				}
@@ -434,10 +436,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 			// 设置批次号
 			musicGroupPaymentCalender.setBatchNo(batchNo);
-			//设置会员缴费金额、级别以及有效期
-//			musicGroupPaymentCalender.setMemberPaymentAmount(musicGroupPaymentCalenderDto.getMemberPaymentAmount());
-//			musicGroupPaymentCalender.setMemberRankSettingId(musicGroupPaymentCalenderDto.getMemberRankSettingId());
-//			musicGroupPaymentCalender.setMemberValidDate(musicGroupPaymentCalenderDto.getMemberValidDate());
 			musicGroupPaymentCalenderDto.setBatchNo(batchNo);
 			musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
@@ -544,13 +542,27 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				throw new BizException("创建失败,已经存在缴费信息");
 			}
 		}
+		//进行中加学员拓展信息
+		CalenderAddStudent calenderAddStudent = musicGroupPaymentBaseCalender.getCalenderAddStudent();
+		MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
+		//判断缴费项目类型
 		if(musicGroup.getStatus() == MusicGroupStatusEnum.PRE_BUILD_FEE){
 			musicGroupPaymentBaseCalender.setPaymentType(MUSIC_APPLY);
 		}else {
-			if(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId() != null){
-				musicGroupPaymentBaseCalender.setPaymentType(MUSIC_RENEW);
+			if(calenderAddStudent != null && calenderAddStudent.getStudentIds() != null){
+				musicGroupPaymentBaseCalender.setPaymentType(ADD_STUDENT);
+				//预计缴费人数
+				musicGroupPaymentCalender.setAttribute1(calenderAddStudent.getClassGroupIds());
+				musicGroupPaymentCalender.setStudentIds(calenderAddStudent.getStudentIds().toString());
+				musicGroupPaymentCalender.setExpectNum(1);
+				//校验是否可以加学员
+				checkAddStudent(calenderAddStudent,musicGroup);
 			}else {
-				musicGroupPaymentBaseCalender.setPaymentType(ADD_COURSE);
+				if(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId() != null){
+					musicGroupPaymentBaseCalender.setPaymentType(MUSIC_RENEW);
+				}else {
+					musicGroupPaymentBaseCalender.setPaymentType(ADD_COURSE);
+				}
 			}
 		}
 		musicGroupPaymentBaseCalender.setMusicGroup(musicGroup);
@@ -594,7 +606,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		Date date = new Date();
 
-		MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
 		musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentBaseCalender.getDeadlinePaymentDate());
 		musicGroupPaymentCalender.setMemo(musicGroupPaymentBaseCalender.getMemo());
 		musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
@@ -605,7 +616,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setCreateTime(date);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalender.setPaymentType(musicGroupPaymentBaseCalender.getPaymentType());
-//		musicGroupPaymentCalender.setPaymentAmount(courseActualAmount);
 		musicGroupPaymentCalender.setCurrentTotalAmount(actualTotalAmount);
 		musicGroupPaymentCalender.setOriginalTotalAmount(originalTotalAmount);
 		musicGroupPaymentCalender.setStatus(status);
@@ -679,10 +689,48 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			Organization organization = organizationDao.get(musicGroup.getOrganId());
 			sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(),new SysUserRoleEnum[]{ORGAN_MANAGER},
 					null,null,MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT,organization.getName(), musicGroup.getName());
+		}else {
+			if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
+				addStudent(musicGroupPaymentCalender, musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList(),musicGroup);
+				//将0元未缴费学员缴费状态更新为已缴费
+				this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender,true);
+				// 学生加到班级
+				classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
+						batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(),musicGroup);
+				ExecutorService executor = Executors.newFixedThreadPool(5);
+				CompletableFuture.runAsync(()->{
+					imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
+				},executor);
+				executor.shutdown();
+			}
 		}
 		return batchNo;
 	}
 
+	//校验缴费项目进行中加学员
+	public void checkAddStudent(CalenderAddStudent calenderAddStudent,MusicGroup musicGroup){
+		//获取缴费状态在审核中或者已拒绝的缴费项目的学员
+		Integer userId = calenderAddStudent.getStudentIds();
+		if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+			//该学员是否在其他的会员团
+			boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroup.getId(),userId);
+			if(hasMemberGroup){
+				throw new BizException("操作失败:学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
+			}
+		}
+
+		String studentIds = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroup.getId(),null);
+		if(StringUtils.isNotEmpty(studentIds)){
+			if(studentIds.contains(userId.toString())){
+				throw new BizException("创建缴费失败:所选学员有待审核或已拒绝的缴费项目");
+			}
+		}
+		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroup.getId());
+		if(musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0){
+			throw new BizException("创建缴费失败:已存在缴费项目");
+		}
+	}
+
 	public Map<String, Object> getCalenderDetail(Map<String, Object> result,Long calenderId){
 		//课程
 		result.put("course", musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(calenderId));

+ 47 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -30,6 +30,8 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.biz.dal.entity.TenantConfig;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 import com.ym.mec.biz.dal.entity.TenantPaymentOrder;
@@ -70,10 +72,10 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private CloudTeacherOrderService cloudTeacherOrderService;
     @Autowired
     private TenantConfigService tenantConfigService;
-    
+
     @Autowired
     private SysConfigService sysConfigService;
-    
+
     @Autowired
     private SysConfigDao sysConfigDao;
     
@@ -104,25 +106,17 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         }
         //签名验证
         checkSing(payParam);
-
-        Map<String, Object> payment = new HashMap<>();
+        //返回值
+        Map<String, Object> payment;
+        //如果platform is null 则应该是这一个,因为老代码就是这样写的。
         if (StringUtils.isBlank(platform)) {
+            payment = student(payParam);
+        } else {
             //根据传入platform 来判断执行哪个操作
             Function<PaymentParam, Map<String, Object>> function = checkOrderType.get(platform);
             //如果以上操作都没有 则应该是这一个,因为老代码就是这样写的。
             if (Objects.isNull(function)) {
-                StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(payParam.getOrderNo());
-                if (Objects.isNull(studentPaymentOrder)) {
-                    throw new BizException("订单不存在");
-                }
-                payParam.setTenantId(studentPaymentOrder.getTenantId());
-                payment = checkOrderAndGetParam(payParam,
-                        studentPaymentOrder,
-                        StudentPaymentOrder::getStatus,
-                        StudentPaymentOrder::getCreateTime,
-                        studentPaymentOrder::setTransNo,
-                        studentPaymentOrderService::update
-                );
+                payment = student(payParam);
             } else {
                 payment = function.apply(payParam);
             }
@@ -130,6 +124,24 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         return payment;
     }
 
+    //platform is null 或者 student
+    private Map<String, Object> student(PaymentParam payParam) throws Exception {
+        Map<String, Object> payment;
+        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(payParam.getOrderNo());
+        if (Objects.isNull(studentPaymentOrder)) {
+            throw new BizException("订单不存在");
+        }
+        payParam.setTenantId(studentPaymentOrder.getTenantId());
+        payment = checkOrderAndGetParam(payParam,
+                studentPaymentOrder,
+                StudentPaymentOrder::getStatus,
+                StudentPaymentOrder::getCreateTime,
+                studentPaymentOrder::setTransNo,
+                studentPaymentOrderService::update
+        );
+        return payment;
+    }
+
     //teacher
     private Map<String, Object> teacher(PaymentParam payParam) {
         Map<String, Object> payment;
@@ -336,6 +348,25 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
                 // 实时分账
     			if (amount.doubleValue() > 0) {
     				
+    				SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
+    		        if (Objects.isNull(config)) {
+    		            throw new BizException("平台收款账户没有设置[platform_collection_organ]");
+    		        }
+    	        	
+    	        	SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(Integer.parseInt(config.getParanValue()));
+    	        	
+    	        	if(sysPaymentConfig == null || StringUtils.isBlank(sysPaymentConfig.getHfMerNo())){
+    	        		throw new BizException("分部[{}]没有设置收款账号", config.getParanValue());
+    	        	}
+    	        	
+    				Map<String, Object> divMember = new HashMap<>();
+    				divMember.put("member_id", sysPaymentConfig.getHfMerNo());
+    				divMember.put("amount", amount);
+    				divMember.put("fee_flag", "Y");
+    				divMemberList.add(divMember);
+    			}
+    			if (amount.doubleValue() > 0) {
+    				
     				/*SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
     		        if (Objects.isNull(config)) {
     		            throw new BizException("平台收款账户没有设置[platform_collection_organ]");

+ 6 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -22,7 +22,6 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -1824,7 +1823,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         } else {
             userDefaultSubjectIds = new ArrayList<>();
         }
-        Collections.swap(subjects, 6, 7);
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
 //        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
@@ -2975,7 +2973,10 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
 
         BigDecimal oneMonthOriginalPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
-        BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
+        BigDecimal originalAmount = ZERO;
+        if (Objects.nonNull(oneMonthOriginalPrice)) {
+            originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
+        }
         BigDecimal studentSingleCourseOriginalCost = originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
 
         //使用优惠券
@@ -4048,7 +4049,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             if (report.getVersion().equals(2)) {
                 pushUrl.append("/#/reportDetailNew?id=").append(report.getId()).append("&classGroupId=").append(report.getClassGroupId());
                 smsUrl.append("/#/transfer?url=").append(baseApiUrl).append("&hash=reportDetailNew&id=").append(report.getId()).append("&classGroupId=").append(report.getClassGroupId());
-            }else {
+            } else {
                 pushUrl.append("/#/reportDetail?classGroupId=").append(report.getClassGroupId());
                 smsUrl.append("/#/transfer?url=").append(baseApiUrl).append("&hash=reportDetail&classGroupId=").append(report.getClassGroupId());
             }
@@ -4057,7 +4058,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 Map<Integer, String> userMap = new HashMap<>();
                 userMap.put(userFreePracticeGroup.getStudentId(), userFreePracticeGroup.getStudentId().toString());
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_PUSH_PRACTICE_COMPLETED_STUDY_REPORT,
-                        userMap, null, 0, pushUrl.insert(0,"5?").toString(), "STUDENT", pushUrl.toString());
+                        userMap, null, 0, pushUrl.insert(0, "5?").toString(), "STUDENT", pushUrl.toString());
             }
 
             if (pushType.equals("ALL") || pushType.equals("SMS")) {

+ 13 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -320,6 +320,17 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void quitCouponAndBalance(StudentPaymentOrder order){
+        //增加用户余额
+        sysUserCashAccountService.updateBalance(order.getUserId(), order.getActualAmount(),
+                PlatformCashAccountDetailTypeEnum.REFUNDS, order.getMemo() + ",订单号:" + order.getOrderNo());
+
+        //退还优惠券
+        sysCouponCodeService.quit(order.getCouponCodeId());
+    }
+
+    @Transactional(rollbackFor = Exception.class)
     public void updateOrder(Map<String, String> rpMap) throws Exception {
         DealStatusEnum status = rpMap.get("tradeState").equals("1") ? DealStatusEnum.SUCCESS : DealStatusEnum.FAILED;
         StudentPaymentOrder order = findOrderByOrderNo(rpMap.get("merOrderNo"));
@@ -337,12 +348,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             if (updateCount <= 0) {
                 throw new BizException("订单更新失败");
             }
-            //增加用户余额
-            sysUserCashAccountService.updateBalance(order.getUserId(), order.getActualAmount(),
-                    PlatformCashAccountDetailTypeEnum.REFUNDS, memo + ",订单号:" + order.getOrderNo());
-
-            //退还优惠券
-            sysCouponCodeService.quit(order.getCouponCodeId());
+            quitCouponAndBalance(order);
             if (StringUtils.isNotBlank(order.getPaymentChannel())
                     && order.getPaymentChannel().equals("ADAPAY")
                     && !rpMap.containsKey("simulation")) {
@@ -801,6 +807,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Transactional(rollbackFor = Exception.class)
+    @Override
     public void cutSubjectPlan(StudentPaymentOrder order){
         if(order.getType() == OrderTypeEnum.APPLY){
             //如果是报名订单,订单关闭时需要更改已缴费学员数

+ 5 - 42
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1155,8 +1155,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         //成功报名状态变更
         StudentRegistration studentRegistration = studentRegistrationDao.lockWithUserAndMusic(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId());
 
-        MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-
         if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
             //支付成功后处理课程、云教练、活动等数据
@@ -1239,25 +1237,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
             studentRegistration.setPayingStatus(0);
             studentRegistrationDao.update(studentRegistration);
-
             //减去缴费人数(器乐收费,0元时不减缴费人数)
-            if (musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE) || musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE)) {
-                if (studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
-                    musicOneSubjectClassPlan.setPaidZeroNum(musicOneSubjectClassPlan.getPaidZeroNum() - 1);
-                    musicOneSubjectClassPlan.setPaidStudentNum(musicOneSubjectClassPlan.getPaidStudentNum() - 1);
-                } else if (studentPaymentOrder.getPaymentAccountNo() == null) {
-                    musicOneSubjectClassPlan.setPaidStudentNum(musicOneSubjectClassPlan.getPaidStudentNum() - 1);
-                }
-            } else {
-                musicOneSubjectClassPlan.setPaidStudentNum(musicOneSubjectClassPlan.getPaidStudentNum() - 1);
-            }
-            updateCount = musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
-            if (updateCount <= 0) {
-                throw new BizException("减去缴费人数失败");
-            }
+            studentPaymentOrderService.cutSubjectPlan(studentPaymentOrder);
+            //余额
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "报名缴费失败");
             }
+            //优惠券
             sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
             //三方乐团不发送缴费通知
             if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
@@ -1778,24 +1764,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public Boolean setNoneCloudTeacher(Long id) {
-        StudentRegistration studentRegistration = studentRegistrationDao.get(id);
-        if (!studentRegistration.getPayingStatus().equals(2)) {
-            throw new BizException("该学生不在审核中");
-        }
-        if (studentRegistration.getNoneNeedCloudTeacher().equals(1)) {
-            throw new BizException("该学生已设置");
-        }
-        studentRegistration.setPayingStatus(0);
-        studentRegistration.setNoneNeedCloudTeacher(1);
-        studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
-        if (studentRegistrationDao.update(studentRegistration) <= 0) {
-            throw new BizException("设置失败,请重试");
-        }
-        return true;
-    }
-
-    @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult<Boolean> addPaidNum(Long id, boolean isContinue) {
         StudentRegistration studentRegistration = studentRegistrationDao.lock(id);
@@ -1833,13 +1801,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setPaymentStatus(YES);
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
         studentRegistrationDao.update(studentRegistration);
-        /*StudentPaymentOrder order = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
-		if (order != null) {
-			order.setPaymentAccountNo("200");
-			if (studentPaymentOrderService.update(order) <= 0) {
-				throw new BizException("订单处理失败,请重试");
-			}
-		}*/
 
         List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, studentRegistration.getMusicGroupId(), studentRegistration.getUserId(), DealStatusEnum.ING, OrderTypeEnum.APPLY);
 
@@ -1851,6 +1812,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
                     studentPaymentOrder.setMemo("用户未支付");
                     updateList.add(studentPaymentOrder);
+                    studentPaymentOrderService.quitCouponAndBalance(studentPaymentOrder);
                 }
             }
         }
@@ -1897,6 +1859,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
                     studentPaymentOrder.setMemo("云教练审核拒绝");
                     updateList.add(studentPaymentOrder);
+                    studentPaymentOrderService.quitCouponAndBalance(studentPaymentOrder);
                 }
             }
         }

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

@@ -322,7 +322,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		if (Objects.equals(messageSender.getSendMode(), "EMAIL")) {
 			LOGGER.info("batch 发送邮件 {} ", simpleUserDto.getTenantId());
 			loadEmailInfo(senderTenantId);
-			debugMode = false;
+			// debugMode = false;
 		}
 		if(StringUtils.isNotEmpty(jpushType) && jpushType == "STUDENT"){
 			//如果不是缴费信息
@@ -365,7 +365,6 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		if (triggerTime == null || date.after(triggerTime)) {
 			status = SendStatusEnum.SENDING;
 			try {
-				// debugMode = false;
 				if (debugMode == true
 						|| messageSenderPluginContext.batchSend(messageSender, messageConfig.getDescription(),
 								MessageFormatter.arrayFormat(messageConfig.getContent(), args), tos, url,jpushType,"default",null)) {

+ 15 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -835,24 +835,29 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
         //查询过期并且没有停用的机构,将其停用
         Date maturity = DateUtils.addDays(now, -1);
-        List<TenantInfo> maturityTenant = baseMapper.queryExpiryTenant(maturity);
+        Map<String, Object> par = new HashMap<>();
+        par.put("expiryDate", maturity);
+        List<TenantInfoInfoPageVo> maturityTenant = baseMapper.queryPage(par);
         maturityTenant.forEach(t -> {
-            t.setState(2);
-            t.setUpdatedBy(-1);
-            t.setUpdatedTime(now);
-            this.updateById(t);
+            TenantInfo tenantInfo = baseMapper.selectById(t.getId());
+            tenantInfo.setState(2);
+            tenantInfo.setUpdatedBy(-1);
+            tenantInfo.setUpdatedTime(now);
+            this.updateById(tenantInfo);
         });
     }
 
     private void checkAndSend(Date now, int i) {
-        Date one = DateUtils.addDays(now, i);
-        List<TenantInfo> oneTenant = baseMapper.queryExpiryTenant(one);
-        send(oneTenant, DateUtils.formatDate(one, "yyyy年MM月dd日"));
+        Date expiryDate = DateUtils.addDays(now, i);
+        Map<String, Object> par = new HashMap<>();
+        par.put("expiryDate", expiryDate);
+        List<TenantInfoInfoPageVo> oneTenant = baseMapper.queryPage(par);
+        send(oneTenant, DateUtils.formatDate(expiryDate, "yyyy年MM月dd日"));
     }
 
-    private void send(List<TenantInfo> infoList, String dateStr) {
+    private void send(List<TenantInfoInfoPageVo> infoList, String dateStr) {
         infoList.forEach(t -> {
-            Object[] objects = {t.getName(), dateStr};
+            Object[] objects = {t.getName(), t.getServeName(), dateStr, t.getStudentUpLimit()};
             tenantInfoSendMsgService.platformSendToAll(EXPIRATION, t.getUserId(), t.getEmail(), t.getPhone(), objects);
         });
     }

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

@@ -580,8 +580,7 @@
         sr.actual_subject_id_ subject_id_,s.name_ subject_name_,sr.music_group_id_,CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_,
         IF(DATE_FORMAT(sr.create_time_,'%Y-%m-%d') > DATE_FORMAT(mg.payment_expire_date_,'%Y-%m-%d'),1,0) is_new_student_,
         stu.care_package_,stu.come_on_package_,sr.create_time_ registerTime,
-        sr.membership_end_time_ music_membership_end_time_,stu.membership_end_time_,
-        DATEDIFF(stu.membership_end_time_,NOW()) music_membership_day_,stu.member_rank_setting_id_
+        stu.membership_end_time_,DATEDIFF(stu.membership_end_time_,NOW()) membership_day_,stu.member_rank_setting_id_
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
         LEFT JOIN subject s ON s.id_ = sr.actual_subject_id_

+ 8 - 32
mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -42,11 +42,13 @@
         <result column="name_" jdbcType="VARCHAR" property="name"/>
         <result column="contacts_" jdbcType="VARCHAR" property="contacts"/>
         <result column="phone_" jdbcType="VARCHAR" property="phone"/>
+        <result column="email_" jdbcType="VARCHAR" property="email"/>
         <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
         <result column="state_" jdbcType="INTEGER" property="state"/>
         <result column="logo_" jdbcType="VARCHAR" property="logo"/>
         <result column="real_name_" jdbcType="VARCHAR" property="createdName"/>
         <result column="studentCount" jdbcType="INTEGER" property="studentCount"/>
+        <result column="userId" jdbcType="INTEGER" property="userId"/>
         <!-- 机构产品信息-->
         <result column="serve_name_" jdbcType="VARCHAR" property="serveName"/>
         <result column="student_up_limit_" jdbcType="INTEGER" property="studentUpLimit"/>
@@ -58,6 +60,7 @@
         a.`name_`,
         a.`contacts_`,
         a.`phone_`,
+        a.`email_`,
         a.`pay_state_`,
         a.`state_`,
         a.logo_,
@@ -65,7 +68,8 @@
         c.`name_` AS serve_name_,
         d.`student_up_limit_`,
         b.`expiry_date_`,
-        ifnull(st.studentCount, 0) as studentCount
+        ifnull(st.studentCount, 0) as studentCount,
+        a.user_id_ as userId
         FROM tenant_info AS a
         LEFT JOIN tenant_product_info AS b ON a.`id_` = b.`tenant_id_` and b.using_ = 0
         LEFT JOIN platform_serve AS c ON b.`serve_id_` = c.`id_`
@@ -96,6 +100,9 @@
             <if test="param.endDate != null ">
                 AND b.`expiry_date_` <![CDATA[ <= ]]>  #{param.endDate}
             </if>
+            <if test="param.expiryDate != null ">
+            AND b.`expiry_date_` = #{param.expiryDate}
+            </if>
         </where>
     </select>
 
@@ -125,37 +132,6 @@
         where id_ = (select tenant_id_ from organization where id_ = #{organId})
     </select>
 
-    <select id="queryExpiryTenant" resultMap="BaseResultMap">
-        SELECT a.id_,
-               a.name_,
-               a.contacts_,
-               a.phone_,
-               address_,
-               a.email_,
-               a.logo_,
-               a.customer_service_phone_,
-               a.remark_,
-               a.domain_name_,
-               a.data_source_,
-               a.pay_state_,
-               a.state_,
-               a.created_by_,
-               a.created_time_,
-               a.updated_by_,
-               a.updated_time_,
-               a.tsign_code_,
-               a.tsign_name_,
-               a.area_id_,
-               a.user_id_
-        FROM `tenant_info` AS a
-                 LEFT JOIN `tenant_product_info` AS b
-                           ON a.id_ = b.`tenant_id_`
-        WHERE a.`state_` = 1
-          AND a.`pay_state_` = 1
-          AND b.`using_` = 0
-          AND b.`expiry_date_` = #{expiryDate}
-    </select>
-
     <select id="queryUserByTenantId" resultType="integer">
         select id_ from sys_user where tenant_id_ = #{tenantId} limit 1
     </select>

+ 8 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.student.controller;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
@@ -96,6 +97,8 @@ public class StudentOrderController extends BaseController {
     private OrderPayOpsService orderPayOpsService;
     @Autowired
     private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
+    @Autowired
+    private TenantConfigService tenantConfigService;
 
     @Value("${spring.profiles.active:dev}")
     private String profiles;
@@ -161,6 +164,11 @@ public class StudentOrderController extends BaseController {
         HashMap<String, Object> orderDetail = new HashMap<>();
         orderDetail.put("order", orderByOrderNo);
         orderDetail.put("groupType", orderByOrderNo.getGroupType());
+        TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>()
+                .eq("tenant_id_", orderByOrderNo.getTenantId()));
+        if (Objects.nonNull(tenantConfig)) {
+            orderDetail.put("financeChops", tenantConfig.getCorporateFinanceChops());
+        }
         if (OrderTypeEnum.APPLY.equals(orderByOrderNo.getType())) {
             StudentRegistration studentRegistration = studentRegistrationDao.getStudentRegister(orderByOrderNo.getMusicGroupId(), orderByOrderNo.getUserId());
             if (studentRegistration.getPayingStatus().equals(2)) {

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -38,7 +38,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                         "/eduSubject/findSubSubjects", "/eduFinancialExpenditure/batchAdd", "/eduSendNotice/*",
                         "/oaContracts/*", "/eduStudent/organStudentOverView", "/activity/countCloudTeacherActive",
                         "/activity/organDoubleEleven2021Statis", "/activity/doubleEleven2021Statis", "/questionnaireTopic/getDetail", "/questionnaireUserResult/add",
-                        "/tenantInfo/info/*", "/tenantInfo/checkInfo/*", "/tenantInfo/pay/*", "/tenantInfo/notify"
+                        "/tenantInfo/info/*", "/tenantInfo/checkInfo/*", "/tenantInfo/pay/*", "/tenantInfo/notify",
+                             "/tenantInfo/testCheck"
                 )
                 .permitAll().anyRequest().authenticated().and().httpBasic();
     }