Commit 98e03437 by jianan

生成合同

parent 585da2ed
package com.yd.api.practitioner; package com.yd.api.practitioner;
import com.yd.api.practitioner.service.PractitionerHiringContractService;
import com.yd.api.practitioner.service.PractitionerHiringService; import com.yd.api.practitioner.service.PractitionerHiringService;
import com.yd.api.practitioner.vo.hiring.*; import com.yd.api.practitioner.vo.hiring.*;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
...@@ -17,6 +18,8 @@ public class PractitionerHiringController { ...@@ -17,6 +18,8 @@ public class PractitionerHiringController {
@Autowired @Autowired
private PractitionerHiringService practitionerHiringService; private PractitionerHiringService practitionerHiringService;
@Autowired
private PractitionerHiringContractService hiringContractService;
/** /**
* 保存报聘经纪人组织关系 * 保存报聘经纪人组织关系
...@@ -233,17 +236,19 @@ public class PractitionerHiringController { ...@@ -233,17 +236,19 @@ public class PractitionerHiringController {
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
*/ */
@RequestMapping("/hiringApprove") @RequestMapping("/hiringPDF")
public Object hiringApprove(@RequestBody HiringApproveRequestVO requestVO){ public Object hiringApprove(@RequestBody HiringPDFRequestVO requestVO){
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
try { try {
PractitionerPDFTest.main(null); // PractitionerPDFTest.main(null);
Long hiringBasicInfoId = requestVO.getHiringBasicInfoId();
hiringContractService.generatePractitionerContract(hiringBasicInfoId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
HiringApproveResponseVO responseVO = practitionerHiringService.hiringApprove(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result; return result;
} }
} }
\ No newline at end of file
package com.yd.api.practitioner.service.impl; package com.yd.api.practitioner.service.impl;
import com.yd.api.practitioner.service.PractitionerHiringContractService; import com.yd.api.practitioner.service.PractitionerHiringContractService;
import com.yd.dal.entity.customer.*;
import com.yd.dal.entity.practitioner.hiring.HiringBasicInfo; import com.yd.dal.entity.practitioner.hiring.HiringBasicInfo;
import com.yd.dal.entity.practitioner.hiring.HiringMemberShip; import com.yd.dal.entity.practitioner.hiring.HiringMemberShip;
import com.yd.dal.entity.practitioner.hiring.HiringPersonalStatements; import com.yd.dal.entity.practitioner.hiring.HiringPersonalStatements;
import com.yd.dal.entity.practitioner.hiring.HiringWorkingExperience; import com.yd.dal.entity.practitioner.hiring.HiringWorkingExperience;
import com.yd.dal.mapper.customer.AclPractitionerHiringBasicInfoMapper; import com.yd.dal.mapper.customer.*;
import com.yd.dal.mapper.customer.AclPractitionerHiringMembershipMapper;
import com.yd.dal.mapper.customer.AclPractitionerHiringPersonalStatementsMapper;
import com.yd.dal.mapper.customer.AclPractitionerHiringWorkingExperienceMapper;
import com.yd.dal.mapper.practitioner.PractitionerHiringMapper; import com.yd.dal.mapper.practitioner.PractitionerHiringMapper;
import com.libs.pdf.*; import com.libs.pdf.*;
import com.yd.rmi.ali.oss.service.OssService; import com.yd.rmi.ali.oss.service.OssService;
import com.yd.util.CommonUtil; import com.yd.util.CommonUtil;
import com.yd.util.HttpUtil;
import com.yd.util.PDFConfiguration; import com.yd.util.PDFConfiguration;
import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("PractitionerHiringContractService") @Service("PractitionerHiringContractService")
public class PractitionerHiringContractServiceImpl implements PractitionerHiringContractService { public class PractitionerHiringContractServiceImpl implements PractitionerHiringContractService {
...@@ -30,9 +31,25 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring ...@@ -30,9 +31,25 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring
private OssService ossService; private OssService ossService;
@Resource @Resource
private PractitionerHiringMapper practitionerHiringMapper; private PractitionerHiringMapper practitionerHiringMapper;
@Autowired
private AclPractitionerHiringMembershipMapper membershipMapper;
@Autowired
private AclPractitionerMapper aclPractitionerMapper;
@Autowired
private AclPractitionerHiringBasicInfoMapper basicInfoMapper;
@Autowired
private AclPractitionerHiringWorkingExperienceMapper workingExperienceMapper;
@Autowired
private AclPractitionerSubordinateSystemMapper systemMapper;
@Autowired
private AclPractitionerHiringApproveRecordsMapper recordsMapper;
@Autowired
private AclPractitionerHiringPersonalStatementsMapper statementsMapper;
/** /**
* 申请经纪人的ID,生成电子合同,在经纪人表中自动生成记录 * 申请经纪人的ID,生成电子合同,在经纪人表中自动生成记录
*
* @param hiringBasicInfoId * @param hiringBasicInfoId
* @return * @return
*/ */
...@@ -51,7 +68,7 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring ...@@ -51,7 +68,7 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring
String contractNO = "CTSH00009"; String contractNO = "CTSH00009";
//3、PDF模板生成合同文件,存本地临时文件后,上传oss //3、PDF模板生成合同文件,存本地临时文件后,上传oss
String contractFile = generatePractitionerPDF(practitionerNO,initDatas,initImages); String contractFile = generatePractitionerPDF(practitionerNO, initDatas, initImages);
//上传至oss ossService //上传至oss ossService
String contractFileOSS = contractFile; String contractFileOSS = contractFile;
...@@ -62,15 +79,30 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring ...@@ -62,15 +79,30 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring
} }
/** /**
* 申请ID的数据列表 * 申请ID的数据列表
*
* @param hiringBasicInfoId * @param hiringBasicInfoId
* @return * @return
*/ */
@Override @Override
public Map<String, String> initHiringBasicInfoData(Long hiringBasicInfoId) { public Map<String, String> initHiringBasicInfoData(Long hiringBasicInfoId) {
//PDF模板中定义的文字key,和值的集合
Map<String, String> data = new HashMap<String, String>(); AclPractitionerHiringBasicInfo basicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
HiringBasicInfo hiringBasicInfo = practitionerHiringMapper.findHiringBasicInfo(hiringBasicInfoId); AclPractitionerHiringMembership memberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
AclPractitioner mentor = aclPractitionerMapper.selectByPrimaryKey(memberShip.getMentorPractitionerId());
AclPractitioner introducer = aclPractitionerMapper.selectByPrimaryKey(memberShip.getIntroducerPractitionerId());
AclPractitioner second = aclPractitionerMapper.selectByMobileNo(basicInfo.getMobileNo());
List<AclPractitionerHiringWorkingExperience> workingExperienceList = workingExperienceMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
String mentorName = mentor == null ? "" : mentor.getName();
String mentorIdNo = mentor == null ? "" : mentor.getIdNo();
String mentorMobile = mentor == null ? "" : mentor.getMobileNo();
String introducerName = introducer == null ? "" : introducer.getName();
String introducerIdNo = introducer == null ? "" : introducer.getIdNo();
String introducerMobile = introducer == null ? "" : introducer.getMobileNo();
//模板文件生成零时文件 //模板文件生成零时文件
//甲方 //甲方
String firstParty = PDFConfiguration.getProperty("pdf.firstParty"); String firstParty = PDFConfiguration.getProperty("pdf.firstParty");
...@@ -79,34 +111,382 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring ...@@ -79,34 +111,382 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring
//甲方地址 //甲方地址
String firstPartyAddress = PDFConfiguration.getProperty("pdf.firstPartyAddress"); String firstPartyAddress = PDFConfiguration.getProperty("pdf.firstPartyAddress");
//PDF模板中定义的文字key,和值的集合
Map<String, String> data = new HashMap<String, String>();
//1页
data.put("contactNo", "C-SH-0001");
data.put("practitionerNo", "YDSH00127");
data.put("subsystem", memberShip.getSubsystem());
data.put("practitioner", basicInfo.getName());
data.put("idNo", basicInfo.getIdNo());
StringBuffer secondResidentAddress = new StringBuffer();
secondResidentAddress.append(basicInfo.getProvinceName()).append(basicInfo.getCityName());
data.put("residentAddress", secondResidentAddress.toString());
data.put("mobileNo", basicInfo.getMobileNo());
//7页
data.put("firstParty", firstParty);
data.put("firstPartyResponser", firstPartyResponser);
data.put("firstPartyAddress", firstPartyAddress);
// 设置一些地址
this.setSomeAddress(data, hiringBasicInfoId);
Calendar now = Calendar.getInstance();
System.out.println("----------------合同年月日------------------");
System.out.println("年: " + now.get(Calendar.YEAR));
System.out.println("月: " + (now.get(Calendar.MONTH) + 1) + "");
System.out.println("日: " + now.get(Calendar.DAY_OF_MONTH));
data.put("contactYear", now.get(Calendar.YEAR) + "");
data.put("contactMonth", (now.get(Calendar.MONTH) + 1) + "");
data.put("contactDay", now.get(Calendar.DAY_OF_MONTH) + "");
//8页
data.put("secondParty801", basicInfo.getName());
Calendar secondBirthday = Calendar.getInstance();
secondBirthday.setTime(basicInfo.getPractitionerBirthdate());
data.put("secondBirthYear801", secondBirthday.get(Calendar.YEAR) + "");
data.put("secondBirthMonth801", (secondBirthday.get(Calendar.MONTH) + 1) + "");
data.put("secondBirthDay801", secondBirthday.get(Calendar.DAY_OF_MONTH) + "");
data.put("secondPartyIDNo801", basicInfo.getIdNo());
data.put("secondPartyPermanentResidenceAddress", secondResidentAddress.toString());
data.put("secondPartyAddress801", basicInfo.getResidentAddress());
data.put("secondMobileNo801", basicInfo.getMobileNo());
data.put("secondPractitionerRegNo", second.getPractitionerRegNo());
data.put("secondEmail", basicInfo.getEmail());
this.setWorkingExperience(data, workingExperienceList);
data.put("secondBankAccount", basicInfo.getName());
data.put("secondBankAccountOpening", basicInfo.getBankAccountOpening());
data.put("secondBankAccountID", basicInfo.getBankAccountId());
data.put("secondMentor802", mentorName);
data.put("secondIntroducer", introducerName);
data.put("secondMentorIDNo801", mentorIdNo);
data.put("secondIntroducerIDNo", introducerIdNo);
Calendar applyDate = Calendar.getInstance();
applyDate.setTime(basicInfo.getCreatedAt());
data.put("secondEffectiveYear", applyDate.get(Calendar.YEAR) + "");
data.put("secondEffectiveMonth", (applyDate.get(Calendar.MONTH) + 1) + "");
data.put("secondEffectiveDay", applyDate.get(Calendar.DAY_OF_MONTH) + "");
data.put("secondParty802", basicInfo.getName());
data.put("secondMentor801", mentorName);
data.put("secondSubsystem", memberShip.getSubsystem());
data.put("secondSubsystemNo", "");
// 签核人员
this.setApprovepeople(data, hiringBasicInfoId);
//9页
String secondSignatureDate = CommonUtil.dateParseString(basicInfo.getCreatedAt(), "yyyy-MM-dd");
//10页
data.put("secondSignatureDate1001", secondSignatureDate);
//12页
data.put("secondParty1201", basicInfo.getName());
data.put("secondSignatureDate1201", secondSignatureDate);
//14页
data.put("secondParty1401", basicInfo.getName());
data.put("secondSignatureDate1401", secondSignatureDate);
//16页
data.put("secondParty1601", basicInfo.getName());
data.put("secondPartyIDNo1601", basicInfo.getIdNo());
data.put("secondSignatureDate1601", secondSignatureDate);
return data; return data;
} }
private void setSomeAddress(Map<String, String> data, Long hiringBasicInfoId) {
AclPractitionerHiringBasicInfo basicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
AclPractitionerHiringMembership memberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
AclPractitioner systemOwner = aclPractitionerMapper.selectByPrimaryKey(memberShip.getSubsystemOwnerId());
AclPractitioner mentor = aclPractitionerMapper.selectByPrimaryKey(memberShip.getMentorPractitionerId());
String mentorName = mentor == null ? "" : mentor.getName();
String mentorIdNo = mentor == null ? "" : mentor.getIdNo();
String mentorMobile = mentor == null ? "" : mentor.getMobileNo();
data.put("secondParty", basicInfo.getName());
data.put("secondPartyIDNo", basicInfo.getIdNo());
StringBuffer secondResidentAddress = new StringBuffer();
secondResidentAddress.append(basicInfo.getProvinceName()).append(basicInfo.getCityName());
data.put("secondPartyAddress", secondResidentAddress.toString());
data.put("secondMobileNo", basicInfo.getMobileNo());
data.put("secondSubsystemOwner", memberShip.getSubsystemOwner());
data.put("secondSubsystemSignature", memberShip.getSubsystemOwner());
data.put("secondSubsystemIDNo", systemOwner.getIdNo());
// 查团队长地址
StringBuffer systemOwnerAddress = new StringBuffer();
if (systemOwner != null) {
systemOwnerAddress.append(systemOwner.getProvinceName()).append(systemOwner.getCityName());
}
data.put("secondSubsystemAddress", systemOwnerAddress.toString());
data.put("secondSubsystemMobileNo", systemOwner.getMobileNo());
data.put("secondMentor", mentorName);
data.put("secondMentorIDNo", mentorIdNo);
// 辅导人地址
StringBuffer mentorAddress = new StringBuffer();
if (mentor != null) {
mentorAddress.append(mentor.getProvinceName()).append(mentor.getCityName());
}
data.put("secondMentorAddress", "上海市浦东新区张杨路560号中融恒瑞国际西楼1706室");
data.put("secondMentorMobileNo", mentorMobile);
}
private void setApprovepeople(Map<String, String> data, Long hiringBasicInfoId) {
// 查询审批记录
List<AclPractitionerHiringApproveRecords> recordsList = recordsMapper.queryListByBasicInfoId(hiringBasicInfoId);
AclPractitioner practitioner;
for (AclPractitionerHiringApproveRecords record:recordsList) {
practitioner = aclPractitionerMapper.selectByPrimaryKey(record.getApprovingPractitionerId());
if ("体系负责人".equals(record.getApproveStepName())) {
data.put("secondSubsystemMaster", practitioner.getName());
continue;
}
if ("公司运营主管".equals(record.getApproveStepName())) {
data.put("secondBranchManager", practitioner.getName());
continue;
}
if ("寿险总经理".equals(record.getApproveStepName())) {
data.put("secondBranchMaster", practitioner.getName());
continue;
}
if ("公司总经理".equals(record.getApproveStepName())) {
data.put("secondCenterCEO", practitioner.getName());
continue;
}
}
data.put("secondSubsystemManager", "");
data.put("secondCenterHr", "EVEN");
}
private void setWorkingExperience(Map<String, String> data, List<AclPractitionerHiringWorkingExperience> workingExperienceList) {
StringBuffer experienceKey = new StringBuffer("secondWorkingExperience");
StringBuffer positionKey = new StringBuffer("secondWorkingPosition");
StringBuffer periodKey = new StringBuffer("secondWorkingPeriod");
String experienceValue = "";
String positionValue = "";
String periodValue = "";
AclPractitionerHiringWorkingExperience item = null;
for (int i = 0; i <= 4; i++) {
if (i < workingExperienceList.size()) {
item = workingExperienceList.get(i);
}
experienceKey.append(i + 1);
positionKey.append(i + 1);
periodKey.append(i + 1);
if (item != null) {
experienceValue = item.getWorkingCompany();
positionValue = item.getPosition();
periodValue = item.getWorkingStart() + "~" + item.getWorkingEnd();
}
data.put(experienceKey.toString(), experienceValue);
data.put(positionKey.toString(), positionValue);
data.put(periodKey.toString(), periodValue);
}
}
/** /**
* 申请ID的图片列表,本地地址。从oss上拉到本地 * 申请ID的图片列表,本地地址。从oss上拉到本地
*
* @param hiringBasicInfoId * @param hiringBasicInfoId
* @return * @return
*/ */
@Override @Override
public Map<String, String> initHiringImageInfoData(Long hiringBasicInfoId) { public Map<String, String> initHiringImageInfoData(Long hiringBasicInfoId) {
AclPractitionerHiringBasicInfo basicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
//PDF模板中定义的文字key,和值的集合 //PDF模板中定义的文字key,和值的集合
Map<String, String> images = new HashMap<String, String>(); Map<String, String> images = new HashMap<String, String>();
//选中 //选中
String check = PDFConfiguration.getProperty("pdf.check"); String check = PDFConfiguration.getProperty("pdf.check");
//未选中 //未选中
String uncheck = PDFConfiguration.getProperty("pdf.uncheck"); String uncheck = PDFConfiguration.getProperty("pdf.uncheck");
//本地图片目录
String localDirectory = PDFConfiguration.getProperty("pdf.temp.path");
// Map赋值
// 个人照片
String personerPicture = this.getImgTolocal(localDirectory,"personerPicture.png", basicInfo.getPersonerPictureOssPath());
images.put("secondPersonerPicture", personerPicture);
//印章从配置文件读
String signImage = PDFConfiguration.getProperty("pdf.signImage");
images.put("yindunESignature1001", signImage);
images.put("yindunESignature1201", signImage);
images.put("yindunESignature1401", signImage);
// 电子签名
String signature = this.getImgTolocal(localDirectory,"signature.png", basicInfo.getPersonalSignOssPath());
images.put("secondSignature1001", signature);
images.put("secondSignature1201", signature);
images.put("secondSignature1401", signature);
images.put("secondSignature1601", signature);
// 证件照
String IDFront = this.getImgTolocal(localDirectory,"IDFront.png", basicInfo.getIdFrontPageOssPath());
String IDBack = this.getImgTolocal(localDirectory,"IDBack.png", basicInfo.getIdBackPageOssPath());
images.put("secondIDFrontPageImage", IDFront);
images.put("secondIDBackPageImage", IDBack);
// images.put("secondBankCardImage", "D:\\pcs12\\bank.jpg");
//选中或不选中从配置文件读
String checkFile = PDFConfiguration.getProperty("pdf.check");
String unCheckFile = PDFConfiguration.getProperty("pdf.uncheck");
// 设置证件类型
this.setIDType(images, basicInfo.getIdType(), checkFile, unCheckFile);
// 设置个人声明
this.setPersonalStatement(images, hiringBasicInfoId, checkFile, unCheckFile);
// 设置报聘职级
this.setPosition(images, hiringBasicInfoId, checkFile, unCheckFile);
return images; return images;
} }
private void setPosition(Map<String, String> images, Long hiringBasicInfoId, String checkFile, String unCheckFile) {
AclPractitionerHiringMembership memberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
images.put("secondPosition1", unCheckFile);
images.put("secondPosition2", unCheckFile);
images.put("secondPosition3", unCheckFile);
images.put("secondPosition4", unCheckFile);
images.put("secondPosition5", unCheckFile);
images.put("secondPosition6", unCheckFile);
Long mdDropOptionId = memberShip == null ? null : memberShip.getMdDropOptionId();
if (Long.valueOf("30").equals(mdDropOptionId)) {
images.put("secondPosition1", unCheckFile);
return;
}
if (Long.valueOf("32").equals(mdDropOptionId)) {
images.put("secondPosition2", unCheckFile);
return;
}
if (Long.valueOf("33").equals(mdDropOptionId)) {
images.put("secondPosition3", unCheckFile);
return;
}
if (Long.valueOf("34").equals(mdDropOptionId)) {
images.put("secondPosition4", unCheckFile);
return;
}
if (Long.valueOf("35").equals(mdDropOptionId)) {
images.put("secondPosition5", unCheckFile);
return;
}
if (Long.valueOf("36").equals(mdDropOptionId)) {
images.put("secondPosition6", unCheckFile);
return;
}
}
private void setPersonalStatement(Map<String, String> images, Long hiringBasicInfoId, String checkFile, String unCheckFile) {
List<AclPractitionerHiringPersonalStatements> statementsList = statementsMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
images.put("secondPersonalStatement1", checkFile);
images.put("secondPersonalStatement2", checkFile);
images.put("secondPersonalStatement3", checkFile);
images.put("secondPersonalStatement4", checkFile);
images.put("secondPersonalStatement5", checkFile);
images.put("secondPersonalStatement6", checkFile);
}
private void setIDType(Map<String, String> images, String idType, String checkFile, String unCheckFile) {
images.put("secondIDType1", unCheckFile);
images.put("secondIDType2", unCheckFile);
images.put("secondIDType3", unCheckFile);
images.put("secondIDType4", unCheckFile);
if (idType.indexOf("身份证") > 0) {
images.put("secondIDType1", checkFile);
return;
}
if (idType.indexOf("台胞照") > 0) {
images.put("secondIDType2", checkFile);
return;
}
if (idType.indexOf("护照") > 0) {
images.put("secondIDType3", checkFile);
return;
}
images.put("secondIDType4", checkFile);
}
private String getImgTolocal(String localDirectory, String filename, String imgUrl) {
Map<String, Object> input = HttpUtil.getInput(imgUrl);
if (!(boolean) input.get("success")) {
return null;
}
//获取头像流
InputStream inputStream = (InputStream) input.get("is");
String filePath = localDirectory + filename;
byte[] data = new byte[1024];
int len = 0;
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(filePath);
while ((len = inputStream.read(data)) != -1) {
fileOutputStream.write(data, 0, len);
}
return filePath;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
/** /**
* 用采集过来的经纪人数据、图片,生成该经纪人的电子合同 * 用采集过来的经纪人数据、图片,生成该经纪人的电子合同
*
* @param initDatas * @param initDatas
* @param initImages * @param initImages
* @return * @return
*/ */
@Override @Override
public String generatePractitionerPDF(String practitionerNO,Map<String, String> initDatas,Map<String, String> initImages) { public String generatePractitionerPDF(String practitionerNO, Map<String, String> initDatas, Map<String, String> initImages) {
String templatePDF = "D:\\pcs12\\templatePractitionerContract.pdf"; String templatePDF = "D:\\pcs12\\templatePractitionerContract.pdf";
templatePDF = PDFConfiguration.getProperty("pdf.template"); templatePDF = PDFConfiguration.getProperty("pdf.template");
//模板文件生成零时文件 //模板文件生成零时文件
...@@ -115,29 +495,30 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring ...@@ -115,29 +495,30 @@ public class PractitionerHiringContractServiceImpl implements PractitionerHiring
//PDF模板输出结果文件 //PDF模板输出结果文件
String templateResultPDF = tmpPathPDF + practitionerNO + "-template.pdf"; String templateResultPDF = tmpPathPDF + practitionerNO + "-template.pdf";
//按模板填充数据生成结果PDF //按模板填充数据生成结果PDF
PDFTemplate.generatePDF(templatePDF,templateResultPDF,initDatas,initImages); PDFTemplate.generatePDF(templatePDF, templateResultPDF, initDatas, initImages);
//加盖电子印章结果文件 //加盖电子印章结果文件
String signResultPDF = "D:\\pcs12\\signedYD.pdf"; String signResultPDF = "D:\\pcs12\\signedYD.pdf";
signResultPDF = tmpPathPDF + practitionerNO + "-signedYD.pdf"; signResultPDF = tmpPathPDF + practitionerNO + "-signedYD.pdf";
String password="UC645YlB"; String password = "UC645YlB";
password = CommonUtil.readFileTxt(PDFConfiguration.getProperty("pdf.keyPasswordFile")); password = CommonUtil.readFileTxt(PDFConfiguration.getProperty("pdf.keyPasswordFile"));
String keyStorePath="D:\\pcs12\\4929078_m.zuihuibi.cn.pfx"; String keyStorePath = "D:\\pcs12\\4929078_m.zuihuibi.cn.pfx";
keyStorePath = PDFConfiguration.getProperty("pdf.keyStorePath");; keyStorePath = PDFConfiguration.getProperty("pdf.keyStorePath");
;
//准备加盖电子印章的源文件 //准备加盖电子印章的源文件
String signSourcePDF = templateResultPDF; String signSourcePDF = templateResultPDF;
//电子印章文件 //电子印章文件
String signImage="D:\\pcs12\\上海银盾保险经纪有限公司.png"; String signImage = "D:\\pcs12\\上海银盾保险经纪有限公司.png";
signImage = PDFConfiguration.getProperty("pdf.signImage"); signImage = PDFConfiguration.getProperty("pdf.signImage");
float x = 450; float x = 450;
float y = 150; float y = 150;
x = Float.parseFloat(PDFConfiguration.getProperty("pdf.position.x")); x = Float.parseFloat(PDFConfiguration.getProperty("pdf.position.x"));
y = Float.parseFloat(PDFConfiguration.getProperty("pdf.position.y")); y = Float.parseFloat(PDFConfiguration.getProperty("pdf.position.y"));
try { try {
PDFSign.sign(signResultPDF,password,keyStorePath,signSourcePDF,signImage,x,y); PDFSign.sign(signResultPDF, password, keyStorePath, signSourcePDF, signImage, x, y);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
package com.yd.api.practitioner.vo.hiring;
import lombok.Data;
@Data
public class HiringPDFRequestVO {
/**
* 经纪人id
*/
private Long practitionerId;
/**
* 审批经纪人基本资料id
*/
private Long hiringBasicInfoId;
}
...@@ -74,4 +74,6 @@ public interface AclPractitionerMapper { ...@@ -74,4 +74,6 @@ public interface AclPractitionerMapper {
List<Long> queryMentoredByPractitionerId(Long practitionerId); List<Long> queryMentoredByPractitionerId(Long practitionerId);
PractitionerInfo findPractitionerInfoByPractitionerId(Long practitionerId); PractitionerInfo findPractitionerInfoByPractitionerId(Long practitionerId);
AclPractitioner selectByMobileNo(String mobileNo);
} }
\ No newline at end of file
...@@ -1515,6 +1515,7 @@ public class CommonUtil { ...@@ -1515,6 +1515,7 @@ public class CommonUtil {
while((line=bufr.readLine())!=null) while((line=bufr.readLine())!=null)
{ {
System.out.println(line); System.out.println(line);
break;
} }
bufr.close();//close()中已经包含了flush bufr.close();//close()中已经包含了flush
} catch (IOException e) { } catch (IOException e) {
......
...@@ -25,7 +25,7 @@ public class PDFConfiguration { ...@@ -25,7 +25,7 @@ public class PDFConfiguration {
{ {
in = PDFConfiguration.class.getClassLoader().getResourceAsStream("pdfconfiguration.properties"); in = PDFConfiguration.class.getClassLoader().getResourceAsStream("pdfconfiguration.properties");
props.load(in); props.load(new InputStreamReader(in, "UTF-8"));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logger.error("pdfconfiguration.properties文件未找到"); logger.error("pdfconfiguration.properties文件未找到");
} catch (IOException e) { } catch (IOException e) {
......
...@@ -348,6 +348,7 @@ ...@@ -348,6 +348,7 @@
select <include refid="Base_Column_List" /> select <include refid="Base_Column_List" />
from ag_acl_practitioner_hiring_working_experience from ag_acl_practitioner_hiring_working_experience
where hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT} where hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT}
order by working_end desc
</select> </select>
<delete id="deleteBatchByIds"> <delete id="deleteBatchByIds">
......
...@@ -966,4 +966,11 @@ ...@@ -966,4 +966,11 @@
where p.id = #{practitionerId} where p.id = #{practitionerId}
</select> </select>
<select id="selectByMobileNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner
where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment