提交 9180c464 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 43e0c31c
package com.zrqx.member.bg.member.controller; package com.zrqx.member.bg.member.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -8,12 +13,15 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -8,12 +13,15 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.excelutil.ExcelUtil;
import com.zrqx.core.util.page.PageInfo; import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam; import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack; import com.zrqx.core.util.response.CallBack;
import com.zrqx.member.bg.member.service.LoginLogService; import com.zrqx.member.bg.member.service.LoginLogService;
import com.zrqx.member.commons.form.bg.member.QueryLoginLogForm; import com.zrqx.member.commons.form.bg.member.QueryLoginLogForm;
import com.zrqx.member.commons.model.LoginLog; import com.zrqx.member.commons.model.LoginLog;
import com.zrqx.member.commons.vo.bg.member.LoginLogListVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -52,4 +60,34 @@ public class LoginLogController { ...@@ -52,4 +60,34 @@ public class LoginLogController {
return CallBack.success(llService.queryExample(pageParam, ex)); return CallBack.success(llService.queryExample(pageParam, ex));
} }
@ApiOperation("导出会员信息Excel")
@GetMapping("/export")
public CallBack<?> exportMemberPage(QueryLoginLogForm form, HttpServletRequest request,
HttpServletResponse response) {
Example ex = llService.createExample();
Criteria cr = ex.createCriteria();
if (form.getLoginAccount() != null) {
cr.andLike("loginAccount", form.getLoginAccount()+"%");
}
if (StringUtils.isNotBlank(form.getBeginTime())) {
cr.andGreaterThanOrEqualTo("createTime", form.getBeginTime());
}
if (StringUtils.isNotBlank(form.getEndTime())) {
cr.andLessThanOrEqualTo("createTime", form.getEndTime()+" 23:59:59");
}
List<LoginLog> loginLogList = llService.selectByExample(ex);
List<LoginLogListVO> list = BeanUtils.copyList(loginLogList, LoginLogListVO.class);
for (LoginLogListVO loginLogListVO : list) {
loginLogListVO.setChannel("app");
}
try {
ExcelUtil.getInstance().exportExcel(list, LoginLogListVO.class,
"用户登录信息信息.xlsx", response, request);
} catch (Exception e) {
return CallBack.fail(e.getMessage());
}
return CallBack.success();
}
} }
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import com.zrqx.core.util.excelutil.ExcelResources; import com.zrqx.core.util.excelutil.ExcelResources;
import io.swagger.annotations.ApiModelProperty;
@Data @Data
public class LoginLogListVO { public class LoginLogListVO {
...@@ -16,7 +18,7 @@ public class LoginLogListVO { ...@@ -16,7 +18,7 @@ public class LoginLogListVO {
@ExcelResources(title="登录时间",order=3) @ExcelResources(title="登录时间",order=3)
private Date createTime; private Date createTime;
@ExcelResources(title="登录方式",order=4) @ExcelResources(title="登录方式",order=4)
private String channel_zh; private String channel;
@ExcelResources(title="描述",order=5) @ExcelResources(title="描述",order=5)
private String description; private String description;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论