|
@@ -75,6 +75,9 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
@Resource
|
|
|
private ExcelExportServiceImpl excelExportService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private StageMapper stageMapper;
|
|
|
+
|
|
|
@Value(value = "${upload.path}")
|
|
|
private String path;
|
|
|
|
|
@@ -270,11 +273,24 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
|
|
|
ContactsVo contactsVo = new ContactsVo();
|
|
|
Contacts contactsSelect = contactsMapper.selectById(contacts.getId());
|
|
|
+
|
|
|
+ String token = String.valueOf(request.getHeader("Token"));
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()).eq("is_active", 1));
|
|
|
if (contactsSelect != null) {
|
|
|
//操作记录
|
|
|
LambdaQueryWrapper<ContactsLog> cLoglqw = new LambdaQueryWrapper<>();
|
|
|
cLoglqw.eq(ContactsLog::getContactsId, contactsSelect.getId());
|
|
|
List<ContactsLog> contactsLogs = contactsLogMapper.selectList(cLoglqw);
|
|
|
+ if (contactsLogs!=null&&!contactsLogs.isEmpty()){
|
|
|
+ for (ContactsLog contactsLog : contactsLogs) {
|
|
|
+ if (contactsLog.getOperateId()!=null&&StringUtils.isNotEmpty(contactsLog.getOperateId())){
|
|
|
+ Optional<User> first = userList.stream().filter(u -> u.getId().equals(contactsLog.getOperateId())).findFirst();
|
|
|
+ first.ifPresent(value -> contactsLog.setOperateName(value.getName()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//相关任务
|
|
|
LambdaQueryWrapper<Task> tLqw = new LambdaQueryWrapper<>();
|
|
@@ -297,6 +313,9 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
LambdaQueryWrapper<BusinessOpportunity> bLqw = new LambdaQueryWrapper<>();
|
|
|
bLqw.eq(BusinessOpportunity::getContactsId,contactsSelect.getId());
|
|
|
List<BusinessOpportunity> opportunityList = businessOpportunityMapper.selectList(bLqw);
|
|
|
+ LambdaQueryWrapper<Stage> stageLQW = new LambdaQueryWrapper<>();
|
|
|
+ List<Stage> stages = stageMapper.selectList(stageLQW);
|
|
|
+
|
|
|
opportunityList.forEach(businessOpportunity -> {
|
|
|
Custom custom = customMapper.selectById(businessOpportunity.getCustomerId());
|
|
|
businessOpportunity.setCustomerName(custom.getCustomName());
|
|
@@ -308,6 +327,10 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
User creatorUser = userMapper.selectById(businessOpportunity.getCreatorId());
|
|
|
businessOpportunity.setCreatorName(creatorUser.getName());
|
|
|
}
|
|
|
+ if (businessOpportunity.getStageId()!=null){
|
|
|
+ Optional<Stage> first = stages.stream().filter(s -> s.getId().equals(businessOpportunity.getStageId())).findFirst();
|
|
|
+ first.ifPresent(stage -> businessOpportunity.setStageValue(stage.getName()));
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
//附件信息查询
|
|
@@ -321,6 +344,22 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
contactsVo.setTaskList(taskList);
|
|
|
contactsVo.setBusinessOpportunityList(opportunityList);
|
|
|
contactsVo.setContactsDocumentList(contactsDocuments);
|
|
|
+ if (contactsVo.getCustomId()!=null){
|
|
|
+ Custom custom = customMapper.selectById(contactsVo.getCustomId());
|
|
|
+ contactsVo.setCustomName(custom.getCustomName());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(contactsVo.getOwnerId())){
|
|
|
+// User user = userMapper.selectById(contactsVo.getOwnerId());
|
|
|
+// contactsVo.setOwnerName(user.getName());
|
|
|
+ Optional<User> first = userList.stream().filter(u -> u.getId().equals(contactsVo.getOwnerId())).findFirst();
|
|
|
+ first.ifPresent(value -> contactsVo.setOwnerName(value.getName()));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(contactsVo.getCreatorId())){
|
|
|
+// User user = userMapper.selectById(contactsVo.getCreatorId());
|
|
|
+// contactsVo.setCreatorName(user.getName());
|
|
|
+ Optional<User> first = userList.stream().filter(u -> u.getId().equals(contactsVo.getCreatorId())).findFirst();
|
|
|
+ first.ifPresent(value -> contactsVo.setCreatorName(value.getName()));
|
|
|
+ }
|
|
|
}
|
|
|
msg.setData(contactsVo);
|
|
|
return msg;
|
|
@@ -539,9 +578,26 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
JSONArray configObJSONArray = configOb.getJSONArray("list");
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
|
List<String> titleList=new ArrayList<>();
|
|
|
+ List<String> modelList=new ArrayList<>();
|
|
|
for (int i = 0; i < configObJSONArray.size(); i++) {
|
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
|
- titleList.add(item.getString("label"));
|
|
|
+ String type = item.getString("type");
|
|
|
+ if (type.equals("grid")){
|
|
|
+ JSONArray columns = item.getJSONArray("columns");
|
|
|
+ for (int j = 0; j < columns.size(); j++) {
|
|
|
+ JSONObject columnsJSONObject = columns.getJSONObject(j);
|
|
|
+ JSONArray listJsonArray = columnsJSONObject.getJSONArray("list");
|
|
|
+ for (int k = 0; k < listJsonArray.size(); k++) {
|
|
|
+ JSONObject listJsonArrayJSONObject = listJsonArray.getJSONObject(k);
|
|
|
+ titleList.add(listJsonArrayJSONObject.getString("label"));
|
|
|
+ modelList.add(listJsonArrayJSONObject.getString("model"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ titleList.add(item.getString("label"));
|
|
|
+ modelList.add(item.getString("model"));
|
|
|
+ }
|
|
|
}
|
|
|
dataList.add(titleList);
|
|
|
|
|
@@ -557,26 +613,40 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
|
|
|
for (ContactsVo contactsVo : records) {
|
|
|
List<String> item=new ArrayList<>();
|
|
|
- for (int i = 0; i < configObJSONArray.size(); i++) {
|
|
|
- JSONObject target = configObJSONArray.getJSONObject(i);
|
|
|
- String model = target.getString("model");
|
|
|
-// String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
|
|
|
+ for (int i = 0; i < modelList.size(); i++) {
|
|
|
+
|
|
|
+ String model = modelList.get(i);
|
|
|
+ String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
|
|
|
Class<? extends ContactsVo> aClass = contactsVo.getClass();
|
|
|
- String value="";
|
|
|
-// String value = String.valueOf(aClass.getMethod("get" + targetName).invoke(contactsVo)==null?"":aClass.getMethod("get" + targetName).invoke(contactsVo));
|
|
|
- /*if(model.equals("inchargerId")){
|
|
|
+ String value = "";
|
|
|
+
|
|
|
+ if(model.equals("customId")){
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(product))+"$";
|
|
|
+ value = "$userName"+String.valueOf(aClass.getMethod("getCustomName").invoke(contactsVo))+"$";
|
|
|
}else {
|
|
|
- value = String.valueOf(aClass.getMethod("getInchargerName").invoke(product));
|
|
|
+ value = String.valueOf(aClass.getMethod("getCustomName").invoke(contactsVo)).equals("null") ?"" :String.valueOf(aClass.getMethod("getCustomName").invoke(contactsVo));
|
|
|
}
|
|
|
- }*/
|
|
|
- if(model.equals("sex")){
|
|
|
- value = String.valueOf(aClass.getMethod("getSex").invoke(contactsVo)).equals("null") ?"":String.valueOf(aClass.getMethod("getSex").invoke(contactsVo));
|
|
|
}
|
|
|
- if(model.equals("name")){
|
|
|
- value = String.valueOf(aClass.getMethod("getName").invoke(contactsVo)).equals("null")?"":String.valueOf(aClass.getMethod("getName").invoke(contactsVo));
|
|
|
+ else if(model.equals("sex")){
|
|
|
+ value = String.valueOf(aClass.getMethod("getSex").invoke(contactsVo)).equals("null") ?"":String.valueOf(aClass.getMethod("getSex").invoke(contactsVo));
|
|
|
+ if (StringUtils.isNotEmpty(value)){
|
|
|
+ if (value.equals("0")){
|
|
|
+ value="女";
|
|
|
+ }else {
|
|
|
+ value="男";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ else if(model.equals("ownerId")){
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ value = "$userName"+String.valueOf(aClass.getMethod("getOwnerName").invoke(contactsVo))+"$";
|
|
|
+ }else {
|
|
|
+ value = String.valueOf(aClass.getMethod("getOwnerName").invoke(contactsVo)).equals("null") ? "" :String.valueOf(aClass.getMethod("getOwnerName").invoke(contactsVo));
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ value= String.valueOf(aClass.getMethod("get" + targetName).invoke(contactsVo)==null?"":aClass.getMethod("get" + targetName).invoke(contactsVo));
|
|
|
+
|
|
|
item.add(value);
|
|
|
}
|
|
|
dataList.add(item);
|
|
@@ -620,5 +690,26 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int claimContacts(Contacts contactsGet, User user) {
|
|
|
+ UpdateWrapper<Contacts> contactsUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ contactsUpdateWrapper.eq("id", contactsGet.getId());
|
|
|
+ contactsUpdateWrapper.set("owner_id", contactsGet.getOwnerId());
|
|
|
+ int count1 = contactsMapper.update(null, contactsUpdateWrapper);
|
|
|
+
|
|
|
+ ContactsLog contactsLog = new ContactsLog();
|
|
|
+ contactsLog.setCompanyId(user.getCompanyId());
|
|
|
+ contactsLog.setContactsId(contactsGet.getId());
|
|
|
+ contactsLog.setOperateId(user.getId());
|
|
|
+ contactsLog.setOperateDate(LocalDateTime.now());
|
|
|
+ contactsLog.setMsg("认领联系人");
|
|
|
+ int count2 = contactsLogMapper.insert(contactsLog);
|
|
|
+ if (count1>0&&count2>0){
|
|
|
+ return 1;
|
|
|
+ }else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|