Commit 914627ab by jianan

Merge branch 'dev_20210120_hiringPDF' into dev

# Conflicts:
#	yd-api/src/main/java/com/yd/dal/entity/customer/AclPractitioner.java
parents c093005b 4a9209ab
package com.yd.api.practitioner;
import com.yd.api.practitioner.service.PractitionerHiringContractService;
import com.yd.api.practitioner.service.PractitionerHiringService;
import com.yd.api.practitioner.vo.hiring.*;
import com.yd.api.result.JsonResult;
......@@ -18,6 +19,7 @@ public class PractitionerHiringController {
@Autowired
private PractitionerHiringService practitionerHiringService;
/**
* 保存报聘经纪人组织关系
*
......@@ -233,15 +235,24 @@ public class PractitionerHiringController {
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/hiringApprove")
public Object hiringApprove(@RequestBody HiringApproveRequestVO requestVO){
@RequestMapping("/generatePDF")
public Object generatePDF(@RequestBody GeneratePDFRequestVO requestVO){
JsonResult result = new JsonResult();
try {
PractitionerPDFTest.main(null);
} catch (Exception e) {
e.printStackTrace();
GeneratePDFResponseVO responseVO = practitionerHiringService.generatePDF(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
HiringApproveResponseVO responseVO = practitionerHiringService.hiringApprove(requestVO);
/**
* 报聘成功后查看经纪人信息
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/queryPractitionerInfo")
public Object queryPractitionerInfo(@RequestBody QueryPractitionerInfoRequestVO requestVO){
JsonResult result = new JsonResult();
QueryPractitionerInfoResponseVO responseVO = practitionerHiringService.queryPractitionerInfo(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
......
package com.yd.api.practitioner.service;
import com.yd.api.practitioner.vo.hiring.GeneratePDFRequestVO;
import java.util.Map;
public interface PractitionerHiringContractService {
String generatePractitionerContract(Long hiringBasicInfoId);
String generatePractitionerContract(String practitionerNO, String contractNo, Long hiringBasicInfoId) throws Exception;
Map<String, String> initHiringBasicInfoData(Long hiringBasicInfoId);
Map<String, String> initHiringBasicInfoData(Long hiringBasicInfoId, String contractNo);
Map<String, String> initHiringImageInfoData(Long hiringBasicInfoId);
String generatePractitionerPDF(String practitionerNO,Map<String, String> initDatas,Map<String, String> initImages);
String getNextContractNo();
}
\ No newline at end of file
......@@ -53,4 +53,7 @@ public interface PractitionerHiringService {
SavePayrollPictureResponseVO savePayrollPicture(SavePayRollPictureRequestVO requestVO);
GeneratePDFResponseVO generatePDF(GeneratePDFRequestVO requestVO);
QueryPractitionerInfoResponseVO queryPractitionerInfo(QueryPractitionerInfoRequestVO requestVO);
}
package com.yd.api.practitioner.service.impl;
import com.yd.api.practitioner.service.PractitionerHiringContractService;
import com.yd.api.practitioner.service.PractitionerHiringService;
import com.yd.api.practitioner.vo.hiring.*;
import com.yd.api.result.CommonResult;
......@@ -11,6 +12,7 @@ import com.yd.dal.mapper.customer.*;
import com.yd.dal.service.customer.AclPractitionerHiringApproveRecordsDALService;
import com.yd.dal.service.practitioner.PractitionerHiringDALService;
import com.yd.rmi.ali.oss.service.OssService;
import com.yd.rmi.ali.send.service.SendService;
import com.yd.rmi.cache.SystemConfigService;
import com.yd.util.CommonUtil;
import com.yd.util.HttpUtil;
......@@ -29,6 +31,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -47,6 +50,12 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
private AclPractitionerHiringContractTermsConfirmsMapper contractTermsConfirmsMapper;
@Autowired
private AclPractitionerHiringApproveRecordsMapper recordsMapper;
@Autowired
private PractitionerHiringContractService hiringContractService;
@Autowired
private AclPractitionerMapper aclPractitionerMapper;
@Autowired
private SendService sendService;
private PractitionerHiringDALService practitionerHiringDalService;
private SystemConfigService systemConfigService;
......@@ -474,14 +483,14 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
//余下的仅有0.不可审批(未到) 1.可审批两种状态
//approvalIdentity的参数意义0.既是辅导人又是团队长 1.辅导人 2.团队长
//当approvalIdentity为0,1时,审批状态为可审批 当为2时判断辅导人是否审批
if (approvalIdentity == 0 || approvalIdentity == 1){
if (approvalIdentity == 0 || approvalIdentity == 1) {
hiringApproveStatus = 1L;
hiringApproveStepsSeq = 1L;
}else {
} else {
//判断辅导人是否审批,仅需判断hiringApproveRecordsList.isEmpty(),因为辅导人是第一步,团队长为第二步
if (hiringApproveRecordsList.isEmpty()) {
hiringApproveStatus = 0L;
}else {
} else {
hiringApproveStatus = 1L;
hiringApproveStepsSeq = 2L;
}
......@@ -497,15 +506,15 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
List<MdPractitionerHiringApproveSteps> hiringApproveStepsList = systemConfigService.findHiringApproveStepsAll();
List<AclPractitionerHiringApproveRecords> hiringApproveRecordsList = new ArrayList<>();
//当approvalIdentity=0时需要保存两条记录
if (approvalIdentity == 0L || approvalIdentity == 1L){
boolean hasStepSeq = addStepToList(requestVO,1,hiringApproveStepsList,hiringApproveRecordsList);
if (approvalIdentity == 0L || approvalIdentity == 1L) {
boolean hasStepSeq = addStepToList(requestVO, 1, hiringApproveStepsList, hiringApproveRecordsList);
if (!hasStepSeq) {
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830025")));
return responseVO;
}
}
if (approvalIdentity == 0L || approvalIdentity == 2L){
boolean hasStepSeq = addStepToList(requestVO,2,hiringApproveStepsList,hiringApproveRecordsList);
if (approvalIdentity == 0L || approvalIdentity == 2L) {
boolean hasStepSeq = addStepToList(requestVO, 2, hiringApproveStepsList, hiringApproveRecordsList);
if (!hasStepSeq) {
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830025")));
return responseVO;
......@@ -688,6 +697,117 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
return resp;
}
@Override
public GeneratePDFResponseVO generatePDF(GeneratePDFRequestVO requestVO) {
GeneratePDFResponseVO resp = new GeneratePDFResponseVO();
try {
Long hiringBasicInfoId = requestVO.getHiringBasicInfoId();
Long practitionerId = requestVO.getPractitionerId();
if (hiringBasicInfoId == null) {
resp.setCommonResult(new CommonResult(true, "此经纪人无电子合同"));
return resp;
}
AclPractitioner practitioner = aclPractitionerMapper.selectByPrimaryKey(practitionerId);
String practitionerCode = practitioner == null ? null : practitioner.getPractitionerCode();
if (StringUtils.isEmpty(practitionerCode)) {
resp.setCommonResult(new CommonResult(true, "内部编号不能为空,请注意保存"));
return resp;
}
// if (contractNo != null) {
// resp.setCommonResult(new CommonResult(true, "合同已存在"));
// return resp;
// }
String contractNo = hiringContractService.getNextContractNo();
String contractOssPath = hiringContractService.generatePractitionerContract(practitionerCode, contractNo, hiringBasicInfoId);
//4、经纪人表生成经纪人记录ag_acl_practitioner,ag_acl_practitioner.contract_oss_path
// 经纪人经纪人类型级别定义表ag_acl_practitioner_setting
AclPractitioner updateObj = new AclPractitioner();
updateObj.setId(practitionerId);
updateObj.setContractNo(contractNo);
updateObj.setContractOssPath(contractOssPath);
aclPractitionerMapper.updateByPrimaryKeySelective(updateObj);
//合同生成后,发短信通知报聘人,辅导人,团队长
this.sendMsgAfterPDF(hiringBasicInfoId);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setContractOssPath(contractOssPath);
} catch (Exception e) {
e.printStackTrace();
resp.setCommonResult(new CommonResult(false, e.getMessage()));
}
return resp;
}
private void sendMsgAfterPDF(Long hiringBasicInfoId) {
AclPractitionerHiringBasicInfo basicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
AclPractitionerHiringMembership memberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
List<String> mobileNoList = new ArrayList<>(3);
mobileNoList.add(basicInfo.getMobileNo());
if (memberShip.getMentorPractitionerId() != null) {
AclPractitioner mentor = aclPractitionerMapper.selectByPrimaryKey(memberShip.getMentorPractitionerId());
mobileNoList.add(mentor.getMobileNo());
}
if (memberShip.getSubsystemOwnerId() != null) {
AclPractitioner system = aclPractitionerMapper.selectByPrimaryKey(memberShip.getSubsystemOwnerId());
mobileNoList.add(system.getMobileNo());
}
// 若辅导人和团队长为同一人,去重
List<String> uniqueList = mobileNoList.stream().distinct().collect(Collectors.toList());
String name = basicInfo.getName();
String system = memberShip.getSubsystem();
String mobileNo;
String templateCode;
String content;
// S2的短信模板
if (Long.valueOf("30").equals(memberShip.getMdDropOptionId())) {
/* 短信提醒 */
templateCode = systemConfigService.getSingleConfigValue("ALI_SMS_CONTRACT_S2");
content = "{\"name\":\""+name+"\"}";
} else {
/* 短信提醒 */
templateCode = systemConfigService.getSingleConfigValue("ALI_SMS_CONTRACT");
content = "{\"system\":\""+system+"\",\"name\":\""+name+"\"}";
}
for (int i = 0; i < uniqueList.size(); i++) {
mobileNo = uniqueList.get(i);
sendService.sendEmailOrSMS("sms", mobileNo, "0", content, templateCode, null, null, "电子报聘合同生成提醒", 99, hiringBasicInfoId);
}
}
@Override
public QueryPractitionerInfoResponseVO queryPractitionerInfo(QueryPractitionerInfoRequestVO requestVO) {
QueryPractitionerInfoResponseVO resp = new QueryPractitionerInfoResponseVO();
try {
Long practitionerId = requestVO.getPractitionerId();
if (practitionerId == null) {
resp.setCommonResult(new CommonResult(false, "practitionerId不能为空"));
} else {
AclPractitioner practitioner = aclPractitionerMapper.selectByPrimaryKey(practitionerId);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setPractitioner(practitioner);
}
} catch (Exception e) {
e.printStackTrace();
resp.setCommonResult(new CommonResult(false, e.getMessage()));
}
return resp;
}
@SuppressWarnings("unchecked")
private boolean addStepToList(HiringApproveRequestVO requestVO,
int stepSeq,
......@@ -741,7 +861,7 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
private String generateKey(int targetUseFor) {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
return targetUseFor+sdf.format(new Date());
return targetUseFor + sdf.format(new Date());
}
}
package com.yd.api.practitioner.vo.hiring;
import lombok.Data;
@Data
public class GeneratePDFRequestVO {
/**
* 经纪人id
*/
private Long practitionerId;
/**
* 审批经纪人基本资料id
*/
private Long hiringBasicInfoId;
}
package com.yd.api.practitioner.vo.hiring;
import com.yd.api.result.CommonResult;
import lombok.Data;
@Data
public class GeneratePDFResponseVO {
private CommonResult commonResult;
private String contractOssPath;
}
package com.yd.api.practitioner.vo.hiring;
import lombok.Data;
@Data
public class QueryPractitionerInfoRequestVO {
/**
* 经纪人id
*/
private Long practitionerId;
}
package com.yd.api.practitioner.vo.hiring;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclPractitioner;
import lombok.Data;
@Data
public class QueryPractitionerInfoResponseVO {
private CommonResult commonResult;
private AclPractitioner practitioner;
}
......@@ -202,7 +202,20 @@ public class AclPractitioner implements Serializable {
*/
private Integer gender;
private Long hiringBasicInfoId;
/**
* 经纪人合同号
*/
private String contractNo;
/**
* 经纪人PDF合同地址
*/
private String contractOssPath;
/**
* 经纪人报聘信息表id
*/
private String hiringBasicInfoId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -29,6 +29,11 @@ public class AclPractitionerHiringPersonalStatements {
private String mdDropOptionName;
/**
* 选项代码
*/
private String dropOptionCode;
/**
* 个人申明条目,用户补充输入
*/
private String userInput;
......
......@@ -74,4 +74,6 @@ public interface AclPractitionerMapper {
List<Long> queryMentoredByPractitionerId(Long practitionerId);
PractitionerInfo findPractitionerInfoByPractitionerId(Long practitionerId);
AclPractitioner selectByMobileNo(String mobileNo);
}
\ No newline at end of file
......@@ -66,4 +66,6 @@ public interface PractitionerHiringMapper {
List<HiringListInfo> queryMentorUnhandledList(Long practitionerId);
List<HiringListInfo> querySystemOwnerUnhandledList(Long practitionerId);
String getNextContractNo();
}
......@@ -1515,6 +1515,7 @@ public class CommonUtil {
while((line=bufr.readLine())!=null)
{
System.out.println(line);
break;
}
bufr.close();//close()中已经包含了flush
} catch (IOException e) {
......
......@@ -25,7 +25,7 @@ public class PDFConfiguration {
{
in = PDFConfiguration.class.getClassLoader().getResourceAsStream("pdfconfiguration.properties");
props.load(in);
props.load(new InputStreamReader(in, "UTF-8"));
} catch (FileNotFoundException e) {
logger.error("pdfconfiguration.properties文件未找到");
} catch (IOException e) {
......
......@@ -297,11 +297,27 @@
</foreach>
</insert>
<select id="selectByHiringBasicInfoId" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from ag_acl_practitioner_hiring_personal_statements
<resultMap id="BaseResultMap2" type="com.yd.dal.entity.customer.AclPractitionerHiringPersonalStatements">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="hiring_basic_info_id" jdbcType="BIGINT" property="hiringBasicInfoId" />
<result column="md_drop_option_id" jdbcType="BIGINT" property="mdDropOptionId" />
<result column="md_drop_option_name" jdbcType="VARCHAR" property="mdDropOptionName" />
<result column="status" jdbcType="BIGINT" property="status" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="user_input" jdbcType="INTEGER" property="userInput" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
<result column="drop_option_code" jdbcType="VARCHAR" property="dropOptionCode" />
</resultMap>
<select id="selectByHiringBasicInfoId" resultMap="BaseResultMap2">
select s.* , o.drop_option_code
from ag_acl_practitioner_hiring_personal_statements s
left join ag_md_drop_options o on o.id = s.md_drop_option_id
where hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT}
</select>
<delete id="deleteBatchByIds">
delete from ag_acl_practitioner_hiring_personal_statements
where id in
......
......@@ -348,6 +348,7 @@
select <include refid="Base_Column_List" />
from ag_acl_practitioner_hiring_working_experience
where hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT}
order by working_end desc
</select>
<delete id="deleteBatchByIds">
......
......@@ -41,6 +41,9 @@
<result column="mentor_id" jdbcType="BIGINT" property="mentorId" />
<result column="introducer_id" jdbcType="BIGINT" property="introducerId" />
<result column="gender" jdbcType="INTEGER" property="gender" />
<result column="contract_no" jdbcType="VARCHAR" property="contractNo" />
<result column="contract_oss_path" jdbcType="VARCHAR" property="contractOssPath" />
<result column="hiring_basic_info_id" jdbcType="BIGINT" property="hiringBasicInfoId" />
</resultMap>
<sql id="Base_Column_List">
id, insurer_id, insurer_branch_id, dept_id, subordinate_system_id, practitioner_code,
......@@ -48,7 +51,8 @@
practitioner_reg_company, effective_start_date, effective_end_date, remark, customer_id,
employee_no, is_active, created_at, created_by, updated_at, updated_by, province_id,
province_name, city_id, city_name, cert_list, bio_intro, wechat_id, qq_id, is_profile_show,
is_name_show, is_mobile_show, education_level, mentor_id, introducer_id, gender
is_name_show, is_mobile_show, education_level, mentor_id, introducer_id, gender,
contract_no, contract_oss_path, hiring_basic_info_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -443,6 +447,15 @@
<if test="gender != null">
gender = #{gender,jdbcType=INTEGER},
</if>
<if test="contractNo != null">
contract_no = #{contractNo,jdbcType=INTEGER},
</if>
<if test="contractOssPath != null">
contract_oss_path = #{contractOssPath,jdbcType=INTEGER},
</if>
<if test="hiringBasicInfoId != null">
hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -967,4 +980,11 @@
where p.id = #{practitionerId}
</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>
\ No newline at end of file
......@@ -262,4 +262,8 @@
from ag_md_drop_master
where scenario_code = 'practitioner_level'))
</select>
<select id="getNextContractNo" resultType="java.lang.String" statementType="CALLABLE">
select f_getNextContractNo()
</select>
</mapper>
\ No newline at end of file
pdf.template=/opt/tomcat8/conf/ydpdf/pdfres/templatePractitionerContract.pdf
pdf.signImage=/opt/tomcat8/conf/ydpdf/pdfres/上海银盾保险经纪有限公司.png
pdf.signImage=/opt/tomcat8/conf/ydpdf/pdfres/yindunsign.png
pdf.keyStorePath=/opt/tomcat8/conf/ydpdf/pdfres/4929078_m.zuihuibi.cn.pfx
pdf.keyPasswordFile=/opt/tomcat8/conf/ydpdf/pdfres/pfx-password.txt
pdf.keyPassword=UC645YlB
pdf.check=/opt/tomcat8/conf/ydpdf/pdfres/check.png
pdf.uncheck=/opt/tomcat8/conf/ydpdf/pdfres/uncheck.png
pdf.temp.path=/opt/tomcat8/temp/
pdf.firstParty=上海银盾保险经纪有限公司
pdf.firstPartyResponser=Sharon Wan
pdf.firstPartyAddress=上海市浦东新区张杨路560号中融恒瑞国际西楼1706室
pdf.firstParty=上海银盾保险经纪有限公司
pdf.firstPartyResponser=Wan Shuang Lian
pdf.firstPartyAddress=上海市浦东新区张杨路560号中融恒瑞国际西楼1706室
pdf.position.x=450
pdf.position.y=150
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