Browse Source

Merge branch 'feature/0613-opt' into develop-new

yuanliang 10 months ago
parent
commit
37ced1ced3

+ 7 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/open/OpenTenantController.java

@@ -123,6 +123,13 @@ public class OpenTenantController {
             if (AuthStatusEnum.DOING.equals(one.getStatus())) {
                 throw new BizException(5003, "请等待审核完成");
             }
+            // 处理注销账号登录报错
+            if (AuthStatusEnum.PASS.equals(one.getStatus())) {
+                SysUser sysUser = sysUserService.getByUserId(one.getUserId());
+                if (sysUser != null && Boolean.TRUE.equals(sysUser.getDelFlag())) {
+                    throw new BizException(5002, "请先申请机构入驻");
+                }
+            }
         } else {
             Long tenantId = tenantStaff.getTenantId();
             TenantInfo tenantInfo = tenantInfoService.getById(tenantId);

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TenantApplyRecord.java

@@ -60,6 +60,10 @@ public class TenantApplyRecord implements Serializable {
 	@TableField(value = "phone_")
     private String phone;
 
+    @ApiModelProperty("用户ID")
+    @TableField(value = "user_id_")
+    private Long userId;
+
     @ApiModelProperty("审核状态 DOING、审核中 PASS、通过 UNPASS、不通过") 
 	@TableField(value = "status_")
     private AuthStatusEnum status;

+ 17 - 17
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysUserServiceImpl.java

@@ -262,6 +262,23 @@ public class SysUserServiceImpl implements SysUserService {
             errMsg.add("账户存在未支付、未确认收货、售后处理中的订单");
         }
 
+        // 存在进行中的课程
+        // 陪练课
+        Integer course = courseGroupService.lambdaQuery()
+                .eq(CourseGroup::getTeacherId, userId)
+                .in(CourseGroup::getType, Arrays.asList("PRACTICE", "LIVE", "PIANO_ROOM_CLASS"))
+                .in(CourseGroup::getStatus, Arrays.asList("ING", "APPLY"))
+                .count();
+        // 视频课
+        Integer videoCourse = videoLessonGroupService.lambdaQuery()
+                .eq(VideoLessonGroup::getTeacherId, userId)
+                .eq(VideoLessonGroup::getShelvesFlag, 1)
+                .count();
+
+        if (course > 0 || videoCourse > 0) {
+            errMsg.add("存在进行中的课程");
+        }
+
         Teacher teacher = teacherService.getById(userId);
 
         if (teacher != null) {
@@ -279,23 +296,6 @@ public class SysUserServiceImpl implements SysUserService {
                 }
             }
 
-            // 存在进行中的课程
-            // 陪练课
-            Integer course = courseGroupService.lambdaQuery()
-                    .eq(CourseGroup::getTeacherId, userId)
-                    .in(CourseGroup::getType, Arrays.asList("PRACTICE", "LIVE", "PIANO_ROOM_CLASS"))
-                    .in(CourseGroup::getStatus, Arrays.asList("ING", "APPLY"))
-                    .count();
-            // 视频课
-            Integer videoCourse = videoLessonGroupService.lambdaQuery()
-                    .eq(VideoLessonGroup::getTeacherId, userId)
-                    .eq(VideoLessonGroup::getShelvesFlag, 1)
-                    .count();
-
-            if (course > 0 || videoCourse > 0) {
-                errMsg.add("存在进行中的课程");
-            }
-
             // 存在未提现的金额
             UserAccountVo detail = userAccountService.detail(userId);
             if (detail != null && (detail.getAmountTotal().compareTo(BigDecimal.ZERO) > 0 || detail.getAmountUnrecorded().compareTo(BigDecimal.ZERO) > 0)) {

+ 10 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantApplyRecordServiceImpl.java

@@ -296,10 +296,11 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
         tenantApplyRecord.setVerifyUserId(verifyUserId);
         tenantApplyRecord.setReason(entry.getReason());
         tenantApplyRecord.setBriefIntroduction(applyRecord.getBriefIntroduction());
+
+        applyRecord.setStatus(Boolean.TRUE.equals(ifPass) ? AuthStatusEnum.PASS : AuthStatusEnum.UNPASS);
+        applyRecord.setVerifyUserId(verifyUserId);
+        applyRecord.setReason(entry.getReason());
         if (ifPass == true){
-            tenantApplyRecord.setStatus(AuthStatusEnum.PASS);
-            //更改当前记录的审核状态
-            tenantApplyRecordMapper.updateStatusById(id);
 
             //机构账户新增逻辑
             TenantInfo tenantInfo = new TenantInfo();
@@ -312,16 +313,15 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
             tenantInfo.setPhone(applyRecord.getPhone());
             tenantInfo.setEnableFlag(true);
             tenantInfo.setBriefIntroduction(applyRecord.getBriefIntroduction());
-            tenantInfoService.add(tenantInfo);
-        } else {
-            tenantApplyRecord.setStatus(AuthStatusEnum.UNPASS);
-            tenantApplyRecordMapper.updateUnpassStatusById(id);
+            if (tenantInfoService.add(tenantInfo)) {
+                applyRecord.setUserId(tenantInfo.getUserId());
+            }
         }
+        tenantApplyRecordMapper.updateById(applyRecord);
+
 
-        String name = tenantEntryRecordMapper.selectName(verifyUserId);
-        tenantApplyRecord.setVerifyUserName(name);
 
-        TenantEntryRecord tenantEntryRecord = JSON.parseObject(JSON.toJSONString(tenantApplyRecord), TenantEntryRecord.class);
+        TenantEntryRecord tenantEntryRecord = JSON.parseObject(JSON.toJSONString(applyRecord), TenantEntryRecord.class);
          tenantEntryRecordMapper.insert(tenantEntryRecord);
 
 

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantApplyRecordWrapper.java

@@ -101,6 +101,12 @@ public class TenantApplyRecordWrapper {
         @NotNull(message = "手机号不能为空")
         private String phone;
 
+        @ApiModelProperty("用户ID")
+        private Long userId;
+
+        @ApiModelProperty("用户删除标记")
+        private Boolean userDelFlag;
+
         @ApiModelProperty("省份名称")
         private String provinceName;
 

+ 42 - 23
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantApplyRecordMapper.xml

@@ -15,6 +15,7 @@
         , t.region_code_ AS regionCode
         , t.username_ AS username
         , t.phone_ AS phone
+        , t.user_id_ AS userId
         , t.status_ AS status
         , t.verify_user_id_ AS verifyUserId
         , t.reason_ AS reason
@@ -34,29 +35,47 @@
     </update>
 
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$TenantApplyRecord">
-		SELECT         
-        	<include refid="baseColumns" />
-		FROM tenant_apply_record t
-        <where>
-            <if test="param.keyword != null and param.keyword  != ''">
-                and (
-                t.name_ like concat('%',#{param.keyword},'%')
-                or t.username_ like concat('%',#{param.keyword},'%')
-                or t.phone_ like concat('%',#{param.keyword},'%')
-                )
-            </if>
-            <if test="param.provinceCode != null">
-                and t.province_code_ = #{param.provinceCode}
-            </if>
-            <if test="param.cityCode != null">
-                and t.city_code_ = #{param.cityCode}
-            </if>
-            <if test="param.regionCode != null">
-                and t.region_code_ = #{param.regionCode}
-            </if>
-        </where>
-
-	</select>
+        SELECT * from(
+            SELECT
+            t.id_ AS id
+            , t.name_ AS name
+            , t.logo_ AS logo
+            , t.province_code_ AS provinceCode
+            , t.city_code_ AS cityCode
+            , t.region_code_ AS regionCode
+            , t.username_ AS username
+            , t.phone_ AS phone
+            , t.user_id_ AS userId
+            , t.status_ AS status
+            , t.verify_user_id_ AS verifyUserId
+            , t.reason_ AS reason
+            , t.update_time_ AS updateTime
+            , t.create_time_ AS createTime
+            , t.brief_Introduction_ AS briefIntroduction
+            , if(t.status_='PASS',su.del_flag_,0) userDelFlag
+            FROM tenant_apply_record t
+            left join sys_user su on t.user_id_ = su.id_
+            <where>
+                <if test="param.keyword != null and param.keyword  != ''">
+                    and (
+                    t.name_ like concat('%',#{param.keyword},'%')
+                    or t.username_ like concat('%',#{param.keyword},'%')
+                    or t.phone_ like concat('%',#{param.keyword},'%')
+                    )
+                </if>
+                <if test="param.provinceCode != null">
+                    and t.province_code_ = #{param.provinceCode}
+                </if>
+                <if test="param.cityCode != null">
+                    and t.city_code_ = #{param.cityCode}
+                </if>
+                <if test="param.regionCode != null">
+                    and t.region_code_ = #{param.regionCode}
+                </if>
+            </where>
+        ) k
+        where k.userDelFlag = 0
+    </select>
     <select id="selectHistoryPage"
             resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$TenantApply">
         select