Commit 0c1d7c6e by 徐高华

群成员导出

parent abeae912
......@@ -24,6 +24,7 @@ import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.chat.GroupChatApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.haoban.manage.web.vo.chat.GroupChatUserExcelVO;
import com.gic.haoban.manage.web.vo.chat.GroupChatUserQuitVO;
import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum;
......@@ -154,6 +155,65 @@ public class GroupChatController {
}
@RequestMapping("user/detail/excel")
public RestResponse<Boolean> detailExcel(HttpServletRequest request, HttpServletResponse response,GroupChatUserSearchQDTO qdto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(1000);
ServiceResponse<Page<GroupChatUserDTO>> resp = this.groupChatApiService.listUserPage(qdto, basePageInfo);
Long groupChatId = qdto.getGroupChatId() ;
ServiceResponse<GroupChatDTO> detailResp = this.groupChatApiService.detail(loginUser.getWxEnterpriseId(),groupChatId);
List<GroupChatUserDTO> list = resp.getResult().getResult() ;
if(CollectionUtils.isEmpty(list)) {
return RestResponse.failure("9999","无相关群成员");
}
String s = DateUtil.formatString(new Date(), DateUtil.FORMAT_DATE_10);
String fileName = "客户群成员-"+detailResp.getResult().getName()+"-"+s;
List<String> titleList = Arrays.asList("群成员名称", "群成员昵称", "身份", "入群方式", "入群时间");
List<String> fileList = Arrays.asList("userName","nickName","userTypeExcel", "sceneExcel", "addTimeExcel");
List<GroupChatUserExcelVO> voList = new ArrayList<>() ;
for (GroupChatUserDTO dto : list) {
GroupChatUserExcelVO vo = EntityUtil.changeEntityByJSON(GroupChatUserExcelVO.class,dto) ;
vo.setAddTimeExcel(DateUtil.dateToStr(dto.getUserQuitTime(),"yyyy-MM-dd HH:mm:ss"));
if(dto.getUserType()==1) {
vo.setUserTypeExcel("企业成员");
}else if(dto.getUserType()==2) {
vo.setUserTypeExcel("外部成员");
}else {
vo.setUserTypeExcel("客户");
}
Integer joinScene = dto.getJoinScene() ;
if(null != joinScene) {
String invitor_user_name = dto.getInvitorUserName() ;
if(StringUtils.isBlank(invitor_user_name)) {
invitor_user_name = "群成员" ;
}
if(joinScene==1) {
// 由群成员邀请入群(直接邀请入群)
vo.setSceneExcel(String.format("由%s直接邀请入群",invitor_user_name));
}else if(joinScene==2) {
// 由群成员邀请入群(通过邀请链接入群)
vo.setSceneExcel(String.format("通过%s分享链接入群",invitor_user_name));
}else if(joinScene==3) {
// 通过扫描群二维码入群
vo.setSceneExcel(String.format("通过扫描%s分享的二维码入群",invitor_user_name));
}
voList.add(vo) ;
}
}
try {
ExcelUtils.xls(response, request, fileName, voList, fileList, titleList);
} catch (Exception e) {
logger.info("异常",e);
logger.info("导出失败");
}
return RestResponse.successResult(true);
}
@RequestMapping("user/quit/excel")
public RestResponse<Boolean> excel(HttpServletRequest request, HttpServletResponse response,String searchParams,Integer userType,
Date startDate,Date endDate,@RequestParam(defaultValue = "2") Integer status) {
......
package com.gic.haoban.manage.web.vo.chat;
import java.io.Serializable;
/**
*
* @ClassName: TabHaobanGroupChatUser
* @Description: TODO
* @Author 徐高华
* @Date 2022年11月25日 15:42:52
* @Modify
* @CopyRight
*/
public class GroupChatUserExcelVO implements Serializable {
private static final long serialVersionUID = 21771431486600L;
/**
* 1企业成员2外部联系人3客户
*/
private String userTypeExcel;
/**
* 姓名
*/
private String userName;
/**
* 昵称
*/
private String nickName;
private String sceneExcel;
private String addTimeExcel;
public String getUserTypeExcel() {
return userTypeExcel;
}
public void setUserTypeExcel(String userTypeExcel) {
this.userTypeExcel = userTypeExcel;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getSceneExcel() {
return sceneExcel;
}
public void setSceneExcel(String sceneExcel) {
this.sceneExcel = sceneExcel;
}
public String getAddTimeExcel() {
return addTimeExcel;
}
public void setAddTimeExcel(String addTimeExcel) {
this.addTimeExcel = addTimeExcel;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment