|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
@@ -843,5 +844,69 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg pinContacts(Contacts contacts, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ contactsMapper.update(null,new LambdaUpdateWrapper<Contacts>()
|
|
|
|
+ .set(Contacts::getNeedPin,Boolean.TRUE)
|
|
|
|
+ .set(Contacts::getPinTime,new Date())
|
|
|
|
+ .eq(Contacts::getId,contacts.getId())
|
|
|
|
+ );
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg pageContactsByPin(Integer pageIndex, Integer pageSize, Integer customId, String name, String email, String creatorId, String phone, String ownerId, HttpServletRequest request) {
|
|
|
|
+ String token = String.valueOf(request.getHeader("Token"));
|
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
|
+ boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部联系人");
|
|
|
|
+ boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门联系人");
|
|
|
|
+
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("customId", customId);
|
|
|
|
+ map.put("name", name);
|
|
|
|
+ map.put("phone", phone);
|
|
|
|
+ map.put("ownerId", ownerId);
|
|
|
|
+ map.put("email", email);
|
|
|
|
+ map.put("creatorId", creatorId);
|
|
|
|
+ map.put("companyId", user.getCompanyId());
|
|
|
|
+ map.put("isDelete", 0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (isAll){
|
|
|
|
+ System.out.println("do nothing");
|
|
|
|
+ }else if (isNotAll){
|
|
|
|
+ Integer departmentId = user.getDepartmentId();//找出对应的部门id
|
|
|
|
+ map.put("departmentId",departmentId);
|
|
|
|
+ }else {
|
|
|
|
+ //查看负责人为自己和null的数据
|
|
|
|
+ map.put("ownerIdByMyselfAndNull",user.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Page<ContactsVo> pageContacts = contactsMapper.pageContactsByPin(new Page( pageIndex, pageSize), map);
|
|
|
|
+
|
|
|
|
+ List<ContactsVo> records = pageContacts.getRecords();
|
|
|
|
+ long total = pageContacts.getTotal();
|
|
|
|
+
|
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
+ hashMap.put("records", records);
|
|
|
|
+ hashMap.put("total", total);
|
|
|
|
+
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ msg.setData(hashMap);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg undoPin(Contacts contacts, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ contactsMapper.update(null,new LambdaUpdateWrapper<Contacts>()
|
|
|
|
+ .set(Contacts::getNeedPin,Boolean.FALSE)
|
|
|
|
+ .set(Contacts::getPinTime,null)
|
|
|
|
+ .eq(Contacts::getId,contacts.getId())
|
|
|
|
+ );
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|