寻爱之旅-后台-奖品记录
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.accompany.admin.mapper.findlove;
|
||||
|
||||
import com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminVo;
|
||||
import com.accompany.admin.vo.linearlypool.LinearlyPoolDrawRecordStatisVo;
|
||||
import com.accompany.admin.vo.linearlypool.UserDrawStatisAdminVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface FindLoveDrawAdminMapper {
|
||||
|
||||
Page<FindLoveDrawRecordAdminVo> pageRecord(Page<FindLoveDrawRecordAdminVo> pageInfo, @Param("uid") Long uid, @Param("giftName") String prizeName,
|
||||
@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
LinearlyPoolDrawRecordStatisVo getDrawStaticList(@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("uid") Long uid, @Param("tableType") String tableType);
|
||||
|
||||
List<UserDrawStatisAdminVo> getUserStatisList(@Param("uid") Long uid, @Param("minDis") Integer minDis, @Param("maxDis") Integer maxDis, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
|
||||
}
|
@@ -1,70 +1,84 @@
|
||||
package com.accompany.admin.service.findlove;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.accompany.admin.base.Pagination;
|
||||
import com.accompany.admin.mapper.findlove.FindLoveDrawAdminMapper;
|
||||
import com.accompany.admin.mapper.linearlypool.LinearlyPoolAdminMapper;
|
||||
import com.accompany.admin.params.linearlypool.PlatformDataReqParams;
|
||||
import com.accompany.admin.service.base.BaseService;
|
||||
import com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminExportVo;
|
||||
import com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminVo;
|
||||
import com.accompany.admin.vo.linearlypool.LinearlyPoolDrawRecordStatisVo;
|
||||
import com.accompany.admin.vo.linearlypool.LinearlyPoolDrawRecordVO;
|
||||
import com.accompany.admin.vo.linearlypool.UserDrawStatisAdminVo;
|
||||
import com.accompany.business.constant.LinearlyPrizePoolTypeEnum;
|
||||
import com.accompany.business.model.linearlypool.LinearlyPrizePoolDrawLineItem;
|
||||
import com.accompany.business.service.linearlypool.LinearlyPrizePoolDrawLineItemService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.util.ReplaceDomainUtil;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.utils.BeanUtil;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.user.UsersBaseService;
|
||||
import com.accompany.core.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.time.FastDateFormat;
|
||||
import org.apache.cxf.common.util.CollectionUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FindLoveDrawDataAdminService extends BaseService {
|
||||
public class FindLoveDrawDataAdminService {
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private LinearlyPrizePoolDrawLineItemService drawLineItemService;
|
||||
@Autowired
|
||||
private UsersBaseService usersBaseService;
|
||||
@Autowired
|
||||
private LinearlyPoolAdminMapper linearlyPoolAdminMapper;
|
||||
@Autowired
|
||||
private FindLoveDrawAdminMapper findLoveAdminMapper;
|
||||
|
||||
public PageInfo<LinearlyPoolDrawRecordVO> getRecordList(Long uid, String prizeName, Integer pageNumber, Integer pageSize, Date startDate, Date endDate) {
|
||||
IPage<LinearlyPrizePoolDrawLineItem> queryPage = new Page<>(pageNumber, pageSize);
|
||||
QueryWrapper<LinearlyPrizePoolDrawLineItem> queryWrapper = genRecordQuery(uid, prizeName, startDate, endDate);
|
||||
IPage<LinearlyPrizePoolDrawLineItem> page = drawLineItemService.page(queryPage, queryWrapper);
|
||||
List<LinearlyPoolDrawRecordVO> recordList = convertToDrawRecordVoList(page.getRecords());
|
||||
PageInfo<LinearlyPoolDrawRecordVO> resPage = new PageInfo(recordList);
|
||||
resPage.setTotal(page.getTotal());
|
||||
return resPage;
|
||||
public void pageRecord(Page<FindLoveDrawRecordAdminVo> pageInfo, Long erbanNo, String prizeName, Date startDate, Date endDate) {
|
||||
Long uid = null;
|
||||
if (null != erbanNo){
|
||||
Users users = usersService.getUserByErbanNo(erbanNo);
|
||||
if(users != null){
|
||||
uid = users.getUid();
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(prizeName)){
|
||||
prizeName = prizeName.trim();
|
||||
}
|
||||
|
||||
findLoveAdminMapper.pageRecord(pageInfo, uid, prizeName, startDate, endDate);
|
||||
if (!CollectionUtils.isEmpty(pageInfo.getRecords())){
|
||||
List<Long> uids = pageInfo.getRecords().stream().map(FindLoveDrawRecordAdminVo::getUid).distinct().collect(Collectors.toList());
|
||||
Map<Long, Users> usersMap = usersService.getUsersMapByUids(uids);
|
||||
for (FindLoveDrawRecordAdminVo vo: pageInfo.getRecords()) {
|
||||
Users user = usersMap.get(vo.getUid());
|
||||
if (null == user){
|
||||
continue;
|
||||
}
|
||||
vo.setErbanNo(user.getErbanNo());
|
||||
vo.setNick(user.getNick());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private QueryWrapper<LinearlyPrizePoolDrawLineItem> genRecordQuery(Long uid, String prizeName, Date startDate, Date endDate) {
|
||||
QueryWrapper<LinearlyPrizePoolDrawLineItem> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(uid != null, LinearlyPrizePoolDrawLineItem::getUid, uid)
|
||||
.like(StringUtils.isNotBlank(prizeName), LinearlyPrizePoolDrawLineItem::getPrizeName, "%" + prizeName + "%")
|
||||
.ge(startDate != null, LinearlyPrizePoolDrawLineItem::getDrawTime, startDate)
|
||||
.le(endDate != null, LinearlyPrizePoolDrawLineItem::getDrawTime, endDate)
|
||||
.eq(LinearlyPrizePoolDrawLineItem::getDrawStatus, Constant.LinearlyPoolDrawStatus.HAS_DRAW)
|
||||
.orderByDesc(LinearlyPrizePoolDrawLineItem::getDrawTime);
|
||||
return queryWrapper;
|
||||
public List<FindLoveDrawRecordAdminExportVo> exportRecord(Long msNo, String prizeName, Date startDate, Date endDate) {
|
||||
List<FindLoveDrawRecordAdminExportVo> voList = new ArrayList<>();
|
||||
|
||||
Page<FindLoveDrawRecordAdminVo> pageInfo = new Page<>(-1, -1);
|
||||
pageRecord(pageInfo, msNo, prizeName, startDate, endDate);
|
||||
if (!CollectionUtils.isEmpty(pageInfo.getRecords())){
|
||||
for (FindLoveDrawRecordAdminVo record: pageInfo.getRecords()) {
|
||||
FindLoveDrawRecordAdminExportVo vo = new FindLoveDrawRecordAdminExportVo();
|
||||
BeanUtils.copyProperties(record, vo);
|
||||
vo.setPoolType(Constant.PrizePoolType.ORDINARY.equals(record.getPoolType())? "普通": "高级");
|
||||
vo.setCreateTime(DateTimeUtil.convertDate(record.getCreateTime()));
|
||||
voList.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
return voList;
|
||||
}
|
||||
|
||||
public PageInfo getUserStatisList(Long uid, Integer minDis, Integer maxDis, Integer pageNumber,
|
||||
@@ -121,63 +135,6 @@ public class FindLoveDrawDataAdminService extends BaseService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<LinearlyPoolDrawRecordVO> convertToDrawRecordVoList(List<LinearlyPrizePoolDrawLineItem> list){
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<LinearlyPoolDrawRecordVO> voList = Lists.newArrayList();
|
||||
Map<Long, Users> userMap = new HashMap<>();
|
||||
for(LinearlyPrizePoolDrawLineItem drawLotteryRecord:list){
|
||||
LinearlyPoolDrawRecordVO vo = BeanUtil.map(drawLotteryRecord, LinearlyPoolDrawRecordVO.class);
|
||||
Users users = userMap.get(drawLotteryRecord.getUid());
|
||||
if (users == null) {
|
||||
users = usersService.getUsersByUid(drawLotteryRecord.getUid());
|
||||
if (users != null) {
|
||||
userMap.put(users.getUid(), users);
|
||||
}
|
||||
}
|
||||
if(users != null){
|
||||
vo.setErbanNo(users.getErbanNo());
|
||||
vo.setNick(users.getNick());
|
||||
}
|
||||
voList.add(vo);
|
||||
}
|
||||
ReplaceDomainUtil.handlerForList(voList);
|
||||
return voList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据礼物记录构建excel数据
|
||||
* @param records
|
||||
* @return
|
||||
*/
|
||||
public List<List> buildExcelData(List<LinearlyPoolDrawRecordVO> records) {
|
||||
FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
|
||||
List<List> excelRows = new ArrayList(records.size());
|
||||
records.forEach((record) -> {
|
||||
List<Object> excelData = new ArrayList<>();
|
||||
excelData.add(record.getLineId());
|
||||
excelData.add(record.getUid());
|
||||
excelData.add(record.getErbanNo());
|
||||
excelData.add(record.getNick());
|
||||
excelData.add(record.getPrizeName());
|
||||
excelData.add(format.format(record.getDrawTime()));
|
||||
excelData.add(record.getPlatformValue());
|
||||
excelData.add(getPoolNameForType(record.getPrizePoolType()));
|
||||
excelRows.add(excelData);
|
||||
});
|
||||
return excelRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据奖池类型获取奖池名称
|
||||
* @param poolType
|
||||
* @return
|
||||
*/
|
||||
private String getPoolNameForType(Byte poolType) {
|
||||
return LinearlyPrizePoolTypeEnum.from(poolType).getPoolName();
|
||||
}
|
||||
|
||||
public Pagination queryPlatformData(PlatformDataReqParams params, boolean oldQuery) {
|
||||
Date startDate = params.getStartDate();
|
||||
Date endDate = params.getEndDate();
|
||||
@@ -207,7 +164,7 @@ public class FindLoveDrawDataAdminService extends BaseService {
|
||||
public LinearlyPoolDrawRecordStatisVo querySingleDrawLotteryRecordStatisVo(PlatformDataReqParams params, Boolean oldQuery){
|
||||
|
||||
// 根据用户靓号获取uid
|
||||
Users user = usersBaseService.getUsersByErBanNo(params.getErbanNo());
|
||||
Users user = usersService.getUserByErbanNo(params.getErbanNo());
|
||||
Long uid = user != null ? user.getUid() : null;
|
||||
|
||||
LinearlyPoolDrawRecordStatisVo drawLotteryRecordStatisVo = new LinearlyPoolDrawRecordStatisVo();
|
||||
@@ -249,10 +206,4 @@ public class FindLoveDrawDataAdminService extends BaseService {
|
||||
return drawLotteryRecordStatisVo;
|
||||
}
|
||||
|
||||
public List<List> listExportRecordRows(Long uid, String prizeName, Date startDate, Date endDate) {
|
||||
QueryWrapper<LinearlyPrizePoolDrawLineItem> queryWrapper = genRecordQuery(uid, prizeName, startDate, endDate);
|
||||
List<LinearlyPrizePoolDrawLineItem> resultList = drawLineItemService.list(queryWrapper);
|
||||
List<LinearlyPoolDrawRecordVO> recordList = convertToDrawRecordVoList(resultList);
|
||||
return buildExcelData(recordList);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,28 @@
|
||||
package com.accompany.admin.vo.findlove;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FindLoveDrawRecordAdminExportVo {
|
||||
|
||||
@ExcelProperty("平台Id")
|
||||
private Long erbanNo;
|
||||
@ExcelProperty("昵称")
|
||||
private String nick;
|
||||
@ExcelProperty("奖池类型")
|
||||
private String poolType;
|
||||
@ExcelProperty("礼物Id")
|
||||
private Integer giftId;
|
||||
@ExcelProperty("礼物名")
|
||||
private String giftName;
|
||||
@ExcelProperty("礼物单价")
|
||||
private Long diamonds;
|
||||
@ExcelProperty("礼物等级")
|
||||
private Integer level;
|
||||
@ExcelProperty("数量")
|
||||
private Integer num;
|
||||
@ExcelProperty("时间")
|
||||
private String createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.accompany.admin.vo.findlove;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class FindLoveDrawRecordAdminVo {
|
||||
|
||||
private Long id;
|
||||
private Long uid;
|
||||
|
||||
private Long erbanNo;
|
||||
private String nick;
|
||||
private Byte poolType;
|
||||
private Integer giftId;
|
||||
private String giftName;
|
||||
private Long diamonds;
|
||||
private Integer level;
|
||||
private Integer num;
|
||||
private Date createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.accompany.admin.mapper.findlove.FindLoveDrawAdminMapper" >
|
||||
|
||||
<resultMap id="recordVo" type="com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminVo">
|
||||
<id column="id" property="id"/>
|
||||
<result column="uid" property="uid"/>
|
||||
<result column="pool_type" property="poolType"/>
|
||||
<result column="gift_id" property="giftId"/>
|
||||
<result column="gift_name" property="giftName"/>
|
||||
<result column="diamonds" property="diamonds"/>
|
||||
<result column="level" property="level"/>
|
||||
<result column="num" property="num"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="pageRecord" resultMap="recordVo">
|
||||
select * from find_love_draw_record r
|
||||
where 1=1
|
||||
<if test="null != startTime">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="null != endTime">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="null != uid and uid > 0">
|
||||
and uid = #{uid}
|
||||
</if>
|
||||
<if test="null != giftName and giftName != ''">
|
||||
and gift_name = #{giftName}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.accompany.admin.vo.linearlypool.LinearlyPoolDrawRecordStatisVo">
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="count_num" property="countNum" jdbcType="INTEGER" />
|
||||
<result column="user_total_pay" property="userTotalPay" jdbcType="BIGINT" />
|
||||
<result column="total_platform_value" property="totalPlatformValue" jdbcType="BIGINT" />
|
||||
<result column="total_actual_value" property="totalActualValue" jdbcType="BIGINT" />
|
||||
<result column="total_gift_actual_value" property="totalGiftActualValue" jdbcType="BIGINT" />
|
||||
<result column="total_not_gift_actual_value" property="totalNotGiftActualValue" jdbcType="BIGINT" />
|
||||
<result column="total_real_gift_actual_value" property="totalRealGiftActualValue" jdbcType="BIGINT" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="UserDrawStatisResultMap" type="com.accompany.admin.vo.linearlypool.UserDrawStatisAdminVo" >
|
||||
<result column="uid" property="uid" jdbcType="BIGINT" />
|
||||
<result column="total_purchase_money" property="totalPurchaseMoney" jdbcType="BIGINT" />
|
||||
<result column="total_draw_money" property="totalDrawMoney" jdbcType="BIGINT" />
|
||||
<result column="total_platform_value" property="totalPlatformValue" jdbcType="BIGINT" />
|
||||
<result column="total_actual_value" property="totalActualValue" jdbcType="BIGINT" />
|
||||
<result column="deviation" property="deviation" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getDrawStaticList" resultMap="BaseResultMap">
|
||||
select
|
||||
count(1) as count_num,
|
||||
sum(key_price) as user_total_pay,
|
||||
sum(platform_value) as total_platform_value,
|
||||
sum(actual_value) as total_actual_value,
|
||||
sum(case when prize_type = 2 then actual_value else 0 end) total_gift_actual_value,
|
||||
sum(case when prize_type != 2 then actual_value else 0 end) as total_not_gift_actual_value,
|
||||
sum(case when prize_type = 6 then actual_value else 0 end) as total_real_gift_actual_value
|
||||
from
|
||||
<choose>
|
||||
<when test="tableType == 'days'">
|
||||
linearly_prize_pool_draw_line_item_day
|
||||
</when>
|
||||
<otherwise>
|
||||
linearly_prize_pool_draw_line_item
|
||||
</otherwise>
|
||||
</choose>
|
||||
where draw_status = ${@com.accompany.common.constant.Constant$LinearlyPoolDrawStatus@HAS_DRAW}
|
||||
<if test="startTime != null">
|
||||
and draw_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and draw_time <= #{endTime}
|
||||
</if>
|
||||
<if test="uid != null">
|
||||
and uid = #{uid}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="getUserStatisList" resultMap="UserDrawStatisResultMap">
|
||||
select
|
||||
a.*,
|
||||
a.total_draw_money - a.total_actual_value as deviation
|
||||
from(select
|
||||
uid,
|
||||
sum(key_price) as total_purchase_money,
|
||||
sum(key_price) as total_draw_money,
|
||||
sum(actual_value) as total_actual_value,
|
||||
sum(platform_value) as total_platform_value
|
||||
from linearly_prize_pool_draw_line_item
|
||||
WHERE draw_status = ${@com.accompany.common.constant.Constant$LinearlyPoolDrawStatus@HAS_DRAW}
|
||||
<if test="uid != null">
|
||||
and uid = #{uid}
|
||||
</if>
|
||||
<if test="startTime !=null and startTime != ''">
|
||||
and draw_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and endTime != ''">
|
||||
and draw_time <= #{endTime}
|
||||
</if>
|
||||
group by uid
|
||||
) a
|
||||
where 1 = 1
|
||||
<if test="maxDis !=null">
|
||||
and ( a.total_draw_money - a.total_actual_value) <= #{maxDis}
|
||||
</if>
|
||||
<if test="minDis !=null">
|
||||
and ( a.total_draw_money - a.total_actual_value) >= #{minDis}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@@ -37,7 +37,6 @@ public class FindLoveDrawAdminController extends BaseController {
|
||||
@GetMapping("/listDeployedPoolItems")
|
||||
public BusiResult<List<PrizeItemVO>> listDeployedPoolItems() {
|
||||
List<PrizeItemVO> poolItems = linearlyPoolItemAdminService.listDeployedPoolItems();
|
||||
|
||||
return new BusiResult<>(BusiStatus.SUCCESS, poolItems);
|
||||
}
|
||||
|
||||
|
@@ -5,17 +5,28 @@ import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.params.linearlypool.PlatformDataReqParams;
|
||||
import com.accompany.admin.service.findlove.FindLoveDrawDataAdminService;
|
||||
import com.accompany.admin.util.ExcelUtils;
|
||||
import com.accompany.admin.vo.BillRecordExcelVo;
|
||||
import com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminExportVo;
|
||||
import com.accompany.admin.vo.findlove.FindLoveDrawRecordAdminVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.user.UsersBaseService;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -50,23 +61,11 @@ public class FindLoveDrawDataAdminController extends BaseController {
|
||||
}
|
||||
|
||||
@GetMapping("/listDrawRecord")
|
||||
public void getRecordList(Long msNo,String prizeName, Date startDate,Date endDate){
|
||||
Users users = usersBaseService.getUsersByErBanNo(msNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
Long uid = null;
|
||||
if(users != null){
|
||||
uid = users.getUid();
|
||||
}
|
||||
try{
|
||||
PageInfo pageInfo = service.getRecordList(uid,prizeName,getPageNumber(),getPageSize(),startDate,endDate);
|
||||
jsonObject.put("total",pageInfo.getTotal());
|
||||
jsonObject.put("rows",pageInfo.getList());
|
||||
writeJson(jsonObject.toJSONString());
|
||||
}catch (Exception e){
|
||||
logger.error("get draw box record list failed",e);
|
||||
jsonObject.put("message",e);
|
||||
writeJson(jsonObject.toJSONString());
|
||||
}
|
||||
public PageResult<FindLoveDrawRecordAdminVo> getRecordList(Long msNo, String prizeName, Date startDate, Date endDate,
|
||||
Integer pageNumber, Integer pageSize){
|
||||
Page<FindLoveDrawRecordAdminVo> pageInfo = new Page<>(pageNumber, pageSize);
|
||||
service.pageRecord(pageInfo, msNo, prizeName, startDate, endDate);
|
||||
return new PageResult<>(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,40 +74,18 @@ public class FindLoveDrawDataAdminController extends BaseController {
|
||||
* @param prizeName
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "export", method = RequestMethod.POST)
|
||||
public void export(Long msNo, String prizeName, Date startDate, Date endDate, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Long uid = null;
|
||||
if(msNo != null) {
|
||||
Users users = usersBaseService.getUsersByErBanNo(msNo);
|
||||
if (users != null) {
|
||||
uid = users.getUid();
|
||||
}
|
||||
}
|
||||
@GetMapping("export")
|
||||
public void export(Long msNo, String prizeName, Date startDate, Date endDate, HttpServletResponse response) throws IOException {
|
||||
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<String> headerList = new ArrayList<>();
|
||||
headerList.add("奖池线id");
|
||||
headerList.add("uid");
|
||||
headerList.add("66号");
|
||||
headerList.add("用户昵称");
|
||||
headerList.add("奖品名称");
|
||||
headerList.add("抽奖时间");
|
||||
headerList.add("平台价值");
|
||||
headerList.add("礼物组类型");
|
||||
String fileName = "用户抽奖记录.xls";
|
||||
List<List> excelRows = service.listExportRecordRows(uid, prizeName, startDate, endDate);
|
||||
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) {
|
||||
logger.error("Failed to export box prize record list. ", e);
|
||||
writeJson(false, "导出失败");
|
||||
}
|
||||
List<FindLoveDrawRecordAdminExportVo> exportVos = service.exportRecord(msNo, prizeName, startDate, endDate);
|
||||
EasyExcel.write(response.getOutputStream(), FindLoveDrawRecordAdminExportVo.class).sheet("寻爱之旅奖品记录").doWrite(exportVos);
|
||||
}
|
||||
|
||||
@GetMapping("/platform/list")
|
||||
|
@@ -1,7 +1,3 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<section class="content">
|
||||
<div class="box box-primary">
|
||||
<section class="content-header">
|
||||
@@ -13,7 +9,7 @@
|
||||
<div id="toolbar">
|
||||
<div class="col-sm-12">
|
||||
<div class="pull-left">
|
||||
<form action="/admin/linearlyPool/data/export.action" id="searchForm" method="POST">
|
||||
<form action="/admin/findLove/data/export.action" id="searchForm">
|
||||
平台号:<input type="text" id="msNo" name="msNo" class="input-sm" placeholder="请输入平台号">
|
||||
|
||||
奖品名称:<input type="text" id="prizeName" name="prizeName" class="input-sm" placeholder="请输入奖品名称">
|
||||
@@ -70,12 +66,11 @@
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
columns: [
|
||||
{field: 'lineId', title: '奖池线id', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'uid', title: 'uid', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'erbanNo', title: '66号', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'erbanNo', title: '平台号', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'nick', title: '用户昵称', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'prizeName', title: '奖品名称', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'drawTime', title: '抽奖时间', align: 'center', valign: 'middle', width: '20%',formatter: function(val,row,index) {
|
||||
{field: 'giftName', title: '奖品名称', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'num', title: '数量', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'createTime', title: '抽奖时间', align: 'center', valign: 'middle', width: '20%',formatter: function(val,row,index) {
|
||||
if(val) {
|
||||
var date = new Date(val);
|
||||
return date.format('yyyy-MM-dd hh:mm:ss');
|
||||
@@ -83,10 +78,11 @@
|
||||
return '-';
|
||||
}
|
||||
}},
|
||||
{field: 'platformValue', title: '平台价值', align: 'center', valign: 'middle', width: '10%'},
|
||||
// {field: 'actualValue', title: '实际价值', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'prizePoolType', title: '礼物组类型', align: 'center', valign: 'middle', width: '10%',formatter: function(val,row,index) {
|
||||
switch(row.prizePoolType) {
|
||||
{field: 'level', title: '礼物等级', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'diamonds', title: '钻石单价', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'diamonds', title: '钻石单价', align: 'center', valign: 'middle', width: '10%'},
|
||||
{field: 'poolType', title: '礼物组类型', align: 'center', valign: 'middle', width: '10%',formatter: function(val,row,index) {
|
||||
switch(row.poolType) {
|
||||
case 1:
|
||||
return '普通礼物组';
|
||||
break;
|
||||
@@ -100,9 +96,9 @@
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [10,20,30,50],
|
||||
pageList: [20,30,50],
|
||||
sidePagination: 'server',
|
||||
queryParamsType: 'undefined',
|
||||
queryParams: function queryParams(params) {
|
||||
|
4
pom.xml
4
pom.xml
@@ -96,7 +96,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.5</esayexcel.version>
|
||||
<easyexcel.version>3.2.1</easyexcel.version>
|
||||
<googlecode-libphonenumber.version>8.12.43</googlecode-libphonenumber.version>
|
||||
<ip2region.version>2.7.0</ip2region.version>
|
||||
<opencc4j.version>1.7.2</opencc4j.version>
|
||||
@@ -934,7 +934,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>${esayexcel.version}</version>
|
||||
<version>${easyexcel.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
Reference in New Issue
Block a user