浏览代码

1.绑定微信调整

yuanliang 2 年之前
父节点
当前提交
c089febdc3

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/StudentSearch.java

@@ -71,6 +71,9 @@ public class StudentSearch extends QueryInfo{
     @ApiModelProperty("机构名称")
     private String tenantName;
 
+    @ApiModelProperty("是否绑定机构,0:不绑定,1:绑定")
+    private Integer bindTenant;
+
     @ApiModelProperty("机构购买专辑的购买记录ID")
     private Long tenantAlbumPurchaseId;
 

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/TeacherSearch.java

@@ -69,6 +69,9 @@ public class TeacherSearch extends QueryInfo{
 	@ApiModelProperty("机构名称")
 	private String tenantName;
 
+	@ApiModelProperty("是否绑定机构,0:不绑定,1:绑定")
+	private Integer bindTenant;
+
 	@ApiModelProperty("结算方式")
 	private ESettlementFrom settlementFrom;
 

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -156,6 +156,12 @@
             <if test="param.tenantId != null">
                 and t.tenant_id_ = #{param.tenantId}
             </if>
+            <if test="param.bindTenant != null and param.bindTenant == 0">
+                and t.tenant_id_ = -1
+            </if>
+            <if test="param.bindTenant != null and param.bindTenant == 1">
+                and t.tenant_id_ != -1
+            </if>
             <if test="param.tenantName != null and param.tenantName.trim() != ''">
                 and ti.name_ like concat('%',#{param.tenantName},'%')
             </if>

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -178,6 +178,12 @@
             <if test="param.tenantId != null">
                 AND t.tenant_id_ = #{param.tenantId}
             </if>
+            <if test="param.bindTenant != null and param.bindTenant == 0">
+                and t.tenant_id_ = -1
+            </if>
+            <if test="param.bindTenant != null and param.bindTenant == 1">
+                and t.tenant_id_ != -1
+            </if>
             <if test="param.settlementFrom != null">
                 AND t.settlement_from_ = #{param.settlementFrom}
             </if>

+ 12 - 12
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenTenantController.java

@@ -1,10 +1,10 @@
 package com.yonge.cooleshow.tenant.controller.open;
 
-import com.yonge.cooleshow.biz.dal.entity.TenantEntryRecord;
+import com.yonge.cooleshow.biz.dal.entity.TenantApplyRecord;
 import com.yonge.cooleshow.biz.dal.entity.TenantStaff;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
 import com.yonge.cooleshow.biz.dal.service.TenantApplyRecordService;
-import com.yonge.cooleshow.biz.dal.service.TenantEntryRecordService;
 import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
@@ -36,9 +36,6 @@ public class OpenTenantController {
     @Autowired
     private SmsCodeService smsCodeService;
 
-    @Autowired
-    private TenantEntryRecordService tenantEntryRecordService;
-
 
     @PostMapping("/apply")
     @ApiOperation(value = "申请")
@@ -61,17 +58,20 @@ public class OpenTenantController {
         if (!validCode) {
             throw new BizException("验证码错误");
         }
-        TenantStaff tenantStaff = tenantStaffService.getByPhone(phone);
-        if (tenantStaff == null) {
+        TenantApplyRecord one = tenantApplyRecordService.lambdaQuery()
+                .eq(TenantApplyRecord::getPhone, phone)
+                .orderByDesc(TenantApplyRecord::getCreateTime)
+                .last("limit 1").one();
+        if (one == null || AuthStatusEnum.UNPASS.equals(one.getStatus())) {
             throw new BizException(5002, "请先申请机构入驻");
         }
-        TenantEntryRecord one = tenantEntryRecordService.lambdaQuery()
-                .eq(TenantEntryRecord::getPhone, phone)
-                .eq(TenantEntryRecord::getStatus, "DOING")
-                .last("limit 1").one();
-        if (one != null) {
+        if (AuthStatusEnum.DOING.equals(one.getStatus())) {
             throw new BizException(5003, "请等待审核完成");
         }
+        TenantStaff tenantStaff = tenantStaffService.getByPhone(phone);
+        if (tenantStaff == null) {
+            throw new BizException("账号注册失败");
+        }
         tenantStaff.setWxOpenid(openId);
         tenantStaffService.updateById(tenantStaff);
         return HttpResponseResult.succeed();