二十一、线索转换2:线索公司信息到客户表,线索中个人信息到联系人

功能需求

1.线索的关联公司信息--》客户表

2.线索的个人信息--》联系人

3.线索的公司备注信息--》客户备注

4.线索的个人信息---》联系人备注

5.线索-市场 --> 联系人和市场

6.创建交易,交易表添加记录

7.创建交易,线索的备注-->交易备注

8.删除该线索所有备注

9.删除该线索和市场活动

10.删除该线索

功能1,2流程图

代码实现一:公司客户

CustomerMapper

    /**
     * 线索转换1:增加客户信息
     */
    int insertCustomer(Customer customer);
    <insert id="insertCustomer">
        insert into tbl_customer (id, owner, name, website,
                                  phone, create_by, create_time,
                                  edit_by, edit_time, contact_summary,
                                  next_contact_time, description, address)
        values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{website,jdbcType=VARCHAR},
                #{phone,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR},
                #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, #{contactSummary,jdbcType=VARCHAR},
                #{nextContactTime,jdbcType=CHAR}, #{description,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR})
    </insert>

ClueService

	/**
	 * 线索转换功能
	 */
	@Override
	public void saveConvertClue(Map<String, Object> map) {
		// 获取参数
		String clueId = (String) map.get("clueId");
		User user = (User) map.get(Contants.SESSION_USER);
		String isCreateTran = (String) map.get("isCreateTran");
		// 根据线索id查询信息
		Clue clue = clueMapper.selectClueById(clueId);

		// 1.线索:公司信息--客户表
		Customer customer = new Customer();
		customer.setId(UUIDUtils.getUUID());
		customer.setOwner(clue.getOwner());
		customer.setName(clue.getCompany());
		customer.setWebsite(clue.getWebsite());
		customer.setPhone(clue.getPhone());
		customer.setCreateBy(user.getId());
		customer.setCreateTime(DateUtils.formateDateTime(new Date()));
		customer.setContactSummary(clue.getContactSummary());
		customer.setNextContactTime(clue.getNextContactTime());
		customer.setDescription(clue.getDescription());
		customer.setAddress(clue.getAddress());
		customerMapper.insertCustomer(customer);
}

代码实现二:联系人

ContactsMapper

    /**
     * 线索转换:增加客户信息
     */
    int insertContacts(Contacts contacts);
  <insert id="insertContacts">
    insert into tbl_contacts (id, owner, source,
                              customer_id, fullname, appellation,
                              email, mphone, job,
                              create_by, create_time, edit_by,
                              edit_time, description, contact_summary,
                              next_contact_time, address)
    values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{source,jdbcType=VARCHAR},
            #{customerId,jdbcType=CHAR}, #{fullname,jdbcType=VARCHAR}, #{appellation,jdbcType=VARCHAR},
            #{email,jdbcType=VARCHAR}, #{mphone,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR},
            #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR},
            #{editTime,jdbcType=CHAR}, #{description,jdbcType=VARCHAR}, #{contactSummary,jdbcType=VARCHAR},
            #{nextContactTime,jdbcType=CHAR}, #{address,jdbcType=VARCHAR})
  </insert>

ClueService

//2.线索:个人信息--联系人表
		Contacts contacts = new Contacts();
		contacts.setId(UUIDUtils.getUUID());
		contacts.setOwner(clue.getOwner());
		contacts.setSource(clue.getSource());
		contacts.setCustomerId(customer.getId());
		contacts.setFullname(clue.getFullname());
		contacts.setAppellation(clue.getAppellation());
		contacts.setEmail(clue.getEmail());
		contacts.setMphone(clue.getMphone());
		contacts.setJob(clue.getJob());
		contacts.setCreateBy(user.getId());
		contacts.setCreateTime(DateUtils.formateDateTime(new Date()));
		contacts.setDescription(clue.getDescription());
		contacts.setContactSummary(clue.getContactSummary());
		contacts.setNextContactTime(clue.getNextContactTime());
		contacts.setAddress(clue.getAddress());
		contactsMapper.insertContacts(contacts);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值