公会月结算
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.accompany.business.model.guild;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公会月政策结算明细表实体类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-07-01
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgencyMonthSettleDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 结算时间
|
||||
*/
|
||||
private Date statDate;
|
||||
/**
|
||||
* 结算结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
private Long uid;
|
||||
/**
|
||||
* 所属厅id
|
||||
*/
|
||||
private Integer guildId;
|
||||
|
||||
private Integer diamondLevel;
|
||||
private Integer hallMemberCount;
|
||||
/**
|
||||
* 能量值
|
||||
*/
|
||||
private BigDecimal diamondNum;
|
||||
/**
|
||||
* 公会长工资
|
||||
*/
|
||||
private BigDecimal hallSalary;
|
||||
/**
|
||||
* 公会长薪资比例
|
||||
*/
|
||||
private Double salaryRate;
|
||||
/**
|
||||
* 区服
|
||||
*/
|
||||
private Byte region;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.accompany.business.model.guild;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公会活动成员奖励信息表实体类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-01-26
|
||||
*/
|
||||
@Data
|
||||
public class AgencySalaryInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private Integer levelId;
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private String levelName;
|
||||
/**
|
||||
* 开始能量值
|
||||
*/
|
||||
private Long startValue;
|
||||
/**
|
||||
* 结束能量值
|
||||
*/
|
||||
private Long endValue;
|
||||
/**
|
||||
* 奖励金币
|
||||
*/
|
||||
private Long rewardCoin;
|
||||
/**
|
||||
* 公会长薪资比例
|
||||
*/
|
||||
private Double salaryRate;
|
||||
|
||||
/**
|
||||
* 薪资兑换钻石数量
|
||||
*/
|
||||
private Long usbToDiamond;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.accompany.business.model.guild;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公会主播月政策结算明细表
|
||||
* </p>
|
||||
*
|
||||
* @author wxf
|
||||
* @since 2024-07-30
|
||||
*/
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("agency_user_month_settle_detail")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgencyUserMonthSettleDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 结算时间
|
||||
*/
|
||||
@TableField("stat_date")
|
||||
private Date statDate;
|
||||
|
||||
/**
|
||||
* 结算结束时间
|
||||
*/
|
||||
@TableField("end_date")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 主播id
|
||||
*/
|
||||
@TableField("uid")
|
||||
private Long uid;
|
||||
|
||||
/**
|
||||
* 所属厅id
|
||||
*/
|
||||
@TableField("guild_id")
|
||||
private Integer guildId;
|
||||
|
||||
/**
|
||||
* 钻石流水
|
||||
*/
|
||||
@TableField("diamond_num")
|
||||
private BigDecimal diamondNum;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.accompany.business.param;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasePageParams {
|
||||
|
||||
@ApiModelProperty("当前页")
|
||||
private Integer pageNo = 1;
|
||||
|
||||
@ApiModelProperty("页大小")
|
||||
private Integer pageSize = 10;
|
||||
@ApiModelProperty("区域")
|
||||
private Byte region ;
|
||||
@ApiModelProperty("公会周期时间")
|
||||
private String dateCycle ;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime ;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.accompany.business.vo.guild;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公会月政策结算明细表实体类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-07-01
|
||||
*/
|
||||
@Data
|
||||
public class AgencyMonthSettleDetailVo {
|
||||
private Long id;
|
||||
private Date statDate;
|
||||
private Date endDate;
|
||||
private Long uid;
|
||||
private Long hallId;
|
||||
|
||||
private Integer energyLevel;
|
||||
private Integer hallMemberCount;
|
||||
private BigDecimal energyValue;
|
||||
private BigDecimal hallSalary;
|
||||
private Double salaryRate;
|
||||
private Byte region;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private Long agencyId;
|
||||
private String agencyName;
|
||||
private String agencyAbbr;
|
||||
private Long agencyUid;
|
||||
private Long agencyErbanNo;
|
||||
private String agencyMarkRegion;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.accompany.business.vo.guild;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AgencyOpenAdminVo {
|
||||
private Long agencyId;
|
||||
private Long uid;
|
||||
private Long hallId;
|
||||
private Long agencyErbanNo;
|
||||
private Long erbanNo;
|
||||
/**
|
||||
* 钻石流水
|
||||
*/
|
||||
private Double diamondFlow;
|
||||
/**
|
||||
* 是否是有效主播
|
||||
*/
|
||||
private Integer effect;
|
||||
private Date createTime;
|
||||
/**
|
||||
* 有效主播数量
|
||||
*/
|
||||
private Integer effectAnchor;
|
||||
/**
|
||||
* 所有主播数量
|
||||
*/
|
||||
private Integer allAnchor;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String dateCycle;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.accompany.business.vo.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencySalaryInfo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AgencySalaryInfoVo extends AgencySalaryInfo {
|
||||
private String nextLevelName;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.accompany.business.vo.guild;
|
||||
|
||||
import com.accompany.business.model.guild.GuildMemberDiamondStatistics;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GuildMemberDiamondStatisticsVo extends GuildMemberDiamondStatistics {
|
||||
private Integer hallMemberCount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.accompany.business.vo.guild;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserHallEnergyLevelDataVo {
|
||||
|
||||
@ApiModelProperty("序号")
|
||||
private Integer seqNO;
|
||||
private Long uid;
|
||||
@ApiModelProperty("用户昵称")
|
||||
private String nick;
|
||||
@ApiModelProperty("ID")
|
||||
private Long erbanNo;
|
||||
@ApiModelProperty("公会长ID")
|
||||
private Long hallErbanNo;
|
||||
@ApiModelProperty("公会ID")
|
||||
private Integer agencyId;
|
||||
@ApiModelProperty("主播数")
|
||||
private Integer hallMemberCount;
|
||||
@ApiModelProperty("公会名称")
|
||||
private String agencyName;
|
||||
@ApiModelProperty("公会国家")
|
||||
private String agencyAbbr;
|
||||
@ApiModelProperty("能量等级")
|
||||
private Integer energyLevel;
|
||||
@ApiModelProperty("能量点")
|
||||
private Double energyValue;
|
||||
@ApiModelProperty("实时钻石余额")
|
||||
private Double diamondNum = 0D;
|
||||
@ApiModelProperty("主播薪资")
|
||||
private Double anchorSalary = 0D;
|
||||
@ApiModelProperty("公会长薪资")
|
||||
private BigDecimal hallSalary = BigDecimal.valueOf(0);
|
||||
@ApiModelProperty("时长薪资")
|
||||
private Double validTimeSalary = 0D;
|
||||
@ApiModelProperty("钻石薪资")
|
||||
private Double diamondSalary = 0D;
|
||||
@ApiModelProperty("公会总薪资")
|
||||
private Double totalHallSalary;
|
||||
@ApiModelProperty("cp能量点")
|
||||
private Double cpEnergyValue = 0D;
|
||||
@ApiModelProperty("cp能量等级")
|
||||
private Integer cpEnergyLevel = 0;
|
||||
@ApiModelProperty("cp能量值薪资")
|
||||
private Double cpSalary = 0D;
|
||||
@ApiModelProperty("账户国家")
|
||||
private String abbr;
|
||||
@ApiModelProperty("有效天数")
|
||||
private Integer micValidDay;
|
||||
private Long micTime;
|
||||
private Integer hallId;
|
||||
private Date signTime;
|
||||
private Byte region;
|
||||
|
||||
@ApiModelProperty("下一档能量值")
|
||||
private BigDecimal nextEnergValue = BigDecimal.valueOf(0);
|
||||
@ApiModelProperty("当前能量等级档位")
|
||||
private BigDecimal energyPosition;
|
||||
@ApiModelProperty("当前公会能量等级档位")
|
||||
private String currentLevelName;
|
||||
private String nextLevelName;
|
||||
/**
|
||||
* 公会长薪资比例
|
||||
*/
|
||||
private Double salaryRate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.accompany.business.mybatismapper.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyMonthSettleDetail;
|
||||
import com.accompany.business.vo.guild.AgencyMonthSettleDetailVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公会月政策结算明细表 Mapper 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2024-07-01
|
||||
*/
|
||||
public interface AgencyMonthSettleDetailMapper extends BaseMapper<AgencyMonthSettleDetail> {
|
||||
|
||||
AgencyMonthSettleDetail totalSalaryData(@Param("beginDate") Date beginDate, @Param("guildId") Long guildId);
|
||||
List<AgencyMonthSettleDetail> userSalaryData(@Param("beginDate") Date beginDate, @Param("guildId") Long diamondNum);
|
||||
|
||||
Page<AgencyMonthSettleDetailVo> agencySettleVo(@Param("page") Page<AgencyMonthSettleDetailVo> page, @Param("dateCycle") String dateCycle, @Param("region") Byte region, @Param("guildId") Long guildId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.accompany.business.mybatismapper.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencySalaryInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* SS公会活动成员奖励信息表 Mapper 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2024-01-26
|
||||
*/
|
||||
public interface AgencySalaryInfoMapper extends BaseMapper<AgencySalaryInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.accompany.business.mybatismapper.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyUserMonthSettleDetail;
|
||||
import com.accompany.business.vo.guild.AgencyOpenAdminVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公会主播月政策结算明细表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wxf
|
||||
* @since 2024-07-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface AgencyUserMonthSettleDetailMapper extends BaseMapper<AgencyUserMonthSettleDetail> {
|
||||
List<AgencyUserMonthSettleDetail> agencySettleDetailVo(@Param("date") String date, @Param("uid") Long uid, @Param("hallId") Long hallId);
|
||||
|
||||
Page<AgencyOpenAdminVo> excellentAnchorList(@Param("page") Page<AgencyOpenAdminVo> page, @Param("hallId") Long hallId, @Param("dateCycle") String dateCycle, @Param("excellentAnchorDiamondNum") Long excellentAnchorDiamondNum);
|
||||
|
||||
Page<AgencyOpenAdminVo> excellentAnchorDetailList(@Param("page") Page<AgencyOpenAdminVo> page, @Param("hallId") Long hallId, @Param("dateCycle") String dateCycle, @Param("excellentAnchorDiamondNum") Long excellentAnchorDiamondNum);
|
||||
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.accompany.business.mybatismapper.guild;
|
||||
|
||||
import com.accompany.business.model.guild.GuildMemberDiamondStatistics;
|
||||
import com.accompany.business.vo.guild.GuildMemberDiamondStatisticsVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface GuildMemberDiamondStatisticsMapper extends BaseMapper<GuildMemberDiamondStatistics> {
|
||||
|
||||
@@ -13,4 +15,12 @@ public interface GuildMemberDiamondStatisticsMapper extends BaseMapper<GuildMemb
|
||||
@Param("diamond")Double diamond, @Param("time")Date time);
|
||||
|
||||
BigDecimal getTotalDiamondInCycle(@Param("cycleDate")String cycleDate, @Param("guildId")Integer guildId);
|
||||
|
||||
List<GuildMemberDiamondStatisticsVo> agencySettle(@Param("ppartitionId") Integer ppartitionId,
|
||||
@Param("cycleDate") Date cycleDate, @Param("guildId") Long guildId);
|
||||
|
||||
List<GuildMemberDiamondStatisticsVo> agencySettleDetail(@Param("ppartitionId") Integer ppartitionId,
|
||||
@Param("cycleDate") Date cycleDate,
|
||||
@Param("guildId") Long guildId,
|
||||
@Param("uid") Long uid);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyMonthSettleDetail;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.business.vo.guild.AgencyMonthSettleDetailVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公会月政策结算明细表 服务类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-07-01
|
||||
*/
|
||||
public interface AgencyMonthSettleDetailService extends IService<AgencyMonthSettleDetail> {
|
||||
|
||||
AgencyMonthSettleDetail totalSalaryData(Date beginDate, Long hallId);
|
||||
List<AgencyMonthSettleDetail> userSalaryData(Date beginDate, Long hallId);
|
||||
|
||||
List<AgencyMonthSettleDetail> listPage(Long hallId, Integer page, Integer pageSize);
|
||||
|
||||
Page<AgencyMonthSettleDetailVo> agencySettleVo(BasePageParams basePageParams, String dateCycle, Long hallId);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyMonthSettleDetail;
|
||||
import com.accompany.business.mybatismapper.guild.AgencyMonthSettleDetailMapper;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.business.vo.guild.AgencyMonthSettleDetailVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公会月政策结算明细表 服务实现类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-07-01
|
||||
*/
|
||||
@Service
|
||||
public class AgencyMonthSettleDetailServiceImpl extends ServiceImpl<AgencyMonthSettleDetailMapper, AgencyMonthSettleDetail> implements AgencyMonthSettleDetailService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AgencyMonthSettleDetail totalSalaryData(Date beginDate, Long hallId) {
|
||||
return baseMapper.totalSalaryData(beginDate, hallId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AgencyMonthSettleDetail> userSalaryData(Date beginDate, Long hallId) {
|
||||
return baseMapper.userSalaryData(beginDate, hallId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AgencyMonthSettleDetail> listPage(Long hallId, Integer page, Integer pageSize) {
|
||||
LambdaQueryWrapper<AgencyMonthSettleDetail> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(AgencyMonthSettleDetail::getGuildId, hallId);
|
||||
wrapper.orderByDesc(AgencyMonthSettleDetail::getStatDate);
|
||||
IPage<AgencyMonthSettleDetail> agencyMonthSettleDetailIPage = baseMapper.selectPage(new Page<>(page, pageSize, false), wrapper);
|
||||
return agencyMonthSettleDetailIPage.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AgencyMonthSettleDetailVo> agencySettleVo(BasePageParams basePageParams, String dateCycle, Long hallId) {
|
||||
|
||||
Page<AgencyMonthSettleDetailVo> page = new Page<>(basePageParams.getPageNo(),basePageParams.getPageSize());
|
||||
|
||||
return this.baseMapper.agencySettleVo(page,dateCycle,basePageParams.getRegion(),hallId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
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 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 static com.accompany.business.constant.guild.GuildUsdOperateTypeEnum.GUILD_USD_SETTLEMENT;
|
||||
|
||||
|
||||
/**
|
||||
* 公会月政策结算表 服务实现类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AgencyMonthSettleService {
|
||||
|
||||
@Autowired
|
||||
private AgencyMonthSettleDetailService agencyMonthSettleDetailService;
|
||||
@Autowired
|
||||
private AgencyUserMonthSettleDetailService agencyUserMonthSettleDetailService;
|
||||
@Autowired
|
||||
private GuildMemberDiamondStatisticsService guildMemberDiamondStatisticsService;
|
||||
@Autowired
|
||||
private GuildUsdOperateService guildUsdOperateService;
|
||||
|
||||
|
||||
public void monthRankTaskAll(Date beginDate, Date endDate) {
|
||||
Integer partitionId = null;
|
||||
try {
|
||||
List<UserHallEnergyLevelDataVo> userHallEnergyLevelDataVos = guildMemberDiamondStatisticsService.agencySettle(partitionId, beginDate, null);
|
||||
if (CollectionUtils.isEmpty(userHallEnergyLevelDataVos)) {
|
||||
return;
|
||||
}
|
||||
List<AgencyMonthSettleDetail> agencyMonthSettleDetails = new ArrayList<>();
|
||||
for (UserHallEnergyLevelDataVo dataVo : userHallEnergyLevelDataVos) {
|
||||
AgencyMonthSettleDetail agencyMonthSettleDetail = AgencyMonthSettleDetail.builder().uid(dataVo.getUid()).guildId(dataVo.getHallId())
|
||||
.diamondLevel(dataVo.getEnergyLevel()).diamondNum(BigDecimal.valueOf(dataVo.getEnergyValue())).hallMemberCount(dataVo.getHallMemberCount())
|
||||
.hallSalary(dataVo.getHallSalary()).salaryRate(dataVo.getSalaryRate()).createTime(new Date()).statDate(beginDate).endDate(endDate).build();
|
||||
agencyMonthSettleDetails.add(agencyMonthSettleDetail);
|
||||
}
|
||||
agencyMonthSettleDetailService.saveBatch(agencyMonthSettleDetails);
|
||||
for (UserHallEnergyLevelDataVo dataVo : userHallEnergyLevelDataVos) {
|
||||
if (dataVo.getHallSalary().doubleValue() == 0) {
|
||||
continue;
|
||||
}
|
||||
guildUsdOperateService.operateUsd(dataVo.getUid(), null, GUILD_USD_SETTLEMENT.getType(), dataVo.getHallSalary());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("AgencyMonthSettleServiceImpl.monthRankTaskAll, region:{} e:{}", partitionId, e);
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
public void monthRankTaskDetail(Date beginDate, Date endDate) {
|
||||
Integer partitionId = null;
|
||||
try {
|
||||
List<UserHallEnergyLevelDataVo> userHallEnergyLevelDataVos = guildMemberDiamondStatisticsService.agencySettleDetail(partitionId, beginDate, null, null);
|
||||
if (CollectionUtils.isEmpty(userHallEnergyLevelDataVos)) {
|
||||
return;
|
||||
}
|
||||
List<AgencyUserMonthSettleDetail> agencyUserMonthSettleDetails = new ArrayList<>();
|
||||
for (UserHallEnergyLevelDataVo dataVo : userHallEnergyLevelDataVos) {
|
||||
AgencyUserMonthSettleDetail agencyMonthSettleDetail = AgencyUserMonthSettleDetail.builder().uid(dataVo.getUid()).guildId(dataVo.getHallId())
|
||||
.diamondNum(BigDecimal.valueOf(dataVo.getEnergyValue())).createTime(new Date()).statDate(beginDate).endDate(endDate).build();
|
||||
agencyUserMonthSettleDetails.add(agencyMonthSettleDetail);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(agencyUserMonthSettleDetails)) {
|
||||
log.info("empty agencyUserMonthSettleDetails");
|
||||
return;
|
||||
}
|
||||
boolean saveBatch = agencyUserMonthSettleDetailService.saveBatch(agencyUserMonthSettleDetails);
|
||||
if (!saveBatch) {
|
||||
log.info("empty agencyUserMonthSettleDetails");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("AgencyMonthSettleServiceImpl.monthRankTaskAll, region:{} e:{}", partitionId, e);
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencySalaryInfo;
|
||||
import com.accompany.business.vo.guild.AgencySalaryInfoVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SS公会活动成员奖励信息表 服务类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-01-26
|
||||
*/
|
||||
public interface AgencySalaryInfoService extends IService<AgencySalaryInfo> {
|
||||
|
||||
|
||||
AgencySalaryInfo getByLevel(Integer level);
|
||||
|
||||
|
||||
AgencySalaryInfoVo calByValue(Double energyValue, List<AgencySalaryInfo> list);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencySalaryInfo;
|
||||
import com.accompany.business.mybatismapper.guild.AgencySalaryInfoMapper;
|
||||
import com.accompany.business.vo.guild.AgencySalaryInfoVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公会活动成员奖励信息表 服务实现类
|
||||
*
|
||||
* @author
|
||||
* @since 2024-01-26
|
||||
*/
|
||||
@Service
|
||||
public class AgencySalaryInfoServiceImpl extends ServiceImpl<AgencySalaryInfoMapper, AgencySalaryInfo> implements AgencySalaryInfoService {
|
||||
|
||||
|
||||
@Override
|
||||
public AgencySalaryInfo getByLevel(Integer level) {
|
||||
LambdaQueryWrapper<AgencySalaryInfo> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(AgencySalaryInfo::getLevelId, level)
|
||||
.orderByAsc(AgencySalaryInfo::getStartValue);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgencySalaryInfoVo calByValue(Double energyValue, List<AgencySalaryInfo> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
int size = list.size();
|
||||
AgencySalaryInfoVo result = null;
|
||||
for (int i = 0; i < size; i++) {
|
||||
AgencySalaryInfo agencySalaryInfo = list.get(i);
|
||||
if (agencySalaryInfo.getStartValue() <= energyValue && agencySalaryInfo.getEndValue() > energyValue) {
|
||||
result = new AgencySalaryInfoVo();
|
||||
BeanUtils.copyProperties(agencySalaryInfo, result);
|
||||
if ((i + 1) < size) {
|
||||
AgencySalaryInfo salaryInfo = list.get(i + 1);
|
||||
if (salaryInfo != null) {
|
||||
result.setNextLevelName(salaryInfo.getLevelName());
|
||||
} else {
|
||||
result.setEndValue(0L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyUserMonthSettleDetail;
|
||||
import com.accompany.business.vo.guild.AgencyOpenAdminVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公会主播月政策结算明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wxf
|
||||
* @since 2024-07-30
|
||||
*/
|
||||
public interface AgencyUserMonthSettleDetailService extends IService<AgencyUserMonthSettleDetail> {
|
||||
List<AgencyUserMonthSettleDetail> agencySettleDetailVo(String date, Long uid, Long hallId);
|
||||
|
||||
Page<AgencyOpenAdminVo> excellentAnchorList(Page<AgencyOpenAdminVo> page, Long hallId, String dateCycle, Long excellentAnchorDiamondNum);
|
||||
|
||||
Page<AgencyOpenAdminVo> excellentAnchorDetailList(Page<AgencyOpenAdminVo> page, Long hallId, String dateCycle, Long excellentAnchorDiamondNum);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencyUserMonthSettleDetail;
|
||||
import com.accompany.business.mybatismapper.guild.AgencyUserMonthSettleDetailMapper;
|
||||
import com.accompany.business.vo.guild.AgencyOpenAdminVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公会主播月政策结算明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wxf
|
||||
* @since 2024-07-30
|
||||
*/
|
||||
@Service
|
||||
public class AgencyUserMonthSettleDetailServiceImpl extends ServiceImpl<AgencyUserMonthSettleDetailMapper, AgencyUserMonthSettleDetail> implements AgencyUserMonthSettleDetailService {
|
||||
|
||||
@Override
|
||||
public List<AgencyUserMonthSettleDetail> agencySettleDetailVo(String date, Long uid, Long hallId) {
|
||||
return this.baseMapper.agencySettleDetailVo(date,uid,hallId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AgencyOpenAdminVo> excellentAnchorList(Page<AgencyOpenAdminVo> page, Long hallId, String dateCycle, Long excellentAnchorDiamondNum) {
|
||||
return this.baseMapper.excellentAnchorList(page,hallId,dateCycle,excellentAnchorDiamondNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AgencyOpenAdminVo> excellentAnchorDetailList(Page<AgencyOpenAdminVo> page, Long hallId, String dateCycle, Long excellentAnchorDiamondNum) {
|
||||
return this.baseMapper.excellentAnchorDetailList(page,hallId,dateCycle,excellentAnchorDiamondNum);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,31 @@
|
||||
package com.accompany.business.service.guild;
|
||||
|
||||
import com.accompany.business.model.guild.AgencySalaryInfo;
|
||||
import com.accompany.business.model.guild.GuildMember;
|
||||
import com.accompany.business.model.guild.GuildMemberDiamondStatistics;
|
||||
import com.accompany.business.mybatismapper.guild.GuildMemberDiamondStatisticsMapper;
|
||||
import com.accompany.business.vo.guild.AgencySalaryInfoVo;
|
||||
import com.accompany.business.vo.guild.GuildMemberDiamondStatisticsVo;
|
||||
import com.accompany.business.vo.guild.UserHallEnergyLevelDataVo;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GuildMemberDiamondStatisticsService extends ServiceImpl<GuildMemberDiamondStatisticsMapper, GuildMemberDiamondStatistics> {
|
||||
|
||||
@Autowired
|
||||
private AgencySalaryInfoService agencySalaryInfoService;
|
||||
|
||||
public void update(String cycleDate, GuildMember guildMember, double diamond){
|
||||
Date now = new Date();
|
||||
this.baseMapper.updateDiamondStatistics(cycleDate, guildMember.getGuildId(), guildMember.getUid(), diamond, now);
|
||||
@@ -22,4 +36,54 @@ public class GuildMemberDiamondStatisticsService extends ServiceImpl<GuildMember
|
||||
return null != totalDiamond? totalDiamond: BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public List<UserHallEnergyLevelDataVo> agencySettle(Integer partitionId, Date cycleDate, Long guildId) {
|
||||
List<UserHallEnergyLevelDataVo> resultList = new ArrayList<>();
|
||||
List<GuildMemberDiamondStatisticsVo> guildMemberDiamondStatistics = baseMapper.agencySettle(partitionId, cycleDate, guildId);
|
||||
if (CollectionUtils.isEmpty(guildMemberDiamondStatistics)) {
|
||||
return resultList;
|
||||
}
|
||||
List<AgencySalaryInfo> list = agencySalaryInfoService.list();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
log.info("empty SsAgencyCoinsReward");
|
||||
return resultList;
|
||||
}
|
||||
for (GuildMemberDiamondStatisticsVo levelDay : guildMemberDiamondStatistics) {
|
||||
UserHallEnergyLevelDataVo vo = new UserHallEnergyLevelDataVo();
|
||||
Long uid = levelDay.getUid();
|
||||
vo.setUid(uid);
|
||||
vo.setHallId(levelDay.getGuildId());
|
||||
vo.setEnergyValue(levelDay.getDiamondNum());
|
||||
AgencySalaryInfoVo ssAgencyCoinsReward = agencySalaryInfoService.calByValue(levelDay.getDiamondNum(), list);
|
||||
if (ssAgencyCoinsReward != null) {
|
||||
vo.setEnergyLevel(ssAgencyCoinsReward.getLevelId());
|
||||
vo.setHallSalary(BigDecimal.valueOf(levelDay.getDiamondNum() * ssAgencyCoinsReward.getSalaryRate())
|
||||
.divide(BigDecimal.valueOf(ssAgencyCoinsReward.getUsbToDiamond()), 2, BigDecimal.ROUND_HALF_UP));
|
||||
vo.setNextEnergValue(BigDecimal.valueOf(ssAgencyCoinsReward.getEndValue()));
|
||||
vo.setEnergyPosition(BigDecimal.valueOf(ssAgencyCoinsReward.getStartValue()));
|
||||
vo.setCurrentLevelName(ssAgencyCoinsReward.getLevelName());
|
||||
vo.setSalaryRate(ssAgencyCoinsReward.getSalaryRate());
|
||||
vo.setNextLevelName(ssAgencyCoinsReward.getNextLevelName());
|
||||
vo.setHallMemberCount(levelDay.getHallMemberCount());
|
||||
}
|
||||
resultList.add(vo);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public List<UserHallEnergyLevelDataVo> agencySettleDetail(Integer partitionId, Date beginDate, Long guildId, Long uid) {
|
||||
List<UserHallEnergyLevelDataVo> resultList = new ArrayList<>();
|
||||
List<GuildMemberDiamondStatisticsVo> statisticsVos = baseMapper.agencySettleDetail(partitionId, beginDate, guildId, uid);
|
||||
if (CollectionUtils.isEmpty(statisticsVos)) {
|
||||
return resultList;
|
||||
}
|
||||
for (GuildMemberDiamondStatisticsVo levelDay : statisticsVos) {
|
||||
UserHallEnergyLevelDataVo vo = new UserHallEnergyLevelDataVo();
|
||||
Long hallUid = levelDay.getUid();
|
||||
vo.setUid(hallUid);
|
||||
vo.setHallId(levelDay.getGuildId());
|
||||
vo.setEnergyValue(levelDay.getDiamondNum());
|
||||
resultList.add(vo);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.accompany.business.service.guild;
|
||||
import com.accompany.business.model.guild.Guild;
|
||||
import com.accompany.business.mybatismapper.guild.GuildMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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.business.mybatismapper.guild.AgencyMonthSettleDetailMapper">
|
||||
|
||||
|
||||
<select id="totalSalaryData" resultType="com.accompany.business.model.guild.AgencyMonthSettleDetail">
|
||||
select ifnull(sum(anchor_salary), 0) anchorSalary,
|
||||
ifnull(sum(diamond_salary), 0) diamondSalary,
|
||||
ifnull(sum(hall_salary), 0) hallSalary,
|
||||
ifnull(sum(anchor_salary), 0) anchorSalary
|
||||
from agency_month_settle_detail
|
||||
where stat_date = #{beginDate}
|
||||
and guild_id = #{guildId}
|
||||
</select>
|
||||
|
||||
<select id="userSalaryData" resultType="com.accompany.business.model.guild.AgencyMonthSettleDetail">
|
||||
select guild_id guildId, uid, ifnull(sum(anchor_salary), 0) anchorSalary,
|
||||
ifnull(sum(diamond_salary), 0) diamondSalary,
|
||||
ifnull(sum(hall_salary), 0) hallSalary,
|
||||
ifnull(sum(diamond_num), 0) diamondNum,
|
||||
ifnull(sum(anchor_salary), 0) anchorSalary,
|
||||
ifnull(sum(cp_salary), 0) cpSalary,
|
||||
ifnull(sum(mic_time), 0) micTime,
|
||||
ifnull(sum(mic_valid_day), 0) micValidDay
|
||||
from agency_month_settle_detail
|
||||
where stat_date = #{beginDate}
|
||||
and guild_id = #{guildId}
|
||||
group by guild_id, uid
|
||||
order by anchorSalary desc
|
||||
</select>
|
||||
<select id="agencySettleVo" resultType="com.accompany.business.vo.guild.AgencyMonthSettleDetailVo">
|
||||
select
|
||||
u.erban_no agencyErbanNo ,
|
||||
u.region region,
|
||||
h.agency_id agencyId ,
|
||||
h.name agencyName ,
|
||||
h.abbr agencyAbbr,
|
||||
amsd.hall_member_count hallMemberCount,
|
||||
amsd.diamond_num energyValue,
|
||||
amsd.hall_salary hallSalary,
|
||||
amsd.salary_rate salaryRate
|
||||
|
||||
from agency_month_settle_detail amsd
|
||||
left join users u on amsd.uid = u.uid
|
||||
left join guild h on amsd.guild_id = h.id
|
||||
where amsd.stat_date = #{dateCycle}
|
||||
<if test="guildId != null">
|
||||
and amsd.guild_id = #{guildId}
|
||||
</if>
|
||||
<if test="region != null">
|
||||
and amsd.region = #{region}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?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.business.mybatismapper.guild.AgencySalaryInfoMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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.business.mybatismapper.guild.AgencyUserMonthSettleDetailMapper">
|
||||
|
||||
<select id="agencySettleDetailVo"
|
||||
resultType="com.accompany.business.model.guild.AgencyUserMonthSettleDetail">
|
||||
select * from agency_user_month_settle_detail where stat_date = #{date}
|
||||
<if test="hallId != null">
|
||||
and guild_id = #{hallId}
|
||||
</if>
|
||||
<if test="uid != null">
|
||||
and uid = #{uid}
|
||||
</if>
|
||||
</select>
|
||||
<select id="excellentAnchorList" resultType="com.accompany.business.vo.guild.AgencyOpenAdminVo">
|
||||
SELECT stat_date dateCycle,guild_id guildId,uid, SUM(IF(diamond_num > #{excellentAnchorDiamondNum},1,0)) effectAnchor ,count(DISTINCT uid) allAnchor
|
||||
FROM agency_user_month_settle_detail
|
||||
WHERE stat_date = #{dateCycle} AND guild_id = #{hallId}
|
||||
GROUP BY guild_id
|
||||
</select>
|
||||
<select id="excellentAnchorDetailList"
|
||||
resultType="com.accompany.business.vo.guild.AgencyOpenAdminVo">
|
||||
SELECT guild_id hallId,uid uid,energy_value diamondFlow,IF(diamond_num > #{excellentAnchorDiamondNum},1,0) effect
|
||||
FROM agency_user_month_settle_detail
|
||||
WHERE stat_date = #{dateCycle} AND guild_id = #{hallId}
|
||||
order by diamondFlow desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -15,4 +15,41 @@
|
||||
where cycle_date = #{cycleDate} and guild_id = #{guildId}
|
||||
</select>
|
||||
|
||||
<select id="agencySettle" resultType="com.accompany.business.vo.guild.GuildMemberDiamondStatisticsVo">
|
||||
select
|
||||
hm.guild_id guildId,
|
||||
h.owner_uid uid,
|
||||
count(hm.uid) hallMemberCount,
|
||||
sum(IFNULL(ed.diamond_num, 0)) diamondNum
|
||||
from guild_member hm
|
||||
left join guild_member_diamond_statistics ed on hm.uid = ed.uid
|
||||
and hm.guild_id = ed.guild_id
|
||||
and ed.cycle_date >=#{cycleDate}
|
||||
left join guild h on hm.guild_id = h.id
|
||||
where hm.`enable` = 1
|
||||
<if test="guildId != null">
|
||||
and hm.guild_id = #{guildId}
|
||||
</if>
|
||||
group by hm.guild_id
|
||||
</select>
|
||||
|
||||
<select id="agencySettleDetail" resultType="com.accompany.business.vo.guild.GuildMemberDiamondStatisticsVo">
|
||||
select
|
||||
hm.guild_id guildId,
|
||||
hm.uid uid,
|
||||
sum(IFNULL(ed.diamond_num, 0)) diamondNum
|
||||
from guild_member hm
|
||||
left join guild_member_diamond_statistics ed on hm.uid = ed.uid
|
||||
and hm.guild_id = ed.guild_id
|
||||
and ed.cycle_date >=#{cycleDate}
|
||||
left join guild h on hm.guild_id = h.id
|
||||
where hm.`enable` = 1
|
||||
<if test="guildId != null">
|
||||
and hm.guild_id = #{guildId}
|
||||
</if>
|
||||
<if test="uid != null">
|
||||
and hm.uid = #{uid}
|
||||
</if>
|
||||
group by hm.guild_id, hm.uid
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.accompany.business.controller.guild;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.accompany.business.service.guild.AgencyMonthSettleService;
|
||||
import com.accompany.business.service.guild.GuildMessageService;
|
||||
import com.accompany.common.annotation.Authorization;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
@@ -18,6 +20,9 @@ public class GuildTestController {
|
||||
|
||||
@Autowired
|
||||
private GuildMessageService guildMessageService;
|
||||
@Autowired
|
||||
private AgencyMonthSettleService agencyMonthSettleService;
|
||||
|
||||
|
||||
@ApiOperation("测试小秘书消息")
|
||||
@Authorization
|
||||
@@ -28,4 +33,22 @@ public class GuildTestController {
|
||||
return BusiResult.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "monthSettleTaskAll")
|
||||
@Authorization
|
||||
public void monthSettleTaskAll(String beginDate, String endDate, String pwd) {
|
||||
if (!"fdsfast43532453".equals(pwd)) {
|
||||
return;
|
||||
}
|
||||
agencyMonthSettleService.monthRankTaskAll(DateUtil.parseDateTime(beginDate), DateUtil.parseDate(endDate));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "monthRankTaskDetailAll")
|
||||
@Authorization
|
||||
public void monthRankTaskDetail_(String beginDate, String endDate, String pwd) throws Exception {
|
||||
if (!"fdsfast43532453".equals(pwd)) {
|
||||
return;
|
||||
}
|
||||
agencyMonthSettleService.monthRankTaskDetail(DateUtil.parseDateTime(beginDate), DateUtil.parseDate(endDate));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.accompany.scheduler.task.guild;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.accompany.business.service.guild.AgencyMonthSettleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class GuildSettleTask {
|
||||
@Autowired
|
||||
private AgencyMonthSettleService agencyMonthSettleService;
|
||||
|
||||
/**
|
||||
* 每月16号凌晨0点10分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 10 0 16 * ?")
|
||||
public void monthRankTaskAll1() {
|
||||
Date date = new Date();
|
||||
DateTime beginTime = DateUtil.beginOfMonth(date);
|
||||
DateTime endTime = DateUtil.beginOfDay(date);
|
||||
log.info("=-=monthRankTaskAll1=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskAll(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskAll1=-= end");
|
||||
log.info("=-=monthRankTaskDetail1=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskDetail(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskDetail1=-= end");
|
||||
}
|
||||
|
||||
/**
|
||||
* 每月1号凌晨0点10分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 10 0 1 * ?")
|
||||
public void monthRankTaskAll2() {
|
||||
Date date = new Date();
|
||||
DateTime lastMonth = DateUtil.offsetMonth(date, -1);
|
||||
DateTime beginTime = DateUtil.offsetDay(lastMonth, 15);
|
||||
DateTime endTime = DateUtil.beginOfDay(date);
|
||||
log.info("=-=monthRankTaskAll2=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskAll(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskAll2=-= end", DateUtil.formatDateTime(date));
|
||||
log.info("=-=monthRankTaskDetail2=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskDetail(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskDetail2=-= end");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user