Commit a1a21250 by hongzhong

Merge remote-tracking branch 'origin/dev_20210330' into dev_20210330

parents b100e14f eb593662
......@@ -81,8 +81,10 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
for (ComeCommissionVO item : list) {
if ("1".equals(item.getCommissionType())) {
dropOption = systemConfigService.getDropOption("Base_Commission_Item", item.getCommissionItem());
item.setCommissionTypeName("基础来佣");
} else {
dropOption = systemConfigService.getDropOption("Special_Commission_Type", item.getCommissionItem());
item.setCommissionTypeName("特殊激励来佣");
}
if (dropOption != null) {
item.setCommissionItemName(dropOption.getDropOptionName());
......
......@@ -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());
......@@ -1495,6 +1502,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
}
private CommonResult isCreateOpportunity(OwnOpportunityBasicInformationSaveRequestVO requestVO) {
Long assignedPractitionerId = requestVO.getAssignedPractitionerId();
Long customerId;
//当指派id为null时,认为是保存新的商机
//校验商机号码,手机号码对应的customer是否存在
......@@ -1503,21 +1511,31 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner");
//判断是否通过手机号码找到客户
if (aclCustomer!=null){
if (aclCustomer != null) {
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
mktLeadsAssigneds.setCustomerId(aclCustomer.getId());
List<MktLeadsAssigneds> mktLeadsAssignedsList = mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
if (!mktLeadsAssignedsList.isEmpty()){
if (!mktLeadsAssignedsList.isEmpty()) {
MktLeadsAssignedTrack leadsAssignedTrack = mktLeadsAssignedTrackDALService.findByListNotesForCustomerId(aclCustomer.getId());
Long mdDropOptionId = leadsAssignedTrack.getMdDropOptionId();
//判断最后一条跟进状态是否为失败,是失败则无需判断经纪人id和之前是否一致
MdDropOptions mdDropOption = mdDropOptionsDALService.findById(mdDropOptionId);
if (!"refused".equalsIgnoreCase(mdDropOption.getDropOptionCode())){
//跳出错误
return new CommonResult(false,ZHBErrorConfig.getErrorInfo("830014"));
if (!"refused".equalsIgnoreCase(mdDropOption.getDropOptionCode())) {
//获取最新track对应的leads
for (MktLeadsAssigneds item : mktLeadsAssignedsList) {
if (item.getId().equals(leadsAssignedTrack.getLeadsAssignedId())) {
//跳出错误
if (item.getAssignedPractitionerId().equals(assignedPractitionerId)) {
return new CommonResult(false, "该商机已存在");
} else {
return new CommonResult(false, ZHBErrorConfig.getErrorInfo("830014"));
}
}
}
}
}
}else {
} else {
//此人为第一次进来
//帮其经行注册
aclCustomer = new AclCustomer();
......@@ -1541,7 +1559,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
customerId = aclCustomer.getId();
//查询此customer是否在pool中
MktLeadsPool pool = mktLeadsPoolDALService.findByCustomerId(customerId);
if (pool == null){
if (pool == null) {
//线索池为空时,保存线索池
pool = new MktLeadsPool();
pool.setMktCampaign(String.valueOf(mdMkCampaignId));
......@@ -1568,7 +1586,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
String mdDropOptionsId = systemConfigService.getSingleConfigValue("OpportunityToBeFollowedUp");
MdDropOptions mdDropOptions = mdDropOptionsDALService.findById(Long.valueOf(mdDropOptionsId));
MktLeadsAssignedTrack leadsAssignedTrack = new MktLeadsAssignedTrack();
leadsAssignedTrack.setSalesNotice("获得此商机,"+CommonUtil.dateParseString(new Date(),"yyyy-MM-dd HH:mm:ss"));
leadsAssignedTrack.setSalesNotice("获得此商机," + CommonUtil.dateParseString(new Date(), "yyyy-MM-dd HH:mm:ss"));
leadsAssignedTrack.setTrackScore(mdDropOptions.getDropOptionScore());
leadsAssignedTrack.setIsActive(1);
leadsAssignedTrack.setCreatedAt(new Date());
......@@ -1585,7 +1603,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsAssignedTrackDALService.saveTrack(leadsAssignedTrack);
requestVO.setOpportunityId(customerId);
requestVO.setLeadsAssignedId(assigneds.getId());
return new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000"));
return new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"));
}
private String createAccountId(String mobileNo) {
......@@ -3640,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();
......@@ -3664,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();
......@@ -3674,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);
......@@ -3754,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