功能需求
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);