Commit c49c9af0 by Mahjong

专家处理商机,更新预约状态,给客户发送预约成功短信,自动添加当前商机到日程

parent f94877d5
...@@ -9,6 +9,7 @@ import com.libs.pdf.PDFTemplate; ...@@ -9,6 +9,7 @@ import com.libs.pdf.PDFTemplate;
import com.yd.api.customer.service.CustomerService; import com.yd.api.customer.service.CustomerService;
import com.yd.api.customer.vo.register.RegisterRequestVO; import com.yd.api.customer.vo.register.RegisterRequestVO;
import com.yd.api.customer.vo.register.RegisterResponseVO; import com.yd.api.customer.vo.register.RegisterResponseVO;
import com.yd.api.practitioner.service.ScheduleTrackService;
import com.yd.api.practitioner.vo.PractitionerIdRequestVO; import com.yd.api.practitioner.vo.PractitionerIdRequestVO;
import com.yd.api.practitioner.vo.QueryCanSeeResponseVO; import com.yd.api.practitioner.vo.QueryCanSeeResponseVO;
import com.yd.api.practitioner.vo.businessCard.Certificate; import com.yd.api.practitioner.vo.businessCard.Certificate;
...@@ -32,6 +33,7 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO; ...@@ -32,6 +33,7 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO; import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*; import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.*; import com.yd.api.practitioner.vo.salestarget.*;
import com.yd.api.practitioner.vo.sechedule.AddScheduleTrackRequestVO;
import com.yd.api.practitioner.vo.setting.*; import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberInfo; import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberInfo;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO; import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO;
...@@ -65,6 +67,7 @@ import com.yd.dal.service.survey.SurveyCustomerAnswersDALService; ...@@ -65,6 +67,7 @@ import com.yd.dal.service.survey.SurveyCustomerAnswersDALService;
import com.yd.dal.service.user.AclUserDALService; import com.yd.dal.service.user.AclUserDALService;
import com.yd.rmi.ali.mail.service.MailService; import com.yd.rmi.ali.mail.service.MailService;
import com.yd.rmi.ali.oss.service.OssService; 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.rmi.cache.SystemConfigService;
import com.yd.rmi.n22.salary.pojo.Achieve; import com.yd.rmi.n22.salary.pojo.Achieve;
import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementRequestBody; import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementRequestBody;
...@@ -84,6 +87,7 @@ import com.yd.util.HttpUtil; ...@@ -84,6 +87,7 @@ import com.yd.util.HttpUtil;
import com.yd.util.PDFConfiguration; import com.yd.util.PDFConfiguration;
import com.yd.util.config.ZHBErrorConfig; import com.yd.util.config.ZHBErrorConfig;
import com.yd.util.deshandler.DESTypeHandler; import com.yd.util.deshandler.DESTypeHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate; import org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -114,6 +118,7 @@ import java.util.stream.Collectors; ...@@ -114,6 +118,7 @@ import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;
@Service("practitionerService") @Service("practitionerService")
@Slf4j
public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService { public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService {
@Autowired @Autowired
...@@ -202,7 +207,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -202,7 +207,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private AgPoInformedMapper informedMapper; private AgPoInformedMapper informedMapper;
@Autowired @Autowired
private MktLeadsAssignedsMapper mktLeadsAssignedsMapper; private MktLeadsAssignedsMapper mktLeadsAssignedsMapper;
@Autowired
private ScheduleTrackService scheduleTrackService;
@Autowired
private SendService sendService;
@Override @Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) { public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
PractitionerLoginResponseVO responseVO = new PractitionerLoginResponseVO(); PractitionerLoginResponseVO responseVO = new PractitionerLoginResponseVO();
...@@ -1764,6 +1773,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1764,6 +1773,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
if (CommonUtil.isNullOrZero(requestVO.getId())) { if (CommonUtil.isNullOrZero(requestVO.getId())) {
//保存 //保存
mktLeadsAssignedTrackDALService.saveTrack(track); mktLeadsAssignedTrackDALService.saveTrack(track);
//1,如果 预约状态是status 0-待确认 isComplete 0-未沟通 ,修改预约状态和是否沟通为1
//2,给客户发送预约成功短信
//3,关联当前商机,并且添加到日程
updateAgSfpAppointmentRecordInfo(requestVO, track);
} else { } else {
//更新 //更新
mktLeadsAssignedTrackDALService.updateTrack(track); mktLeadsAssignedTrackDALService.updateTrack(track);
...@@ -1773,6 +1786,48 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1773,6 +1786,48 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp; return resp;
} }
private void updateAgSfpAppointmentRecordInfo(OwnOpportunityRecordSaveRequestVO requestVO, MktLeadsAssignedTrack track) {
MktLeadsPool pool = mktLeadsPoolDALService.findByCustomerIdForSfp(track.getCustomerId());
if(pool != null){
AgSfpAppointmentRecord agSfpAppointmentRecord = new AgSfpAppointmentRecord();
agSfpAppointmentRecord.setSfpMainId(pool.getSfpMainId());
mktLeadsAssignedTrackDALService.updateAppointmentRecord(agSfpAppointmentRecord);
String mobileNo = pool.getMobile();
//给客户发送预约短信
if (StringUtils.isNotBlank(mobileNo)) {
DESTypeHandler jpaCryptoConverter = new DESTypeHandler();
mobileNo = jpaCryptoConverter.decode(mobileNo);
log.error("SFP客户手机号:{}",mobileNo);
// 发短信 ALI_SMS_CUS_RESERVATION
String templateCode = systemConfigService.getSingleConfigValue("ALI_SMS_CUS_RESERVATION");
String content = systemConfigService.getSingleConfigValue("SFP_SMS_RESERVATION_CONTENT");
content = content.replace("date", requestVO.getNoticeDate());
try {
sendService.sendEmailOrSMS("sms", mobileNo, "0", content, templateCode, null, null, "SFP智能财策预约通知", 99, pool.getId());
}catch (Exception e){
e.printStackTrace();
log.error("给客户发送短信异常:{}",e.getMessage());
}
}
//关联商机
//添加到日程
AddScheduleTrackRequestVO addScheduleTrackRequestVO = new AddScheduleTrackRequestVO();
addScheduleTrackRequestVO.setPractitionerId(track.getPractitionerId());
addScheduleTrackRequestVO.setTaskType(1);
addScheduleTrackRequestVO.setReferLeadsId(track.getId());
addScheduleTrackRequestVO.setTaskImportantTag(0);
addScheduleTrackRequestVO.setIsActive(1);
addScheduleTrackRequestVO.setTaskTimeFrom("08:00:00");
addScheduleTrackRequestVO.setTaskTimeEnd("22:00:00");
addScheduleTrackRequestVO.setCustomerId(track.getCustomerId());
addScheduleTrackRequestVO.setMdDropOptionId(requestVO.getMdDropOptionId());
addScheduleTrackRequestVO.setTrackTime(track.getTrackTime());
scheduleTrackService.insert(addScheduleTrackRequestVO);
}
}
@Override @Override
public OpportunityStatisticsResponseVO opportunityStatistics(OpportunityStatisticsRequestVO requestVO) { public OpportunityStatisticsResponseVO opportunityStatistics(OpportunityStatisticsRequestVO requestVO) {
OpportunityStatisticsResponseVO resp = new OpportunityStatisticsResponseVO(); OpportunityStatisticsResponseVO resp = new OpportunityStatisticsResponseVO();
......
...@@ -54,4 +54,9 @@ public class MktLeadsPool { ...@@ -54,4 +54,9 @@ public class MktLeadsPool {
private Long addedBy; private Long addedBy;
private Integer adderType; private Integer adderType;
} private String remark;//备注
\ No newline at end of file private Long appointmentRecordId;//预约表id
private Long sfpMainId;
private String mobile;
}
...@@ -2,6 +2,7 @@ package com.yd.dal.mapper.marketing; ...@@ -2,6 +2,7 @@ package com.yd.dal.mapper.marketing;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail; import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail;
import com.yd.dal.entity.marketing.AgSfpAppointmentRecord;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack; import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -37,4 +38,7 @@ public interface MktLeadsAssignedTrackMapper { ...@@ -37,4 +38,7 @@ public interface MktLeadsAssignedTrackMapper {
int updateInformedOssPathByInformedId(@Param("informedOssPath") String InformedOssPath, @Param("informedId") Long informedId); int updateInformedOssPathByInformedId(@Param("informedOssPath") String InformedOssPath, @Param("informedId") Long informedId);
int updateCustomerIdByLeadsAssignedId(@Param("customerId") Long customerId, @Param("leadsAssignedId") Long leadsAssignedId); int updateCustomerIdByLeadsAssignedId(@Param("customerId") Long customerId, @Param("leadsAssignedId") Long leadsAssignedId);
}
\ No newline at end of file int updateAppointmentRecord(AgSfpAppointmentRecord appointmentRecord);
}
...@@ -28,4 +28,7 @@ public interface MktLeadsPoolMapper { ...@@ -28,4 +28,7 @@ public interface MktLeadsPoolMapper {
List<LeadsStatisticsInfo> findIsAssignLeads(); List<LeadsStatisticsInfo> findIsAssignLeads();
List<LeadsStatusInfo> findLeadsStatusMap(); List<LeadsStatusInfo> findLeadsStatusMap();
}
\ No newline at end of file MktLeadsPool findByCustomerIdForSfp(Long customerId);
}
...@@ -3,6 +3,7 @@ package com.yd.dal.service.marketing.Impl; ...@@ -3,6 +3,7 @@ package com.yd.dal.service.marketing.Impl;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail; import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail;
import com.yd.dal.entity.marketing.AgSfpAppointmentRecord;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack; import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import com.yd.dal.mapper.marketing.MktLeadsAssignedTrackMapper; import com.yd.dal.mapper.marketing.MktLeadsAssignedTrackMapper;
import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService; import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
...@@ -70,4 +71,10 @@ public class MktLeadsAssignedTrackDALServiceImpl implements MktLeadsAssignedTrac ...@@ -70,4 +71,10 @@ public class MktLeadsAssignedTrackDALServiceImpl implements MktLeadsAssignedTrac
public int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId) { public int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId) {
return mktLeadsAssignedTrackMapper.updateCustomerIdByLeadsAssignedId(customerId, leadsAssignedId); return mktLeadsAssignedTrackMapper.updateCustomerIdByLeadsAssignedId(customerId, leadsAssignedId);
} }
@Override
public void updateAppointmentRecord(AgSfpAppointmentRecord appointmentRecord) {
mktLeadsAssignedTrackMapper.updateAppointmentRecord(appointmentRecord);
}
} }
...@@ -62,4 +62,9 @@ public class MktLeadsPoolDALServiceImpl implements MktLeadsPoolDALService { ...@@ -62,4 +62,9 @@ public class MktLeadsPoolDALServiceImpl implements MktLeadsPoolDALService {
public void updateMktLeadsAssigneds(MktLeadsPool pool){ public void updateMktLeadsAssigneds(MktLeadsPool pool){
mktLeadsPoolMapper.updateByPrimaryKeySelective(pool); mktLeadsPoolMapper.updateByPrimaryKeySelective(pool);
} }
@Override
public MktLeadsPool findByCustomerIdForSfp(Long customerId) {
return mktLeadsPoolMapper.findByCustomerIdForSfp(customerId);
}
} }
package com.yd.dal.service.marketing; package com.yd.dal.service.marketing;
import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail; import com.yd.api.practitioner.vo.opportunity.SalesScoreDetail;
import com.yd.dal.entity.marketing.AgSfpAppointmentRecord;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack; import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -38,4 +39,6 @@ public interface MktLeadsAssignedTrackDALService { ...@@ -38,4 +39,6 @@ public interface MktLeadsAssignedTrackDALService {
int updateInformedOssPathByInformedId(String ossPath, Long informedId); int updateInformedOssPathByInformedId(String ossPath, Long informedId);
int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId); int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId);
void updateAppointmentRecord(AgSfpAppointmentRecord appointmentRecord);
} }
...@@ -21,4 +21,7 @@ public interface MktLeadsPoolDALService { ...@@ -21,4 +21,7 @@ public interface MktLeadsPoolDALService {
PageInfo<LeadsStatisticsInfo> findByConditionPage(int pageNum, int size, Integer isStatement, Integer leadsStatus, Integer expertApplyStatus, String leadsStartTime, String leadsEndTime); PageInfo<LeadsStatisticsInfo> findByConditionPage(int pageNum, int size, Integer isStatement, Integer leadsStatus, Integer expertApplyStatus, String leadsStartTime, String leadsEndTime);
void updateMktLeadsAssigneds(MktLeadsPool pool); void updateMktLeadsAssigneds(MktLeadsPool pool);
MktLeadsPool findByCustomerIdForSfp(Long customerId);
} }
...@@ -1528,7 +1528,9 @@ ...@@ -1528,7 +1528,9 @@
(SELECT md.drop_option_name from ag_md_drop_options md LEFT JOIN ag_mkt_leads_assigned_track amlat ON md.id = amlat.md_drop_option_id where amlat.practitioner_id = a.assigned_practitioner_id and amlat.customer_id = a.customer_id ORDER BY amlat.created_at DESC LIMIT 1) mdDropOptionName, (SELECT md.drop_option_name from ag_md_drop_options md LEFT JOIN ag_mkt_leads_assigned_track amlat ON md.id = amlat.md_drop_option_id where amlat.practitioner_id = a.assigned_practitioner_id and amlat.customer_id = a.customer_id ORDER BY amlat.created_at DESC LIMIT 1) mdDropOptionName,
(SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id) scoreTotal , (SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id) scoreTotal ,
(SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id and to_days(track_time) = to_days(now())) scoreDay, (SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id and to_days(track_time) = to_days(now())) scoreDay,
if(ass.id is null ,0,1) expertType if(ass.id is null ,0,1) expertType ,
p.remark remark,
p.appointment_record_id appointmentRecordId
FROM FROM
ag_mkt_leads_assigneds a ag_mkt_leads_assigneds a
left join ag_mkt_leads_expert_request r on r.customer_id = a.customer_id and r.is_active =1 left join ag_mkt_leads_expert_request r on r.customer_id = a.customer_id and r.is_active =1
......
...@@ -423,4 +423,11 @@ ...@@ -423,4 +423,11 @@
set customer_id = #{customerId,jdbcType=BIGINT} set customer_id = #{customerId,jdbcType=BIGINT}
where leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT} where leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT}
</update> </update>
</mapper>
\ No newline at end of file <update id="updateAppointmentRecord" parameterType="com.yd.dal.entity.marketing.AgSfpAppointmentRecord">
update ag_sfp_appointment_record
set status = 1,is_complete = 1,updated_at = now()
where sfp_main_id = #{sfpMainId,jdbcType=BIGINT}
</update>
</mapper>
...@@ -13,11 +13,15 @@ ...@@ -13,11 +13,15 @@
<result column="is_active" jdbcType="INTEGER" property="isActive" /> <result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="added_at" jdbcType="TIMESTAMP" property="addedAt" /> <result column="added_at" jdbcType="TIMESTAMP" property="addedAt" />
<result column="added_by" jdbcType="BIGINT" property="addedBy" /> <result column="added_by" jdbcType="BIGINT" property="addedBy" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="appointment_record_id" jdbcType="BIGINT" property="appointmentRecordId" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, customer_id, mkt_campaign, mkt_task, has_assigned, source_from, is_active, id, customer_id, mkt_campaign, mkt_task, has_assigned, source_from, is_active,
added_at, added_by added_at, added_by,remark,appointment_record_id
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated--> <!--@mbg.generated-->
...@@ -262,4 +266,17 @@ ...@@ -262,4 +266,17 @@
INNER JOIN ag_mkt_leads_assigned_track tr on maxt.customer_id=tr.customer_id AND maxt.track_time = tr.updated_at order by tr.leads_assigned_id INNER JOIN ag_mkt_leads_assigned_track tr on maxt.customer_id=tr.customer_id AND maxt.track_time = tr.updated_at order by tr.leads_assigned_id
</select> </select>
</mapper>
\ No newline at end of file <select id="findByCustomerIdForSfp" resultType="com.yd.dal.entity.marketing.MktLeadsPool">
select
a.id, a.customer_id customerId, a.mkt_campaign mktCampaign, a.mkt_task mktTask, a.has_assigned hasAssigned, a.source_from sourceFrom,
a.is_active isActive,c.mobile mobile,
a.added_at addedAt, a.added_by addedBy,a.remark remark,a.appointment_record_id appointmentRecordId,b.sfp_main_id sfpMainId
from ag_mkt_leads_pool a , ag_sfp_appointment_record b , ag_sfp_user c
where a.appointment_record_id=b.id and b.user_id=c.id
and b.status = 0 and b.is_complete =0
and a.customer_id = #{customerId,jdbcType=BIGINT}
and a.appointment_record_id is not null
and a.is_active=1
</select>
</mapper>
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