修复代充bug

This commit is contained in:
liaozetao
2023-08-23 11:47:25 +08:00
parent 2f9e966f98
commit f51e09b876
10 changed files with 200 additions and 101 deletions

View File

@@ -0,0 +1,76 @@
package com.accompany.admin.dto.recharge;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author: liaozetao
* @date: 2023/8/23 11:41
* @description:
*/
@Data
public class RechargeDiamondGiveDetailAdminDto {
/**
* 时间
*/
@ExcelProperty("时间")
private String createTime;
/**
* 转出人peko id
*/
@ExcelProperty("转出人peko id")
private String fromErBanNo;
/**
* 转出人昵称
*/
@ExcelProperty("转出人昵称")
private String fromNick;
/**
* 转出人所在公会
*/
@ExcelProperty("转出人所在公会")
private String fromClanName;
/**
* 转出人所属代充地区
*/
@ExcelProperty("转出人所属代充地区")
private String fromRegion;
/**
* 收入人peko id
*/
@ExcelProperty("收入人peko id")
private String toErBanNo;
/**
* 收入人昵称
*/
@ExcelProperty("收入人昵称")
private String toNick;
/**
* 收入人地区
*/
@ExcelProperty("收入人地区")
private String toRegion;
/**
* 收入人填写的邀请码
*/
@ExcelProperty("收入人填写的邀请码")
private String inviteCode;
/**
* 转赠数额
*/
@ExcelProperty("转赠数额")
private BigDecimal diamondNum;
}

View File

@@ -2,6 +2,7 @@ package com.accompany.admin.service.recharge.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.accompany.admin.dto.recharge.RechargeDiamondGiveDetailAdminDto;
import com.accompany.admin.mapper.UserMapperExpand;
import com.accompany.admin.mapper.recharge.RechargeDiamondGiveHistoryAdminMapper;
import com.accompany.admin.service.recharge.RechargeDiamondGiveHistoryAdminService;
@@ -14,11 +15,13 @@ import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.ServletWebRequest;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -84,7 +87,15 @@ public class RechargeDiamondGiveHistoryAdminServiceImpl implements RechargeDiamo
req.setPage(1);
req.setPageSize(10000);
Page<RechargeDiamondGiveDetailAdminVo> page = giveDetailByDayPage(fromErBanNo, toErBanNo, toRegion, startTime, endTime, giveDate, req);
List<RechargeDiamondGiveDetailAdminDto> datas = new ArrayList<>();
List<RechargeDiamondGiveDetailAdminVo> records = page.getRecords();
if (CollectionUtil.isNotEmpty(records)) {
for (RechargeDiamondGiveDetailAdminVo record : records) {
RechargeDiamondGiveDetailAdminDto admin = new RechargeDiamondGiveDetailAdminDto();
BeanUtils.copyProperties(record, admin);
datas.add(admin);
}
}
if (servletWebRequest.getResponse() != null) {
try {
//这里注意 有同学反应使用swagger 会导致各种问题请直接用浏览器或者用postman
@@ -93,7 +104,7 @@ public class RechargeDiamondGiveHistoryAdminServiceImpl implements RechargeDiamo
//这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder.encode(giveDate + "代充转赠明细", "UTF-8").replaceAll("\\+", "%20");
servletWebRequest.getResponse().setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
EasyExcel.write(servletWebRequest.getResponse().getOutputStream(), RechargeDiamondGiveDetailAdminVo.class).sheet(giveDate + "代充转赠明细").doWrite(records);
EasyExcel.write(servletWebRequest.getResponse().getOutputStream(), RechargeDiamondGiveDetailAdminDto.class).sheet(giveDate + "代充转赠明细").doWrite(datas);
} catch (Exception e) {
log.error(e.getMessage(), e);
}

View File

@@ -1,7 +1,7 @@
package com.accompany.admin.vo.charge;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@@ -18,7 +18,7 @@ public class RechargeDiamondGiveDetailAdminVo {
/**
* 时间
*/
@ExcelProperty("时间")
@ApiModelProperty("时间")
private String createTime;
/**
@@ -29,19 +29,19 @@ public class RechargeDiamondGiveDetailAdminVo {
/**
* 转出人peko id
*/
@ExcelProperty("转出人peko id")
@ApiModelProperty("转出人peko id")
private String fromErBanNo;
/**
* 转出人昵称
*/
@ExcelProperty("转出人昵称")
@ApiModelProperty("转出人昵称")
private String fromNick;
/**
* 转出人所在公会
*/
@ExcelProperty("转出人所在公会")
@ApiModelProperty("转出人所在公会")
private String fromClanName;
private Integer type;
@@ -49,31 +49,37 @@ public class RechargeDiamondGiveDetailAdminVo {
/**
* 转出人所属代充地区
*/
@ExcelProperty("转出人所属代充地区")
@ApiModelProperty("转出人所属代充地区")
private String fromRegion;
/**
* 收入人peko id
*/
@ExcelProperty("收入人peko id")
@ApiModelProperty("收入人peko id")
private String toErBanNo;
/**
* 收入人昵称
*/
@ApiModelProperty("收入人昵称")
private String toNick;
/**
* 收入人地区
*/
@ExcelProperty("收入人地区")
private String toNick;
@ApiModelProperty("收入人地区")
private String toRegion;
/**
* 收入人填写的邀请码
*/
@ExcelProperty("收入人填写的邀请码")
@ApiModelProperty("收入人填写的邀请码")
private String inviteCode;
/**
* 转赠数额
*/
@ExcelProperty("转赠数额")
@ApiModelProperty("转赠数额")
private BigDecimal diamondNum;
}

View File

@@ -17,6 +17,7 @@
<if test="endTime != null and endTime != ''">
and date_format(dgh.create_time, '%Y-%m-%d') <![CDATA[ <= ]]> date_format(#{endTime}, '%Y-%m-%d')
</if>
and dgh.create_time >= DATE_SUB(CURDATE(), INTERVAL 90 DAY)
group by giveDate
order by giveDate desc
</select>
@@ -40,24 +41,26 @@
left join clan as c on c.id = ch.clan_id
left join recharge_user as ru on ru.uid = u1.uid
left join users as u2 on u2.uid = dgh.to_uid
<if test="fromErBanNo != null and fromErBanNo != ''">
and u1.erban_no like concat('%', #{fromErBanNo}, '%')
</if>
<if test="toErBanNo != null and toErBanNo != ''">
and u2.erban_no like concat('%', #{toErBanNo}, '%')
</if>
<if test="toRegion != null and toRegion != ''">
and u2.region = #{toRegion}
</if>
<if test="startTime != null and startTime != ''">
and dgh.create_time >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and dgh.create_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="giveDate != null and giveDate != ''">
and date_format(dgh.create_time, '%Y-%m-%d') = #{giveDate}
</if>
<where>
<if test="fromErBanNo != null and fromErBanNo != ''">
and u1.erban_no like concat('%', #{fromErBanNo}, '%')
</if>
<if test="toErBanNo != null and toErBanNo != ''">
and u2.erban_no like concat('%', #{toErBanNo}, '%')
</if>
<if test="toRegion != null and toRegion != ''">
and u2.region = #{toRegion}
</if>
<if test="startTime != null and startTime != ''">
and dgh.create_time >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and dgh.create_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="giveDate != null and giveDate != ''">
and date_format(dgh.create_time, '%Y-%m-%d') = #{giveDate}
</if>
</where>
order by dgh.create_time desc
</select>
</mapper>

View File

@@ -17,7 +17,7 @@
and u.erban_no = #{erbanNo}
</if>
<if test="regionType != null and regionType != 0">
and ((u.`type` <![CDATA[ & ]]> #{regionType}) != 0)
and ((ru.`type` <![CDATA[ & ]]> #{regionType}) != 0)
</if>
order by ru.create_time desc
</select>

View File

@@ -635,8 +635,8 @@
}
});
}
$('#chargeProd' + index).remove();
}
$('#chargeProd' + index).remove();
});
//地区

View File

@@ -10,15 +10,15 @@
<div id="toolbar">
<form id="searchForm" action="/admin/recharge/user/give/export" method="get" target="_blank">
<div class="col-sm-12">
<label for="fromErBanNo" class="col-sm-1 control-label">转出人id:</label>
<div class="col-sm-2">
<label for="fromErBanNo" class="col-sm-3 control-label">转出人id:</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="fromErBanNo" id="fromErBanNo">
</div>
<label for="toErBanNo" class="col-sm-1 control-label">收入人id:</label>
<div class="col-sm-2">
<label for="toErBanNo" class="col-sm-3 control-label">收入人id:</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="toErBanNo" id="toErBanNo">
</div>
<label for="toRegion" class="col-sm-1 control-label">收入人地区:</label>
<label for="toRegion" class="col-sm-3 control-label">收入人地区:</label>
<div class="col-sm-2">
<select name="toRegion" id="toRegion" data-btn-class="btn-warning"
class="form-control">
@@ -28,18 +28,16 @@
</div>
<div class="col-sm-12">
<label for="startTime" class="col-sm-2 control-label">时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="startTime"
<div class="col-sm-4"><input type="text" class="form-control" name="startTime"
id="startTime"></div>
<label for="endTime" class="col-sm-1 control-label">-</label>
<div class="col-sm-2"><input type="text" class="form-control" name="endTime"
<div class="col-sm-4"><input type="text" class="form-control" name="endTime"
id="endTime"></div>
</div>
</form>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
</div>
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-Export"></i>导出
</button>
@@ -158,7 +156,7 @@
});
var $select = $('#toRegion');
for(let i = 0; i < array.length; i++){
var value = data[i];
var value = array[i];
var $option = $('<option value="'+ value +'" />');
$option.html(value);
$select.append($option);

View File

@@ -21,10 +21,10 @@
<div id="toolbar">
<div class="col-sm-12">
<label for="startTime" class="col-sm-2 control-label">日期:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="startTime"
<div class="col-sm-4"><input type="text" class="form-control" name="startTime"
id="startTime"></div>
<label for="endTime" class="col-sm-1 control-label">-</label>
<div class="col-sm-2"><input type="text" class="form-control" name="endTime"
<div class="col-sm-4"><input type="text" class="form-control" name="endTime"
id="endTime"></div>
</div>
<div class="col-sm-12">
@@ -40,7 +40,7 @@
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-content" style="width:190%;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
@@ -217,6 +217,11 @@
$("#btnExport").on('click',function () {
$("#searchForm").submit();
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
});
</script>

View File

@@ -217,7 +217,6 @@
var region = regionArray[i];
var name = region.name;
var type = region.type;
var seq = region.seq;
var $formGroup = $('<div/>');
$formGroup.attr('id', 'region' + i);
$formGroup.attr('class', 'form-group');
@@ -227,7 +226,7 @@
$formGroup.append($label);
var $div = $('<div/>');
$div.attr('class', 'col-sm-9');
$div.html('<input type="text" readonly class="form-control" id="seq' + type + '" value="' + seq + '"/>');
$div.html('<input type="text" readonly class="form-control" id="seq' + type + '" value="0"/>');
$formGroup.append($div);
$form.append($formGroup);
}
@@ -306,10 +305,12 @@
if (regionArray) {
for (let i = 0; i < regionArray.length; i++) {
var region = regionArray[i];
var seq = 0;
var isCheck = false;
for (let j = 0; j < userRegions.length; j++) {
var userRegion = userRegions[j];
if (region.type == userRegion.type) {
seq = userRegion.seq;
isCheck = true;
break;
}
@@ -317,9 +318,11 @@
if (isCheck) {
$('input:checkbox[value="' + region.type + '"]').prop('checked', true);
$('#seq' + region.type).removeAttr('readonly');
$('#seq' + region.type).val(seq);
} else {
$("input:checkbox[value='" + region.type + "']").prop('checked', false);
$('#seq' + region.type).attr('readonly', 'true');
$('#seq' + region.type).val(0);
}
}
}

View File

@@ -275,22 +275,22 @@
prod_status = #{record.prodStatus,jdbcType=TINYINT},
</if>
<if test="record.country != null">
country = #{country,jdbcType=VARCHAR},
country = #{record.country,jdbcType=VARCHAR},
</if>
<if test="record.localCurrencyCode != null">
local_currency_code = #{localCurrencyCode,jdbcType=VARCHAR},
local_currency_code = #{record.localCurrencyCode,jdbcType=VARCHAR},
</if>
<if test="record.payChannel != null">
pay_channel = #{payChannel,jdbcType=VARCHAR},
pay_channel = #{record.payChannel,jdbcType=VARCHAR},
</if>
<if test="record.paymentType != null">
payment_type = #{paymentType,jdbcType=VARCHAR},
payment_type = #{record.paymentType,jdbcType=VARCHAR},
</if>
<if test="record.money != null">
money = #{record.money,jdbcType=BIGINT},
</if>
<if test="record.usdRate != null">
usd_rate = #{usdRate,jdbcType=DECIMAL},
usd_rate = #{record.usdRate,jdbcType=DECIMAL},
</if>
<if test="record.changeGoldRate != null">
change_gold_rate = #{record.changeGoldRate,jdbcType=INTEGER},
@@ -324,12 +324,12 @@
prod_name = #{record.prodName,jdbcType=VARCHAR},
prod_desc = #{record.prodDesc,jdbcType=VARCHAR},
prod_status = #{record.prodStatus,jdbcType=TINYINT},
country = #{country,jdbcType=VARCHAR},
local_currency_code = #{localCurrencyCode,jdbcType=VARCHAR},
pay_channel = #{payChannel,jdbcType=VARCHAR},
payment_type = #{paymentType,jdbcType=VARCHAR},
country = #{record.country,jdbcType=VARCHAR},
local_currency_code = #{record.localCurrencyCode,jdbcType=VARCHAR},
pay_channel = #{record.payChannel,jdbcType=VARCHAR},
payment_type = #{record.paymentType,jdbcType=VARCHAR},
money = #{record.money,jdbcType=BIGINT},
usd_rate = #{usdRate,jdbcType=DECIMAL},
usd_rate = #{record.usdRate,jdbcType=DECIMAL},
change_gold_rate = #{record.changeGoldRate,jdbcType=INTEGER},
gift_gold_num = #{record.giftGoldNum,jdbcType=INTEGER},
first_gift_gold_num = #{record.firstGiftGoldNum,jdbcType=INTEGER},
@@ -344,78 +344,75 @@
<update id="updateByPrimaryKeySelective" parameterType="com.accompany.payment.model.ChargeProd">
update charge_prod
<set>
<if test="record.chargeProdId != null">
charge_prod_id = #{record.chargeProdId,jdbcType=VARCHAR},
<if test="prodName != null">
prod_name = #{prodName,jdbcType=VARCHAR},
</if>
<if test="record.prodName != null">
prod_name = #{record.prodName,jdbcType=VARCHAR},
<if test="prodDesc != null">
prod_desc = #{prodDesc,jdbcType=VARCHAR},
</if>
<if test="record.prodDesc != null">
prod_desc = #{record.prodDesc,jdbcType=VARCHAR},
<if test="prodStatus != null">
prod_status = #{prodStatus,jdbcType=TINYINT},
</if>
<if test="record.prodStatus != null">
prod_status = #{record.prodStatus,jdbcType=TINYINT},
</if>
<if test="record.country != null">
<if test="country != null">
country = #{country,jdbcType=VARCHAR},
</if>
<if test="record.localCurrencyCode != null">
<if test="localCurrencyCode != null">
local_currency_code = #{localCurrencyCode,jdbcType=VARCHAR},
</if>
<if test="record.payChannel != null">
<if test="payChannel != null">
pay_channel = #{payChannel,jdbcType=VARCHAR},
</if>
<if test="record.paymentType != null">
<if test="paymentType != null">
payment_type = #{paymentType,jdbcType=VARCHAR},
</if>
<if test="record.money != null">
money = #{record.money,jdbcType=BIGINT},
<if test="money != null">
money = #{money,jdbcType=BIGINT},
</if>
<if test="record.usdRate != null">
<if test="usdRate != null">
usd_rate = #{usdRate,jdbcType=DECIMAL},
</if>
<if test="record.changeGoldRate != null">
change_gold_rate = #{record.changeGoldRate,jdbcType=INTEGER},
<if test="changeGoldRate != null">
change_gold_rate = #{changeGoldRate,jdbcType=INTEGER},
</if>
<if test="record.giftGoldNum != null">
gift_gold_num = #{record.giftGoldNum,jdbcType=INTEGER},
<if test="giftGoldNum != null">
gift_gold_num = #{giftGoldNum,jdbcType=INTEGER},
</if>
<if test="record.firstGiftGoldNum != null">
first_gift_gold_num = #{record.firstGiftGoldNum,jdbcType=INTEGER},
<if test="firstGiftGoldNum != null">
first_gift_gold_num = #{firstGiftGoldNum,jdbcType=INTEGER},
</if>
<if test="record.channel != null">
channel = #{record.channel,jdbcType=TINYINT},
<if test="channel != null">
channel = #{channel,jdbcType=TINYINT},
</if>
<if test="record.seqNo != null">
seq_no = #{record.seqNo,jdbcType=TINYINT},
<if test="seqNo != null">
seq_no = #{seqNo,jdbcType=TINYINT},
</if>
<if test="record.chargeGoldNum != null">
charge_gold_num = #{record.chargeGoldNum,jdbcType=BIGINT},
<if test="chargeGoldNum != null">
charge_gold_num = #{chargeGoldNum,jdbcType=BIGINT},
</if>
<if test="record.handlingRate != null">
handling_rate = #{record.handlingRate,jdbcType=DECIMAL},
<if test="handlingRate != null">
handling_rate = #{handlingRate,jdbcType=DECIMAL},
</if>
</set>
where charge_prod_id = #{chargeProdId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.accompany.payment.model.ChargeProd">
update charge_prod
set prod_name = #{record.prodName,jdbcType=VARCHAR},
prod_desc = #{record.prodDesc,jdbcType=VARCHAR},
prod_status = #{record.prodStatus,jdbcType=TINYINT},
set prod_name = #{prodName,jdbcType=VARCHAR},
prod_desc = #{prodDesc,jdbcType=VARCHAR},
prod_status = #{prodStatus,jdbcType=TINYINT},
country = #{country,jdbcType=VARCHAR},
local_currency_code = #{localCurrencyCode,jdbcType=VARCHAR},
pay_channel = #{payChannel,jdbcType=VARCHAR},
payment_type = #{paymentType,jdbcType=VARCHAR},
money = #{record.money,jdbcType=BIGINT},
money = #{money,jdbcType=BIGINT},
usd_rate = #{usdRate,jdbcType=DECIMAL},
change_gold_rate = #{record.changeGoldRate,jdbcType=INTEGER},
gift_gold_num = #{record.giftGoldNum,jdbcType=INTEGER},
first_gift_gold_num = #{record.firstGiftGoldNum,jdbcType=INTEGER},
channel = #{record.channel,jdbcType=TINYINT},
seq_no = #{record.seqNo,jdbcType=TINYINT},
charge_gold_num = #{record.chargeGoldNum,jdbcType=BIGINT},
handling_rate = #{record.handlingRate,jdbcType=DECIMAL}
change_gold_rate = #{changeGoldRate,jdbcType=INTEGER},
gift_gold_num = #{giftGoldNum,jdbcType=INTEGER},
first_gift_gold_num = #{firstGiftGoldNum,jdbcType=INTEGER},
channel = #{channel,jdbcType=TINYINT},
seq_no = #{seqNo,jdbcType=TINYINT},
charge_gold_num = #{chargeGoldNum,jdbcType=BIGINT},
handling_rate = #{handlingRate,jdbcType=DECIMAL}
where charge_prod_id = #{chargeProdId,jdbcType=VARCHAR}
</update>
</mapper>