公会长提现审核

This commit is contained in:
2024-08-20 14:59:34 +08:00
committed by khalil
parent ae6ec12b95
commit fa3f1c8886
16 changed files with 285 additions and 14 deletions

3
.gitignore vendored
View File

@@ -7,4 +7,5 @@ target/
**/.DS_Store
**/rebel.xml
**/.rebel.xml.bak
**/.rebel.xml.bak
/tmpI18n/

View File

@@ -0,0 +1,99 @@
package com.accompany.admin.controller.guild;
import com.accompany.admin.controller.BaseController;
import com.accompany.admin.service.system.AdminUserService;
import com.accompany.business.param.BasePageParams;
import com.accompany.business.service.guild.GuildUsdWithdrawRecordService;
import com.accompany.business.vo.guild.AgencyWithdrawExamineVo;
import com.accompany.common.status.BusiStatus;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.core.vo.BaseResponseVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/agencyWithdrawExamine")
public class AgencyWithdrawExamineController extends BaseController {
@Autowired
private GuildUsdWithdrawRecordService guildUsdWithdrawRecordService;
@Autowired
private AdminUserService adminUserService;
@ApiOperation("列表")
@GetMapping("/list")
public BaseResponseVO<Page<AgencyWithdrawExamineVo>> list(BasePageParams basePageParams, Long agencyOwnerErbanNo, Integer status) throws Exception {
Page<AgencyWithdrawExamineVo> iPage = guildUsdWithdrawRecordService.listPage(basePageParams,agencyOwnerErbanNo,status);
return new BaseResponseVO<>(iPage);
}
@ApiOperation("批量结算")
@PostMapping("/batchSettle")
public BaseResponseVO<Void> batchSettle(Integer[] ids){
String adminName = adminUserService.getAdminName(getAdminId());
guildUsdWithdrawRecordService.batchSettle(ids, adminName);
return new BaseResponseVO<>(BusiStatus.SUCCESS);
}
@ApiOperation("结算")
@PostMapping("/settle")
public BaseResponseVO<Void> settle(Integer id){
String adminName = adminUserService.getAdminName(getAdminId());
guildUsdWithdrawRecordService.settle(id, adminName, new Date());
return new BaseResponseVO<>(BusiStatus.SUCCESS);
}
@ApiOperation("导出")
@PostMapping("/export")
public BaseResponseVO<Void> export(HttpServletResponse response,BasePageParams basePageParams, Long agencyOwnerErbanNo, Integer status) throws IOException {
basePageParams.setPageSize(5000);
Page<AgencyWithdrawExamineVo> iPage = guildUsdWithdrawRecordService.listPage(basePageParams,agencyOwnerErbanNo,status);
List<AgencyWithdrawExamineVo> agencyMonthSettleDetailVos = iPage.getRecords();
HSSFWorkbook workbook = this.buildWithdrawExcel(agencyMonthSettleDetailVos);
// 设置下载时客户端Excel的名称
String filename = "agency_withdraw.xls";
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment;filename=" + filename);
response.setCharacterEncoding("UTF-8");
OutputStream ouputStream = response.getOutputStream();
workbook.write(ouputStream);
ouputStream.flush();
ouputStream.close();
return new BaseResponseVO(BusiStatus.SUCCESS);
}
private HSSFWorkbook buildWithdrawExcel(List<AgencyWithdrawExamineVo> agencyWithdrawExamineVos) {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("公会钻石流水统计");
String[] headers = {"公会ID","公会长ID","公会长昵称", "提现薪资", "创建时间", "状态", "操作时间","操作人"};
HSSFRow header = sheet.createRow(0);
for (int i = 0; i < headers.length; i++) {
header.createCell(i).setCellValue(headers[i]);
}
int rowNum = 1;
for (AgencyWithdrawExamineVo item : agencyWithdrawExamineVos) {
HSSFRow row = sheet.createRow(rowNum++);
row.createCell(0).setCellValue(item.getAgencyId());
row.createCell(1).setCellValue(item.getErbanNo());
row.createCell(2).setCellValue(item.getNick());
row.createCell(3).setCellValue(item.getGuildUsdNum().doubleValue());
row.createCell(4).setCellValue(DateTimeUtil.convertDate(item.getCreateTime()));
row.createCell(5).setCellValue(item.getStatus() == 0 ? "未结算":"已结算");
row.createCell(6).setCellValue(DateTimeUtil.convertDate(item.getUpdateTime()));
row.createCell(7).setCellValue(item.getOperator());
}
return workbook;
}
}

View File

@@ -236,7 +236,7 @@ public class DateTimeUtil {
* @param date 日期
* @return
*/
public static String convertDate(Date date) {
public static String convertDateTime(Date date) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATETIME_PATTERN);
return sdf.format(date);
@@ -245,6 +245,21 @@ public class DateTimeUtil {
}
return null;
}
/**
* 把日期转换成另一种格式
*
* @param date 日期
* @return
*/
public static String convertDate(Date date) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
return sdf.format(date);
} catch (Exception e) {
logger.warn("convertDate fail, date is " + date, e);
}
return null;
}
/**
* 把日期转换成另一种格式

View File

@@ -13,7 +13,7 @@ public class BasePageParams {
@ApiModelProperty("页大小")
private Integer pageSize = 10;
@ApiModelProperty("区域")
private Byte region ;
private Integer partitionId;
@ApiModelProperty("公会周期时间")
private String dateCycle ;

View File

@@ -0,0 +1,21 @@
package com.accompany.business.vo.guild;
import com.accompany.business.model.guild.GuildUsdWithdrawRecord;
import lombok.Data;
/**
* <p>
* 主播提现表
* </p>
*
* @author wxf
* @since 2024-08-01
*/
@Data
public class AgencyWithdrawExamineVo extends GuildUsdWithdrawRecord {
private Long agencyId;
private Long erbanNo;
private String nick;
private String abbr;
}

View File

@@ -1,11 +1,13 @@
package com.accompany.business.mybatismapper.guild;
import com.accompany.business.model.guild.Guild;
import com.accompany.business.vo.guild.AgencyOwnerVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface GuildMapper extends BaseMapper<Guild> {
@@ -16,4 +18,5 @@ public interface GuildMapper extends BaseMapper<Guild> {
@Param("partitionId") Integer partitionId,
@Param("guildName") String familyName);
List<AgencyOwnerVo> getAgencyOwnerByguildIds(@Param("guildIds") Set<Long> guildIds);
}

View File

@@ -16,10 +16,10 @@ public interface GuildMemberDiamondStatisticsMapper extends BaseMapper<GuildMemb
BigDecimal getTotalDiamondInCycle(@Param("cycleDate")String cycleDate, @Param("guildId")Integer guildId);
List<GuildMemberDiamondStatisticsVo> agencySettle(@Param("ppartitionId") Integer ppartitionId,
List<GuildMemberDiamondStatisticsVo> agencySettle(@Param("partitionId") Integer partitionId,
@Param("cycleDate") Date cycleDate, @Param("guildId") Long guildId);
List<GuildMemberDiamondStatisticsVo> agencySettleDetail(@Param("ppartitionId") Integer ppartitionId,
List<GuildMemberDiamondStatisticsVo> agencySettleDetail(@Param("partitionId") Integer partitionId,
@Param("cycleDate") Date cycleDate,
@Param("guildId") Long guildId,
@Param("uid") Long uid);

View File

@@ -1,8 +1,11 @@
package com.accompany.business.mybatismapper.guild;
import com.accompany.business.model.guild.GuildUsdWithdrawRecord;
import com.accompany.business.vo.guild.AgencyWithdrawExamineVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
public interface GuildUsdWithdrawRecordMapper extends BaseMapper<GuildUsdWithdrawRecord> {
Page<AgencyWithdrawExamineVo> listPage(@Param("page") Page<AgencyWithdrawExamineVo> page, @Param("agencyOwnerErbanNo") Long agencyOwnerErbanNo, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("region") Byte region, @Param("status") Integer status);
}

View File

@@ -1,19 +1,18 @@
package com.accompany.business.service.guild;
import cn.hutool.core.date.DateUtil;
import com.accompany.business.model.guild.AgencyMonthSettleDetail;
import com.accompany.business.model.guild.AgencyUserMonthSettleDetail;
import com.accompany.business.service.user.UsersService;
import com.accompany.business.vo.guild.UserHallEnergyLevelDataVo;
import com.accompany.core.service.common.JedisService;
import com.accompany.core.enumeration.PartitionEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.accompany.business.constant.guild.GuildUsdOperateTypeEnum.GUILD_USD_SETTLEMENT;
@@ -39,7 +38,7 @@ public class AgencyMonthSettleService {
public void monthRankTaskAll(Date beginDate, Date endDate) {
Integer partitionId = null;
Integer partitionId = PartitionEnum.ARAB.getId();
try {
List<UserHallEnergyLevelDataVo> userHallEnergyLevelDataVos = guildMemberDiamondStatisticsService.agencySettle(partitionId, beginDate, null);
if (CollectionUtils.isEmpty(userHallEnergyLevelDataVos)) {
@@ -66,7 +65,7 @@ public class AgencyMonthSettleService {
}
public void monthRankTaskDetail(Date beginDate, Date endDate) {
Integer partitionId = null;
Integer partitionId = PartitionEnum.ARAB.getId();
try {
List<UserHallEnergyLevelDataVo> userHallEnergyLevelDataVos = guildMemberDiamondStatisticsService.agencySettleDetail(partitionId, beginDate, null, null);
if (CollectionUtils.isEmpty(userHallEnergyLevelDataVos)) {

View File

@@ -2,12 +2,17 @@ package com.accompany.business.service.guild;
import com.accompany.business.model.guild.Guild;
import com.accompany.business.mybatismapper.guild.GuildMapper;
import com.accompany.business.vo.guild.AgencyOwnerVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@@ -45,4 +50,19 @@ public class GuildService extends ServiceImpl<GuildMapper, Guild> {
return this.baseMapper.listVaildGuildByPartitionId(partitionId);
}
public List<Guild> listAllEnable() {
return this.lambdaQuery()
.eq(Guild::getEnable, Boolean.TRUE).list();
}
public Map<Long, AgencyOwnerVo> getAgencyOwnerMapByHallIds(Set<Long> hallIds) {
List<AgencyOwnerVo> agencyOwnerVos = baseMapper.getAgencyOwnerByguildIds(hallIds);
if (CollectionUtils.isEmpty(agencyOwnerVos)){
return new HashMap<>();
}
return agencyOwnerVos.stream().collect(Collectors.toMap(AgencyOwnerVo::getGuildId, Function.identity()));
}
}

View File

@@ -2,7 +2,12 @@ package com.accompany.business.service.guild;
import com.accompany.business.model.guild.GuildUsdWithdrawRecord;
import com.accompany.business.mybatismapper.guild.GuildUsdWithdrawRecordMapper;
import com.accompany.business.param.BasePageParams;
import com.accompany.business.vo.guild.AgencyWithdrawExamineVo;
import com.accompany.common.constant.Constant;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.exception.ServiceException;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -27,4 +32,27 @@ public class GuildUsdWithdrawRecordService extends ServiceImpl<GuildUsdWithdrawR
save(record);
}
public Page<AgencyWithdrawExamineVo> listPage(BasePageParams basePageParams, Long agencyOwnerErbanNo, Integer status) {
if (agencyOwnerErbanNo == null){
throw new ServiceException(BusiStatus.SERVERERROR, "请输入公会长ID");
}
Page<AgencyWithdrawExamineVo> page = new Page<>(basePageParams.getPageNo(),basePageParams.getPageSize());
Page<AgencyWithdrawExamineVo> agencyWithdrawExamineVoPage = this.baseMapper.listPage(page, agencyOwnerErbanNo, basePageParams.getStartTime(), basePageParams.getEndTime(), basePageParams.getRegion(), status);
return agencyWithdrawExamineVoPage;
}
public void batchSettle(Integer[] ids, String operator) {
Date date = new Date();
for (Integer id : ids) {
this.settle(id,operator,date);
}
}
public void settle(Integer id, String operator, Date date) {
GuildUsdWithdrawRecord guildUsdWithdrawRecord = this.getById(id);
guildUsdWithdrawRecord.setUpdateTime(date);
guildUsdWithdrawRecord.setOperator(operator);
guildUsdWithdrawRecord.setStatus((byte)1);
this.updateById(guildUsdWithdrawRecord);
}
}

View File

@@ -1,6 +1,7 @@
package com.accompany.business.service.purse;
import com.accompany.business.model.UserPurse;
import com.accompany.business.model.UserPurseExample;
import com.accompany.business.model.clan.Clan;
import com.accompany.business.mybatismapper.UserPurseMapper;
import com.accompany.business.param.neteasepush.NeteasePushParam;
@@ -25,6 +26,7 @@ import com.accompany.core.enumeration.ExchangeTypeEnum;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.model.Users;
import com.accompany.core.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.google.gson.Gson;
@@ -36,13 +38,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Date;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* Created by liuguofu on 2017/7/2.
@@ -494,4 +498,14 @@ public class UserPurseService extends ServiceImpl<UserPurseMapper,UserPurse> {
return vo;
}
public Map<Long, UserPurse> getAgencyPurseMap(Set<Long> uids) {
LambdaQueryWrapper<UserPurse> wrapper = new LambdaQueryWrapper<>();
wrapper.in(UserPurse::getUid, uids);
List<UserPurse> purseInUids = baseMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(purseInUids)){
return new HashMap<>();
}
return purseInUids.stream().collect(Collectors.toMap(UserPurse::getUid,Function.identity()));
}
}

View File

@@ -1,5 +1,6 @@
package com.accompany.business.util;
import cn.hutool.core.date.DateUtil;
import com.accompany.common.utils.DateTimeUtil;
import java.time.ZonedDateTime;
@@ -28,6 +29,25 @@ public class GuildTimeUtil {
return zdt.with(TemporalAdjusters.firstDayOfMonth()).format(dateFormatter);
}
public static Date getAgencyCycleBeginDate(Date now) {
Date beginOfMonth = cn.hutool.core.date.DateUtil.beginOfMonth(now);
Date offsetDay = DateUtil.offsetDay(beginOfMonth, 15);
if (now.after(offsetDay)) {
return offsetDay;
}
return beginOfMonth;
}
public static Date getAgencyCycleEndDate(Date now) {
Date beginOfMonth = cn.hutool.core.date.DateUtil.beginOfMonth(now);
Date offsetDay = DateUtil.offsetDay(beginOfMonth, 15);
if (now.before(offsetDay)) {
return offsetDay;
}
return DateTimeUtil.addMonth(beginOfMonth,1);
}
public static void main(String[] args) {
System.out.println(getCurCycleDateByZoneId("Asia/Riyadh"));
}

View File

@@ -27,4 +27,21 @@
order by f.enable, f.id desc
</select>
<select id="getAgencyOwnerByguildIds" resultType="com.accompany.business.vo.guild.AgencyOwnerVo">
select
h.id guildId,
u.nick nick,
u.erban_no erbanNo,
u.uid onwerUid,
u.avatar avatar
from guild h
left join users u on h.owner_uid = u.uid
where 1 = 1
<if test="guildIds != null and guildIds.size() > 0">
and h.id in
<foreach collection="guildIds" open="(" separator="," close=")" item="id">
#{id}
</foreach>
</if>
</select>
</mapper>

View File

@@ -26,7 +26,11 @@
and hm.guild_id = ed.guild_id
and ed.cycle_date &gt;=#{cycleDate}
left join guild h on hm.guild_id = h.id
left join users u on hm.uid = u.uid
where hm.`enable` = 1
<if test="partitionId != null">
and u.partition_id = #{partitionId}
</if>
<if test="guildId != null">
and hm.guild_id = #{guildId}
</if>
@@ -43,7 +47,11 @@
and hm.guild_id = ed.guild_id
and ed.cycle_date &gt;=#{cycleDate}
left join guild h on hm.guild_id = h.id
left join users u on hm.uid = u.uid
where hm.`enable` = 1
<if test="partitionId != null">
and u.partition_id = #{partitionId}
</if>
<if test="guildId != null">
and hm.guild_id = #{guildId}
</if>

View File

@@ -2,4 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.accompany.business.mybatismapper.guild.GuildUsdWithdrawRecordMapper">
<select id="listPage" resultType="com.accompany.business.vo.guild.AgencyWithdrawExamineVo">
select awe.*,u.erban_no erbanNo,u.nick nick ,h.id agencyId
from guild_usd_withdraw_record awe
left join users u on awe.uid = u.uid
left join guild h on awe.guildId = h.id
where 1= 1
<if test="agencyOwnerErbanNo != null">
and u.erban_no = #{agencyOwnerErbanNo}
</if>
<if test="region != null">
and u.region = #{region}
</if>
<if test="startTime != null">
and awe.create_time >=#{startTime}
</if>
<if test="endTime != null">
and awe.create_time &lt;=#{endTime}
</if>
<if test="status != null">
and awe.status =#{status}
</if>
order by awe.create_time desc
</select>
</mapper>