Commit eb593662 by jianan

客户告知书关联保单号后添加到附件

parent 2f22b370
...@@ -913,7 +913,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -913,7 +913,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
AclCustomer customer = aclCustomerDALService.findByCustomerId(customerId); AclCustomer customer = aclCustomerDALService.findByCustomerId(customerId);
info.setOpportunityId(customerId); info.setOpportunityId(customerId);
info.setName(customer.getName()); String customerName = customer.getName();
info.setName(customerName);
info.setAge(customer.getAge()); info.setAge(customer.getAge());
info.setGender(customer.getGender()); info.setGender(customer.getGender());
info.setMobileNo(customer.getMobileNo()); info.setMobileNo(customer.getMobileNo());
...@@ -963,6 +964,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -963,6 +964,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssigneds.setAssignedPractitionerId(practitionerId); mktLeadsAssigneds.setAssignedPractitionerId(practitionerId);
List<MktLeadsAssigneds> mktLeadsAssignedsList =mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds); List<MktLeadsAssigneds> mktLeadsAssignedsList =mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
mktLeadsAssigneds = mktLeadsAssignedsList.get(0); mktLeadsAssigneds = mktLeadsAssignedsList.get(0);
String leadsAssignedsCustomerName = mktLeadsAssigneds.getCustomerName();
if (customerName != null && leadsAssignedsCustomerName != null) {
if (!customerName.equals(leadsAssignedsCustomerName)) {
info.setName(leadsAssignedsCustomerName);
}
}
info.setFyc(mktLeadsAssigneds.getFyc()); info.setFyc(mktLeadsAssigneds.getFyc());
info.setFyp(mktLeadsAssigneds.getFyp()); info.setFyp(mktLeadsAssigneds.getFyp());
info.setPieces(mktLeadsAssigneds.getPieces()); info.setPieces(mktLeadsAssigneds.getPieces());
...@@ -3651,9 +3658,16 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3651,9 +3658,16 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
AclCustomer oldCustomer = aclCustomerDALService.findById(requestVO.getCustomerId()); AclCustomer oldCustomer = aclCustomerDALService.findById(requestVO.getCustomerId());
String newName = requestVO.getCustomerName(); String newName = requestVO.getCustomerName();
String newMobile = requestVO.getCustomerMobile(); String newMobile = requestVO.getCustomerMobile();
// 数据库实体 // 查询客户是否存在
AclCustomer newerCustomer = aclCustomerDALService.findByMobileNo(newMobile); AclCustomer customerParams = new AclCustomer();
if (newerCustomer == null) { customerParams.setMobileNo(newMobile);
customerParams.setRole(2);
customerParams.setIsActive(1);
List<AclCustomer> customerList = aclCustomerDALService.findByObj(customerParams);
AclCustomer newerCustomer = null;
if (CollectionUtils.isNotEmpty(customerList)) {
newerCustomer = customerList.get(0);
} else {
//此人为第一次进来 //此人为第一次进来
//帮其进行注册 //帮其进行注册
newerCustomer = new AclCustomer(); newerCustomer = new AclCustomer();
...@@ -3675,7 +3689,22 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3675,7 +3689,22 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner"); Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner");
newerCustomer.setMktCampaign(String.valueOf(mdMkCampaignId)); newerCustomer.setMktCampaign(String.valueOf(mdMkCampaignId));
aclCustomerDALService.save(newerCustomer); aclCustomerDALService.save(newerCustomer);
newerCustomer.setId(newerCustomer.getId());
Long newerCustomerId = newerCustomer.getId();
//查询此customer是否在pool中
MktLeadsPool pool = mktLeadsPoolDALService.findByCustomerId(newerCustomerId);
if (pool == null) {
//线索池为空时,保存线索池
pool = new MktLeadsPool();
pool.setMktCampaign(String.valueOf(mdMkCampaignId));
pool.setCustomerId(newerCustomerId);
pool.setHasAssigned(1);
pool.setIsActive(1);
pool.setAddedAt(new Date());
pool.setAddedBy(requestVO.getPractitionerId());
pool.setAdderType(2);
mktLeadsPoolDALService.save(pool);
}
} }
if (!newMobile.equals(oldCustomer.getMobileNo()) || !newName.equals(oldCustomer.getName())) {// 如果电话不一样,就更新商机的电话 if (!newMobile.equals(oldCustomer.getMobileNo()) || !newName.equals(oldCustomer.getName())) {// 如果电话不一样,就更新商机的电话
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds(); MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
...@@ -3685,7 +3714,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3685,7 +3714,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssigneds.setCustomerId(newerCustomer.getId()); mktLeadsAssigneds.setCustomerId(newerCustomer.getId());
mktLeadsAssignedsMapper.updateByPrimaryKeySelective(mktLeadsAssigneds); mktLeadsAssignedsMapper.updateByPrimaryKeySelective(mktLeadsAssigneds);
} }
// 数据库实体
AgPoInformed informed = new AgPoInformed(); AgPoInformed informed = new AgPoInformed();
informed.setCustomerName(newName); informed.setCustomerName(newName);
informed.setCustomerMobile(newMobile); informed.setCustomerMobile(newMobile);
...@@ -3765,13 +3794,18 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3765,13 +3794,18 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp; return resp;
} }
// 更新保单号
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId()); AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
BeanUtils.copyProperties(requestVO, informed); // 删除旧保单号关联的客户告知书保单附件
if (informed.getPolicyNo() != null) {
informedMapper.deletePoPolicyOfflineUploadByPolicyNo(informed.getPolicyNo());
}
// 更新保单号
informed.setPolicyNo(policyNo);
informed.setUpdatedBy(requestVO.getLoginId()); informed.setUpdatedBy(requestVO.getLoginId());
informed.setUpdatedAt(new Date()); informed.setUpdatedAt(new Date());
informedMapper.updateByPrimaryKeySelective(informed); informedMapper.updateByPrimaryKeySelective(informed);
// 新保单号新增客户告知书到保单附件
informedMapper.insertInformedSheet(informed);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setId(informed.getId()); resp.setId(informed.getId());
......
...@@ -20,4 +20,9 @@ public interface AgPoInformedMapper { ...@@ -20,4 +20,9 @@ public interface AgPoInformedMapper {
List<AgPoInformed> selectByRecord(AgPoInformed record); List<AgPoInformed> selectByRecord(AgPoInformed record);
String getNextInformedNo(); String getNextInformedNo();
void insertInformedSheet(AgPoInformed record);
void deletePoPolicyOfflineUploadByPolicyNo(String policyNo);
} }
\ No newline at end of file
...@@ -797,5 +797,11 @@ ...@@ -797,5 +797,11 @@
and id = #{id,jdbcType=BIGINT} and id = #{id,jdbcType=BIGINT}
</if> </if>
<if test="role != null">
and `role` = #{role,jdbcType=INTEGER}
</if>
<if test="isActive != null">
and is_active = #{isActive,jdbcType=INTEGER}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -259,4 +259,21 @@ ...@@ -259,4 +259,21 @@
<select id="getNextInformedNo" resultType="java.lang.String" statementType="CALLABLE"> <select id="getNextInformedNo" resultType="java.lang.String" statementType="CALLABLE">
select f_getNextInformedNo() select f_getNextInformedNo()
</select> </select>
<insert id="insertInformedSheet" parameterType="com.yd.dal.entity.customer.AgPoInformed">
INSERT INTO ag_po_policy_offline_upload
(`policy_offline_id`,
`policy_no`, `file_type`, `file_name`, `file_path`,`file_size`,
`uploaded_at`, `uploaded_by`, `attachment_type`)
VALUES (
(select id from ag_po_policy_offline where policy_no = #{policyNo,jdbcType=VARCHAR}),
#{policyNo,jdbcType=VARCHAR}, 'pdf', #{informedNo,jdbcType=VARCHAR}, #{informedOssPath,jdbcType=VARCHAR},'0',
now(), -1, 2)
</insert>
<delete id="deletePoPolicyOfflineUploadByPolicyNo" parameterType="java.lang.String">
delete from ag_po_policy_offline_upload
where policy_no = #{policyNo,jdbcType=VARCHAR} and attachment_type=2
</delete>
</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