Commit 91c83e99 by yao.xiao

修改-商机跟进保存

parent a148a4ea
......@@ -694,7 +694,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
OpportunityRecordInfo info = new OpportunityRecordInfo();
CommonUtil.simpleObjectCopy(track, info);
info.setOpportunityId(track.getCustomerId());
info.setNoticeDate(CommonUtil.dateParseString(track.getCreatedAt(), "yyyy-MM-dd"));
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);
if (!select.isEmpty()){
......@@ -1207,10 +1207,13 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
MktLeadsAssignedTrack track = new MktLeadsAssignedTrack();
CommonUtil.simpleObjectCopy(requestVO,track);
track.setCustomerId(requestVO.getOpportunityId());
track.setTrackTime(CommonUtil.stringParseDate(requestVO.getNoticeDate()+" 00:00:00", "yyyy-MM-dd HH:mm:ss"));
track.setCreatedBy(-1L);
track.setCreatedAt(CommonUtil.stringParseDate(requestVO.getNoticeDate()+" 00:00:00", "yyyy-MM-dd HH:mm:ss"));
track.setCreatedAt(new Date());
track.setCreatorType(2);
track.setUpdatedBy(-1L);
track.setUpdatedAt((new Date()));
track.setUpdatorType(2);
track.setUpdatedAt(new Date());
MdDropOptions dropOtions = mdDropOptionsDALService.findByDropOptionId(requestVO.getMdDropOptionId());
track.setTrackScore(dropOtions.getDropOptionScore());
if (CommonUtil.isNullOrZero(requestVO.getId())){
......@@ -1234,6 +1237,15 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
if (CommonUtil.isNullOrBlank(salesNotice)){
return new CommonResult(false, ZHBErrorConfig.getErrorInfo("830013"));
}
//判断此经纪人当天是否已为此商机经行了此项跟进
if (CommonUtil.isNullOrZero(requestVO.getId())){
MktLeadsAssignedTrack mktLeadsAssignedTrack = new MktLeadsAssignedTrack();
mktLeadsAssignedTrack.setPractitionerId(requestVO.getPractitionerId());
mktLeadsAssignedTrack.setCustomerId(requestVO.getOpportunityId());
mktLeadsAssignedTrack.setLeadsAssignedId(requestVO.getLeadsAssignedId());
mktLeadsAssignedTrack.setMdDropOptionId(requestVO.getMdDropOptionId());
List<MktLeadsAssignedTrack> trackList = mktLeadsAssignedTrackDALService.findByTrackTimeForNew(mktLeadsAssignedTrack);
}
return new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"));
}
......
......@@ -90,5 +90,7 @@ public class MktLeadsAssignedTrack implements Serializable {
*/
private Long leadsAssignedId;
private Date trackTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.yd.dal.mapper.marketing;
import com.github.pagehelper.Page;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import java.util.List;
public interface MktLeadsAssignedTrackMapper {
int deleteByPrimaryKey(Long id);
......@@ -17,4 +19,6 @@ public interface MktLeadsAssignedTrackMapper {
int updateByPrimaryKey(MktLeadsAssignedTrack record);
Page<MktLeadsAssignedTrack> selectByPrimaryKeySelective(MktLeadsAssignedTrack mktLeadsAssignedTrack);
List<MktLeadsAssignedTrack> findByTrackTimeForNew(MktLeadsAssignedTrack mktLeadsAssignedTrack);
}
\ No newline at end of file
......@@ -32,4 +32,9 @@ public class MktLeadsAssignedTrackDALServiceImpl implements MktLeadsAssignedTrac
public void updateTrack(MktLeadsAssignedTrack track) {
mktLeadsAssignedTrackMapper.updateByPrimaryKeySelective(track);
}
@Override
public List<MktLeadsAssignedTrack> findByTrackTimeForNew(MktLeadsAssignedTrack mktLeadsAssignedTrack) {
return mktLeadsAssignedTrackMapper.findByTrackTimeForNew(mktLeadsAssignedTrack);
}
}
......@@ -10,4 +10,6 @@ public interface MktLeadsAssignedTrackDALService {
void saveTrack(MktLeadsAssignedTrack track);
void updateTrack(MktLeadsAssignedTrack track);
List<MktLeadsAssignedTrack> findByTrackTimeForNew(MktLeadsAssignedTrack mktLeadsAssignedTrack);
}
......@@ -18,11 +18,12 @@
<result column="md_drop_option_id" jdbcType="BIGINT" property="mdDropOptionId" />
<result column="track_score" jdbcType="INTEGER" property="trackScore" />
<result column="leads_assigned_id" jdbcType="BIGINT" property="leadsAssignedId" />
<result column="track_time" jdbcType="TIMESTAMP" property="trackTime" />
</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_score, leads_assigned_id,track_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -39,13 +40,14 @@
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
md_drop_option_id, track_score, leads_assigned_id,track_time
)
values (#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, #{salesNotice,jdbcType=VARCHAR},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{creatorType,jdbcType=INTEGER}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT},
#{updatorType,jdbcType=INTEGER}, #{practitionerId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT},
#{mdDropOptionId,jdbcType=BIGINT}, #{trackScore,jdbcType=INTEGER}, #{leadsAssignedId,jdbcType=BIGINT}
#{mdDropOptionId,jdbcType=BIGINT}, #{trackScore,jdbcType=INTEGER}, #{leadsAssignedId,jdbcType=BIGINT},
#{trackTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsAssignedTrack" useGeneratedKeys="true">
......@@ -96,6 +98,9 @@
<if test="leadsAssignedId != null">
leads_assigned_id,
</if>
<if test="trackTime != null">
track_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
......@@ -143,6 +148,9 @@
<if test="leadsAssignedId != null">
#{leadsAssignedId,jdbcType=BIGINT},
</if>
<if test="trackTime != null">
#{trackTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsAssignedTrack">
......@@ -193,6 +201,9 @@
<if test="leadsAssignedId != null">
leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT},
</if>
<if test="trackTime != null">
track_time = #{trackTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -212,7 +223,8 @@
customer_id = #{customerId,jdbcType=BIGINT},
md_drop_option_id = #{mdDropOptionId,jdbcType=BIGINT},
track_score = #{trackScore,jdbcType=INTEGER},
leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT}
leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT},
track_time = #{trackTime,jdbcType=TIMESTAMP},
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectByPrimaryKeySelective" resultMap="BaseResultMap">
......@@ -268,6 +280,47 @@
<if test="leadsAssignedId != null">
and leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT}
</if>
<if test="trackTime != null">
and track_time = #{trackTime,jdbcType=TIMESTAMP}
</if>
</where>
</select>
<select id="findByTrackTimeForNew" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_assigned_track
<where>
to_days(track_time) = to_days(now())
<if test="id != null">
and id = #{id}
</if>
<if test="orderId != null">
and order_id = #{orderId,jdbcType=BIGINT}
</if>
<if test="orderNo != null">
and order_no = #{orderNo,jdbcType=VARCHAR}
</if>
<if test="salesNotice != null">
and sales_notice = #{salesNotice,jdbcType=VARCHAR}
</if>
<if test="isActive != null">
and is_active = #{isActive,jdbcType=INTEGER}
</if>
<if test="practitionerId != null">
and practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if>
<if test="customerId != null">
and customer_id = #{customerId,jdbcType=BIGINT}
</if>
<if test="mdDropOptionId != null">
and md_drop_option_id = #{mdDropOptionId,jdbcType=BIGINT}
</if>
<if test="trackScore != null">
and track_score = #{trackScore,jdbcType=INTEGER}
</if>
<if test="leadsAssignedId != null">
and leads_assigned_id = #{leadsAssignedId,jdbcType=BIGINT}
</if>
</where>
</select>
</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