|
@@ -3,7 +3,6 @@ package com.management.platform.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
@@ -17,10 +16,6 @@ import com.management.platform.service.WxCorpInfoService;
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
@@ -64,6 +59,9 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
@Resource
|
|
|
private BusinessOpportunityMapper businessOpportunityMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private SalesOrderMapper salesOrderMapper;
|
|
|
+
|
|
|
@Resource
|
|
|
private CustomMapper customMapper;
|
|
|
|
|
@@ -112,13 +110,10 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
}
|
|
|
|
|
|
LambdaQueryWrapper<Contacts> lqw_contacts = new LambdaQueryWrapper<>();
|
|
|
- lqw_contacts.eq(Contacts::getCustomId, contacts.getCustomId())
|
|
|
- .eq(Contacts::getName, contacts.getName())
|
|
|
- .eq(Contacts::getPhone,contacts.getPhone())
|
|
|
- .eq(Contacts::getOwnerId,contacts.getOwnerId());
|
|
|
+ lqw_contacts.eq(Contacts::getPhone,contacts.getPhone());
|
|
|
Contacts selectedOne = contactsMapper.selectOne(lqw_contacts);
|
|
|
if (selectedOne != null) {
|
|
|
- httpRespMsg.setError("已存在该联系人!");
|
|
|
+ httpRespMsg.setError("已存在该联系人,手机号重复!");
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
contacts.setCompanyId(companyId)
|
|
@@ -141,19 +136,19 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, String customName, String name, String email, String creatorName, String phone, String ownerName, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, Integer customId, String name, String email, String creatorId, String phone, String ownerId, HttpServletRequest request) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("customName", customName);
|
|
|
+ map.put("customId", customId);
|
|
|
map.put("name", name);
|
|
|
map.put("phone", phone);
|
|
|
- map.put("ownerName", ownerName);
|
|
|
+ map.put("ownerId", ownerId);
|
|
|
map.put("email", email);
|
|
|
- map.put("creatorName", creatorName);
|
|
|
+ map.put("creatorId", creatorId);
|
|
|
String token = String.valueOf(request.getHeader("Token"));
|
|
|
User user = userMapper.selectById(token);
|
|
|
map.put("companyId", user.getCompanyId());
|
|
|
map.put("isDelete", 0);
|
|
|
- Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page(pageIndex, pageSize), map);
|
|
|
+ Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page((long) (pageIndex - 1) *pageSize, pageSize), map);
|
|
|
|
|
|
List<ContactsVo> records = pageContacts.getRecords();
|
|
|
long total = pageContacts.getTotal();
|
|
@@ -241,7 +236,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
User user = userMapper.selectById(token);
|
|
|
map.put("companyId", user.getCompanyId());
|
|
|
map.put("isDelete", 1);
|
|
|
- Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page(pageIndex, pageSize), map);
|
|
|
+ Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page((long) (pageIndex - 1) *pageSize, pageSize), map);
|
|
|
|
|
|
List<ContactsVo> records = pageContacts.getRecords();
|
|
|
long total = pageContacts.getTotal();
|
|
@@ -475,11 +470,6 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
userNameList.add(cell.getStringCellValue());
|
|
|
}
|
|
|
}
|
|
|
- if(modelName.equals("companySigner")){
|
|
|
- if(!org.springframework.util.StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
- userNameList.add(cell.getStringCellValue());
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -508,6 +498,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
Contacts contacts=new Contacts();
|
|
|
contacts.setCompanyId(companyId);
|
|
|
contacts.setCreatorId(user.getId());
|
|
|
+ contacts.setIsDelete(0);
|
|
|
for (int i = 0; i < cellNum; i++) {
|
|
|
String modelName = modelNameList.get(i);
|
|
|
String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
|
|
@@ -684,10 +675,32 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getAllContacts(Integer customerId, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg getAllContacts(Integer businessId, Integer salesId, Integer customerId, HttpServletRequest request) {
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
HttpRespMsg mgs = new HttpRespMsg();
|
|
|
- if (customerId!=null){
|
|
|
+ if (businessId!=null){
|
|
|
+ BusinessOpportunity businessOpportunity = businessOpportunityMapper.selectById(businessId);
|
|
|
+ if (businessOpportunity==null||businessOpportunity.getContactsId()==null){
|
|
|
+ mgs.setData(new ArrayList<Contacts>());
|
|
|
+ }else {
|
|
|
+ Integer contactsId = businessOpportunity.getContactsId();
|
|
|
+ mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
|
|
|
+ .eq("company_id",user.getCompanyId())
|
|
|
+ .eq("id",contactsId)));
|
|
|
+ }
|
|
|
+ }else if(salesId!=null){
|
|
|
+ SalesOrder salesOrder = salesOrderMapper.selectById(salesId);
|
|
|
+ if (salesOrder==null||salesOrder.getContactsId()==null){
|
|
|
+ mgs.setData(new ArrayList<Contacts>());
|
|
|
+ }else {
|
|
|
+ Integer contactsId = salesOrder.getContactsId();
|
|
|
+ mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
|
|
|
+ .eq("company_id",user.getCompanyId())
|
|
|
+ .eq("id",contactsId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (customerId!=null){
|
|
|
mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
|
|
|
.eq("company_id",user.getCompanyId())
|
|
|
.eq("custom_id",customerId)));
|