Commit e21ce2be by hongzhong

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

parents f40ff4c5 508c302a
......@@ -1081,6 +1081,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
OpportunityRecordInfo info = new OpportunityRecordInfo();
CommonUtil.simpleObjectCopy(track, info);
info.setOpportunityId(track.getCustomerId());
info.setStatus(track.getInformedStatus());
info.setNoticeDate(CommonUtil.dateParseString(track.getTrackTime(), "yyyy-MM-dd"));
BeanPropertyValueEqualsPredicate predicate = new BeanPropertyValueEqualsPredicate("id", track.getMdDropOptionId());
List<MdDropOptions> select = (List<MdDropOptions>)CollectionUtils.select(dropOptionsList, predicate);
......@@ -3620,14 +3621,28 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
// 数据库实体
AclCustomer newerCustomer = aclCustomerDALService.findByMobileNo(newMobile);
if (newerCustomer == null) {
// 注册
RegisterRequestVO registerRequestVO = new RegisterRequestVO();
registerRequestVO.setMobileNo(newName);
registerRequestVO.setName(newMobile);
//将增员对象进行注册
RegisterResponseVO registerResp = customerService.register(registerRequestVO);
//此人为第一次进来
//帮其进行注册
newerCustomer = new AclCustomer();
newerCustomer.setId(registerResp.getCustomerId());
newerCustomer.setRole(2);//1= Staff 2=Customer 3=Partner
newerCustomer.setAccountId(createAccountId(newMobile));
newerCustomer.setLogin(newMobile);
newerCustomer.setMobileNo(newMobile);
newerCustomer.setCusLevel(1);
newerCustomer.setName(newName);
newerCustomer.setIsActive(1);
newerCustomer.setRoleId(3L);
newerCustomer.setWithdrawType(0);
newerCustomer.setCreatedAt(new Date());
newerCustomer.setCreatedBy(-1L);
newerCustomer.setUpdatedAt(new Date());
newerCustomer.setUpdatedBy(-1L);
newerCustomer.setChannelReferralRateId(3L);
Long mdMkCampaignId = systemConfigService.getMdMkCampaignId("leadaddedbypractioner");
newerCustomer.setMktCampaign(String.valueOf(mdMkCampaignId));
aclCustomerDALService.save(newerCustomer);
newerCustomer.setId(newerCustomer.getId());
}
if (!newMobile.equals(oldCustomer.getMobileNo()) || !newName.equals(oldCustomer.getName())) {// 如果电话不一样,就更新商机的电话
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
......@@ -3639,7 +3654,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
}
AgPoInformed informed = new AgPoInformed();
BeanUtils.copyProperties(requestVO, informed);
informed.setCustomerName(newName);
informed.setCustomerMobile(newMobile);
informed.setPractitionerId(requestVO.getPractitionerId());
informed.setLeadsId(requestVO.getLeadsAssignedId());
informed.setCustomerId(newerCustomer.getId());
informed.setStatus("0");
informed.setIsActive(1);
......@@ -3656,8 +3674,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
// 商机更新一条告知书待签署的记录
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
track.setInformedId(informed.getId());
track.setPractitionerId(requestVO.getPractitionerId());
track.setCustomerId(newerCustomer.getId());// 商机的id还是得用旧的customerId
track.setLeadsAssignedId(requestVO.getLeadsAssignedId());
track.setInformedStatus("0");
track.setInformedOssPath("https://yindun-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/ElectronicNotice/ElectronicNotice.pdf");
track.setSalesNotice("告知书发送成功");
track.setTrackTime(curDate);
track.setCreatedBy(loginId);
track.setCreatedAt(new Date());
......@@ -3670,6 +3693,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
track.setTrackScore(dropOption.getDropOptionScore());
//保存
mktLeadsAssignedTrackDALService.saveTrack(track);
//更新所有商机状态
mktLeadsAssignedTrackDALService.updateCustomerIdByLeadsAssignedId(newerCustomer.getId(), requestVO.getLeadsAssignedId());
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
resp.setId(informed.getId());
......@@ -3700,6 +3725,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
public CommonResultIDResponseVO updateInformedSheetById(UpdateInformedSheetByIdRequestVO requestVO) {
CommonResultIDResponseVO resp = new CommonResultIDResponseVO();
try {
String policyNo = requestVO.getPolicyNo();
List<PoOrder> orderList = poOrderDALService.findByPolicyNo(policyNo);
if (CollectionUtils.isEmpty(orderList)) {
resp.setCommonResult(new CommonResult(false, "保单号不存在"));
return resp;
}
// 更新保单号
AgPoInformed informed = informedMapper.selectByPrimaryKey(requestVO.getId());
BeanUtils.copyProperties(requestVO, informed);
......@@ -3723,6 +3755,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long id = requestVO.getId();
String imgStr = requestVO.getImgStr();
try {
AgPoInformed dbData = informedMapper.selectByPrimaryKey(id);
if (dbData != null && "1".equals(dbData.getStatus())) {
resp.setCommonResult(new CommonResult(false, "不可重复签署"));
return resp;
}
if (StringUtils.isBlank(imgStr)) {
resp.setCommonResult(new CommonResult(false, "file不可为空"));
return resp;
......@@ -3756,8 +3793,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
// 商机更新一条告知书已签署的记录
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
track.setPractitionerId(informed.getPractitionerId());
track.setLeadsAssignedId(informed.getLeadsId());
track.setInformedId(id);
track.setInformedStatus("1");
track.setCustomerId(informed.getCustomerId());
track.setSalesNotice("客户告知书签署成功");
track.setTrackTime(curDate);
track.setCreatedBy(-1L);
track.setCreatedAt(curDate);
......
......@@ -4,6 +4,7 @@ import lombok.Data;
@Data
public class QueryInformedSheetListRequestVO {
private Long id;
private Long practitionerId;
private String customerName;
private String customerMobile;
......
......@@ -13,4 +13,16 @@ public class OpportunityRecordInfo {
private Long mdDropOptionId;
private String mdDropOptionName;
private Integer trackScore;
/**
* 告知书记录Id
*/
private Long informedId;
/**
* 告知书url
*/
private String informedOssPath;
/**
* 告知书签署状态
*/
private String status;
}
......@@ -47,6 +47,7 @@ public class AgPoInformed implements Serializable {
* practitioner_id
*/
private Long practitionerId;
private String practitionerName;
/**
* 保单号
......@@ -326,4 +327,12 @@ public class AgPoInformed implements Serializable {
public void setSignOssPath(String signOssPath) {
this.signOssPath = signOssPath;
}
public String getPractitionerName() {
return practitionerName;
}
public void setPractitionerName(String practitionerName) {
this.practitionerName = practitionerName;
}
}
\ No newline at end of file
......@@ -105,6 +105,10 @@ public class MktLeadsAssignedTrack implements Serializable {
* 告知书url
*/
private String informedOssPath;
/**
* 告知书签署状态
*/
private String informedStatus;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -35,4 +35,6 @@ public interface MktLeadsAssignedTrackMapper {
void deleteScheduleTrackById(Long scheduleTrackId);
int updateInformedOssPathByInformedId(@Param("informedOssPath") String InformedOssPath, @Param("informedId") Long informedId);
int updateCustomerIdByLeadsAssignedId(@Param("customerId") Long customerId, @Param("leadsAssignedId") Long leadsAssignedId);
}
\ No newline at end of file
......@@ -31,5 +31,7 @@ public interface PoOrderMapper {
List<PoOrder> findByIds(List<Long> orderIds);
List<PoOrder> findByPolicyNo(@Param("policyNo") String policyNo);
List<Long> findVehiclePolicyInfoByCustomerId(Long customerId);
}
\ No newline at end of file
......@@ -65,4 +65,9 @@ public class MktLeadsAssignedTrackDALServiceImpl implements MktLeadsAssignedTrac
public int updateInformedOssPathByInformedId(String ossPath, Long informedId) {
return mktLeadsAssignedTrackMapper.updateInformedOssPathByInformedId(ossPath, informedId);
}
@Override
public int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId) {
return mktLeadsAssignedTrackMapper.updateCustomerIdByLeadsAssignedId(customerId, leadsAssignedId);
}
}
......@@ -36,4 +36,6 @@ public interface MktLeadsAssignedTrackDALService {
void deleteScheduleTrackById(Long scheduleTrackId);
int updateInformedOssPathByInformedId(String ossPath, Long informedId);
int updateCustomerIdByLeadsAssignedId(Long customerId, Long leadsAssignedId);
}
......@@ -76,4 +76,9 @@ public class PoOrderDALServiceImpl implements PoOrderDALService {
public List<Long> findVehiclePolicyInfoByCustomerId(Long customerId) {
return poOrderMapper.findVehiclePolicyInfoByCustomerId(customerId);
}
@Override
public List<PoOrder> findByPolicyNo(String policyNo) {
return poOrderMapper.findByPolicyNo(policyNo);
}
}
......@@ -29,4 +29,6 @@ public interface PoOrderDALService {
List<PoOrder> findByIds(List<Long> orderIds);
List<Long> findVehiclePolicyInfoByCustomerId(Long customerId);
List<PoOrder> findByPolicyNo(String policyNo);
}
......@@ -1404,7 +1404,7 @@
SELECT
a.customer_id opportunityId,
IFNULL(a.customer_name,c.NAME) name,
IFNULL(a.customer_mobile,c.mobile_no) mobileNo,
IFNULL(c.mobile_no,a.customer_mobile) mobileNo,
date_format(a.created_at, '%Y-%m-%d %H:%i:%s') opportunityDate,
if (p.source_from = 0 ,(SELECT cam.name from ag_md_mk_campaign cam where cam.id = p.mkt_campaign ),(SELECT md.drop_option_name from ag_md_drop_options md where p.source_from = md.id )) opportunityFrom,
a.id leadsAssignedId ,
......
......@@ -10,6 +10,7 @@
<result column="customer_name" jdbcType="VARCHAR" property="customerName" />
<result column="customer_mobile" jdbcType="VARCHAR" property="customerMobile" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
<result column="practitioner_name" jdbcType="VARCHAR" property="practitionerName" />
<result column="policy_no" jdbcType="VARCHAR" property="policyNo" />
<result column="sign_date" jdbcType="VARCHAR" property="signDate" />
<result column="status" jdbcType="VARCHAR" property="status" />
......@@ -231,23 +232,27 @@
</update>
<select id="selectByRecord" parameterType="com.yd.dal.entity.customer.AgPoInformed" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_po_informed
p.name practitioner_name,
t.*
from ag_po_informed t left join ag_acl_practitioner p on t.practitioner_id = p.id
where 1=1
<if test="customerName != null">
and customer_name = #{customerName,jdbcType=VARCHAR}
and t.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
<if test="customerMobile != null">
and customer_mobile = #{customerMobile,jdbcType=VARCHAR}
and t.customer_mobile = #{customerMobile,jdbcType=VARCHAR}
</if>
<if test="practitionerId != null">
and practitioner_id = #{practitionerId,jdbcType=BIGINT}
and t.practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if>
<if test="policyNo != null">
and policy_no = #{policyNo,jdbcType=VARCHAR}
and t.policy_no = #{policyNo,jdbcType=VARCHAR}
</if>
<if test="signDate != null">
and sign_date = #{signDate,jdbcType=VARCHAR}
and t.sign_date = #{signDate,jdbcType=VARCHAR}
</if>
<if test="id != null">
and t.id = #{id,jdbcType=BIGINT}
</if>
</select>
<select id="getNextInformedNo" resultType="java.lang.String" statementType="CALLABLE">
......
......@@ -20,11 +20,13 @@
<result column="leads_assigned_id" jdbcType="BIGINT" property="leadsAssignedId" />
<result column="track_time" jdbcType="TIMESTAMP" property="trackTime" />
<result column="informed_oss_path" jdbcType="VARCHAR" property="informedOssPath" />
<result column="informed_id" jdbcType="BIGINT" property="informedId" />
<result column="informed_status" jdbcType="VARCHAR" property="informedStatus" />
</resultMap>
<sql id="Base_Column_List">
id, order_id, order_no, sales_notice, is_active, created_at, created_by, creator_type,
updated_at, updated_by, updator_type, practitioner_id, customer_id, md_drop_option_id,
track_score, leads_assigned_id,track_time
id, order_id, order_no, sales_notice, is_active, created_at, created_by, creator_type,
updated_at, updated_by, updator_type, practitioner_id, customer_id, md_drop_option_id,
track_score, leads_assigned_id,track_time,informed_oss_path,informed_id,informed_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -108,6 +110,12 @@
<if test="informedId != null">
informed_id,
</if>
<if test="informedOssPath != null">
informed_oss_path,
</if>
<if test="informedStatus != null">
informed_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
......@@ -164,6 +172,12 @@
<if test="informedId != null">
#{informedId,jdbcType=BIGINT},
</if>
<if test="informedOssPath != null">
#{informedOssPath,jdbcType=VARCHAR},
</if>
<if test="informedStatus != null">
#{informedStatus,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsAssignedTrack">
......@@ -217,6 +231,15 @@
<if test="trackTime != null">
track_time = #{trackTime,jdbcType=TIMESTAMP},
</if>
<if test="informedStatus != null">
informed_status = #{informedStatus,jdbcType=VARCHAR},
</if>
<if test="informedOssPath != null">
informed_oss_path = #{informedOssPath,jdbcType=VARCHAR},
</if>
<if test="informedId != null">
leads_assigned_id = #{informedId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -393,6 +416,11 @@
<update id="updateInformedOssPathByInformedId">
update ag_mkt_leads_assigned_track
set informed_oss_path = #{informedOssPath,jdbcType=VARCHAR}
where informed_id = #{informedId,jdbcType=BIGINT}
where informed_id = #{informedId,jdbcType=BIGINT} and informed_status = '1'
</update>
<update id="updateCustomerIdByLeadsAssignedId">
update ag_mkt_leads_assigned_track
set customer_id = #{customerId,jdbcType=BIGINT}
where leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -13,7 +13,7 @@
<result column="pieces" jdbcType="INTEGER" property="pieces" />
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
<result column="customer_name" jdbcType="VARCHAR" property="customerName" />
<result column="customer_mobile" jdbcType="VARCHAR" property="customerMobile" />
<result column="customer_mobile" jdbcType="VARCHAR" property="customerMobile" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
......@@ -174,7 +174,7 @@
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if test="customerMobile != null">
customer_mobile = #{customerMobile,jdbcType=VARCHAR},
customer_mobile = #{customerMobile,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
......
......@@ -1151,6 +1151,13 @@
</foreach>
</select>
<select id="findByPolicyNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from ag_po_order
where policy_no = #{policyNo,jdbcType=VARCHAR}
</select>
<select id="findVehiclePolicyInfoByCustomerId" resultType="java.lang.Long">
select o.id
from ag_po_quotation_vehicle_relation v
......
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