Commit eb593662 by jianan

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

parent 2f22b370
......@@ -913,7 +913,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long practitionerId = requestVO.getPractitionerId();
AclCustomer customer = aclCustomerDALService.findByCustomerId(customerId);
info.setOpportunityId(customerId);
info.setName(customer.getName());
String customerName = customer.getName();
info.setName(customerName);
info.setAge(customer.getAge());
info.setGender(customer.getGender());
info.setMobileNo(customer.getMobileNo());
......@@ -963,6 +964,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssigneds.setAssignedPractitionerId(practitionerId);
List<MktLeadsAssigneds> mktLeadsAssignedsList =mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
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.setFyp(mktLeadsAssigneds.getFyp());
info.setPieces(mktLeadsAssigneds.getPieces());
......@@ -3651,9 +3658,16 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
AclCustomer oldCustomer = aclCustomerDALService.findById(requestVO.getCustomerId());
String newName = requestVO.getCustomerName();
String newMobile = requestVO.getCustomerMobile();
// 数据库实体
AclCustomer newerCustomer = aclCustomerDALService.findByMobileNo(newMobile);
if (newerCustomer == null) {
// 查询客户是否存在
AclCustomer customerParams = new AclCustomer();
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();
......@@ -3675,7 +3689,22 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner");
newerCustomer.setMktCampaign(String.valueOf(mdMkCampaignId));
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())) {// 如果电话不一样,就更新商机的电话
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
......@@ -3685,7 +3714,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssigneds.setCustomerId(newerCustomer.getId());
mktLeadsAssignedsMapper.updateByPrimaryKeySelective(mktLeadsAssigneds);
}
// 数据库实体
AgPoInformed informed = new AgPoInformed();
informed.setCustomerName(newName);
informed.setCustomerMobile(newMobile);
......@@ -3765,13 +3794,18 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp;
}
// 更新保单号
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.setUpdatedAt(new Date());
informedMapper.updateByPrimaryKeySelective(informed);
// 新保单号新增客户告知书到保单附件
informedMapper.insertInformedSheet(informed);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setId(informed.getId());
......
......@@ -20,4 +20,9 @@ public interface AgPoInformedMapper {
List<AgPoInformed> selectByRecord(AgPoInformed record);
String getNextInformedNo();
void insertInformedSheet(AgPoInformed record);
void deletePoPolicyOfflineUploadByPolicyNo(String policyNo);
}
\ No newline at end of file
......@@ -797,5 +797,11 @@
and id = #{id,jdbcType=BIGINT}
</if>
<if test="role != null">
and `role` = #{role,jdbcType=INTEGER}
</if>
<if test="isActive != null">
and is_active = #{isActive,jdbcType=INTEGER}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
......@@ -259,4 +259,21 @@
<select id="getNextInformedNo" resultType="java.lang.String" statementType="CALLABLE">
select f_getNextInformedNo()
</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>
\ 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