Commit 22e0ff24 by zhangchunyu

添加canUseCount

parent ce749d8c
......@@ -46,6 +46,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
......@@ -360,6 +361,13 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
// 组合两部分数据
for(QrStatisticsVO qr:qrStatistics){
List<Integer> list = Arrays.asList(1, 2, 4);
//社群吗需要过滤过期的群,个人码不需要
if (list.contains(qr.getVersion())) {
qr.setCanUseCount(weixinQrcodeDao.getCanUseCount(qr.getVersion()));
}else {
qr.setCanUseCount(qr.getNotUseCount());
}
for(QrStatisticsVO c: counts){
if(qr.getVersion().equals(c.getVersion())){
qr.setAllCount(c.getAllCount());
......
......@@ -172,4 +172,6 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
void updateGenerationMachineIp(Integer generation, String machineIp);
List<UpdateQrDTO> listUpdateQrByGeneration(Integer generation, Integer limit);
Integer getCanUseCount(Integer version);
}
......@@ -188,4 +188,9 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
paramMap.put("num", limit);
return this.getSessionTemplate().selectList(getStatement("listUpdateQrByGeneration"), paramMap);
}
@Override
public Integer getCanUseCount(Integer version) {
return this.getSessionTemplate().selectOne(getStatement("getCanUseCount"), version);
}
}
package com.pcloud.book.group.vo;
import java.io.Serializable;
import java.util.Map;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -25,4 +24,7 @@ public class QrStatisticsVO implements Serializable {
@ApiModelProperty("QR版本")
private Integer version;
@ApiModelProperty("可用个数")
private Integer canUseCount;
}
\ No newline at end of file
......@@ -313,4 +313,9 @@
ORDER BY update_qr_time ASC
LIMIT #{num}
</select>
<select id="getCanUseCount" parameterType="int" resultType="integer">
SELECT ifnull(COUNT(1), 0) FROM weixin_qrcode WHERE update_state !=2 AND use_state = 0
and generation = #{_parameter}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment