用户活动结束统计fixed
用户活动结束统计
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
package com.accompany.admin.controller.userevent;
|
||||
|
||||
import com.accompany.admin.service.system.AdminUserService;
|
||||
import com.accompany.business.model.userevent.vo.UserEventDataVO;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.business.service.userevent.UserEventDataService;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -18,12 +26,17 @@ public class UserEventDataAdminController {
|
||||
private UserEventDataService userEventDataService;
|
||||
@Autowired
|
||||
private AdminUserService adminUserV2Service;
|
||||
//
|
||||
// @ApiOperation(value = "列表", httpMethod = "GET")
|
||||
// @GetMapping("/list")
|
||||
// public BaseResponseVO<PaginateResponseVO<UserEventDataVO>> list(BasePageParams basePageParams) {
|
||||
// adminUserV2Service.checkAreaRoleForList(basePageParams.getRegion(),null);
|
||||
// return userEventDataService.list(basePageParams.getPageNo(), basePageParams.getPageSize(),basePageParams.getRegion());
|
||||
// }
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roomErbanNo", value = "房间id", dataType = "long", required = true),
|
||||
// @ApiImplicitParam(name = "eventStatus", value = "状态 -1-全部,0-待审核,1-审核通过,2-拒绝,3-删除", dataType = "int", required = true),
|
||||
})
|
||||
@ApiOperation(value = "列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public BusiResult<PageResult<UserEventDataVO>> list(Long roomErbanNo, Integer eventStatus, BasePageParams basePageParams) {
|
||||
return userEventDataService.list(roomErbanNo,
|
||||
basePageParams.getPageNo(), basePageParams.getPageSize(),
|
||||
basePageParams.getPartitionId(), basePageParams.getStartTime(), basePageParams.getEndTime(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import com.accompany.sharding.vo.RoomRevenueExcelVo;
|
||||
import com.accompany.sharding.vo.RoomSerialVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -66,4 +67,8 @@ public interface GiftSendRecordMapperExpand {
|
||||
List<GiftSendRecord> listUserTotalGoldNum(@Param("uid")Long uid);
|
||||
List<GiftSendRecord> listReceiverUserTotalGoldNum();
|
||||
|
||||
GiftSendRecord sumRoomFlowByDate(@Param("roomUid")Long roomUid, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime,
|
||||
@Param("goldCommonRate")BigDecimal goldCommonRate, @Param("gold24Rate")BigDecimal gold24Rate,
|
||||
@Param("goldBravoRate")BigDecimal goldBravoRate, @Param("gold25Rate")BigDecimal gold25Rate);
|
||||
|
||||
}
|
||||
|
@@ -258,4 +258,15 @@
|
||||
group by recive_uid
|
||||
</select>
|
||||
|
||||
<select id="sumRoomFlowByDate" resultType="com.accompany.sharding.model.GiftSendRecord">
|
||||
SELECT
|
||||
sum(gsr.total_diamond_num) totalGoldNum,
|
||||
sum(g.gold_price *
|
||||
IF(gsr.gift_type = 18, #{gold24Rate}, IF(gsr.gift_type = 21, #{goldBravoRate}, IF(gsr.gift_type = 22, #{gold25Rate}, #{goldCommonRate})))) totalDiamondNum
|
||||
FROM
|
||||
gift_send_record gsr
|
||||
LEFT JOIN gift g ON gsr.gift_id = g.gift_id
|
||||
where gsr.create_time >= #{beginTime} and gsr.create_time <= #{endTime} and gsr.room_uid = #{roomUid}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@@ -42,13 +42,13 @@ public class UserEventData implements Serializable {
|
||||
*/
|
||||
private Date eventEndTime;
|
||||
/**
|
||||
* 送礼人数
|
||||
* 金币流水
|
||||
*/
|
||||
private Integer giftNum;
|
||||
private BigDecimal goldNum;
|
||||
/**
|
||||
* 送礼流水
|
||||
* 钻石流水
|
||||
*/
|
||||
private BigDecimal giftValue;
|
||||
private BigDecimal diamondNum;
|
||||
/**
|
||||
* 进房人数
|
||||
*/
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.accompany.business.mybatismapper.userevent;
|
||||
|
||||
import com.accompany.business.model.userevent.UserEvent;
|
||||
import com.accompany.business.model.userevent.UserEventData;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -14,5 +15,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface UserEventDataMapper extends BaseMapper<UserEventData> {
|
||||
|
||||
IPage<UserEventData> listPage(@Param("page") Page<UserEventData> page, @Param("region") Byte region);
|
||||
IPage<UserEventData> listEventPage(@Param("page") Page<UserEventData> page,
|
||||
@Param("roomUid") Long roomUid, @Param("partitionId") Integer partitionId,
|
||||
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("eventStatus") Integer eventStatus);
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.accompany.business.service.gift;
|
||||
|
||||
import com.accompany.business.model.userevent.UserEventData;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -146,4 +148,9 @@ public class GiftSendRecordService extends ServiceImpl<GiftSendRecordMapper, Gif
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
public GiftSendRecord sumRoomFlowByDate(Long roomUid, Date beginTime, Date endTime,
|
||||
BigDecimal goldCommonRate, BigDecimal gold24Rate, BigDecimal goldBravoRate, BigDecimal gold25Rate) {
|
||||
return giftSendRecordMapperExpand.sumRoomFlowByDate(roomUid, beginTime, endTime, goldCommonRate, gold24Rate, goldBravoRate, gold25Rate);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,11 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface UserEventDataService extends IService<UserEventData> {
|
||||
|
||||
/**
|
||||
* 用户活动结束通知
|
||||
* @param beginMessage
|
||||
*/
|
||||
void notifyEnd(UserEventBeginEndMessage beginMessage);
|
||||
|
||||
BusiResult<PageResult<UserEventDataVO>> list(Integer pageNo, Integer pageSize, Byte region);
|
||||
BusiResult<PageResult<UserEventDataVO>> list(Long roomErbanNo, Integer pageNo, Integer pageSize,
|
||||
Integer partitionId, String startTime, String endTime, Integer eventStatus);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.accompany.business.service.userevent;
|
||||
|
||||
import com.accompany.business.model.userevent.UserEvent;
|
||||
import com.accompany.business.model.userevent.UserEventData;
|
||||
import com.accompany.business.model.userevent.vo.UserEventConfigVo;
|
||||
import com.accompany.business.model.userevent.vo.UserEventVO;
|
||||
import com.accompany.common.device.DeviceInfo;
|
||||
@@ -130,6 +131,12 @@ public interface UserEventService extends IService<UserEvent> {
|
||||
*/
|
||||
void taskEnd(int subMinutes);
|
||||
|
||||
/**
|
||||
* 活动结束定时任务
|
||||
*
|
||||
*/
|
||||
UserEventData taskByEventIdEnd(UserEvent userEvent, Boolean saveNow);
|
||||
|
||||
void taskNotOperateExpire(int subMinutes);
|
||||
|
||||
BusiResult<String> genLink(Long uid, Long eventId, DeviceInfo deviceInfo);
|
||||
|
@@ -2,21 +2,16 @@ package com.accompany.business.service.userevent.impl;
|
||||
|
||||
import com.accompany.business.model.userevent.UserEvent;
|
||||
import com.accompany.business.model.userevent.UserEventData;
|
||||
import com.accompany.business.model.userevent.constant.UserEventConstant;
|
||||
import com.accompany.business.message.UserEventBeginEndMessage;
|
||||
import com.accompany.business.model.userevent.vo.UserEventDataVO;
|
||||
import com.accompany.business.mybatismapper.userevent.UserEventDataMapper;
|
||||
import com.accompany.business.service.gift.GiftSendRecordService;
|
||||
import com.accompany.business.service.gift.GiftService;
|
||||
import com.accompany.business.service.room.RoomService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.service.userevent.UserEventDataService;
|
||||
import com.accompany.business.service.userevent.UserEventService;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.model.Room;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -37,44 +32,34 @@ import java.util.*;
|
||||
@Service
|
||||
public class UserEventDataServiceImpl extends ServiceImpl<UserEventDataMapper, UserEventData> implements UserEventDataService {
|
||||
|
||||
@Autowired
|
||||
private UserEventService userEventService;
|
||||
@Autowired
|
||||
private RoomService roomService;
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private GiftSendRecordService giftSendRecordService;
|
||||
@Autowired
|
||||
private GiftService giftService;
|
||||
|
||||
@Override
|
||||
public void notifyEnd(UserEventBeginEndMessage beginMessage) {
|
||||
UserEvent userEvent = userEventService.getById(beginMessage.getEventId());
|
||||
if (!(UserEventConstant.EventStatus.PASS == userEvent.getEventStatus())) {
|
||||
log.info("用户活动未通过审核,或者已经被删除:UserEvent:{}", JSONObject.toJSONString(userEvent));
|
||||
return;
|
||||
public BusiResult<PageResult<UserEventDataVO>> list(Long roomErbanNo, Integer pageNo, Integer pageSize,
|
||||
Integer partitionId, String startTime, String endTime, Integer eventStatus) {
|
||||
Long roomUid = null;
|
||||
if (roomErbanNo != null) {
|
||||
Users users = usersService.getUserByErbanNo(roomErbanNo);
|
||||
if (users == null) {
|
||||
throw new AdminServiceException(6000, "ROOM NOT EXIST");
|
||||
}
|
||||
roomUid = users.getUid();
|
||||
}
|
||||
UserEventData userEventData = new UserEventData();
|
||||
userEventData.setEventId(userEvent.getId());
|
||||
userEventData.setEventEndTime(userEvent.getEventEndTime());
|
||||
userEventData.setEventStartTime(userEvent.getEventStartTime());
|
||||
userEventData.setUid(userEvent.getUid());
|
||||
userEventData.setRoomUid(userEvent.getRoomUid());
|
||||
userEventData.setCreateTime(new Date());
|
||||
save(userEventData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BusiResult<PageResult<UserEventDataVO>> list(Integer pageNo, Integer pageSize, Byte region) {
|
||||
Page<UserEventData> page = new Page<>(pageNo, pageSize);
|
||||
IPage<UserEventData> pageData = baseMapper.listPage(page,region);
|
||||
|
||||
PageResult<UserEventDataVO> responseVO = new PageResult<>();
|
||||
responseVO.setTotal((int)pageData.getTotal());
|
||||
List<UserEventDataVO> resultList = new ArrayList<>();
|
||||
responseVO.setRows(resultList);
|
||||
responseVO.setTotal(0);
|
||||
IPage<UserEventData> pageData = baseMapper
|
||||
.listEventPage(new Page<>(pageNo, pageSize), roomUid, partitionId, startTime, endTime, eventStatus);
|
||||
if (pageData.getTotal() <= 0) {
|
||||
return BusiResult.success(responseVO);
|
||||
}
|
||||
responseVO.setTotal((int) pageData.getTotal());
|
||||
|
||||
List<UserEventData> records = pageData.getRecords();
|
||||
Set<Long> uids = new HashSet<>();
|
||||
List<UserEventDataVO> result = new ArrayList<>();
|
||||
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.accompany.business.dto.room.UserEventConfigDto;
|
||||
import com.accompany.business.model.userevent.UserEvent;
|
||||
import com.accompany.business.model.userevent.UserEventData;
|
||||
import com.accompany.business.model.userevent.UserEventSub;
|
||||
import com.accompany.business.model.userevent.constant.UserEventConstant;
|
||||
import com.accompany.business.model.userevent.vo.UserEventConfigVo;
|
||||
@@ -12,16 +13,20 @@ import com.accompany.business.model.userevent.vo.UserEventVO;
|
||||
import com.accompany.business.mybatismapper.userevent.UserEventMapper;
|
||||
import com.accompany.business.service.BaseSendService;
|
||||
import com.accompany.business.service.follow.FansService;
|
||||
import com.accompany.business.service.gift.GiftRateService;
|
||||
import com.accompany.business.service.gift.GiftSendRecordService;
|
||||
import com.accompany.business.service.level.LevelService;
|
||||
import com.accompany.business.service.purse.UserPurseService;
|
||||
import com.accompany.business.service.record.BillRecordService;
|
||||
import com.accompany.business.service.room.RoomService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.service.userevent.UserEventDataService;
|
||||
import com.accompany.business.service.userevent.UserEventService;
|
||||
import com.accompany.business.service.userevent.UserEventSubService;
|
||||
import com.accompany.business.util.VipUtil;
|
||||
import com.accompany.common.config.SystemConfig;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.constant.GiftTypeEnum;
|
||||
import com.accompany.common.device.DeviceInfo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
@@ -37,6 +42,7 @@ import com.accompany.core.service.SysConfService;
|
||||
import com.accompany.core.util.I18NMessageSourceUtil;
|
||||
import com.accompany.core.vo.UserLevelVo;
|
||||
import com.accompany.core.vo.vip.UserVipInfoVO;
|
||||
import com.accompany.sharding.model.GiftSendRecord;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -51,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -89,6 +96,12 @@ public class UserEventServiceImpl extends ServiceImpl<UserEventMapper, UserEvent
|
||||
private SysConfService sysConfService;
|
||||
@Autowired
|
||||
private FansService fansService;
|
||||
@Autowired
|
||||
private GiftRateService giftRateService;
|
||||
@Autowired
|
||||
private GiftSendRecordService giftSendRecordService;
|
||||
@Autowired
|
||||
private UserEventDataService userEventDataService;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@@ -412,7 +425,7 @@ public class UserEventServiceImpl extends ServiceImpl<UserEventMapper, UserEvent
|
||||
.map(map -> map.get(partitionId.toString()))
|
||||
.orElseGet(() -> Optional.ofNullable(parse)
|
||||
.map(UserEventConfigDto::getDefaultDuration)
|
||||
.orElse(Arrays.asList(30,60,90,120)));
|
||||
.orElse(Arrays.asList(30, 60, 90, 120)));
|
||||
return UserEventConfigVo.builder()
|
||||
.goldNum(goldNum)
|
||||
.latestDay(parse.getLatestDay())
|
||||
@@ -453,13 +466,13 @@ public class UserEventServiceImpl extends ServiceImpl<UserEventMapper, UserEvent
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(subUids)) {
|
||||
jsonObject.put("type", 1);
|
||||
baseSendService.sendBatchMsg(SystemConfig.secretaryUid, new ArrayList<>(subUids),USER_EVENT, USER_EVENT_BEGIN, jsonObject);
|
||||
baseSendService.sendBatchMsg(SystemConfig.secretaryUid, new ArrayList<>(subUids), USER_EVENT, USER_EVENT_BEGIN, jsonObject);
|
||||
}
|
||||
jsonObject.put("type", 2);
|
||||
subUids.clear();
|
||||
subUids.add(userEvent.getUid());
|
||||
subUids.add(userEvent.getRoomUid());
|
||||
baseSendService.sendBatchMsg(SystemConfig.secretaryUid, new ArrayList<>(subUids) ,USER_EVENT, USER_EVENT_BEGIN, jsonObject);
|
||||
baseSendService.sendBatchMsg(SystemConfig.secretaryUid, new ArrayList<>(subUids), USER_EVENT, USER_EVENT_BEGIN, jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +488,41 @@ public class UserEventServiceImpl extends ServiceImpl<UserEventMapper, UserEvent
|
||||
if (CollectionUtils.isEmpty(userEvents)) {
|
||||
return;
|
||||
}
|
||||
//to-do taskData
|
||||
List<UserEventData> userEventDatas = new ArrayList<>();
|
||||
for (UserEvent userEvent : userEvents) {
|
||||
userEventDatas.add(this.taskByEventIdEnd(userEvent, Boolean.FALSE));
|
||||
}
|
||||
userEventDataService.saveBatch(userEventDatas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEventData taskByEventIdEnd(UserEvent userEvent, Boolean saveNow) {
|
||||
Date eventStartTime = userEvent.getEventStartTime();
|
||||
Date eventEndTime = userEvent.getEventEndTime();
|
||||
Users users = usersService.getUsersByUid(userEvent.getUid());
|
||||
Integer partitionId = users.getPartitionId();
|
||||
BigDecimal goldCommonRate = giftRateService.goldFlowRate(partitionId, GiftTypeEnum.COMMON.getType());
|
||||
BigDecimal gold24Rate = giftRateService.goldFlowRate(partitionId, GiftTypeEnum.LUCKY_24.getType());
|
||||
BigDecimal goldBravoRate = giftRateService.goldFlowRate(partitionId, GiftTypeEnum.BRAVO.getType());
|
||||
BigDecimal gold25Rate = giftRateService.goldFlowRate(partitionId, GiftTypeEnum.LUCKY_25.getType());
|
||||
GiftSendRecord giftSendRecord = giftSendRecordService.sumRoomFlowByDate(userEvent.getRoomUid(), eventStartTime, eventEndTime, goldCommonRate, gold24Rate, goldBravoRate, gold25Rate);
|
||||
UserEventData data = new UserEventData();
|
||||
data.setEventEndTime(eventEndTime);
|
||||
data.setEventStartTime(eventStartTime);
|
||||
data.setEventId(userEvent.getId());
|
||||
data.setUid(userEvent.getUid());
|
||||
data.setCreateTime(new Date());
|
||||
data.setRoomUid(userEvent.getRoomUid());
|
||||
if (giftSendRecord != null && giftSendRecord.getTotalGoldNum() != null) {
|
||||
data.setGoldNum(BigDecimal.valueOf(giftSendRecord.getTotalGoldNum()));
|
||||
}
|
||||
if (giftSendRecord != null && giftSendRecord.getTotalDiamondNum() != null) {
|
||||
data.setDiamondNum(BigDecimal.valueOf(giftSendRecord.getTotalDiamondNum()));
|
||||
}
|
||||
if (saveNow) {
|
||||
userEventDataService.save(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -2,36 +2,43 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.accompany.business.mybatismapper.userevent.UserEventDataMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="userEventDataResultMap" type="com.accompany.business.model.userevent.UserEventData">
|
||||
<id column="id" property="id" jdbcType="BIGINT"/>
|
||||
<result column="event_id" property="eventId" jdbcType="BIGINT"/>
|
||||
<result column="uid" property="uid" jdbcType="BIGINT"/>
|
||||
<result column="room_uid" property="roomUid" jdbcType="BIGINT"/>
|
||||
<result column="event_start_time" property="eventStartTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="event_end_time" property="eventEndTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="gift_num" property="giftNum" jdbcType="INTEGER"/>
|
||||
<result column="gift_value" property="giftValue" jdbcType="DECIMAL"/>
|
||||
<result column="in_room_people" property="inRoomPeople" jdbcType="INTEGER"/>
|
||||
<result column="in_room_num" property="inRoomNum" jdbcType="INTEGER"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, event_id, uid, room_uid, event_start_time, event_end_time, gift_num, gift_value, in_room_people, in_room_num, create_time
|
||||
</sql>
|
||||
<select id="listPage" resultType="com.accompany.business.model.userevent.UserEventData">
|
||||
select ued.* from user_event_data ued
|
||||
left join users u on ued.room_uid = u.uid
|
||||
where 1 = 1
|
||||
|
||||
<if test="region !=null ">
|
||||
and u.region = #{region}
|
||||
</if>
|
||||
|
||||
order by ued.event_start_time desc
|
||||
<select id="listEventPage" resultType="com.accompany.business.model.userevent.UserEventData">
|
||||
select ued.* from user_event_data ued
|
||||
left join users u on ued.room_uid = u.uid
|
||||
left join user_event ue on ue.id = ued.event_id
|
||||
<where>
|
||||
<if test="roomUid !=null ">
|
||||
and ue.room_uid = #{roomUid}
|
||||
</if>
|
||||
<if test="partitionId != null and partitionId != 0">
|
||||
and u.partition_id = #{partitionId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and ue.event_start_time >=#{startTime}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and ue.event_start_time <= #{startTime}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="eventStatus != null and eventStatus == 0">
|
||||
and ue.event_status = #{eventStatus}
|
||||
</when>
|
||||
<when test="eventStatus != null and eventStatus == 1">
|
||||
and ue.event_status = #{eventStatus} and ue.event_end_time > now()
|
||||
</when>
|
||||
<when test="eventStatus != null and eventStatus == 2">
|
||||
and ue.event_status = #{eventStatus}
|
||||
</when>
|
||||
<when test="eventStatus != null and eventStatus == 3">
|
||||
and ue.event_status = #{eventStatus}
|
||||
</when>
|
||||
<when test="eventStatus != null and eventStatus == 4">
|
||||
and (ue.event_status = #{eventStatus} or (ue.event_status = 1 and ue.event_end_time < now()))
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by event_status asc ,event_start_time asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.accompany.business.controller.userevent;
|
||||
|
||||
import com.accompany.business.common.BaseController;
|
||||
import com.accompany.business.model.userevent.UserEvent;
|
||||
import com.accompany.business.model.userevent.constant.UserEventConstant;
|
||||
import com.accompany.business.model.userevent.vo.UserEventConfigVo;
|
||||
import com.accompany.business.model.userevent.vo.UserEventVO;
|
||||
@@ -140,4 +141,11 @@ public class UserEventController extends BaseController {
|
||||
userEventService.taskBegin(-1);
|
||||
return BusiResult.success();
|
||||
}
|
||||
@ApiOperation(value = "taskByEventIdEnd", httpMethod = "GET")
|
||||
@GetMapping("/taskByEventIdEnd")
|
||||
public BusiResult<Void> taskBegin(Long eventId) {
|
||||
UserEvent userEvent = userEventService.getById(eventId);
|
||||
userEventService.taskByEventIdEnd(userEvent, Boolean.TRUE);
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public class UserEventTask {
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void userEventTaskMinutesV2() {
|
||||
log.info("=-=userEventTaskMinutes-taskEnd=-=:begin");
|
||||
userEventService.taskEnd(-1);
|
||||
userEventService.taskEnd(-5);
|
||||
log.info("=-=userEventTaskMinutes-taskEnd=-=:end");
|
||||
|
||||
log.info("=-=userEventTaskMinutes-taskNotOperateExpire=-=:begin");
|
||||
|
Reference in New Issue
Block a user