浏览代码

Merge branch 'feature/0721-tenant'

yuanliang 1 年之前
父节点
当前提交
60398a2ead

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImGroupServiceImpl.java

@@ -497,6 +497,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
                 .one();
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public void quit(String groupId, Long userId, ClientEnum clientType,Boolean quit) throws Exception {
         try {

+ 6 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -540,13 +540,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
                 List<String> orgGroupIdList = imGroupService.listByIds(groupIdList).stream()
                         .filter(next -> ImGroupType.ORG.equals(next.getType())).map(ImGroup::getId)
                         .collect(Collectors.toList());
-                orgGroupIdList.forEach(groupId -> {
+                for (String groupId : orgGroupIdList) {
                     try {
                         imGroupService.quit(groupId, student.getUserId(), ClientEnum.STUDENT,true);
                     } catch (Exception e) {
                         log.error("学生注册,切换机构退群失败:{}", e.getMessage());
+                        throw new BizException("退群失败");
                     }
-                });
+                }
             }
 //             删除好友
             imUserFriendService.delTeacherFriendByTenantId(student.getTenantId(), student.getUserId(),
@@ -588,13 +589,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
                 List<String> orgGroupIdList = imGroupService.listByIds(groupIdList).stream()
                         .filter(next -> ImGroupType.ORG.equals(next.getType())).map(ImGroup::getId)
                         .collect(Collectors.toList());
-                orgGroupIdList.forEach(groupId -> {
+                for (String groupId : orgGroupIdList) {
                     try {
                         imGroupService.quit(groupId, student.getUserId(), ClientEnum.STUDENT, true);
                     } catch (Exception e) {
                         log.error("学生注册,切换机构退群失败:{}", e.getMessage());
+                        throw new BizException("退群失败");
                     }
-                });
+                }
             }
 //             删除好友
             imUserFriendService.delTeacherFriendByTenantId(student.getTenantId(), student.getUserId(),

+ 7 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java

@@ -388,21 +388,21 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
     public HttpResponseResult<Object> importActiveCode(List<ExcelDataReaderProperty<TenantActivationCodeWrapper.ImportTemplate>> dataList,
                                                            Long tenantId, Long userId, Long tenantAlbumPurchaseId) {
         if (dataList.isEmpty()) {
-            throw new BizException("未解析到数据");
+            return HttpResponseResult.failed(500, null, "未解析到数据");
         }
         dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
 
         List<TenantActivationCodeWrapper.ImportTemplate> importTemplates = dataList.stream().map(ExcelDataReaderProperty::getClazz).collect(Collectors.toList());
         List<String> codeList = importTemplates.stream().map(TenantActivationCodeWrapper.ImportTemplate::getCode).
                 filter(StringUtils::isNotEmpty).collect(Collectors.toList());
-        if(codeList.isEmpty()){
-            throw new BizException("未指定激活码");
+        if (codeList.isEmpty()) {
+            return HttpResponseResult.failed(500, null, "未指定激活码");
         }
 
         List<String> phoneList = importTemplates.stream().map(TenantActivationCodeWrapper.ImportTemplate::getPhone)
                         .filter(StringUtils::isNotEmpty).collect(Collectors.toList());
-        if(phoneList.isEmpty()){
-            throw new BizException("未指定手机号");
+        if (phoneList.isEmpty()) {
+            return HttpResponseResult.failed(500, null, "未指定手机号");
         }
 
         List<TenantActivationCode> activationCodes = this.lambdaQuery()
@@ -450,6 +450,7 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
                     lines.add(repeatLine);
                 }
                 lines.add(msgRowNo);
+                code_repeat_lines.put(code, lines);
             } else {
                 codeRowMap.put(acCode, msgRowNo);
             }
@@ -532,7 +533,7 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
                     return tenantActivationCode;
                 }).collect(Collectors.toList());
         if (tenantActivationCodes.isEmpty()) {
-            throw new BizException("没有合法的导入数据");
+            return HttpResponseResult.failed(500, null, "没有合法的导入数据");
         }
         this.updateBatchById(tenantActivationCodes, 50);
         return HttpResponseResult.succeed();

+ 6 - 1
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/TeacherController.java

@@ -108,7 +108,11 @@ public class TeacherController extends BaseController {
     @PostMapping("/submit")
     @ApiOperation(value = "新增或修改", notes = "传入teacher")
     public HttpResponseResult<Boolean> submit(@Valid @RequestBody TeacherSubmitReq teacherSubmitReq) {
-        TenantInfo tenantInfo = getTenantInfo();
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        TenantInfo tenantInfo = tenantInfoService.getById(sysUser.getTenantId());
+        if (tenantInfo == null) {
+            throw new BizException("非法请求");
+        }
         if (teacherSubmitReq.getUserId() != null) {
             Teacher teacher = teacherService.lambdaQuery().eq(Teacher::getUserId, teacherSubmitReq.getUserId())
                     .eq(Teacher::getTenantId, tenantInfo.getId()).last("limit 1").one();
@@ -117,6 +121,7 @@ public class TeacherController extends BaseController {
             }
         }
         teacherSubmitReq.setTenantId(tenantInfo.getId());
+        teacherSubmitReq.setUpdateBy(sysUser.getId());
         return teacherService.submit(teacherSubmitReq);
     }