|
|
@@ -1,5 +1,6 @@
|
|
|
package com.mokamrp.privates.service.impl;
|
|
|
|
|
|
+import com.aliyun.oss.OSS;
|
|
|
import com.aliyun.oss.model.PutObjectRequest;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -49,6 +50,15 @@ public class WorkEmployeeServiceImpl extends ServiceImpl<WorkEmployeeMapper, Wor
|
|
|
@Autowired
|
|
|
private WorkRoomMapper workRoomMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DownfileMapper downfileMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OSSConfiguration ossConfiguration;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OSS ossClient;
|
|
|
+
|
|
|
public Object selectWorkEmployeeList(String authUserId, WorkEmployeeHandle workEmployee) {
|
|
|
List<Integer> userCorpIds = userCorpService.getAuthUserCorpIds(authUserId);
|
|
|
List<Integer> corpIds = new ArrayList<Integer>();
|
|
|
@@ -89,6 +99,59 @@ public class WorkEmployeeServiceImpl extends ServiceImpl<WorkEmployeeMapper, Wor
|
|
|
|
|
|
@Override
|
|
|
public void export(Downfile downFile, PostWorkEmployee handle) {
|
|
|
+ List<Object> tempObj;
|
|
|
+ List<List<Object>> resList = new ArrayList<List<Object>>();
|
|
|
+
|
|
|
+ /*
|
|
|
+ 所属主体 主体分组 客服名称 标签 性别 头像 客服唯一码 手机编号 手机号 封禁状态 粉丝数 管理群数 迁移状态
|
|
|
+ companyName groupName name gender avatar wxUserId mobile fanNum roomNum
|
|
|
+ */
|
|
|
+
|
|
|
+ Object[] head = {"id", "所属主体", "主体分组", "客服名称", "性别", "头像", "客服唯一码", "手机编号", "粉丝数", "管理群数"};
|
|
|
+ List<Object> headList = Arrays.asList(head);
|
|
|
+ Date currentTime = new Date();
|
|
|
+ String fileName = Downfile.WORK_EMPLOYEE;
|
|
|
+
|
|
|
+ QueryWrapper<WorkEmployeeVo> obj = getWrapper(handle);
|
|
|
+ Integer total = workEmployeeMapper.getVoListTotal(obj);
|
|
|
+ Page<WorkEmployeeVo> pageObj = new Page<>(1, total);
|
|
|
+ List<WorkEmployeeVo> list = getCommonList(pageObj, obj);
|
|
|
+
|
|
|
+ resList.add(headList);
|
|
|
+
|
|
|
+ if (list.size() >= 1) {
|
|
|
+ for (WorkEmployeeVo o : list) {
|
|
|
+ tempObj = new ArrayList<Object>() {
|
|
|
+ {
|
|
|
+ this.add(o.getId());
|
|
|
+ this.add(o.getCompanyName());
|
|
|
+ this.add(o.getGroupName());
|
|
|
+ this.add(o.getName());
|
|
|
+ this.add(o.getGenderTxt());
|
|
|
+ this.add(o.getAvatar());
|
|
|
+ this.add(o.getWxUserId());
|
|
|
+ this.add(o.getMobile());
|
|
|
+ this.add(o.getFanNum());
|
|
|
+ this.add(o.getRoomNum());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ resList.add(tempObj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer content = OssFile.createCSV(resList);
|
|
|
+
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String dateString = formatter.format(currentTime);
|
|
|
+ String filePath = OSSConfiguration.DOWN_DIR + dateString + "/" + downFile.getId().toString() + "_" + fileName;
|
|
|
+
|
|
|
+ PutObjectRequest putObjectRequest = new PutObjectRequest(ossConfiguration.getBucketName(), filePath,
|
|
|
+ new ByteArrayInputStream(content.toString().getBytes()));
|
|
|
+ ossClient.putObject(putObjectRequest);
|
|
|
+
|
|
|
+ downFile.setDownUrl(ossConfiguration.getHost() + filePath);
|
|
|
+ downFile.setStatus(1);
|
|
|
+ downfileMapper.updateById(downFile);
|
|
|
|
|
|
return;
|
|
|
}
|