|
|
@@ -2,9 +2,10 @@ package com.mokamrp.privates.service.impl;
|
|
|
|
|
|
import com.aliyun.oss.OSS;
|
|
|
import com.aliyun.oss.model.PutObjectRequest;
|
|
|
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
-import com.baomidou.mybatisplus.plugins.Page;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.mokamrp.privates.config.OSSConfiguration;
|
|
|
+import com.mokamrp.privates.entity.GetWorkContactEmployeeHandle;
|
|
|
import com.mokamrp.privates.mapper.CorpMapper;
|
|
|
import com.mokamrp.privates.mapper.DownfileMapper;
|
|
|
import com.mokamrp.privates.mapper.pojo.Downfile;
|
|
|
@@ -12,7 +13,7 @@ import com.mokamrp.privates.mapper.pojo.WorkContactEmployee;
|
|
|
import com.mokamrp.privates.mapper.WorkContactEmployeeMapper;
|
|
|
import com.mokamrp.privates.mapper.vo.WorkContactEmployeeVo;
|
|
|
import com.mokamrp.privates.service.WorkContactEmployeeService;
|
|
|
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.utils.OssFile;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.apache.tomcat.util.bcel.Const;
|
|
|
@@ -46,56 +47,15 @@ public class WorkContactEmployeeServiceImpl extends ServiceImpl<WorkContactEmplo
|
|
|
private OSSConfiguration ossConfiguration;
|
|
|
|
|
|
@Autowired
|
|
|
- private WorkContactEmployeeMapper mapperObj ;
|
|
|
+ private WorkContactEmployeeMapper mapperObj;
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> getPageList(Integer gender, Integer status,
|
|
|
- Integer pagesize, Integer page, String name,
|
|
|
- Integer start_deleted_at, Integer end_deleted_at,
|
|
|
- Integer start_created_at, Integer end_created_at,
|
|
|
- Integer group_id,
|
|
|
- Integer corp_id, List employee_id, List tag_id, Integer channel_code_id) {
|
|
|
|
|
|
- Page<WorkContactEmployeeVo> pageObj = new Page<>(page, pagesize);
|
|
|
- EntityWrapper<WorkContactEmployee> obj = new EntityWrapper<WorkContactEmployee>();
|
|
|
+ public Map<String, Object> getPageList(GetWorkContactEmployeeHandle handle) {
|
|
|
|
|
|
- if(name != null && !name.equals("")){
|
|
|
- obj.like("c.name", name);
|
|
|
- }
|
|
|
-
|
|
|
- if (gender != null) {
|
|
|
- obj.eq("c.gender", gender);
|
|
|
- }
|
|
|
-
|
|
|
- if (status != null) {
|
|
|
- obj.eq("a.`status`", status);
|
|
|
- }
|
|
|
-
|
|
|
- if (channel_code_id != null) {
|
|
|
- obj.eq("a.channel_code_id", channel_code_id);
|
|
|
- }
|
|
|
-
|
|
|
- if (start_deleted_at != null) {
|
|
|
- obj.ge("c.deleted_at", start_deleted_at);
|
|
|
- }
|
|
|
-
|
|
|
- if (end_created_at != null) {
|
|
|
- obj.le("c.deleted_at", end_deleted_at);
|
|
|
- }
|
|
|
-
|
|
|
- if (start_created_at != null) {
|
|
|
- obj.ge("c.created_at", start_created_at);
|
|
|
- }
|
|
|
+ Page<WorkContactEmployeeVo> pageObj = new Page<>(handle.getPage(), handle.getPagesize());
|
|
|
+ QueryWrapper<WorkContactEmployee> obj = getWrapper(handle);
|
|
|
|
|
|
- if (end_created_at != null) {
|
|
|
- obj.le("c.created_at", end_created_at);
|
|
|
- }
|
|
|
- if (corp_id != null) {
|
|
|
- obj.eq("a.corp_id", corp_id);
|
|
|
- }
|
|
|
- if (employee_id != null) {
|
|
|
- obj.in("a.employee_id", employee_id);
|
|
|
- }
|
|
|
|
|
|
List<WorkContactEmployeeVo> list = mapperObj.getVoList(pageObj, obj);
|
|
|
|
|
|
@@ -110,63 +70,20 @@ public class WorkContactEmployeeServiceImpl extends ServiceImpl<WorkContactEmplo
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void export(Downfile downFile,Integer gender, Integer status, String name,
|
|
|
- Integer start_deleted_at, Integer end_deleted_at,
|
|
|
- Integer start_created_at, Integer end_created_at,
|
|
|
- Integer group_id,
|
|
|
- Integer corp_id, List employee_id, List tag_id , Integer channel_code_id){
|
|
|
+ public void export(Downfile downFile, GetWorkContactEmployeeHandle handle) {
|
|
|
|
|
|
- EntityWrapper<WorkContactEmployee> obj = new EntityWrapper<WorkContactEmployee>();
|
|
|
List<Object> tempObj;
|
|
|
-
|
|
|
- if(name != null && !name.equals("")){
|
|
|
- obj.like("c.name",name);
|
|
|
- }
|
|
|
-
|
|
|
- if(gender != null){
|
|
|
- obj.eq("c.gender",gender);
|
|
|
- }
|
|
|
-
|
|
|
- if(status != null) {
|
|
|
- obj.eq("a.`status`", status);
|
|
|
- }
|
|
|
-
|
|
|
- if(channel_code_id != null) {
|
|
|
- obj.eq("a.channel_code_id", channel_code_id);
|
|
|
- }
|
|
|
-
|
|
|
- if(start_deleted_at != null) {
|
|
|
- obj.ge("c.deleted_at", start_deleted_at);
|
|
|
- }
|
|
|
-
|
|
|
- if(end_created_at != null) {
|
|
|
- obj.le("c.deleted_at", end_deleted_at);
|
|
|
- }
|
|
|
-
|
|
|
- if(start_created_at != null) {
|
|
|
- obj.ge("c.created_at", start_created_at);
|
|
|
- }
|
|
|
-
|
|
|
- if(end_created_at != null) {
|
|
|
- obj.le("c.created_at", end_created_at);
|
|
|
- }
|
|
|
- if(corp_id != null) {
|
|
|
- obj.eq("a.corp_id", corp_id);
|
|
|
- }
|
|
|
- if(employee_id !=null) {
|
|
|
- obj.in("a.employee_id", employee_id);
|
|
|
- }
|
|
|
-
|
|
|
+ QueryWrapper<WorkContactEmployee> obj = getWrapper(handle);
|
|
|
List<WorkContactEmployeeVo> list = mapperObj.getAllVoList(obj);
|
|
|
|
|
|
//实现下载
|
|
|
List<List<Object>> resList = new ArrayList<List<Object>>();
|
|
|
- Object[] head = { "id", "客户昵称", "状态","渠道码id","渠道名称","客户删除时间","客户创建时间","unionid","客服名称","公司名称" };
|
|
|
+ Object[] head = {"id", "客户昵称", "状态", "渠道码id", "渠道名称", "客户删除时间", "客户创建时间", "unionid", "客服名称", "公司名称"};
|
|
|
List<Object> headList = Arrays.asList(head);
|
|
|
resList.add(headList);
|
|
|
|
|
|
- if(list.size() >=1){
|
|
|
- for (WorkContactEmployeeVo o: list){
|
|
|
+ if (list.size() >= 1) {
|
|
|
+ for (WorkContactEmployeeVo o : list) {
|
|
|
tempObj = new ArrayList<Object>() {//这个大括号 就相当于我们 new 接口
|
|
|
{//这个大括号 就是 构造代码块 会在构造函数前 调用
|
|
|
this.add(o.getId());
|
|
|
@@ -182,7 +99,6 @@ public class WorkContactEmployeeServiceImpl extends ServiceImpl<WorkContactEmplo
|
|
|
}
|
|
|
};
|
|
|
resList.add(tempObj);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -192,16 +108,79 @@ public class WorkContactEmployeeServiceImpl extends ServiceImpl<WorkContactEmplo
|
|
|
Date currentTime = new Date();
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String dateString = formatter.format(currentTime);
|
|
|
- String filePath = OSSConfiguration.DOWN_DIR+dateString+"/"+downFile.getId().toString()+"_"+Downfile.WORK_CONTACT_EMPLOYEE;
|
|
|
+ String filePath = OSSConfiguration.DOWN_DIR + dateString + "/" + downFile.getId().toString() + "_" + Downfile.WORK_CONTACT_EMPLOYEE;
|
|
|
|
|
|
PutObjectRequest putObjectRequest = new PutObjectRequest(ossConfiguration.getBucketName(), filePath, new ByteArrayInputStream(content.toString().getBytes()));
|
|
|
ossClient.putObject(putObjectRequest);
|
|
|
|
|
|
- downFile.setDownUrl(ossConfiguration.getHost()+filePath);
|
|
|
+ downFile.setDownUrl(ossConfiguration.getHost() + filePath);
|
|
|
downFile.setStatus(1);
|
|
|
downfileMapper.updateById(downFile);
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ private QueryWrapper<WorkContactEmployee> getWrapper(GetWorkContactEmployeeHandle handle) {
|
|
|
+
|
|
|
+ QueryWrapper<WorkContactEmployee> obj = new QueryWrapper<WorkContactEmployee>();
|
|
|
+
|
|
|
+ Integer gender = handle.getGender();
|
|
|
+ Integer status = handle.getStatus();
|
|
|
+ String name = handle.getName();
|
|
|
+ Integer startDeletedAt = handle.getStartDeletedAt();
|
|
|
+ Integer endDeletedAt = handle.getEndDeletedAt();
|
|
|
+ Integer startCreatedAt = handle.getStartCreatedAt();
|
|
|
+ Integer endCreatedAt = handle.getEndCreatedAt();
|
|
|
+ Integer group_id = handle.getGroupId();
|
|
|
+ Integer corpId = handle.getCorpId();
|
|
|
+ List employeeId = handle.getEmployeeId();
|
|
|
+ List tagId = handle.getTagId();
|
|
|
+ Integer channel_code_id = handle.getChannelCodeId();
|
|
|
+ List<Integer> authCorpIds = handle.getAuthCorpIds();
|
|
|
+
|
|
|
+ if (name != null && !name.equals("")) {
|
|
|
+ obj.like("c.name", name);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (gender != null) {
|
|
|
+ obj.eq("c.gender", gender);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (status != null) {
|
|
|
+ obj.eq("a.`status`", status);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (channel_code_id != null) {
|
|
|
+ obj.eq("a.channel_code_id", channel_code_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (startDeletedAt != null) {
|
|
|
+ obj.ge("c.deleted_at", startDeletedAt);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (endDeletedAt != null) {
|
|
|
+ obj.le("c.deleted_at", endDeletedAt);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (startCreatedAt != null) {
|
|
|
+ obj.ge("c.created_at", startCreatedAt);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (endCreatedAt != null) {
|
|
|
+ obj.le("c.created_at", endCreatedAt);
|
|
|
+ }
|
|
|
+ if (corpId != null) {
|
|
|
+ obj.eq("a.corp_id", corpId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (employeeId != null) {
|
|
|
+ obj.in("a.employee_id", employeeId);
|
|
|
+ }
|
|
|
+
|
|
|
+ obj.in("a.corp_id", authCorpIds);
|
|
|
+
|
|
|
+ return obj;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|