|
@@ -8,6 +8,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
@@ -23,6 +24,7 @@ import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentInfo;
|
|
|
+import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
|
|
@@ -52,6 +54,7 @@ import com.ym.mec.biz.service.VipGroupService;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.thirdparty.eseal.ESealPlugin;
|
|
|
import com.ym.mec.thirdparty.storage.StoragePlugin;
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
|
|
|
import com.ym.mec.util.money.MoneyUtil;
|
|
|
import com.ym.mec.util.pdf.PDFUtil;
|
|
@@ -108,33 +111,42 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
private String contractBaseDir;
|
|
|
|
|
|
private DateFormat dateFormatOss = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
+
|
|
|
+ private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
|
|
|
|
|
|
@Override
|
|
|
public void afterPropertiesSet() throws Exception {
|
|
|
// 注册企业账户
|
|
|
- String orgName = "武汉长乐长风乐器销售有限公司";
|
|
|
- String organCode = "91420106333619290A";
|
|
|
+ Map<String, String> organList = new HashMap<String, String>();
|
|
|
+ organList.put("91420106333619290A", "武汉长乐长风乐器销售有限公司");
|
|
|
+ organList.put("91440300326364429H", "深圳大雅乐盟网络教育股份有限公司");
|
|
|
|
|
|
- SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
+ for (Entry<String, String> organ : organList.entrySet()) {
|
|
|
|
|
|
- if (sysUserTsign == null) {
|
|
|
+ String organCode = organ.getKey();
|
|
|
+ String orgName = organ.getValue();
|
|
|
|
|
|
- String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
|
|
|
+ SysUserTsign sysUserTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
|
|
|
- if (StringUtils.isBlank(accountId)) {
|
|
|
- throw new BizException("创建企业电子存证账户失败");
|
|
|
- }
|
|
|
+ if (sysUserTsign == null) {
|
|
|
|
|
|
- String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
|
|
|
+ String accountId = eSealPlugin.createOrganAccount(orgName, organCode);
|
|
|
|
|
|
- if (StringUtils.isBlank(sealData)) {
|
|
|
- throw new BizException("创建电子存证印章失败");
|
|
|
- }
|
|
|
+ if (StringUtils.isBlank(accountId)) {
|
|
|
+ throw new BizException("创建企业电子存证账户失败");
|
|
|
+ }
|
|
|
|
|
|
- sysUserTsign = new SysUserTsign(-1, accountId, sealData, orgName, organCode);
|
|
|
+ String sealData = eSealPlugin.createOrganSeal(accountId, "", "");
|
|
|
|
|
|
- sysUserTsignService.insert(sysUserTsign);
|
|
|
+ if (StringUtils.isBlank(sealData)) {
|
|
|
+ throw new BizException("创建电子存证印章失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ sysUserTsign = new SysUserTsign(-1, accountId, sealData, orgName, organCode);
|
|
|
+
|
|
|
+ sysUserTsignService.insert(sysUserTsign);
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -209,6 +221,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
Date date = new Date();
|
|
|
// 上传到oss
|
|
|
String dateStrOss = dateFormatOss.format(date);
|
|
|
+ dateStrOss = dateStrOss + "/" + DateUtil.getHour(date);
|
|
|
String pdfFilePath = storagePlugin.uploadFile(dateStrOss, srcFile);
|
|
|
|
|
|
SysUserContracts sysUserContracts = new SysUserContracts();
|
|
@@ -266,9 +279,10 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
|
|
|
}
|
|
|
+ Date date = new Date();
|
|
|
|
|
|
// 合成freemarker
|
|
|
- String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
|
|
|
+ String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
|
|
|
|
|
|
File srcFile = new File(srcPdfPath);
|
|
|
|
|
@@ -330,16 +344,27 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
// 生成借款协议PDF
|
|
|
try {
|
|
|
PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath,
|
|
|
- "config/fonts/simsun.ttc");
|
|
|
+ "config/fonts/simsun.ttf");
|
|
|
} catch (IOException e) {
|
|
|
throw new BizException("生成pdf协议失败", e);
|
|
|
}
|
|
|
-
|
|
|
+ String organCode = "";
|
|
|
+ if(musicGroup.getOwnershipType() == OwnershipType.OWN){
|
|
|
+ organCode = "91440300326364429H";
|
|
|
+ }else{
|
|
|
+ organCode = "91420106333619290A";
|
|
|
+ }
|
|
|
+ SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
+ if(organTsign == null){
|
|
|
+ throw new BizException("甲方未创建签章");
|
|
|
+ }
|
|
|
+
|
|
|
+ eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
|
|
|
- Date date = new Date();
|
|
|
// 上传到oss
|
|
|
String dateStrOss = dateFormatOss.format(date);
|
|
|
+ dateStrOss = dateStrOss + "/" + DateUtil.getHour(date);
|
|
|
String pdfFilePath = storagePlugin.uploadFile(dateStrOss, srcFile);
|
|
|
|
|
|
SysUserContracts sysUserContracts = new SysUserContracts();
|
|
@@ -441,9 +466,10 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
|
|
|
}
|
|
|
+ Date date = new Date();
|
|
|
|
|
|
// 合成freemarker
|
|
|
- String srcPdfPath = contractBaseDir + "/courses/" + userId + ".pdf";
|
|
|
+ String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
|
|
|
|
|
|
File srcFile = new File(srcPdfPath);
|
|
|
|
|
@@ -487,12 +513,19 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
} catch (IOException e) {
|
|
|
throw new BizException("生成pdf协议失败", e);
|
|
|
}
|
|
|
+ String organCode = "91440300326364429H";
|
|
|
+ SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
+ if(organTsign == null){
|
|
|
+ throw new BizException("甲方未创建签章");
|
|
|
+ }
|
|
|
+
|
|
|
+ eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
|
|
|
eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
|
|
|
- Date date = new Date();
|
|
|
// 上传到oss
|
|
|
String dateStrOss = dateFormatOss.format(date);
|
|
|
+ dateStrOss = dateStrOss + "/" + DateUtil.getHour(date);
|
|
|
String pdfFilePath = storagePlugin.uploadFile(dateStrOss, srcFile);
|
|
|
|
|
|
SysUserContracts sysUserContracts = new SysUserContracts();
|
|
@@ -570,9 +603,10 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
}
|
|
|
sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
|
|
|
}
|
|
|
+ Date date = new Date();
|
|
|
|
|
|
// 合成freemarker
|
|
|
- String srcPdfPath = contractBaseDir + "/goods/" + userId + ".pdf";
|
|
|
+ String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
|
|
|
|
|
|
File srcFile = new File(srcPdfPath);
|
|
|
|
|
@@ -639,12 +673,24 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
} catch (IOException e) {
|
|
|
throw new BizException("生成pdf协议失败", e);
|
|
|
}
|
|
|
+ String organCode = "";
|
|
|
+ if(musicGroup.getOwnershipType() == OwnershipType.OWN){
|
|
|
+ organCode = "91440300326364429H";
|
|
|
+ }else{
|
|
|
+ organCode = "91420106333619290A";
|
|
|
+ }
|
|
|
+ SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
|
|
|
+ if(organTsign == null){
|
|
|
+ throw new BizException("甲方未创建签章");
|
|
|
+ }
|
|
|
+
|
|
|
+ eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
|
|
|
eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
|
|
|
|
|
|
- Date date = new Date();
|
|
|
// 上传到oss
|
|
|
String dateStrOss = dateFormatOss.format(date);
|
|
|
+ dateStrOss = dateStrOss + "/" + DateUtil.getHour(date);
|
|
|
String pdfFilePath = storagePlugin.uploadFile(dateStrOss, srcFile);
|
|
|
|
|
|
SysUserContracts sysUserContracts = new SysUserContracts();
|
|
@@ -693,7 +739,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
|
|
|
|
|
|
double depositFee = 0d;
|
|
|
if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.WAIT_PAY);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService
|
|
|
+ .findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.WAIT_PAY);
|
|
|
|
|
|
if (studentPaymentOrder == null) {
|
|
|
MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.findSubjectPlan(musicGroupId, subjectId);
|