小精灵优化-后台-导出
This commit is contained in:
@@ -31,4 +31,16 @@ public interface SeekElfinAdminMapper {
|
||||
List<SeekElfinAdminUserRecordVO> listUserDrawRecord(@Param("startTime") String startTime, @Param("endTime") String endTime,
|
||||
@Param("erbanNoList") List<String> erbanNoList);
|
||||
|
||||
/**
|
||||
* 分页获取用户的游戏记录
|
||||
*
|
||||
* @param page
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @param erbanNoList
|
||||
* @return
|
||||
*/
|
||||
Page<SeekElfinAdminUserRecordVO> pageUserDrawRecord(Page<SeekElfinAdminUserRecordVO> page, @Param("startTime") String startTime, @Param("endTime") String endTime,
|
||||
@Param("erbanNoList") List<String> erbanNoList);
|
||||
|
||||
}
|
||||
|
@@ -147,24 +147,21 @@ public class SeekElfinAdminService {
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @param erbanNos
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listUserRecord(String startTime, String endTime, String erbanNos, Integer page, Integer pageSize) {
|
||||
page = page != null ? page : Constant.DEFAULT_PAGE;
|
||||
pageSize = pageSize != null ? pageSize : Constant.DEFAULT_PAGE_SIZE;
|
||||
PageHelper.startPage(page, pageSize);
|
||||
public List<SeekElfinAdminUserRecordVO> listUserRecord(String startTime, String endTime, String erbanNos) {
|
||||
List<String> erbanNoList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(erbanNos)) {
|
||||
erbanNoList = Arrays.asList(erbanNos.trim().split(","));
|
||||
}
|
||||
List<SeekElfinAdminUserRecordVO> list = seekElfinAdminMapper.listUserDrawRecord(startTime, endTime, erbanNoList);
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
PageInfo<SeekElfinAdminUserRecordVO> pageInfo = new PageInfo<>(list);
|
||||
map.put("rows", pageInfo.getList());
|
||||
map.put("total", pageInfo.getTotal());
|
||||
return map;
|
||||
return seekElfinAdminMapper.listUserDrawRecord(startTime, endTime, erbanNoList);
|
||||
}
|
||||
|
||||
public void pageUserRecord(Page<SeekElfinAdminUserRecordVO> pageInfo, String startTime, String endTime, String erbanNos) {
|
||||
List<String> erbanNoList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(erbanNos)) {
|
||||
erbanNoList = Arrays.asList(erbanNos.trim().split(","));
|
||||
}
|
||||
seekElfinAdminMapper.pageUserDrawRecord(pageInfo, startTime, endTime, erbanNoList);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.accompany.admin.vo.seekelfin;
|
||||
|
||||
import com.accompany.business.model.seekelfin.SeekElfinRecord;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,10 +8,19 @@ import lombok.Data;
|
||||
* <br>功能详细描述:
|
||||
*/
|
||||
@Data
|
||||
public class SeekElfinAdminUserRecordVO extends SeekElfinRecord {
|
||||
public class SeekElfinAdminUserRecordVO {
|
||||
@ExcelProperty("平台ID")
|
||||
private Long erbanNo;
|
||||
|
||||
private String giftName;
|
||||
|
||||
private String prodName;
|
||||
@ExcelProperty("昵称")
|
||||
private String nick;
|
||||
@ExcelProperty("档位ID")
|
||||
private Integer prodId;
|
||||
@ExcelProperty("选择个数")
|
||||
private Integer selectNoNum;
|
||||
@ExcelProperty("花费钻石数")
|
||||
private Long costGoldNum;
|
||||
@ExcelProperty("产出钻石数")
|
||||
private Long receiveGoldNum;
|
||||
@ExcelProperty("时间")
|
||||
private String createTime;
|
||||
}
|
||||
|
@@ -41,4 +41,23 @@
|
||||
</if>
|
||||
order by sr.id desc
|
||||
</select>
|
||||
|
||||
<select id="pageUserDrawRecord" resultType="com.accompany.admin.vo.seekelfin.SeekElfinAdminUserRecordVO">
|
||||
select sr.id,sr.uid,u.erban_no,u.nick,sr.selectd_no_num `select_no_num`, sr.prod_id, sr.cost_gold_num,sr.receive_gold_num,sr.create_time
|
||||
from seek_elfin_record sr, users u
|
||||
where sr.uid = u.uid
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and sr.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and sr.create_time < #{endTime}
|
||||
</if>
|
||||
<if test="erbanNoList != null and erbanNoList.size() > 0">
|
||||
and u.erban_no in
|
||||
<foreach collection="erbanNoList" open="(" separator="," close=")" item="erbanNo">
|
||||
#{erbanNo}
|
||||
</foreach>
|
||||
</if>
|
||||
order by sr.id desc
|
||||
</select>
|
||||
</mapper>
|
@@ -7,6 +7,7 @@ import com.accompany.admin.vo.seekelfin.SeekElfinAdminPlatformStatVo;
|
||||
import com.accompany.admin.vo.seekelfin.SeekElfinAdminUserRecordVO;
|
||||
import com.accompany.admin.vo.seekelfin.SeekElfinItemSaveReqParams;
|
||||
import com.accompany.business.util.seekelfin.SeekElfinUtil;
|
||||
import com.accompany.business.vo.clan.ClanGoldFlowDetailVO;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
@@ -76,16 +77,12 @@ public class SeekElfinAdminController extends BaseController {
|
||||
EasyExcel.write(response.getOutputStream(), SeekElfinAdminPlatformStatVo.class).sheet("小精灵平台数据统计").doWrite(pageInfo.getRecords());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/listUserRecord", method = RequestMethod.GET)
|
||||
public void listUserRecord(String startTime, String endTime, String erbanNos,
|
||||
@RequestMapping(value = "/pageUserRecord", method = RequestMethod.GET)
|
||||
public PageResult<SeekElfinAdminUserRecordVO> listUserRecord(String startTime, String endTime, String erbanNos,
|
||||
Integer page, Integer pageSize) {
|
||||
try{
|
||||
Map<String, Object> map = seekElfinAdminService.listUserRecord(startTime, endTime, erbanNos, page, pageSize);
|
||||
writeJson(JSONObject.toJSONString(map));
|
||||
}catch(Exception e){
|
||||
logger.error(e.getMessage());
|
||||
writeJson(false, e.getMessage());
|
||||
}
|
||||
Page<SeekElfinAdminUserRecordVO> pageInfo = new Page<>(page, pageSize);
|
||||
seekElfinAdminService.pageUserRecord(pageInfo, startTime, endTime, erbanNos);
|
||||
return new PageResult<>(pageInfo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getStock", method = RequestMethod.GET)
|
||||
@@ -104,49 +101,14 @@ public class SeekElfinAdminController extends BaseController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/exportUserDrawRecordList", method = RequestMethod.GET)
|
||||
public void exportUserDrawRecordList(HttpServletRequest request, HttpServletResponse response, String startTime, String endTime, String erbanNos) throws Exception {
|
||||
Map<String, Object> map = seekElfinAdminService.listUserRecord(startTime, endTime, erbanNos, 1, Integer.MAX_VALUE);
|
||||
List<SeekElfinAdminUserRecordVO> recordList = (List<SeekElfinAdminUserRecordVO>) map.get("rows");
|
||||
try {
|
||||
List<String> headerList = new ArrayList<>();
|
||||
headerList.add("id");
|
||||
headerList.add("uid");
|
||||
headerList.add("平台号");
|
||||
headerList.add("昵称");
|
||||
headerList.add("档位");
|
||||
headerList.add("购买个数");
|
||||
headerList.add("花费总钻石数");
|
||||
headerList.add("产出平台价值");
|
||||
headerList.add("时间");
|
||||
String fileName = "用户寻找小精灵记录.xls";
|
||||
List<List> excelRows = buildExcelData(recordList);
|
||||
Workbook workbook = ExcelUtils.createExcelSheet(headerList, excelRows);
|
||||
ExcelUtils.setExcelResponseHeader(request, response, fileName);
|
||||
java.io.OutputStream out = response.getOutputStream();
|
||||
workbook.write(out);
|
||||
out.flush();
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to exportUserDrawRecordList", e);
|
||||
writeJson(false, "导出失败");
|
||||
}
|
||||
}
|
||||
|
||||
public List<List> buildExcelData(List<SeekElfinAdminUserRecordVO> vos) {
|
||||
List<List> excelRows = new ArrayList<>(vos.size());
|
||||
for (SeekElfinAdminUserRecordVO vo : vos) {
|
||||
List<Object> excelData = new ArrayList<>();
|
||||
excelData.add(vo.getId());
|
||||
excelData.add(vo.getUid());
|
||||
excelData.add(vo.getErbanNo());
|
||||
excelData.add(vo.getNick());
|
||||
excelData.add(vo.getProdId());
|
||||
excelData.add(vo.getSelectNoNum());
|
||||
excelData.add(vo.getCostGoldNum());
|
||||
excelData.add(vo.getReceiveGoldNum());
|
||||
excelData.add(DateTimeUtil.convertDate(vo.getCreateTime(), DateTimeUtil.DEFAULT_DATETIME_PATTERN));
|
||||
excelRows.add(excelData);
|
||||
}
|
||||
return excelRows;
|
||||
public void exportUserDrawRecordList(HttpServletResponse response, String startTime, String endTime, String erbanNos) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("小精灵用户记录", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
List<SeekElfinAdminUserRecordVO> recordList = seekElfinAdminService.listUserRecord(startTime, endTime, erbanNos);
|
||||
EasyExcel.write(response.getOutputStream(), SeekElfinAdminUserRecordVO.class).sheet("小精灵用户记录").doWrite(recordList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -73,24 +73,13 @@
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
columns: [
|
||||
{field: 'id', title: 'id', align: 'center', width: '5%'},
|
||||
{field: 'uid', title: 'uid', align: 'center', width: '5%'},
|
||||
{field: 'erbanNo', title: '平台号', align: 'center', width: '5%'},
|
||||
{field: 'nick', title: '昵称', align: 'center', width: '5%'},
|
||||
{field: 'prodId', title: '档位', align: 'center', width: '5%'},
|
||||
{field: 'selectNoNum', title: '购买个数', align: 'center', width: '5%'},
|
||||
{field: 'costGoldNum', title: '花费总钻石数', align: 'center', width: '5%'},
|
||||
{field: 'receiveGoldNum', title: '产出平台价值', align: 'center', width: '5%'},
|
||||
{field: 'createTime', title: '时间', align: 'center', width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
if (val) {
|
||||
var date = new Date(val);
|
||||
return date.format('yyyy-MM-dd hh:mm:ss');
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
{field: 'createTime', title: '时间', align: 'center', width: '5%'}
|
||||
],
|
||||
undefinedText: 0,
|
||||
cache: false,
|
||||
@@ -113,7 +102,7 @@
|
||||
return param;
|
||||
},
|
||||
toolbar: '#toolbar',
|
||||
url: '/admin/seekElfin/listUserRecord.action',
|
||||
url: '/admin/seekElfin/pageUserRecord.action',
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
console.log("load success");
|
||||
},
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.accompany.business.model.seekelfin;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -42,6 +44,4 @@ public class SeekElfinRecord {
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String nick;
|
||||
}
|
||||
|
2
pom.xml
2
pom.xml
@@ -111,7 +111,7 @@
|
||||
<sud-mgp-auth-java.version>1.0.2</sud-mgp-auth-java.version>
|
||||
<redisson.version>3.16.8</redisson.version>
|
||||
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
|
||||
<esayexcel.version>3.1.1</esayexcel.version>
|
||||
<esayexcel.version>3.1.5</esayexcel.version>
|
||||
<googlecode-libphonenumber.version>8.12.43</googlecode-libphonenumber.version>
|
||||
</properties>
|
||||
|
||||
|
Reference in New Issue
Block a user