|
@@ -5,10 +5,7 @@ import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -293,7 +290,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
@Override
|
|
|
public boolean transferMusicGroupCoursesContract(Integer userId, String musicGroupId) {
|
|
|
if(true){
|
|
|
- return transferProduceContract(userId);
|
|
|
+ return transferProduceContract(userId, musicGroupId);
|
|
|
}
|
|
|
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
@@ -489,7 +486,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
@Override
|
|
|
public boolean transferVipGroupCoursesContract(Integer userId, Long vipGroupId) {
|
|
|
if(true){
|
|
|
- return transferProduceContract(userId);
|
|
|
+ return transferProduceContract(userId, null);
|
|
|
}
|
|
|
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
@@ -632,7 +629,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
@Override
|
|
|
public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
|
|
|
if(true){
|
|
|
- return transferProduceContract(userId);
|
|
|
+ return transferProduceContract(userId, musicGroupId);
|
|
|
}
|
|
|
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
@@ -867,7 +864,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
@Override
|
|
|
public boolean transferPracticeCoursesContract(Integer userId, int courseSectionNum, Date startDate, Date endDate, BigDecimal fee) {
|
|
|
if(true){
|
|
|
- return transferProduceContract(userId);
|
|
|
+ return transferProduceContract(userId, null);
|
|
|
}
|
|
|
|
|
|
SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
|
|
@@ -945,7 +942,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public boolean transferProduceContract(Integer userId) {
|
|
|
+ public boolean transferProduceContract(Integer userId,String musicGroupId) {
|
|
|
SysUser user = studentDao.lockUserReturnInfo(userId);
|
|
|
|
|
|
List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT);
|
|
@@ -983,7 +980,15 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
params.put("isShowVisualSeal", false);
|
|
|
|
|
|
- params.put("ownershipType", OwnershipType.OWN);
|
|
|
+ if(Objects.nonNull(musicGroupId)){
|
|
|
+ params.put("ownershipType", OwnershipType.OWN);
|
|
|
+ }else{
|
|
|
+ MusicGroup musicGroup = musicGroupService.get(musicGroupId);
|
|
|
+ if (musicGroup == null) {
|
|
|
+ throw new BizException("乐团信息没找到");
|
|
|
+ }
|
|
|
+ params.put("ownershipType", musicGroup.getOwnershipType());
|
|
|
+ }
|
|
|
|
|
|
templateEngine.render(params, "product.ftl", srcFile);
|
|
|
|
|
@@ -993,7 +998,14 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
} catch (IOException e) {
|
|
|
throw new BizException("生成产品协议失败", e);
|
|
|
}
|
|
|
- String organCode = "91440300326364429H";
|
|
|
+
|
|
|
+
|
|
|
+ String organCode = "";
|
|
|
+ if (params.get("ownershipType") == OwnershipType.OWN) {
|
|
|
+ organCode = "91440300326364429H";
|
|
|
+ } else {
|
|
|
+ organCode = "91420106333619290A";
|
|
|
+ }
|
|
|
SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
if (organTsign == null) {
|
|
|
throw new BizException("甲方未创建签章");
|
|
@@ -1023,7 +1035,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED)
|
|
|
- public Map<String, Object> queryProductContract(Integer userId) {
|
|
|
+ public Map<String, Object> queryProductContract(Integer userId,String musicGroupId) {
|
|
|
// 合成freemarker
|
|
|
String srcPdfPath = contractBaseDir + "/product/" + userId + ".pdf";
|
|
|
|
|
@@ -1042,7 +1054,15 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
|
|
|
params.put("studentInfo", studentInfo);
|
|
|
params.put("isShowVisualSeal", true);
|
|
|
- params.put("ownershipType", OwnershipType.OWN);
|
|
|
+ if(Objects.nonNull(musicGroupId)){
|
|
|
+ params.put("ownershipType", OwnershipType.OWN);
|
|
|
+ }else{
|
|
|
+ MusicGroup musicGroup = musicGroupService.get(musicGroupId);
|
|
|
+ if (musicGroup == null) {
|
|
|
+ throw new BizException("乐团信息没找到");
|
|
|
+ }
|
|
|
+ params.put("ownershipType", musicGroup.getOwnershipType().name());
|
|
|
+ }
|
|
|
templateEngine.render(params, "product.ftl", srcFile);
|
|
|
|
|
|
String html = "";
|