Prechádzať zdrojové kódy

云教练导出优化

zouxuan 3 rokov pred
rodič
commit
e09eb61eac

+ 1 - 115
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -669,121 +669,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 	@Override
 	public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
 
-		if(true){
-			return transferProduceContract(userId, musicGroupId, null);
-		}
-
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/goods/" + dateFormat1.format(date) + "/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-
-		int subjectId = studentInfo.getSubject().getId();
-
-		Subject subject = subjectService.get(subjectId);
-		studentInfo.setSubject(subject);
-
-		params.put("studentInfo", studentInfo);
-
-		List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
-		params.put("goodsList", goodsList);
-
-		double depositFee = 0d;
-		if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
-			StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.SUCCESS);
-
-			if (studentPaymentOrder == null) {
-				MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
-				if (musicGroupSubjectPlan != null) {
-					depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
-				}
-			} else {
-
-				List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
-				for (StudentPaymentOrderDetail detail : orderDetailList) {
-					if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-						depositFee = detail.getPrice().doubleValue();
-					}
-				}
-			}
-		}
-		params.put("depositFee", depositFee);
-		params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
-
-		params.put("isShowVisualSeal", false);
-
-		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-		if (musicGroup == null) {
-			throw new BizException("乐团信息没找到");
-		}
-
-		params.put("ownershipType", musicGroup.getOwnershipType().name());
-
-		templateEngine.render(params, "goods.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} 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);
-
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "goods/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.INSTRUMENT);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
-
-		return true;
+		return transferProduceContract(userId, musicGroupId,null);
 	}
 
 	@Override