提交修改
This commit is contained in:
commit
dea0963688
@ -58,7 +58,7 @@ public class LuckController {
|
|||||||
if(luck.getFinish().intValue() == 0){//活动未结束
|
if(luck.getFinish().intValue() == 0){//活动未结束
|
||||||
luckDetailInfoReq.setId(luckId);
|
luckDetailInfoReq.setId(luckId);
|
||||||
luckDetailInfoReq.setName(luck.getName());
|
luckDetailInfoReq.setName(luck.getName());
|
||||||
List<LuckGoods> luckGoods = luckGoodsService.getByLuckId(luckId);
|
List<LuckGoods> luckGoods = luckGoodsService.getNoFinishByLuckId(luckId);
|
||||||
if(luckGoods.size() > 0){
|
if(luckGoods.size() > 0){
|
||||||
List<LuckGoodsReq> luckGoodsReqs = new ArrayList<>();
|
List<LuckGoodsReq> luckGoodsReqs = new ArrayList<>();
|
||||||
for (LuckGoods luckGood:luckGoods
|
for (LuckGoods luckGood:luckGoods
|
||||||
@ -71,7 +71,7 @@ public class LuckController {
|
|||||||
luckGoodsReqs.add(luckGoodsReq);
|
luckGoodsReqs.add(luckGoodsReq);
|
||||||
}
|
}
|
||||||
luckDetailInfoReq.setLuckGoodsReqs(luckGoodsReqs);
|
luckDetailInfoReq.setLuckGoodsReqs(luckGoodsReqs);
|
||||||
List<LuckRecord> luckRecords = luckRecordService.selectLuckRecordByLuckId(String.valueOf(luckId));
|
List<LuckRecord> luckRecords = luckRecordService.selectNoGoodLuckRecordByLuckId(String.valueOf(luckId));
|
||||||
if(luckRecords.size() > 0){
|
if(luckRecords.size() > 0){
|
||||||
List<LuckRecordReq> luckRecordReqList = new ArrayList<>();
|
List<LuckRecordReq> luckRecordReqList = new ArrayList<>();
|
||||||
for (LuckRecord luckRecord:luckRecords
|
for (LuckRecord luckRecord:luckRecords
|
||||||
@ -130,11 +130,14 @@ public class LuckController {
|
|||||||
luckId = luckRecordReq.getLuckId();
|
luckId = luckRecordReq.getLuckId();
|
||||||
luckRecordService.updateLuckRecordByReqWithId(luckRecordReq);
|
luckRecordService.updateLuckRecordByReqWithId(luckRecordReq);
|
||||||
}
|
}
|
||||||
|
int count0 = luckRecordService.selectCountRecordByLuckId(luckId);
|
||||||
|
|
||||||
int count = luckRecordService.selectCountGoodLuckRecordByLuckId(luckId);
|
int count = luckRecordService.selectCountGoodLuckRecordByLuckId(luckId);
|
||||||
|
|
||||||
int count1 = luckGoodsService.selectNumGoodLuckRecordByLuckId(luckId);
|
int count1 = luckGoodsService.selectNumGoodLuckRecordByLuckId(luckId);
|
||||||
if(count < count1){
|
if(count < count1 && count != count0){
|
||||||
//获取未中奖人列表
|
//获取未中奖人列表
|
||||||
|
|
||||||
return getLuck(luckId);
|
return getLuck(luckId);
|
||||||
}else{
|
}else{
|
||||||
//设置中将结束
|
//设置中将结束
|
||||||
|
|||||||
@ -36,4 +36,6 @@ public interface LuckGoodsMapper extends BaseMapper<LuckGoods> {
|
|||||||
List<LuckGoods> getByLuckId(@Param("luckId") Long luckId);
|
List<LuckGoods> getByLuckId(@Param("luckId") Long luckId);
|
||||||
|
|
||||||
int selectNumGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
int selectNumGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
||||||
|
|
||||||
|
List<LuckGoods> getNoFinishByLuckId(Long luckId);
|
||||||
}
|
}
|
||||||
@ -43,4 +43,8 @@ public interface LuckRecordMapper extends BaseMapper<LuckRecord> {
|
|||||||
List<LuckRecord> selectGoodLuckRecordByLuckId(String luckId);
|
List<LuckRecord> selectGoodLuckRecordByLuckId(String luckId);
|
||||||
|
|
||||||
int selectCountGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
int selectCountGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
||||||
|
|
||||||
|
List<LuckRecord> selectNoGoodLuckRecordByLuckId(String luckId);
|
||||||
|
|
||||||
|
int selectCountRecordByLuckId(Long luckId);
|
||||||
}
|
}
|
||||||
@ -34,6 +34,8 @@ public class LuckGoods implements java.io.Serializable {
|
|||||||
private String remark;
|
private String remark;
|
||||||
//数量
|
//数量
|
||||||
private Integer counts;
|
private Integer counts;
|
||||||
|
|
||||||
|
private Integer isFinish;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -169,6 +171,14 @@ public class LuckGoods implements java.io.Serializable {
|
|||||||
this.counts = counts;
|
this.counts = counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getIsFinish() {
|
||||||
|
return isFinish;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsFinish(Integer isFinish) {
|
||||||
|
this.isFinish = isFinish;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LuckGoods{" +
|
return "LuckGoods{" +
|
||||||
@ -181,6 +191,7 @@ public class LuckGoods implements java.io.Serializable {
|
|||||||
",weight=" + weight +
|
",weight=" + weight +
|
||||||
",remark=" + remark +
|
",remark=" + remark +
|
||||||
",counts=" + counts +
|
",counts=" + counts +
|
||||||
|
",isFinish=" + isFinish +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,4 +36,6 @@ public interface LuckGoodsService extends IService<LuckGoods> {
|
|||||||
|
|
||||||
//获取奖品总数
|
//获取奖品总数
|
||||||
int selectNumGoodLuckRecordByLuckId(Long luckId);
|
int selectNumGoodLuckRecordByLuckId(Long luckId);
|
||||||
|
|
||||||
|
List<LuckGoods> getNoFinishByLuckId(Long luckId);
|
||||||
}
|
}
|
||||||
@ -42,4 +42,8 @@ public interface LuckRecordService extends IService<LuckRecord> {
|
|||||||
List<LuckRecord> selectGoodLuckRecordByLuckId(String valueOf);
|
List<LuckRecord> selectGoodLuckRecordByLuckId(String valueOf);
|
||||||
//获取中奖人数
|
//获取中奖人数
|
||||||
int selectCountGoodLuckRecordByLuckId(Long luckId);
|
int selectCountGoodLuckRecordByLuckId(Long luckId);
|
||||||
|
//获取为未奖人数
|
||||||
|
List<LuckRecord> selectNoGoodLuckRecordByLuckId(String valueOf);
|
||||||
|
//获取参与人数
|
||||||
|
int selectCountRecordByLuckId(Long luckId);
|
||||||
}
|
}
|
||||||
@ -70,4 +70,9 @@ public class LuckGoodsServiceImpl extends ServiceImpl<LuckGoodsMapper, LuckGoods
|
|||||||
return luckGoodsMapper.selectNumGoodLuckRecordByLuckId(luckId);
|
return luckGoodsMapper.selectNumGoodLuckRecordByLuckId(luckId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LuckGoods> getNoFinishByLuckId(Long luckId){
|
||||||
|
return luckGoodsMapper.getNoFinishByLuckId(luckId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,5 +86,15 @@ public class LuckRecordServiceImpl extends ServiceImpl<LuckRecordMapper, LuckRec
|
|||||||
return luckRecordMapper.selectCountGoodLuckRecordByLuckId(luckId);
|
return luckRecordMapper.selectCountGoodLuckRecordByLuckId(luckId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LuckRecord> selectNoGoodLuckRecordByLuckId(String luckId){
|
||||||
|
return luckRecordMapper.selectNoGoodLuckRecordByLuckId(luckId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectCountRecordByLuckId(Long luckId){
|
||||||
|
return luckRecordMapper.selectCountRecordByLuckId(luckId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class DingTalkLoginController {
|
|||||||
public R luck(@RequestBody String body){
|
public R luck(@RequestBody String body){
|
||||||
log.info("luck{}", body);
|
log.info("luck{}", body);
|
||||||
JSONObject json = JSONObject.parseObject(body);
|
JSONObject json = JSONObject.parseObject(body);
|
||||||
Luck luck = luckService.selectLuckById(2L);//默认第一个活动
|
Luck luck = luckService.selectLuckById(1L);//默认第一个活动
|
||||||
if(luck.getStopTime().getTime() > System.currentTimeMillis()){
|
if(luck.getStopTime().getTime() > System.currentTimeMillis()){
|
||||||
return dingtalkBusiness.luck(json.getString("code"), appid, luck.getId());
|
return dingtalkBusiness.luck(json.getString("code"), appid, luck.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,13 @@
|
|||||||
<result column="weight" property="weight"/>
|
<result column="weight" property="weight"/>
|
||||||
<result column="remark" property="remark"/>
|
<result column="remark" property="remark"/>
|
||||||
<result column="counts" property="counts"/>
|
<result column="counts" property="counts"/>
|
||||||
|
<result column="is_finish" property="isFinish"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, luck_id AS luckId, name AS name, weight AS weight, remark AS remark, counts AS counts
|
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, luck_id AS luckId, name AS name, weight AS weight, remark AS remark, counts AS counts, is_finish as isFinish
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +37,7 @@
|
|||||||
<if test="weight != null">weight, </if>
|
<if test="weight != null">weight, </if>
|
||||||
<if test="remark != null">remark, </if>
|
<if test="remark != null">remark, </if>
|
||||||
<if test="counts != null">counts, </if>
|
<if test="counts != null">counts, </if>
|
||||||
|
<if test="isFinish != null">is_finish, </if>
|
||||||
is_delete,
|
is_delete,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
gmt_modified
|
gmt_modified
|
||||||
@ -45,6 +47,7 @@
|
|||||||
<if test="weight != null">#{ weight}, </if>
|
<if test="weight != null">#{ weight}, </if>
|
||||||
<if test="remark != null">#{ remark}, </if>
|
<if test="remark != null">#{ remark}, </if>
|
||||||
<if test="counts != null">#{ counts}, </if>
|
<if test="counts != null">#{ counts}, </if>
|
||||||
|
<if test="isFinish != null">#{ isFinish}, </if>
|
||||||
0,
|
0,
|
||||||
now(),
|
now(),
|
||||||
now()
|
now()
|
||||||
@ -62,7 +65,8 @@
|
|||||||
<if test="name != null">name = #{name},</if>
|
<if test="name != null">name = #{name},</if>
|
||||||
<if test="weight != null">weight = #{weight},</if>
|
<if test="weight != null">weight = #{weight},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="counts != null">counts = #{counts}</if>
|
<if test="counts != null">counts = #{counts}</if>
|
||||||
|
<if test="isFinish != null">is_finish = #{isFinish}</if>
|
||||||
</trim>
|
</trim>
|
||||||
,gmt_modified = now()
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
@ -79,7 +83,8 @@
|
|||||||
name = #{name},
|
name = #{name},
|
||||||
weight = #{weight},
|
weight = #{weight},
|
||||||
remark = #{remark},
|
remark = #{remark},
|
||||||
counts = #{counts}
|
counts = #{counts},
|
||||||
|
is_finish = #{isFinish},
|
||||||
,gmt_modified = now()
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -96,5 +101,9 @@
|
|||||||
<select id="selectNumGoodLuckRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
<select id="selectNumGoodLuckRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
||||||
select sum(counts) from luck_goods where luck_id=#{luckId} and is_delete = 0
|
select sum(counts) from luck_goods where luck_id=#{luckId} and is_delete = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getNoFinishByLuckId" resultType="LuckGoods" >
|
||||||
|
select * from luck_goods where luck_id=#{luckId} and is_delete = 0 and is_finish=0 order by weight desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@ -137,5 +137,13 @@
|
|||||||
select count(1) from luck_record where luck_id=#{luckId} and is_delete = 0 and is_luck=1
|
select count(1) from luck_record where luck_id=#{luckId} and is_delete = 0 and is_luck=1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectNoGoodLuckRecordByLuckId" resultType="LuckRecord" >
|
||||||
|
select * from luck_record where luck_id=#{luckId}and is_delete = 0 and is_luck=0 order by is_luck desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCountRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
||||||
|
select count(1) from luck_record where luck_id=#{luckId} and is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user