Commit aba9a3ac by LiZeC

查询按照版本分组的二维码数量

parent bd1c0493
......@@ -107,6 +107,11 @@ public interface WeixinQrcodeBiz {
QrStatisticsVO getQrStatistics();
/**
* 根据版本分类统计平台端二维码数据
*/
List<QrStatisticsVO> getQrStatisticsByVersion();
/**
* 分页获取可用微信群
* @param currentPage
* @param numPerPage
......
......@@ -324,6 +324,35 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
}
@Override
@ParamLog("按照版本分类获取平台端统计数据")
public List<QrStatisticsVO> getQrStatisticsByVersion() {
List<QrStatisticsVO> qrStatistics = weixinQrcodeDao.getQrStatisticsByVersion();
List<QrStatisticsVO> counts = weixinQrcodeDao.getQrcodeCountByVersion();
if (ListUtils.isEmpty(qrStatistics)) {
qrStatistics = new ArrayList<>();
QrStatisticsVO qr = new QrStatisticsVO();
qr.setAllCount(0);
qr.setInUseCount(0);
qr.setNotUseCount(0);
qr.setVersion(0);
qrStatistics.add(qr);
return qrStatistics;
}
// 组合两部分数据
for(QrStatisticsVO qr:qrStatistics){
for(QrStatisticsVO c: counts){
if(qr.getVersion().equals(c.getVersion())){
qr.setAllCount(c.getAllCount());
break;
}
}
}
return qrStatistics;
}
@Override
@ParamLog("分页获取可用微信群")
public List<BookWxQrcodeDTO> listAvailableGroupByPage(Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
......
......@@ -41,6 +41,12 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
QrStatisticsVO getQrStatistics();
/**
* 获取依据版本分类的二维码统计数据
* @return 依据版本分类的二维码统计数据
*/
List<QrStatisticsVO> getQrStatisticsByVersion();
/**
* @Author:lili
* @Desr:将处理中的二维码修改为处理失败
* @Date:2019/3/7 15:21
......@@ -117,6 +123,8 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
*/
Integer getQrcodeCount();
List<QrStatisticsVO> getQrcodeCountByVersion();
/**
* @Author:lili
* @Desr:校验存在性
......
......@@ -47,6 +47,11 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
}
@Override
public List<QrStatisticsVO> getQrStatisticsByVersion() {
return this.getSessionTemplate().selectList(this.getStatement("getQrStatisticsByVersion"));
}
@Override
public void updateStatusToError() {
this.getSqlSession().update(this.getStatement("updateStatusToError"));
}
......@@ -118,6 +123,11 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
}
@Override
public List<QrStatisticsVO> getQrcodeCountByVersion() {
return this.getSqlSession().selectList(this.getStatement("getQrcodeCountByVersion"));
}
@Override
public Boolean checkExist(String weixinGroupId) {
return this.getSqlSession().selectOne(this.getStatement("checkExist"), weixinGroupId);
}
......
......@@ -16,6 +16,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @author lily
* @date 2019/4/26 15:10
......@@ -38,4 +40,10 @@ public interface WeixinQrcodeFacade {
@GetMapping("getQrStatistics")
ResponseDto<QrStatisticsVO> getQrStatistics(@RequestHeader("token") String token)
throws BizException, PermissionException;
@GetMapping("getQrStatisticsByVersion")
ResponseDto<List<QrStatisticsVO>> getQrStatisticsByVersion(@RequestHeader("token") String token)
throws BizException, PermissionException;
}
......@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @author lily
* @date 2019/4/26 15:10
......@@ -44,4 +46,11 @@ public class WeixinQrcodeFacadeImpl implements WeixinQrcodeFacade {
throws BizException {
return new ResponseDto<>(weixinQrcodeBiz.getQrStatistics());
}
@Override
@GetMapping("getQrStatisticsByVision")
@ApiOperation("平台端按照版本获取二维码统计数据")
public ResponseDto<List<QrStatisticsVO>> getQrStatisticsByVersion(String token) throws BizException {
return new ResponseDto<>(weixinQrcodeBiz.getQrStatisticsByVersion());
}
}
package com.pcloud.book.group.vo;
import java.io.Serializable;
import java.util.Map;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 戴兴
* @description TODO
* @date 2019/2/28 18:15
*/
@Data
public class QrStatisticsVO implements Serializable {
@ApiModelProperty("所有个数")
......@@ -20,36 +23,6 @@ public class QrStatisticsVO implements Serializable {
@ApiModelProperty("未使用的个数")
private Integer notUseCount;
public Integer getAllCount() {
return allCount;
}
public void setAllCount(Integer allCount) {
this.allCount = allCount;
}
public Integer getInUseCount() {
return inUseCount;
}
public void setInUseCount(Integer inUseCount) {
this.inUseCount = inUseCount;
}
public Integer getNotUseCount() {
return notUseCount;
}
public void setNotUseCount(Integer notUseCount) {
this.notUseCount = notUseCount;
}
@Override
public String toString() {
return "QrStatisticsVO{" +
"allCount=" + allCount +
", inUseCount=" + inUseCount +
", notUseCount=" + notUseCount +
'}';
}
@ApiModelProperty("QR版本")
private Integer version;
}
\ No newline at end of file
......@@ -69,6 +69,13 @@
update_state != 2 AND use_state in (0,1,3)
</select>
<select id="getQrStatisticsByVersion" resultType="QrStatisticsVO">
SELECT sum(if(use_state = 0, 1, 0)) notUseCount, sum(if(use_state = 1, 1, 0)) inUseCount, generation version
FROM weixin_qrcode
WHERE update_state != 2
GROUP BY generation;
</select>
<update id="updateStatusToError" >
update
weixin_qrcode
......@@ -208,6 +215,12 @@
FROM weixin_qrcode
</select>
<select id="getQrcodeCountByVersion" resultType="QrStatisticsVO">
SELECT count(1) allCount, generation version
FROM weixin_qrcode
group by generation;
</select>
<select id="checkExist" resultType="Boolean" parameterType="String">
select
count(1)
......
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