金币兑换钻石-后台-结算明细-exchangeGolds

This commit is contained in:
2022-11-26 22:02:44 +08:00
parent 48f64f5925
commit 9e4823e79f
9 changed files with 21 additions and 54 deletions

View File

@@ -6,14 +6,11 @@ import com.accompany.business.model.clan.Clan;
import com.accompany.business.model.clan.ClanGoldSettlementRecord;
import com.accompany.business.service.clan.ClanGoldSettlementService;
import com.accompany.business.service.clan.ClanService;
import com.accompany.business.service.record.BillRecordService;
import com.accompany.business.service.user.UsersService;
import com.accompany.common.constant.Constant;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.core.enumeration.BillObjTypeEnum;
import com.accompany.core.model.Users;
import com.accompany.core.util.StringUtils;
import com.accompany.sharding.model.BillRecord;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -37,8 +34,6 @@ public class ClanGoldSettlementAdminService extends BaseService {
private ClanGoldSettlementService recordService;
@Autowired
private UsersService usersService;
@Autowired
private BillRecordService billRecordService;
public Page<ClanGoldSettlementRecordAdminVo> page(Integer pageNum, Integer pageSize, Long erbanNo, String beginDate, String endDate) {
Page<ClanGoldSettlementRecordAdminVo> voPage = new Page<>(pageNum, pageSize);
@@ -73,15 +68,6 @@ public class ClanGoldSettlementAdminService extends BaseService {
List<Clan> clanList = clanService.list(clanQueryWrapper);
Map<Long, Clan> clansMap = clanList.stream().collect(Collectors.toMap(Clan::getId, clan-> clan));
Date minDate = clanList.stream().map(Clan::getCreateTime).min(Date::compareTo).get();
Date now = new Date();
QueryWrapper<BillRecord> exchangeQueryWrapper = Wrappers.query();
exchangeQueryWrapper.lambda().select(BillRecord::getObjId, BillRecord::getAmount)
.between(BillRecord::getCreateTime, minDate, now)
.in(BillRecord::getObjId, clanIds).eq(BillRecord::getObjType, BillObjTypeEnum.EXCHANGE_GOLD_TO_DIAMOND_PAY.getValue());
Map<Long, Double> clanExchangeGoldsMap = billRecordService.list(exchangeQueryWrapper)
.stream().collect(Collectors.groupingBy(bill->Long.parseLong(bill.getObjId()), Collectors.summingDouble(bill->bill.getAmount().doubleValue())));
List<ClanGoldSettlementRecordAdminVo> voList = records.stream().map(record->{
ClanGoldSettlementRecordAdminVo vo = new ClanGoldSettlementRecordAdminVo();
BeanUtils.copyProperties(record, vo);
@@ -92,9 +78,6 @@ public class ClanGoldSettlementAdminService extends BaseService {
vo.setNick(clan.getName());
});
Double clanExchangeGolds = clanExchangeGoldsMap.get(record.getClanId());
vo.setExchangeGolds(null != clanExchangeGolds? Math.abs(clanExchangeGolds): 0d);
vo.setCreateTime(DateTimeUtil.convertDate(record.getCreateTime()));
return vo;
}).collect(Collectors.toList());
@@ -128,15 +111,6 @@ public class ClanGoldSettlementAdminService extends BaseService {
List<Long> uids = dbList.stream().map(ClanGoldSettlementRecord::getUid).distinct().collect(Collectors.toList());
Map<Long, Users> usersMap = usersService.getUsersListByUids(uids).stream().collect(Collectors.toMap(Users::getUid, users -> users));
Date minDate = usersMap.values().stream().map(Users::getCreateTime).min(Date::compareTo).get();
Date now = new Date();
QueryWrapper<BillRecord> exchangeQueryWrapper = Wrappers.query();
exchangeQueryWrapper.lambda().select(BillRecord::getUid, BillRecord::getAmount)
.between(BillRecord::getCreateTime, minDate, now)
.in(BillRecord::getUid, uids).eq(BillRecord::getObjType, BillObjTypeEnum.EXCHANGE_GOLD_TO_DIAMOND_PAY.getValue());
Map<Long, Double> exchangeGoldsMap = billRecordService.list(exchangeQueryWrapper)
.stream().collect(Collectors.groupingBy(BillRecord::getUid, Collectors.summingDouble(bill->bill.getAmount().doubleValue())));
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(2);
@@ -148,9 +122,6 @@ public class ClanGoldSettlementAdminService extends BaseService {
vo.setNick(users.getNick());
});
Double exchangeGolds = exchangeGoldsMap.get(item.getClanId());
vo.setExchangeGolds(null != exchangeGolds? Math.abs(exchangeGolds): 0d);
vo.setFee(nf.format(item.getFee()));
vo.setCreateTime(DateTimeUtil.convertDate(item.getCreateTime()));
voList.add(vo);

View File

@@ -24,11 +24,11 @@ public class ClanGoldSettlementRecordAdminVo {
@ExcelProperty("已兑换金币数")
private Double exchangeGolds;
@ExcelProperty("结算金币数")
private BigDecimal golds;
private Double golds;
@ExcelProperty("手续费")
private String fee;
@ExcelProperty("实际结算金币数")
private BigDecimal actualGolds;
private Double actualGolds;
@ExcelProperty("结算时间")
private String createTime;

View File

@@ -26,7 +26,6 @@ import java.util.stream.Collectors;
@RequestMapping("/admin/clanGoldSettlement")
public class ClanGoldSettlementAdminController extends BaseController {
@Autowired
private ClanGoldSettlementAdminService service;

View File

@@ -50,9 +50,11 @@ spring:
singleServerConfig:
address: redis://118.194.255.128:6200
password: anan@dev@redis@#!
connectionMinimumIdleSize: 8
timeout: 10000
threads: 16
nettyThreads: 32
codec: !<org.redisson.codec.MarshallingCodec> {}
codec: !<org.redisson.codec.JsonJacksonCodec> {}
transportMode: "NIO"
##activemq 配置

View File

@@ -13,10 +13,8 @@
<label for="clanErbanNo" class="col-sm-2 control-label">会长平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="clanErbanNo"></div>
<label for="beginDate" class="col-sm-1 control-label">开始时间:</label>
<label for="beginDate" class="col-sm-2 control-label">统计时间:</label>
<div class="col-sm-3"><input type="text" class="form-control" name="beginDate" id="beginDate"></div>
<label for="endDate" class="col-sm-1 control-label">结束时间:</label>
<div class="col-sm-3"><input type="text" class="form-control" name="endDate" id="endDate"></div>
</form>
</div>
@@ -173,7 +171,8 @@
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
settlementId: currentData.settlementId,
clanId: currentData.clanId,
createTime: currentData.createTime,
erbanNo: $('#erbanNo').val()
};
return param;

View File

@@ -50,9 +50,11 @@ spring:
singleServerConfig:
address: redis://118.194.255.128:6200
password: anan@dev@redis@#!
connectionMinimumIdleSize: 8
timeout: 10000
threads: 16
nettyThreads: 32
codec: !<org.redisson.codec.MarshallingCodec> {}
codec: !<org.redisson.codec.JsonJacksonCodec> {}
transportMode: "NIO"
##activemq 配置
@@ -71,4 +73,7 @@ elasticsearch:
username: elastic
password: xuanyin@es123
roomIndex: yinyou_dev_room
userIndex: yinyou_dev_users_202204121516
userIndex: yinyou_dev_users_202204121516
server:
port: 8081

View File

@@ -50,7 +50,7 @@ spring:
singleServerConfig:
address: redis://118.194.255.128:6200
password: anan@dev@redis@#!
connectionMinimumIdleSize: 16
connectionMinimumIdleSize: 8
timeout: 10000
threads: 16
nettyThreads: 32
@@ -73,7 +73,4 @@ elasticsearch:
username: elastic
password: xuanyin@es123
roomIndex: yinyou_dev_room
userIndex: yinyou_dev_users_202204121516
server:
port: 8081
userIndex: yinyou_dev_users_202204121516

View File

@@ -50,7 +50,7 @@ spring:
singleServerConfig:
address: redis://118.194.255.128:6200
password: anan@dev@redis@#!
connectionMinimumIdleSize: 16
connectionMinimumIdleSize: 8
timeout: 10000
threads: 16
nettyThreads: 32
@@ -73,7 +73,4 @@ elasticsearch:
username: elastic
password: xuanyin@es123
roomIndex: yinyou_dev_room
userIndex: yinyou_dev_users_202204121516
server:
port: 8081
userIndex: yinyou_dev_users_202204121516

View File

@@ -50,7 +50,7 @@ spring:
singleServerConfig:
address: redis://118.194.255.128:6200
password: anan@dev@redis@#!
connectionMinimumIdleSize: 16
connectionMinimumIdleSize: 8
timeout: 10000
threads: 16
nettyThreads: 32
@@ -73,7 +73,4 @@ elasticsearch:
username: elastic
password: xuanyin@es123
roomIndex: yinyou_dev_room
userIndex: yinyou_dev_users_202204121516
server:
port: 8081
userIndex: yinyou_dev_users_202204121516