Browse Source

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

zouxuan 3 years ago
parent
commit
edadbff55b
35 changed files with 381 additions and 121 deletions
  1. 1 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysMenuServiceImpl.java
  2. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderActivityDao.java
  3. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  4. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/service/ContractService.java
  5. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderActivityService.java
  6. 123 55
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  7. 13 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  8. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java
  9. 56 12
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  10. 6 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  11. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  12. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  13. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  14. 24 12
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  15. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantContractTemplateServiceImpl.java
  16. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  17. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  18. 6 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  19. 7 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml
  20. 1 1
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml
  21. 1 1
      mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml
  22. 2 1
      mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml
  23. 5 1
      mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/BaseServiceImpl.java
  24. 1 1
      mec-im/src/main/java/com/ym/job/ScheduleManager.java
  25. 7 7
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  26. 1 1
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherContractController.java
  27. 20 0
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/ESealPlugin.java
  28. 38 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java
  29. 1 1
      mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java
  30. 1 1
      mec-web/src/main/java/com/ym/mec/web/config/PermissionCheckService.java
  31. 2 0
      mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java
  32. 3 0
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  33. 6 6
      mec-web/src/main/java/com/ym/mec/web/controller/PlatformServeController.java
  34. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/TenantContractTemplateController.java
  35. 1 0
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduStudentRegistrationController.java

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysMenuServiceImpl.java

@@ -38,7 +38,7 @@ public class SysMenuServiceImpl extends BaseServiceImpl<Integer, SysMenu>  imple
 		List<SysMenu> sysMenus;
 		List<SysMenu> sysMenusAllList;
 
-		if(sysUser.getTenantId() == -1){
+		if(sysUser.getTenantId() == -1 && sysUser.getIsSuperAdmin()){
 			sysMenus = sysMenuDao.findList(menuQueryInfo.getParentId(),menuQueryInfo.getDelFlag(),menuQueryInfo.getHid());
 			sysMenusAllList = sysMenuDao.findList(null,menuQueryInfo.getDelFlag(),menuQueryInfo.getHid());
 		}else {

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

@@ -15,4 +15,6 @@ public interface MusicGroupPaymentCalenderActivityDao extends BaseDAO<Long, Musi
     List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId);
 
     List<MusicGroupPaymentCalenderActivity> findByIds(@Param("activityIdList") List<Long> buyCalenderActivityIdList);
+
+    List<MusicGroupPaymentCalenderActivity> findByActivityIds(@Param("activityIdList") List<Long> buyCalenderActivityIdList,@Param("calenderId") Long calenderId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -199,6 +199,9 @@ public class MusicGroup extends BaseEntity {
 	
 	@ApiModelProperty(value = "收费标准",required = false)
 	private BigDecimal chargeStandard;
+	
+	@ApiModelProperty(value = "是否赠送辅件",required = false)
+	private Boolean isGiveAccessories;
 
 	public Integer getHasInstrumentNum() {
 		return hasInstrumentNum;
@@ -689,4 +692,12 @@ public class MusicGroup extends BaseEntity {
 	public void setChargeStandard(BigDecimal chargeStandard) {
 		this.chargeStandard = chargeStandard;
 	}
+
+	public Boolean getIsGiveAccessories() {
+		return isGiveAccessories;
+	}
+
+	public void setIsGiveAccessories(Boolean isGiveAccessories) {
+		this.isGiveAccessories = isGiveAccessories;
+	}
 }

+ 1 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/ContractService.java

@@ -2,10 +2,8 @@ package com.ym.mec.biz.service;
 
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 
-import com.ym.mec.biz.dal.dto.CirculationUser;
 import com.ym.mec.biz.dal.dto.OAFinancialDto;
 import com.ym.mec.biz.dal.entity.SysUserTsign;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
@@ -25,7 +23,7 @@ public interface ContractService {
 	SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo);
 
     void addTsign(Integer userId,String organCode, String orgName,Integer tenantId);
-
+    
 	/**
 	 * 传递注册协议至第三方公证平台
 	 * @param userId

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderActivityService.java

@@ -21,4 +21,6 @@ public interface MusicGroupPaymentCalenderActivityService {
     List<MusicGroupPaymentCalenderActivity> findByCalenderId(Long calenderId);
 
     List<MusicGroupPaymentCalenderActivity> findByIds(List<Long> buyCalenderActivityIdList);
+
+    List<MusicGroupPaymentCalenderActivity> findByActivityIds(List<Long> buyCalenderActivityIdList,Long calenderId);
 }

+ 123 - 55
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -1,22 +1,84 @@
 package com.ym.mec.biz.service.impl;
 
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import java.nio.charset.Charset;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SysUserContractsDao;
 import com.ym.mec.biz.dal.dto.CirculationUser;
 import com.ym.mec.biz.dal.dto.OAFinancialDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.entity.SysUserContracts;
 import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
+import com.ym.mec.biz.dal.entity.SysUserTsign;
+import com.ym.mec.biz.dal.entity.TenantConfig;
+import com.ym.mec.biz.dal.entity.TenantContractTemplate;
+import com.ym.mec.biz.dal.entity.TenantInfo;
+import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.MusicGroupService;
+import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.SubjectService;
+import com.ym.mec.biz.service.SysUserContractsService;
+import com.ym.mec.biz.service.SysUserTsignService;
+import com.ym.mec.biz.service.TenantConfigService;
+import com.ym.mec.biz.service.TenantContractTemplateService;
+import com.ym.mec.biz.service.TenantInfoService;
+import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
-import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.storage.StoragePluginContext;
 import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
@@ -27,33 +89,6 @@ import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.pdf.PDFUtil;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.http.HttpStatus;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
 @Service
 public class ContractServiceImpl implements ContractService, InitializingBean {
 
@@ -157,25 +192,48 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
      * 校验企业营业信息,不存在则添加一个
      */
     @Override
-    public void addTsign(Integer userId, String organCode, String orgName, Integer tenantId) {
-        Optional.ofNullable(organCode).orElseThrow(() -> new BizException("营业执照编号不能为空!"));
-        Optional.ofNullable(orgName).orElseThrow(() -> new BizException("营业名称不能为空"));
+	public void addTsign(Integer userId, String organCode, String orgName, Integer tenantId) {
+		Optional.ofNullable(organCode).orElseThrow(() -> new BizException("营业执照编号不能为空!"));
+		Optional.ofNullable(orgName).orElseThrow(() -> new BizException("营业名称不能为空"));
 
-        String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
-        if (StringUtils.isBlank(accountId)) {
-            throw new BizException("创建企业电子存证账户失败");
-        }
+		SysUserTsign sysUserTsign = null;
 
-        String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
-        if (StringUtils.isBlank(sealData)) {
-            throw new BizException("创建电子存证印章失败");
-        }
+		SysUserTsign orignSysUserTsign = sysUserTsignService.get(-userId);
 
-        SysUserTsign sysUserTsign = new SysUserTsign(-userId, accountId, sealData, orgName, organCode, tenantId);
-        sysUserTsignService.insert(sysUserTsign);
-    }
+		if (orignSysUserTsign == null || !StringUtils.equals(orignSysUserTsign.getCardNo(), organCode)) {
 
-    @Override
+			String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
+			if (StringUtils.isBlank(accountId)) {
+				throw new BizException("创建企业电子存证账户失败");
+			}
+
+			String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
+			if (StringUtils.isBlank(sealData)) {
+				throw new BizException("创建电子存证印章失败");
+			}
+
+			sysUserTsign = new SysUserTsign(-userId, accountId, sealData, orgName, organCode, tenantId);
+
+			if (orignSysUserTsign == null) {
+				sysUserTsignService.insert(sysUserTsign);
+			} else {
+				orignSysUserTsign.setAccountId(accountId);
+				orignSysUserTsign.setSealData(sealData);
+				orignSysUserTsign.setName(orgName);
+				orignSysUserTsign.setCardNo(organCode);
+				sysUserTsignService.update(orignSysUserTsign);
+			}
+
+		} else if (!StringUtils.equals(orignSysUserTsign.getName(), orgName)) {
+			if (eSealPlugin.updateOrganAccount(orignSysUserTsign.getAccountId(), orgName, organCode)) {
+				orignSysUserTsign.setName(orgName);
+				sysUserTsignService.update(orignSysUserTsign);
+			}
+		}
+
+	}
+
+	@Override
     public SysUserTsign register(Integer userId, String realName, String idCardNo, String mobileNo) {
 
         if (StringUtils.isBlank(realName) || StringUtils.isBlank(idCardNo) || StringUtils.isBlank(mobileNo)) {
@@ -944,8 +1002,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         
 		if (studentInfo.getTenantId() == 1) {
 			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
-				params.put("companyName", "深圳大雅乐盟网络教育股份有限公司");
-				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
+				//params.put("companyName", "深圳大雅乐盟网络教育股份有限公司");
+				//params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
 			} else {
 				params.put("companyName", "武汉长乐长风乐器销售有限公司");
 				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png");
@@ -1153,8 +1211,22 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
         params.put("isShowVisualSeal", false);
 
-        CourseViewTypeEnum courseViewType = CourseViewTypeEnum.COURSE_FEE;
         params.put("ownershipType", "OWN");
+		
+        // 查询最新协议模板
+		TenantContractTemplate tenantContractTemplate = tenantContractTemplateService.queryLatestContractTemplate(user.getTenantId(), null, null);
+		if(tenantContractTemplate == null){
+			logger.error("最新协议模板查询失败");
+            return BaseController.succeed();
+		}
+		String mainContent = tenantContractTemplate.getContractTemplateContent();
+		params.put("contractMainContent", mainContent);
+
+        // 查询是否已生成协议
+        List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, tenantContractTemplate.getVersion());
+        if (!CollectionUtils.isEmpty(userContracts)) {
+            return BaseController.succeed();
+        }
         
 		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
 		if(tenantInfo == null){
@@ -1179,12 +1251,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 			}
 		}
 
-        List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, 2);
-        if (!CollectionUtils.isEmpty(userContracts)) {
-            return BaseController.succeed();
-        }
-
-        templateEngine.render(params, "product2.ftl", srcFile);
+        templateEngine.render(params, "latest_contract_template.ftl", srcFile);
 
         // 生成借款协议PDF
         try {
@@ -1228,6 +1295,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         sysUserContracts.setUrl(pdfFilePath);
         sysUserContracts.setUserId(userId);
         sysUserContracts.setVersion(2);
+        sysUserContracts.setTenantId(user.getTenantId());
 
         sysUserContractsService.insert(sysUserContracts);
 

+ 13 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -769,11 +769,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 							throw new BizException("调整时间不得早于开课时间({})",groupStartDate);
 						}
 					}
-					if (groupEndDate != null) {
+					/*if (groupEndDate != null) {
 						if (calendar.getTime().after(groupEndDate)) {
 							throw new BizException("排课时间超出排课截止日期({})", DateUtil.dateToString(groupEndDate, DateUtil.DATE_FORMAT_MIN));
 						}
-					}
+					}*/
 
 					courseScheduleDao.insert(courseSchedule);
 					courseScheduleList.add(courseSchedule);
@@ -1683,6 +1683,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			existCours.setUpdateTime(now);
 			existCours.setStartClassTime(ac.getStartClassTime());
 			existCours.setEndClassTime(DateUtil.addMinutes(existCours.getStartClassTime(), singleClassMinutes));
+            
+            //课程结束时间必须在21:00之前
+            if(DateUtil.getHour(existCours.getEndClassTime()) > 20 && DateUtil.getMinute(existCours.getEndClassTime()) > 0){
+            	throw new BizException("课程结束时间不能超过21:00,请重新调整上课时间");
+            }
 
 			if(!DateUtil.isSameDay(existCours.getStartClassTime(), existCours.getEndClassTime())){
 				throw new BizException("课程暂不支持跨天");
@@ -3353,6 +3358,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             	int minutes = DateUtil.minutesBetween(oldCourseSchedule.getStartClassTime(), oldCourseSchedule.getEndClassTime());
             	newCourseSchedule.setEndClassTime(DateUtil.addMinutes(newCourseSchedule.getStartClassTime(), minutes));
             }
+            
+            //课程结束时间必须在21:00之前
+            if(DateUtil.getHour(newCourseSchedule.getEndClassTime()) > 20 && DateUtil.getMinute(newCourseSchedule.getEndClassTime()) > 0){
+            	throw new BizException("课程结束时间不能超过21:00,请重新调整上课时间");
+            }
+            
             //判断上课时间是否跨天
 			if (!DateUtil.isSameDay(newCourseSchedule.getStartClassTime(), newCourseSchedule.getEndClassTime())) {
 				throw new BizException("上课时间不允许跨天,请重新调整上课时间");

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderActivityServiceImpl.java

@@ -138,4 +138,9 @@ public class MusicGroupPaymentCalenderActivityServiceImpl extends BaseServiceImp
     public List<MusicGroupPaymentCalenderActivity> findByIds(List<Long> buyCalenderActivityIdList) {
         return musicGroupPaymentCalenderActivityDao.findByIds(buyCalenderActivityIdList);
     }
+
+    @Override
+    public List<MusicGroupPaymentCalenderActivity> findByActivityIds(List<Long> buyCalenderActivityIdList,Long calenderId) {
+        return musicGroupPaymentCalenderActivityDao.findByActivityIds(buyCalenderActivityIdList,calenderId);
+    }
 }

+ 56 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -4,7 +4,6 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.ST
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
-import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -19,27 +18,54 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDetailDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.service.*;
 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 com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
+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.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.FeeStudentDto;
 import com.ym.mec.biz.dal.dto.MusicArrearageStudentDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDetailDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
+import com.ym.mec.biz.dal.dto.StudentSubTotalCourseTimesDto;
+import com.ym.mec.biz.dal.entity.ActivityUserMapper;
+import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
+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.MusicGroupPaymentCalenderActivity;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
 import com.ym.mec.biz.dal.page.MusicCalenderDetailQueryInfo;
-import com.ym.mec.biz.event.source.GroupEventSource;
-import com.ym.mec.common.constant.CommonConstants;
+import com.ym.mec.biz.service.ActivityUserMapperService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderMemberService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -433,10 +459,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		// 所有缴费项目已完成排课才能创建下一个缴费项目
 		List<String> batchNoList = new ArrayList<>();
 		batchNoList.add(batchNo);
-		String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,batchNoList);
+		/*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,batchNoList);
 		if (StringUtils.isNoneBlank(orignBatchNo)) {
 			throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
-		}
+		}*/
 		//获取欠费学员列表
 		List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroupId, new ArrayList<>(userIdList));
 		if(noPaymentUserIds.size() > 0){
@@ -465,6 +491,25 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(Collections.disjoint(userList, userIdList) == false){
 			throw new BizException("操作失败:包含已存在的学员");
 		}
+		
+		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
+		
+		if (courseSettingsList != null && courseSettingsList.size() > 0) {
+			List<StudentSubTotalCourseTimesDto> studentCourseTypeDtos = musicGroupPaymentStudentCourseDetailDao.queryStudentSubTotalCourseTimes(musicGroupId);
+
+			Set<String> courseTypes = new HashSet<String>();
+			for (StudentSubTotalCourseTimesDto dto : studentCourseTypeDtos) {
+				if (userIdList.contains(dto.getUserId())) {
+					courseTypes.addAll(dto.getMapDtos().stream().filter(t -> t.getValue() > 0).map(t -> t.getKey()).collect(Collectors.toSet()));
+				}
+			}
+
+			for (MusicGroupPaymentCalenderCourseSettings mgpccs : courseSettingsList) {
+				if (courseTypes.contains(mgpccs.getCourseType().name())) {
+					throw new BizException("操作失败:存在未排完的[{}]", mgpccs.getCourseType().getMsg());
+				}
+			}
+		}
 
 		Date date = new Date();
 		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
@@ -540,7 +585,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
 
 		//创建学生课排课分钟数
-		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		if(courseSettingsList != null && courseSettingsList.size() > 0){
 			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<>();
 			MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;

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

@@ -247,10 +247,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("创建缴费失败:已存在缴费项目");
         }
         // 所有缴费项目已完成排课才能创建下一个缴费项目
-        String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
+        /*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
         if (StringUtils.isNoneBlank(orignBatchNo)) {
             throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
-        }
+        }*/
 
         // 不是进行中,只能创建一次缴费
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
@@ -448,14 +448,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
     public Map<String, Object> getCalenderDetail(Map<String, Object> result, Long calenderId) {
         //课程
-        result.put("course", musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(calenderId));
+        List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(calenderId);
+        result.put("course", courseSettingsList==null?null:courseSettingsList.size() == 0?null:courseSettingsList);
         //乐保
         result.put("repair", musicGroupPaymentCalenderRepairService.findByCalenderId(calenderId));
         MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberService.findByCalenderId(calenderId);
         //会员信息
         result.put("member", calenderMember);
         //活动相关信息
-        result.put("activity", musicGroupPaymentCalenderActivityService.findByCalenderId(calenderId));
+        List<MusicGroupPaymentCalenderActivity> byCalenderId = musicGroupPaymentCalenderActivityService.findByCalenderId(calenderId);
+        result.put("activity", byCalenderId==null?null:byCalenderId.size() == 0?null:byCalenderId);
         if (calenderMember != null) {
             result.put("memberPrivilegesItemList", memberRankPrivilegesService.queryByMemberRankId(calenderMember.getMemberRankSettingId()));
         }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -687,6 +687,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     private MusicGroupApplyGoodsDto getCalenderTotalAmount(RegisterPayDto registerPayDto, MusicGroupPaymentCalender calender) {
+    	
+    	String musicGroupId = calender.getMusicGroupId();
+    	MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+    	
+    	if(musicGroup == null){
+    		throw new BizException("乐团[{}]信息查询失败", musicGroupId);
+    	}
+    	
+    	boolean isGiveAccessories = musicGroup.getIsGiveAccessories();
+    	
         MusicGroupApplyGoodsDto goodsDto = new MusicGroupApplyGoodsDto();
         //乐器及打包辅件价格
         List<MusicGroupSubjectGoodsGroup> goodsGroups;
@@ -697,6 +707,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
                 });
+                
+                if(isGiveAccessories && registerPayDto.getBuyCloudTeacher()){
+                	if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
+                		continue;
+                	}
+                }
 
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());

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

@@ -2794,7 +2794,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             return BaseController.succeed(payMap);
         } catch (Exception e) {
             LOGGER.error("网管课购买失败:", e.getCause());
-            throw new BizException("订单提交超时,请尝试重新提交购买");
+            throw new BizException("网管课购买失败:", e.getMessage());
         }
     }
 
@@ -3261,7 +3261,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             return BaseController.succeed(payMap);
         } catch (Exception e) {
             LOGGER.error("网管课购买失败:", e.getCause());
-            throw new BizException("订单提交超时,请尝试重新提交购买");
+            throw new BizException("网管课购买失败:", e.getMessage());
         }
     }
 

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

@@ -3,10 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -587,7 +584,6 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
             studentCourseFeeDetail.setOperator(studentPaymentOrder.getUserId());
             studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
         }
-        studentRegistrationDao.update(studentRegistration);
 
         //缴费项目详情
         musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder, studentRegistration);
@@ -632,11 +628,15 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
         //学生云教练处理
         if (detailTypeEnums.contains(CLOUD_TEACHER)) {
+            if(studentPaymentOrder.getType() == OrderTypeEnum.APPLY){
+                studentRegistration.setHasCloudTeacher(1);
+            }
             BigDecimal cloudTeacherFee = allDetails.stream().filter(o -> o.getType() == CLOUD_TEACHER)
                     .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
             cloudTeacherOrderService.addOrderDetail2CloudTeacher(studentPaymentOrder, cloudTeacherFee);
         }
+        studentRegistrationDao.update(studentRegistration);
     }
 
     @Override

+ 24 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -535,6 +535,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                                         MusicGroupApplyGoodsDto goodsDto,
                                         RegisterPayDto registerPayDto,
                                         CouponPayParam couponPayParam) throws Exception {
+    	
+        MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+        
+        if(musicGroup == null){
+        	throw new BizException("乐团[{}]信息查询失败", studentRegistration.getMusicGroupId());
+        }
+        
+        boolean isGiveAccessories = musicGroup.getIsGiveAccessories() == null ? false : musicGroup.getIsGiveAccessories();
+        
         Date date = new Date();
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         //乐器及打包辅件
@@ -559,17 +568,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setType(type);
 
                 BigDecimal goodsPrice = new BigDecimal(0);
-                if (studentRegistration.getOrganId() == 55 && (newCourses == null || newCourses.size() == 0) && !registerPayDto.getBuyCloudTeacher()) {
-                    //取商品零售价
-                    if (StringUtils.isNotBlank(goodsGroup.getGoodsIdList())) {
-                        List<Goods> goodsList = goodsDao.findGoodsByIds(goodsGroup.getGoodsIdList());
-                        for (Goods goods : goodsList) {
-                            goodsPrice = goodsPrice.add(goods.getDiscountPrice());
-                        }
-                    }
-                } else {
-                    goodsPrice = goodsGroup.getPrice();
-                }
+                
+				if (!(type == OrderDetailTypeEnum.ACCESSORIES && (isGiveAccessories && registerPayDto.getBuyCloudTeacher()))) {
+
+	                if (studentRegistration.getOrganId() == 55 && (newCourses == null || newCourses.size() == 0) && !registerPayDto.getBuyCloudTeacher()) {
+	                    //取商品零售价
+	                    if (StringUtils.isNotBlank(goodsGroup.getGoodsIdList())) {
+	                        List<Goods> goodsList = goodsDao.findGoodsByIds(goodsGroup.getGoodsIdList());
+	                        for (Goods goods : goodsList) {
+	                            goodsPrice = goodsPrice.add(goods.getDiscountPrice());
+	                        }
+	                    }
+	                } else {
+	                    goodsPrice = goodsGroup.getPrice();
+	                }
+				}
                 studentPaymentOrderDetail4goodsGroup.setPrice(goodsPrice);
                 studentPaymentOrderDetail4goodsGroup.setGoodsIdList(goodsGroup.getGoodsIdList());
                 studentPaymentOrderDetail4goodsGroup.setCreateTime(date);
@@ -652,7 +665,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(maintenanceOrderDetail);
             }
         }
-        MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
 
         //云教练/云教练+  todo  团练宝
         if (registerPayDto.getBuyCloudTeacher()) {

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantContractTemplateServiceImpl.java

@@ -69,6 +69,13 @@ public class TenantContractTemplateServiceImpl extends BaseServiceImpl<Integer,
 			return true;
 		}
 		
+		tenantInfoDao.getLocked(tenantContractTemplate.getTenantId());
+		
+		Integer maxVersion = tenantContractTemplateDao.queryMaxVersion();
+		int version = maxVersion == null ? 1 : maxVersion + 1;
+		
+		tenantContractTemplate.setVersion(version);
+		
 		tenantContractTemplateDao.disableContract(tenantContractTemplate.getOwner(), tenantContractTemplate.getType(), tenantContractTemplate.getTenantId());
 		
 		Date date = new Date();

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -216,6 +216,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
                 tenantContractTemplateDao.update(tenantContractTemplate);
             }
+            //添加签章信息
+            contractService.addTsign(tenantInfo.getUserId(), dto.getTsignCode(), dto.getTsignName(), tenantId);
         }
 
         //机构状态 1已缴费,并且 机构注册的手机号与本次修改后的手机号不同,就证明本次修改了手机号 则需要修改机构的账号信息

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -4526,6 +4526,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getExpectAmount());
                     SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentPaymentOrder.getUserId());
                     SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail();
+                    sysUserIncomeCashAccountDetail.setTenantId(studentPaymentOrder.getTenantId());
                     sysUserIncomeCashAccountDetail.setUserId(studentPaymentOrder.getUserId());
                     sysUserIncomeCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
                     sysUserIncomeCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -47,6 +47,7 @@
         <result column="member_course_show_flag_" property="memberCourseShowFlag"/>
         <result column="homework_push_flag_" property="homeworkPushFlag"/>
         <result column="tenant_id_" property="tenantId"/>
+        <result column="is_give_accessories_" property="isGiveAccessories"/>
     </resultMap>
     
     <resultMap type="com.ym.mec.biz.dal.dto.MusicGroupBasicDto" id="MusicGroupBasicDto" extends="MusicGroup">
@@ -106,7 +107,7 @@
                  settlement_type_, cooperation_organ_id_, enlightenment_course_time_,
                  parent_meeting_time_, img_, director_user_id_, is_classroom_lessons_, memo_, expect_start_group_date_,
                  ownership_type_, repair_user_id_, del_flag_, payment_valid_start_date_, payment_valid_end_date_,
-                 payment_pattern_, course_view_type_, transaction_teacher_id_,homework_push_flag_,member_course_show_flag_,tenant_id_)
+                 payment_pattern_, course_view_type_, transaction_teacher_id_,homework_push_flag_,member_course_show_flag_,tenant_id_,is_give_accessories_)
         VALUES (#{id}, #{name}, #{organId}, #{schoolId}, #{applyExpireDate}, #{preApplyExpireDate}, #{teamTeacherId},
                 #{educationalTeacherId},
                 #{chargeTypeId}, #{courseForm}, now(), now(),
@@ -118,7 +119,7 @@
                 #{isClassroomLessons}, #{memo}, #{expectStartGroupDate},
                 #{ownershipType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{repairUserId},
                 #{delFlag}, #{paymentValidStartDate}, #{paymentValidEndDate}, #{paymentPattern},
-                #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{transactionTeacherId},#{homeworkPushFlag},#{memberCourseShowFlag},#{tenantId})
+                #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{transactionTeacherId},#{homeworkPushFlag},#{memberCourseShowFlag},#{tenantId},#{isGiveAccessories})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -230,6 +231,9 @@
             <if test="memberCourseShowFlag != null">
                 member_course_show_flag_ = #{memberCourseShowFlag},
             </if>
+            <if test="isGiveAccessories != null">
+                is_give_accessories_ = #{isGiveAccessories},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderActivityDao.xml

@@ -108,4 +108,11 @@
           #{id}
         </foreach>
     </select>
+    <select id="findByActivityIds" resultType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity">
+      SELECT <include refid="Base_Column_List"/> FROM music_group_payment_calender_activity
+      WHERE calender_id_ = #{calenderId} AND activity_id_ IN
+        <foreach collection="activityIdList" separator="," item="id" close=")" open="(">
+          #{id}
+        </foreach>
+    </select>
 </mapper>

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

@@ -128,7 +128,7 @@
 		LEFT JOIN sys_music_score_categories smsc ON smsc.id_ = ses.music_score_categories_id_
 		<include refid="queryPageSql"/>
 		GROUP BY ses.id_
-		ORDER BY ses.music_score_categories_id_ DESC,ses.order_ ASC,ses.create_time_ DESC
+		ORDER BY ses.music_score_categories_id_ DESC,ses.order_ ASC,ses.create_time_ DESC,ses.id_ desc
 		<include refid="global.limit"/>
 	</select>
 	

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

@@ -205,7 +205,7 @@
         FROM sys_payment_config spc
         LEFT JOIN organization o on spc.organ_id_ = o.id_
         <where>
-        	spc.tenant_id_ = #{tenantId}
+        	<!-- spc.tenant_id_ = #{tenantId} -->
             <if test="payType == null">
                 and pay_type_ IS NOT NULL
                 AND (spc.yq_mer_no_ !='' OR spc.hf_mer_no_ !='')

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

@@ -469,7 +469,8 @@
         LEFT JOIN sys_user u on ta.teacher_id_ = u.id_
         WHERE ta.sign_out_status_ IS NULL and cs.tenant_id_ = #{tenantId}
         AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
-        AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ ) &lt;= DATE_SUB(now(),INTERVAL #{minutes} MINUTE) AND cs.del_flag_ = 0
+        AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ ) &lt;= DATE_SUB(now(),INTERVAL #{minutes} MINUTE)
+        AND cs.class_date_ = DATE_FORMAT(NOW(),'%Y-%m-%d') AND cs.del_flag_ = 0
         AND cs.group_type_ = 'MUSIC'
     </select>
     <select id="findTeacherIdByCourseSchedule" resultMap="TeacherAttendance">

+ 5 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/BaseServiceImpl.java

@@ -82,7 +82,11 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 	 */
 	public List<T> findAll(Map<String, Object> params) {
 		
-		params.put("tenantId", TenantContextHolder.getTenantId());
+		final String TENANT_ID = "tenantId";
+		
+		if(!params.containsKey(TENANT_ID)){
+			params.put(TENANT_ID, TenantContextHolder.getTenantId());
+		}
 		return this.getDAO().findAll(params);
 	}
 

+ 1 - 1
mec-im/src/main/java/com/ym/job/ScheduleManager.java

@@ -45,7 +45,7 @@ public class ScheduleManager implements SchedulingConfigurer {
     @Autowired
     RedissonClient redissonClient;
 
-//    private ConcurrentHashMap<String, ScheduledTask> schedulingTasks = new ConcurrentHashMap<>();
+    //    private ConcurrentHashMap<String, ScheduledTask> schedulingTasks = new ConcurrentHashMap<>();
     private ConcurrentHashMap<String, ScheduledTask> roomCacheTasks = new ConcurrentHashMap<>();
     private ConcurrentHashMap<String, Date> userIMOfflineMap = new ConcurrentHashMap<>();
     private ScheduledDelayTask userIMOfflineKickTask = new ScheduledDelayTask(new Runnable() {

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

@@ -191,19 +191,19 @@ public class StudentOrderController extends BaseController {
             orderDetail.put("detailType", orderDetailType);
             orderDetail.put("chargeTypeId", musicGroup.getChargeTypeId());
             orderDetail.put("courseViewType", musicGroup.getCourseViewType());
-            //如果包含vip和网管,代表购买了活动包
-            if (orderDetailType.contains("VIP") || orderDetailType.contains("PRACTICE")) {
-                List<Long> activityList = orderDetail1.stream().filter(e -> e.getType() == OrderDetailTypeEnum.VIP
-                                || e.getType() == OrderDetailTypeEnum.PRACTICE).map(e -> e.getStudentInstrumentId())
-                        .collect(Collectors.toList());
-                orderDetail.put("activity", musicGroupPaymentCalenderActivityService.findByIds(activityList));
-            }
 
             //新的课程形态10.27
             MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(musicGroup.getId());
             if (musicGroupRegCalender != null) {
                 List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(musicGroup.getId());
                 musicGroupRegCalender.setMusicGroupPaymentCalenderCourseSettingsList(courseSettings);
+                //如果包含vip和网管,代表购买了活动包
+                List<Long> activityList = orderDetail1.stream().filter(e -> e.getType() == OrderDetailTypeEnum.VIP
+                        || e.getType() == OrderDetailTypeEnum.PRACTICE).map(e -> e.getStudentInstrumentId())
+                        .collect(Collectors.toList());
+                if(activityList != null && activityList.size() > 0){
+                    orderDetail.put("activity", musicGroupPaymentCalenderActivityService.findByActivityIds(activityList,musicGroupRegCalender.getId()));
+                }
             }
             orderDetail.put("calender", musicGroupRegCalender);
 

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherContractController.java

@@ -52,7 +52,7 @@ public class TeacherContractController extends BaseController {
 			//判断分部
 			Teacher teacher = teacherService.get(sysUser.getId());
 			
-			if(teacher == null || (teacher.getOrganId() == 55 ||teacher.getOrganId() == 59)){
+			if(teacher == null || teacher.getTeacherOrganId() == null || (teacher.getTeacherOrganId() == 55 ||teacher.getTeacherOrganId() == 59)){
 				return succeed(false);
 			}
 			

+ 20 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/ESealPlugin.java

@@ -11,6 +11,16 @@ public interface ESealPlugin {
      * @return 账户唯一标识
      */
     public String createUserAccount(String realName, String idcard, String mobile);
+    
+    /**
+     * 更新用户账户(个人)
+     * @param accountId 账户唯一标识
+     * @param realName 姓名
+     * @param idcard 身份证号码
+     * @param mobile 手机号码
+     * @return
+     */
+    public boolean updateUserAccount(String accountId, String realName, String idcard, String mobile);
 
     /**
      * 创建用户账户(企业)
@@ -22,6 +32,16 @@ public interface ESealPlugin {
     public String createOrganAccount(String orgName, String organCode);
 
     /**
+     * 修改用户账户(企业)
+     *
+     * @param accountId   账户唯一标识
+     * @param orgName   机构名称
+     * @param organCode 统一社会信用代码
+     * @return
+     */
+    public boolean updateOrganAccount(String accountId, String orgName, String organCode);
+
+    /**
      * 创建个人印章
      *
      * @param accountId 账户唯一标识

+ 38 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java

@@ -10,6 +10,8 @@ import com.timevale.esign.sdk.tech.bean.OrganizeBean;
 import com.timevale.esign.sdk.tech.bean.PersonBean;
 import com.timevale.esign.sdk.tech.bean.PosBean;
 import com.timevale.esign.sdk.tech.bean.SignPDFFileBean;
+import com.timevale.esign.sdk.tech.bean.UpdateOrganizeBean;
+import com.timevale.esign.sdk.tech.bean.UpdatePersonBean;
 import com.timevale.esign.sdk.tech.bean.result.AddAccountResult;
 import com.timevale.esign.sdk.tech.bean.result.AddSealResult;
 import com.timevale.esign.sdk.tech.bean.result.FileDigestSignResult;
@@ -32,6 +34,9 @@ import com.timevale.tech.sdk.bean.ProjectConfig;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.exception.ThirdpartyException;
 
+/**
+ * 接口文档地址  https://open.esign.cn/doc/detail?id=opendoc%2Fpaas_sdk%2Fbzu9e8&namespace=opendoc%2Fpaas_sdk&searchText=
+ */
 @Service
 public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBean {
 
@@ -97,7 +102,23 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
         throw new ThirdpartyException(result.getMsg());
     }
 
-    /**
+    @Override
+	public boolean updateUserAccount(String accountId, String realName, String idcard, String mobile) {
+    	
+    	UpdatePersonBean updatePersonBean = new UpdatePersonBean();
+        updatePersonBean.setMobile(mobile);// 手机号码,可空
+        updatePersonBean.setName(realName);// 姓名,可空
+        
+        AccountService service = serviceClient.accountService();
+        Result result = service.updateAccount(accountId, updatePersonBean, null);
+        
+        if (result.getErrCode() == 0) {
+            return true;
+        }
+        throw new ThirdpartyException(result.getMsg());
+	}
+
+	/**
      * 创建用户账户(企业)
      *
      * @param orgName   机构名称
@@ -119,6 +140,22 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
         throw new ThirdpartyException("创建企业账户接口调用失败code=" + result.getErrCode() + "msg=" + result.getMsg());
     }
 
+	@Override
+	public boolean updateOrganAccount(String accountId, String orgName, String organCode) {
+		
+		UpdateOrganizeBean updateOrganizeBean = new UpdateOrganizeBean();
+        updateOrganizeBean.setName(orgName);//机构名称,可空
+
+        AccountService service = serviceClient.accountService();
+        Result result = service.updateAccount(accountId, updateOrganizeBean, null);
+        
+        if (result.getErrCode() == 0) {
+            return true;
+        }
+        throw new ThirdpartyException(result.getMsg());
+		
+	}
+
     /**
      * 创建印章
      *

+ 1 - 1
mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java

@@ -334,7 +334,7 @@ public class DateUtil {
 		return calendar.get(Calendar.HOUR_OF_DAY);
 	}
 
-	public static int geMinute(Date date) {
+	public static int getMinute(Date date) {
 		if (date == null) {
 			return -1;
 		}

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

@@ -27,7 +27,7 @@ public class PermissionCheckService {
 		}
 
 		SysUser user = sysUserFeignService.queryUserInfo();
-		if(user.getTenantId() == -1){
+		if(user.getTenantId() == -1 && user.getIsSuperAdmin()){
 			return true;
 		}
 

+ 2 - 0
mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -112,6 +113,7 @@ public class EmployeeController extends BaseController {
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('employee/update')")
     public Object update(@RequestBody Employee employee) {
+        TenantContextHolder.setTenantId(employee.getTenantId());
         employee.setUpdateTime(new Date());
         employeeService.updateEmployee(employee);
         return succeed();

+ 3 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -171,6 +171,9 @@ public class ExportController extends BaseController {
     @PostMapping("export/managerDownload")
     @PreAuthorize("@pcs.hasPermissions('export/managerDownload')")
     public HttpResponseResult managerDownload(@RequestBody ExportDto exportDto){
+        if(exportDto.getHeadColumns() == null || exportDto.getHeadColumns().size() == 0){
+            throw new BizException("请选择导出字段");
+        }
         Map<String, Object> queryInfo = exportDto.getQueryInfo();
         if(queryInfo == null){
             queryInfo = new HashMap<>(10);

+ 6 - 6
mec-web/src/main/java/com/ym/mec/web/controller/PlatformServeController.java

@@ -26,7 +26,7 @@ public class PlatformServeController extends BaseController {
 
     @ApiOperation("添加平台服务")
     @PostMapping(value = "/add")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/add')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/add')")
     public Object addServe(@Valid @RequestBody PlatformServeDto dto) {
         platformServeService.addServe(dto);
         return succeed();
@@ -34,7 +34,7 @@ public class PlatformServeController extends BaseController {
 
     @ApiOperation("修改平台服务")
     @PostMapping(value = "/update")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/update')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/update')")
     public Object updateServe(@Valid @RequestBody PlatformServeDto dto) {
         platformServeService.updateServe(dto);
         return succeed();
@@ -42,7 +42,7 @@ public class PlatformServeController extends BaseController {
 
     @ApiOperation("删除平台服务")
     @GetMapping(value = "/delete/{id}")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/delete')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/delete')")
     public Object deleteServe(@ApiParam(value = "平台服务ID", required = true) @PathVariable("id") Integer id) {
         platformServeService.deleteServe(id);
         return succeed();
@@ -50,21 +50,21 @@ public class PlatformServeController extends BaseController {
 
     @ApiOperation("分页查询")
     @GetMapping(value = "/queryPage")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/queryPage')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/queryPage')")
     public Object queryPage(String search, Integer page, Integer rows) {
         return succeed(platformServeService.queryPage(search, page, rows));
     }
 
     @ApiOperation("查询单个服务的详情")
     @GetMapping(value = "/queryInfo/{id}")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/queryInfo')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/queryInfo')")
     public Object queryInfo(@ApiParam(value = "平台服务ID", required = true) @PathVariable("id") Integer id) {
         return succeed(platformServeService.queryInfo(id));
     }
 
     @ApiOperation("查询单个服务各付费模式详情")
     @GetMapping(value = "/queryModeDetail/{id}")
-    @PreAuthorize("@pcs.hasPermissions('/platformServe/queryModeDetail')")
+    @PreAuthorize("@pcs.hasPermissions('platformServe/queryModeDetail')")
     public Object queryModeDetail(@ApiParam(value = "平台服务ID", required = true) @PathVariable("id") Integer id) {
         return succeed(platformServeService.queryModeDetail(id));
     }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/TenantContractTemplateController.java

@@ -59,7 +59,7 @@ public class TenantContractTemplateController extends BaseController {
 		if (sysUser == null || sysUser.getId() == null) {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
-		return succeed(tenantContractTemplateService.queryLatestContractTemplate(sysUser.getTenantId(), null, null));
+		return succeed(tenantContractTemplateService.queryLatestContractTemplate(TenantContextHolder.getTenantId(), null, null));
 	}
 
 	@ApiOperation("新增")

+ 1 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduStudentRegistrationController.java

@@ -66,6 +66,7 @@ public class EduStudentRegistrationController extends BaseController {
     	
     	Map<String, Object> params = new HashMap<String, Object>();
 		params.put("musicGroupId", queryInfo.getMusicGroupId());
+		params.put("tenantId", queryInfo.getTenantId());
     	List<StudentPreRegistration> studentPreRegistrationList = studentPreRegistrationService.findAll(params);
     	
     	int instrument = 0;