101captain
2022-02-21 e7fbb69f132d0b040e329f8cf212de5d9ce5f3b3
抽奖活动代码提交
2个文件已添加
13个文件已修改
187 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRafflePrizeCount.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRaffleRecordVO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRaffleVO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActRaffleApi.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActRaffleRecordApi.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActRaffleRecordApi.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActRafflePrizeDao.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActRaffleRecordDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActRaffleRecordService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActRaffleRecordServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActRaffleServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRaffleMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRafflePrizeMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRaffleRecordMapper.xml 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRafflePrizeCount.java
New file
@@ -0,0 +1,21 @@
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;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRaffleRecordVO.java
@@ -63,4 +63,22 @@
    @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;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/raffle/ComActRaffleVO.java
@@ -39,35 +39,35 @@
     * 开始时间
     */
    @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;
    /**
@@ -131,6 +131,9 @@
    @ApiModelProperty(value = "社区id")
    private Long communityId;
    @ApiModelProperty(value = "奖品数量")
    private Integer prizeCount;
    @ApiModelProperty(value = "参与人数")
    private Integer joinCount;
@@ -141,11 +144,14 @@
    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;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -8082,7 +8082,7 @@
    @PostMapping("/comActColumn/queryLevel")
    public R queryLevel(@RequestBody ComActColumnVO comActColumnVO);
    @PostMapping("/comActRaffle/querAll")
    @PostMapping("/comActRaffle/queryAll")
    R selectAllComActRaffle(@RequestBody CommonPage commonPage);
    @GetMapping("/comActRaffle/detail")
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActRaffleApi.java
@@ -54,7 +54,7 @@
    @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);
    }
    /**
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActRaffleRecordApi.java
New file
@@ -0,0 +1,33 @@
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;
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActRaffleRecordApi.java
@@ -41,6 +41,10 @@
    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);
    }
    /**
     * 通过主键查询单条数据
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActRafflePrizeDao.java
@@ -1,6 +1,7 @@
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;
@@ -23,4 +24,12 @@
     * @return
     */
    List<ComActRafflePrizeVO> selectByRaffleId(Long id);
    /**
     *
     * 查询奖品统计
     * @param id
     * @return
     */
    ComActRafflePrizeCount selectCount(Long id);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActRaffleRecordDao.java
@@ -1,6 +1,9 @@
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;
@@ -24,4 +27,12 @@
     * @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);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActRaffleRecordService.java
@@ -21,4 +21,11 @@
     * @return
     */
    R pageList(CommonPage commonPage);
    /**
     * 查询奖品信息
     * @param id
     * @return
     */
    R queryPrize(Long id);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActRaffleRecordServiceImpl.java
@@ -1,13 +1,18 @@
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)表服务实现类
@@ -20,9 +25,18 @@
@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);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActRaffleServiceImpl.java
@@ -112,6 +112,15 @@
          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);
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRaffleMapper.xml
@@ -23,11 +23,12 @@
    </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}
@@ -48,6 +49,6 @@
         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>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRafflePrizeMapper.xml
@@ -15,4 +15,8 @@
        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>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActRaffleRecordMapper.xml
@@ -13,9 +13,31 @@
    </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>