New file |
| | |
| | | package com.panzhihua.common.model.vos.community.raffle; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zzj |
| | | */ |
| | | @Data |
| | | @ApiModel("礼品统计") |
| | | public class ComActRafflePrizeCount { |
| | | @ApiModelProperty("总数") |
| | | private Integer total; |
| | | @ApiModelProperty("剩下") |
| | | private Integer surplus; |
| | | @ApiModelProperty("礼品列表") |
| | | private List<ComActRafflePrizeVO> comActRafflePrizeVOList; |
| | | } |
| | |
| | | @ApiModelProperty(value = "抽奖id") |
| | | private Long raffleId; |
| | | |
| | | @ApiModelProperty(value = "核销人名称") |
| | | private String staffName; |
| | | |
| | | @ApiModelProperty(value = "奖品名称") |
| | | private String prizeName; |
| | | |
| | | @ApiModelProperty(value = "奖品图片") |
| | | private String image; |
| | | |
| | | @ApiModelProperty(value = "昵称") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | private String username; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phone; |
| | | |
| | | } |
| | |
| | | * 开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date stopTime; |
| | | |
| | | /** |
| | | * 开奖时间 |
| | | */ |
| | | @ApiModelProperty(value = "开奖时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date lotteryTime; |
| | | |
| | | /** |
| | | * 兑奖开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "兑奖开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date raffleStartTime; |
| | | |
| | | /** |
| | | * 兑奖结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "兑奖结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date raffleStopTime; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "社区id") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "奖品数量") |
| | | private Integer prizeCount; |
| | | |
| | | @ApiModelProperty(value = "参与人数") |
| | | private Integer joinCount; |
| | | |
| | |
| | | private Integer waitRaffleCount; |
| | | |
| | | @ApiModelProperty(value = "创建人名称") |
| | | private Integer createName; |
| | | private String createName; |
| | | |
| | | @ApiModelProperty(value = "奖品集合") |
| | | private List<ComActRafflePrizeVO> comActRafflePrizeVOList; |
| | | |
| | | @ApiModelProperty(value = "中奖情况") |
| | | private ComActRaffleRecordVO comActRaffleRecordVO; |
| | | |
| | | @ApiModelProperty(value = "参与状态 0 不可参与 1 可参与") |
| | | private Integer joinStatus; |
| | | } |
| | |
| | | @PostMapping("/comActColumn/queryLevel") |
| | | public R queryLevel(@RequestBody ComActColumnVO comActColumnVO); |
| | | |
| | | @PostMapping("/comActRaffle/querAll") |
| | | @PostMapping("/comActRaffle/queryAll") |
| | | R selectAllComActRaffle(@RequestBody CommonPage commonPage); |
| | | |
| | | @GetMapping("/comActRaffle/detail") |
| | |
| | | @ApiOperation(value = "详情",response = ComActRaffleVO.class) |
| | | @GetMapping("{id}") |
| | | public R selectOne(@PathVariable("id") Long id) { |
| | | return this.communityService.selectOneComActRaffle(id,null); |
| | | return this.communityService.selectOneComActRaffle(id,0L); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 抽奖活动中奖记录表(ComActRaffleRecord)表控制层 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 抽奖活动中奖记录表相关功能 |
| | | * |
| | | * @author zzj |
| | | * @since 2022-02-18 14:32:02 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"获奖记录"}) |
| | | @RestController |
| | | @RequestMapping("comActRaffleRecord") |
| | | public class ComActRaffleRecordApi { |
| | | /** |
| | | * 服务对象 |
| | | */ |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | } |
| | |
| | | public R selectAll(@RequestBody CommonPage commonPage) { |
| | | return this.comActRaffleRecordService.pageList(commonPage); |
| | | } |
| | | @GetMapping("/queryPrize") |
| | | public R queryPrize(@RequestParam("id")Long id){ |
| | | return this.comActRaffleRecordService.queryPrize(id); |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.common.model.vos.community.raffle.ComActRafflePrizeCount; |
| | | import com.panzhihua.common.model.vos.community.raffle.ComActRafflePrizeVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import com.panzhihua.service_community.entity.ComActRafflePrize; |
| | |
| | | * @return |
| | | */ |
| | | List<ComActRafflePrizeVO> selectByRaffleId(Long id); |
| | | |
| | | /** |
| | | * |
| | | * 查询奖品统计 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | ComActRafflePrizeCount selectCount(Long id); |
| | | } |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import com.panzhihua.service_community.entity.ComActRaffleRecord; |
| | |
| | | * @return |
| | | */ |
| | | ComActRaffleRecordVO selectByUserId(@Param("userId")Long userId,@Param("raffleId")Long raffleId); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param page |
| | | * @param commonPage |
| | | * @return |
| | | */ |
| | | IPage<ComActRaffleRecordVO> pageList(Page page, @Param("commonPage")CommonPage commonPage); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | R pageList(CommonPage commonPage); |
| | | |
| | | /** |
| | | * 查询奖品信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | R queryPrize(Long id); |
| | | } |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.raffle.ComActRafflePrizeCount; |
| | | import com.panzhihua.service_community.dao.ComActRafflePrizeDao; |
| | | import com.panzhihua.service_community.entity.ComActRaffleRecord; |
| | | import com.panzhihua.service_community.dao.ComActRaffleRecordDao; |
| | | import com.panzhihua.service_community.service.ComActRaffleRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 抽奖活动中奖记录表(ComActRaffleRecord)表服务实现类 |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ComActRaffleRecordServiceImpl extends ServiceImpl<ComActRaffleRecordDao, ComActRaffleRecord> implements ComActRaffleRecordService { |
| | | @Resource |
| | | private ComActRafflePrizeDao comActRafflePrizeDao; |
| | | |
| | | @Override |
| | | public R pageList(CommonPage commonPage) { |
| | | return null; |
| | | return R.ok(this.baseMapper.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage)); |
| | | } |
| | | |
| | | @Override |
| | | public R queryPrize(Long id) { |
| | | ComActRafflePrizeCount comActRafflePrizeCount= comActRafflePrizeDao.selectCount(id); |
| | | comActRafflePrizeCount.setComActRafflePrizeVOList(comActRafflePrizeDao.selectByRaffleId(id)); |
| | | return R.ok(comActRafflePrizeCount); |
| | | } |
| | | } |
| | |
| | | ComActRaffleRecordVO comActRaffleRecordVO=comActRaffleRecordDao.selectByUserId(userId,id); |
| | | if(comActRaffleRecordVO!=null){ |
| | | comActRaffleVO.setComActRaffleRecordVO(comActRaffleRecordVO); |
| | | comActRaffleVO.setJoinStatus(0); |
| | | } |
| | | else { |
| | | if(comActRaffleVO.getStatus()==1){ |
| | | comActRaffleVO.setJoinStatus(1); |
| | | } |
| | | else { |
| | | comActRaffleVO.setJoinStatus(0); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(comActRaffleVO); |
| | |
| | | </resultMap> |
| | | |
| | | <select id="pageList" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleVO"> |
| | | select t.*,t2.waitRaffleCount,t3.joinCount,t4.name as createName,t5.raffleCount from com_act_raffle t |
| | | select t.*,t2.waitRaffleCount,t3.joinCount,t4.name as createName,t5.raffleCount,t6.prizeCount from com_act_raffle t |
| | | LEFT JOIN (select sum(surplus) as waitRaffleCount,raffle_id from com_act_raffle_prize GROUP BY raffle_id) t2 on t.id = t2.raffle_id |
| | | LEFT JOIN (select count(*) as joinCount,raffle_id from com_act_raffle_record GROUP BY raffle_id) t3 on t.id = t3.raffle_id |
| | | LEFT JOIN sys_user t4 on t.create_by = t4.user_id |
| | | LEFT JOIN (select count(*) as raffleCount,raffle_id from com_act_raffle_record where status >0 GROUP BY raffle_id) t5 on t.id = t5.raffle_id |
| | | LEFT JOIN (select sum(total) as prizeCount,raffle_id from com_act_raffle_prize GROUP BY raffle_id) t6 on t.id = t6.raffle_id |
| | | <where> |
| | | <if test="commonPage.communityId!=null"> |
| | | and t.community_id = #{commonPage.communityId} |
| | |
| | | LEFT JOIN (select count(*) as joinCount,raffle_id from com_act_raffle_record GROUP BY raffle_id) t3 on t.id = t3.raffle_id |
| | | LEFT JOIN sys_user t4 on t.create_by = t4.user_id |
| | | LEFT JOIN (select count(*) as raffleCount,raffle_id from com_act_raffle_record where status >0 GROUP BY raffle_id) t5 on t.id = t5.raffle_id |
| | | where t.id #{id} |
| | | where t.id=#{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | select * from com_act_raffle_prize where raffle_id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRafflePrizeCount"> |
| | | select sum(total) as total,sum(surplus) as surplus from com_act_raffle_prize where raffle_id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="selectByUserId" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO"> |
| | | select t.*,t1.`name`,t1.image from com_act_raffle_record t |
| | | LEFT JOIN com_act_raffle_prize t1 on t.prize_id = t1.id |
| | | where t.user_id = #{userId} and t.raffle_id = #{raffleId} |
| | | select t.*, t1.`name`, t1.image |
| | | from com_act_raffle_record t |
| | | LEFT JOIN com_act_raffle_prize t1 on t.prize_id = t1.id |
| | | where 1=1 <if test="userId !=null and userId !=0"> and t.user_id = #{userId} </if> |
| | | and t.raffle_id = #{raffleId} |
| | | </select> |
| | | |
| | | <select id="pageList" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO"> |
| | | select t.*, t1.image, t1.name as prizeName, t2.nick_name, t2.phone, t2.`name` as username, t3.name as staffName |
| | | from com_act_raffle_record t |
| | | left join com_act_raffle_prize t1 on t.staff_id = t1.id |
| | | left join sys_user t2 on t.user_id = t2.user_id |
| | | left join sys_user t3 on t.staff_id = t3.user_id |
| | | <where> |
| | | <if test="commonPage.status!=null"> |
| | | and t.status = #{commonPage.status} |
| | | </if> |
| | | <if test="commonPage.keyword!=null and commonPage.keyword!=''"> |
| | | and (t2.name like concat('%',#{commonPage.keyword},'%') or t2.phone like |
| | | concat('%',#{commonPage.keyword},'%') or t1.name like concat('%',#{commonPage.keyword},'%') ) |
| | | </if> |
| | | <if test="commonPage.paramId !=null"> |
| | | and t.raffle_id = #{commonPage.paramId} |
| | | </if> |
| | | </where> |
| | | order by t.create_time desc |
| | | </select> |
| | | </mapper> |