yanite 3 years ago
parent
commit
08e523a986

+ 28 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantProductSumm.java

@@ -37,9 +37,15 @@ public class TenantProductSumm extends TenantInfo implements Serializable  {
     @ApiModelProperty(value = "冻结金额")
     private BigDecimal frozenAmount;
 
+    @ApiModelProperty(value = "已有学员")
+    private Integer studentNum;
+
+    @ApiModelProperty(value = "学员上限")
+    private Integer studentUpLimit;
+
     // ----------- 计算字段
-    @ApiModelProperty(value = "服务有效期开始")
-    private Date payDateEnd;
+    @ApiModelProperty(value = "服务有效期结束")
+    private Date expiryDateEnd;
 
     @ApiModelProperty(value = "剩余天数")
     private String validRemaining;
@@ -95,12 +101,12 @@ public class TenantProductSumm extends TenantInfo implements Serializable  {
         this.frozenAmount = frozenAmount;
     }
 
-    public Date getPayDateEnd() {
-        return payDateEnd;
+    public Date getExpiryDateEnd() {
+        return expiryDateEnd;
     }
 
-    public void setPayDateEnd(Date payDateEnd) {
-        this.payDateEnd = payDateEnd;
+    public void setExpiryDateEnd(Date expiryDateEnd) {
+        this.expiryDateEnd = expiryDateEnd;
     }
 
     public String getValidRemaining() {
@@ -118,5 +124,21 @@ public class TenantProductSumm extends TenantInfo implements Serializable  {
     public void setSumBalance(BigDecimal sumBalance) {
         this.sumBalance = sumBalance;
     }
+
+    public Integer getStudentNum() {
+        return studentNum;
+    }
+
+    public void setStudentNum(Integer studentNum) {
+        this.studentNum = studentNum;
+    }
+
+    public Integer getStudentUpLimit() {
+        return studentUpLimit;
+    }
+
+    public void setStudentUpLimit(Integer studentUpLimit) {
+        this.studentUpLimit = studentUpLimit;
+    }
 }
 

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -81,6 +81,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     private TenantOrderRecordService tenantOrderRecordService;
     @Autowired
     private TenantAssetsInfoService assetsInfoService;
+    @Autowired
+    private StudentService studentService;
 
     /**
      * 新增机构
@@ -658,7 +660,13 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         } else {
             d1 = null;
         }
-        tps.setPayDateEnd(d1);
+        tps.setSumBalance(tps.getBalance().add(tps.getFrozenAmount()));
+        tps.setExpiryDateEnd(d1);
+
+        Map<String, Object> params = new HashMap<>();
+        params.put("tenantId", tenantId);
+        int studentCount = studentService.findCount(params);
+        tps.setStudentNum(studentCount);
         return tps;
     }
 

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -194,7 +194,7 @@
     </select>
     <sql id="queryPageSql">
         <where>
-        	s.tenant_id_ = #{tenantId}
+        	s.tenant_id_ = #{tenantId} and su.del_flag_ = 0
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(su.organ_id_,#{organId})
             </if>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -95,9 +95,9 @@
                    tp.expiry_date_ as expiryDate,
                    tp.expiry_count_  as expiryCount,
                    tp.expiry_unit_ as expiryUnit,
-
                    ta.balance_ as balance,
-                   ta.frozen_amount_ as frozenAmount
+                   ta.frozen_amount_ as frozenAmount,
+                   psd.student_up_limit_ as studentUpLimit
             FROM `tenant_info` t
                      left join tenant_assets_info ta on ta.tenant_id_ = t.id_
                      left join tenant_product_info tp on tp.tenant_id_ = t.id_