|
|
@@ -7,6 +7,7 @@ import com.fdkankan.agent.entity.User;
|
|
|
import com.fdkankan.agent.mapper.IUserMapper;
|
|
|
import com.fdkankan.agent.request.UserParam;
|
|
|
import com.fdkankan.agent.response.UserVo;
|
|
|
+import com.fdkankan.agent.response.UserVoEn;
|
|
|
import com.fdkankan.agent.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -14,6 +15,8 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -38,6 +41,8 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
private ISceneProService sceneProService;
|
|
|
@Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ IExcelService excelService;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -91,7 +96,42 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
return PageInfo.PageInfo(pageVo);
|
|
|
}
|
|
|
|
|
|
- private List<UserVo> getUserVo(List<User> userList,Integer agentId){
|
|
|
+ @Override
|
|
|
+ public void exportUserList(UserParam param, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ Page<User> page = this.getBaseMapper().pageList(new Page<>(1,100000), param);
|
|
|
+ List<User> records = page.getRecords();
|
|
|
+ List<Long> userIdList = records.parallelStream().map(User::getId).collect(Collectors.toList());
|
|
|
+ HashMap<Long,Long> incrementCountMap = userIncrementService.getValidCountGroupByUserId(userIdList);
|
|
|
+
|
|
|
+ List<UserVo> voList = new ArrayList<>();
|
|
|
+ List<UserVoEn> voListEn = new ArrayList<>();
|
|
|
+ for (User user : records) {
|
|
|
+ long incrementCount = incrementCountMap.get(user.getId()) == null ? 0 : incrementCountMap.get(user.getId());
|
|
|
+ if("en".equals(param.getLang())){
|
|
|
+ UserVoEn vo = new UserVoEn();
|
|
|
+ BeanUtils.copyProperties(user,vo);
|
|
|
+ vo.setVip(incrementCount > 0 ? 1: 0);
|
|
|
+ voListEn.add(vo);
|
|
|
+ }else {
|
|
|
+ UserVo vo = new UserVo();
|
|
|
+ BeanUtils.copyProperties(user,vo);
|
|
|
+ vo.setVip(incrementCount > 0 ? 1: 0);
|
|
|
+ voList.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ if("en".equals(param.getLang())){
|
|
|
+ excelService.commonExport(req,resp,new Date().getTime() +"user",voListEn, UserVoEn.class);
|
|
|
+ }else {
|
|
|
+ excelService.commonExport(req,resp,new Date().getTime() +"用户管理",voList, UserVo.class);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<UserVo> getUserVo(List<User> userList, Integer agentId){
|
|
|
List<UserVo> voList = new ArrayList<>();
|
|
|
if(userList.size() >0){
|
|
|
List<Long> userIdList = userList.parallelStream().map(User::getId).collect(Collectors.toList());
|