|
@@ -126,6 +126,13 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
// msg.setError("电话号码重复了");
|
|
// msg.setError("电话号码重复了");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (contactsMapper.selectCount(new QueryWrapper<Contacts>()
|
|
|
|
+ .eq("contacts_name", custom.getContactsName())
|
|
|
|
+ ) == 0) {
|
|
|
|
+ msg.setError("此联系人不存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
custom.setCreateTime(new Date());
|
|
custom.setCreateTime(new Date());
|
|
custom.setCreatorId(user.getId());
|
|
custom.setCreatorId(user.getId());
|
|
custom.setIsDelete(0);
|
|
custom.setIsDelete(0);
|
|
@@ -137,6 +144,11 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
actionLog.setItemId(custom.getId());
|
|
actionLog.setItemId(custom.getId());
|
|
actionLogMapper.insert(actionLog);
|
|
actionLogMapper.insert(actionLog);
|
|
customMapper.insert(custom);
|
|
customMapper.insert(custom);
|
|
|
|
+ Contacts contacts = contactsMapper.selectOne(new QueryWrapper<Contacts>().eq("name", custom.getCustomName()).eq("phone", custom.getTelPhone()));
|
|
|
|
+ if (contacts != null){
|
|
|
|
+ contacts.setCustomId(custom.getId());
|
|
|
|
+ contactsMapper.update(contacts,new UpdateWrapper<Contacts>().eq("id",contacts.getId()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
msg.setMsg("操作成功");
|
|
msg.setMsg("操作成功");
|
|
return msg;
|
|
return msg;
|
|
@@ -207,15 +219,17 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
custom1.setBusinessOpportunitys(businessOpportunityMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("customer_id",custom1.getId())));
|
|
custom1.setBusinessOpportunitys(businessOpportunityMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("customer_id",custom1.getId())));
|
|
//操作记录
|
|
//操作记录
|
|
custom1.setActionLogs(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("code","custom").eq("item_id",custom1.getId())));
|
|
custom1.setActionLogs(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("code","custom").eq("item_id",custom1.getId())));
|
|
- List<CustomItemContacts> contacts = customItemContactsMapper.selectList(new QueryWrapper<CustomItemContacts>().eq("contacts_id", custom1.getId()));
|
|
|
|
- List<Integer> ids = new ArrayList<>();
|
|
|
|
- for (CustomItemContacts contact : contacts) {
|
|
|
|
- ids.add(contact.getCustomId());
|
|
|
|
- }
|
|
|
|
- if (ids.size() > 0){
|
|
|
|
- List<Contacts> cs = contactsMapper.selectListByIds(ids);
|
|
|
|
- custom1.setContactsList(cs);
|
|
|
|
- }
|
|
|
|
|
|
+// List<CustomItemContacts> contacts = customItemContactsMapper.selectList(new QueryWrapper<CustomItemContacts>().eq("contacts_id", custom1.getId()));
|
|
|
|
+// List<Integer> ids = new ArrayList<>();
|
|
|
|
+// for (CustomItemContacts contact : contacts) {
|
|
|
|
+// ids.add(contact.getCustomId());
|
|
|
|
+// }
|
|
|
|
+// if (ids.size() > 0){
|
|
|
|
+// List<Contacts> cs = contactsMapper.selectListByIds(ids);
|
|
|
|
+// custom1.setContactsList(cs);
|
|
|
|
+// }
|
|
|
|
+ //联系人
|
|
|
|
+ custom1.setContacts(contactsMapper.selectList((new QueryWrapper<Contacts>().eq("custom_id",custom1.getId()))));
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
httpRespMsg.setData(custom1);
|
|
httpRespMsg.setData(custom1);
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|