Sfoglia il codice sorgente

add 列表加上统计数据

周箭河 4 anni fa
parent
commit
3d13b80bb6

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentCooperationDao.java

@@ -3,13 +3,22 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 public interface ReplacementInstrumentCooperationDao extends com.ym.mec.common.dal.BaseDAO<Integer, ReplacementInstrumentCooperation> {
 
     /**
      * 获取合作单位的活动
+     *
      * @param cooperationId
      * @return
      */
     ReplacementInstrumentCooperation getByCooperationId(@Param("cooperationId") Integer cooperationId);
+
+    /**
+     * 统计个合作单位的转化率
+     * @return
+     */
+    List<ReplacementInstrumentCooperation> countAllReplacementsInfo();
 }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentCooperation.java

@@ -54,9 +54,15 @@ public class ReplacementInstrumentCooperation {
     @ApiModelProperty(value = "置换人数")
     private Integer replaceNum = 0;
 
+    @ApiModelProperty(value = "支付人数")
+    private Integer payNum = 0;
+
     @ApiModelProperty(value = "置换率")
     private BigDecimal replaceScale = BigDecimal.ZERO;
 
+    @ApiModelProperty(value = "缴费率")
+    private BigDecimal payScale = BigDecimal.ZERO;
+
     public Integer getId() {
         return id;
     }
@@ -160,4 +166,20 @@ public class ReplacementInstrumentCooperation {
     public void setReplaceScale(BigDecimal replaceScale) {
         this.replaceScale = replaceScale;
     }
+
+    public Integer getPayNum() {
+        return payNum;
+    }
+
+    public void setPayNum(Integer payNum) {
+        this.payNum = payNum;
+    }
+
+    public BigDecimal getPayScale() {
+        return payScale;
+    }
+
+    public void setPayScale(BigDecimal payScale) {
+        this.payScale = payScale;
+    }
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentCooperationServiceImpl.java

@@ -14,6 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 @Service
 public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentCooperation> implements ReplacementInstrumentCooperationService {
 
@@ -56,6 +59,15 @@ public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl
     public PageInfo<ReplacementInstrumentCooperation> getPageList(ReplacementInstrumentCooperationQueryInfo queryInfo) {
         PageInfo<ReplacementInstrumentCooperation> pageInfo = queryPage(queryInfo);
         if (pageInfo.getRows().size() > 0) {
+            List<ReplacementInstrumentCooperation> replacementInstruments = replacementInstrumentCooperationDao.countAllReplacementsInfo();
+            for (ReplacementInstrumentCooperation row : pageInfo.getRows()) {
+                for (ReplacementInstrumentCooperation replacementInstrument : replacementInstruments) {
+                    if (!row.getCooperationOrganId().equals(row.getCooperationOrganId())) continue;
+                    row.setActiveNum(replacementInstrument.getActiveNum());
+                    row.setReplaceNum(replacementInstrument.getReplaceNum());
+                    row.setReplaceScale(new BigDecimal(replacementInstrument.getReplaceNum()).multiply(new BigDecimal(100)).divide(new BigDecimal(replacementInstrument.getActiveNum()), 2, BigDecimal.ROUND_HALF_UP));
+                }
+            }
 
         }
         return pageInfo;

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentCooperationMapper.xml

@@ -93,4 +93,12 @@
         WHERE cooperation_organ_id_ = #{cooperationId}
     </select>
 
+    <select id="countAllReplacementsInfo" resultType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
+        SELECT cooperation_organ_id_              cooperationOrganId,
+               COUNT(*)                           activeNum,
+               SUM(IF(instruments_id_ > 0, 1, 0)) replaceNum
+        FROM replacement_instrument_activity
+        GROUP BY cooperation_organ_id_
+    </select>
+
 </mapper>