|
@@ -62,6 +62,7 @@ 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.dal.enums.OrderTypeEnum;
|
|
|
import com.ym.mec.biz.service.ContractService;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
import com.ym.mec.biz.service.MusicGroupService;
|
|
@@ -365,9 +366,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean transferMusicGroupCoursesContract(Integer userId, String musicGroupId) {
|
|
|
+ public boolean transferMusicGroupCoursesContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
|
|
|
if (true) {
|
|
|
- transferProduceContract(userId, musicGroupId, null);
|
|
|
+ transferProduceContract(userId, musicGroupId, orderType);
|
|
|
return true;
|
|
|
}
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
@@ -561,9 +562,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean transferVipGroupCoursesContract(Integer userId, Long vipGroupId) {
|
|
|
+ public boolean transferVipGroupCoursesContract(Integer userId, Long vipGroupId, OrderTypeEnum orderType) {
|
|
|
if (true) {
|
|
|
- transferProduceContract(userId, null, null);
|
|
|
+ transferProduceContract(userId, null, orderType);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -705,9 +706,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
|
|
|
+ public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, OrderTypeEnum orderType) {
|
|
|
|
|
|
- transferProduceContract(userId, musicGroupId, null);
|
|
|
+ transferProduceContract(userId, musicGroupId, orderType);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -816,9 +817,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
@Override
|
|
|
@Async
|
|
|
- public boolean transferPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
|
|
|
+ public boolean transferPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee, OrderTypeEnum orderType) {
|
|
|
if (true) {
|
|
|
- transferProduceContract(userId, null, null);
|
|
|
+ transferProduceContract(userId, null, orderType);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -898,7 +899,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
@Override
|
|
|
@Async
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
|
|
|
- public void transferProduceContract(Integer userId, String musicGroupId, CourseViewTypeEnum courseViewType) {
|
|
|
+ public void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
|
|
|
SysUser user = studentDao.lockUserReturnInfo(userId);
|
|
|
|
|
|
if (user == null) {
|
|
@@ -943,14 +944,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
params.put("isShowVisualSeal", false);
|
|
|
|
|
|
- CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
|
|
|
-
|
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
|
params.put("ownershipType", "OWN");
|
|
|
- MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
|
|
|
- if (Objects.nonNull(userLastNormalMusicGroup)) {
|
|
|
- ownershipType = userLastNormalMusicGroup.getCourseViewType();
|
|
|
- }
|
|
|
+ //MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
|
|
|
} else {
|
|
|
MusicGroup musicGroup = musicGroupService.get(musicGroupId);
|
|
|
if (musicGroup == null) {
|
|
@@ -958,13 +954,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
return;
|
|
|
}
|
|
|
params.put("ownershipType", musicGroup.getOwnershipType().name());
|
|
|
- ownershipType = musicGroup.getCourseViewType();
|
|
|
}
|
|
|
|
|
|
- if (Objects.nonNull(courseViewType)) {
|
|
|
- ownershipType = courseViewType;
|
|
|
- }
|
|
|
-
|
|
|
// 查询最新协议模板
|
|
|
TenantContractTemplate tenantContractTemplate = tenantContractTemplateService.queryLatestContractTemplate(user.getTenantId(), null, null);
|
|
|
if(tenantContractTemplate == null){
|
|
@@ -983,7 +974,10 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
//如果分部有企业信息,就用分部上的企业信息,否则用机构上的企业信息
|
|
|
String companyName = null;
|
|
|
TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());;
|
|
|
- Organization organizationDto = organizationService.get(user.getOrganId());
|
|
|
+ Organization organizationDto = null;
|
|
|
+ if(orderType != OrderTypeEnum.PRACTICE_GROUP_BUY && orderType != OrderTypeEnum.PRACTICE_GROUP_RENEW && orderType != OrderTypeEnum.SMALL_CLASS_TO_BUY){
|
|
|
+ organizationDto = organizationService.get(studentInfo.getOrganId());
|
|
|
+ }
|
|
|
if (organizationDto == null || StringUtils.isBlank(organizationDto.getCorporateName()) || StringUtils.isBlank(organizationDto.getCorporateCode())) {
|
|
|
companyName = tenantInfo.getTsignName();
|
|
|
} else {
|
|
@@ -1011,7 +1005,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String organCode = StringUtils.isEmpty(organizationDto.getCorporateCode()) ? tenantInfo.getTsignCode() : organizationDto.getCorporateCode();
|
|
|
+ String organCode = StringUtils.equals(companyName, tenantInfo.getTsignName()) ? tenantInfo.getTsignCode() : organizationDto.getCorporateCode();
|
|
|
|
|
|
if (user.getTenantId() == 1) {
|
|
|
if (!OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
|
|
@@ -1049,7 +1043,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED)
|
|
|
- public Map<String, Object> queryProductContract(Integer userId, String musicGroupId, CourseViewTypeEnum courseViewType) {
|
|
|
+ public Map<String, Object> queryProductContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
|
|
|
// 合成freemarker
|
|
|
String srcPdfPath = contractBaseDir + "/product/" + userId + ".pdf";
|
|
|
|
|
@@ -1077,14 +1071,12 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
|
|
|
- CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
|
|
|
|
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
|
params.put("ownershipType", "OWN");
|
|
|
MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
|
|
|
if (Objects.nonNull(userLastNormalMusicGroup)) {
|
|
|
result.put("courseViewType", userLastNormalMusicGroup.getCourseViewType());
|
|
|
- ownershipType = userLastNormalMusicGroup.getCourseViewType();
|
|
|
}
|
|
|
} else {
|
|
|
MusicGroup musicGroup = musicGroupService.get(musicGroupId);
|
|
@@ -1093,17 +1085,15 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
params.put("ownershipType", musicGroup.getOwnershipType().name());
|
|
|
result.put("courseViewType", musicGroup.getCourseViewType());
|
|
|
- ownershipType = musicGroup.getCourseViewType();
|
|
|
}
|
|
|
|
|
|
- if (Objects.nonNull(courseViewType)) {
|
|
|
- ownershipType = courseViewType;
|
|
|
- }
|
|
|
-
|
|
|
//如果分部有企业信息,就用分部上的企业信息,否则用机构上的企业信息
|
|
|
String companyName = null, sealPicture = null;
|
|
|
TenantInfo tenantInfo = null;
|
|
|
- Organization organizationDto = organizationService.get(studentInfo.getOrganId());
|
|
|
+ Organization organizationDto = null;
|
|
|
+ if(orderType != OrderTypeEnum.PRACTICE_GROUP_BUY && orderType != OrderTypeEnum.PRACTICE_GROUP_RENEW && orderType != OrderTypeEnum.SMALL_CLASS_TO_BUY){
|
|
|
+ organizationDto = organizationService.get(studentInfo.getOrganId());
|
|
|
+ }
|
|
|
if (organizationDto == null || StringUtils.isBlank(organizationDto.getCorporateName()) || StringUtils.isBlank(organizationDto.getCorporateCode())) {
|
|
|
|
|
|
tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
|