Browse Source

学校功能

TRX 1 year ago
parent
commit
0a0f2a61df

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/service/school/SchoolBingShopService.java

@@ -20,6 +20,9 @@ public interface SchoolBingShopService {
     // 学校删除商户
     // 学校删除商户
     ResultContent deleteSchoolBingShop(String shopOid);
     ResultContent deleteSchoolBingShop(String shopOid);
 
 
+    // 得到信息商户信息
+    ResultContent<ShopToSchoolModel> getSchoolBingShop(String shopOid);
+
     // 学校商户列表
     // 学校商户列表
     ResultContent<Page<ShopToSchoolModel>> page(OrganizationRelationSearch param, Pageable pageable);
     ResultContent<Page<ShopToSchoolModel>> page(OrganizationRelationSearch param, Pageable pageable);
 }
 }

+ 7 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/school/OrganizationRelationController.java

@@ -60,6 +60,13 @@ public class OrganizationRelationController {
         return this.schoolBingShopService.deleteSchoolBingShop(shopOid);
         return this.schoolBingShopService.deleteSchoolBingShop(shopOid);
     }
     }
 
 
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "查询学校商户详情", description = "查询学校商户详情")
+    @RequestMapping(value = "getSchoolBingShop", method = {RequestMethod.GET})
+    public ResultContent<ShopToSchoolModel> getSchoolBingShop(@Parameter(name = "shopOid", description = "商户Oid", example = "") @RequestParam("shopOid") String shopOid) {
+        return this.schoolBingShopService.getSchoolBingShop(shopOid);
+    }
+
     @ResourceAuth(value = "user", type = AuthType.User)
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "商户列表-分页查询", description = "商户列表-分页查询")
     @Operation(summary = "商户列表-分页查询", description = "商户列表-分页查询")
     @RequestMapping(value = {"pageTeacher"}, method = {RequestMethod.POST})
     @RequestMapping(value = {"pageTeacher"}, method = {RequestMethod.POST})

+ 26 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/school/SchoolBingShopServiceImpl.java

@@ -106,6 +106,32 @@ public class SchoolBingShopServiceImpl extends SuperService implements SchoolBin
         return ResultContent.buildSuccess();
         return ResultContent.buildSuccess();
     }
     }
 
 
+    /**
+     * 得到学校商户信息
+     *
+     * @param shopOid
+     * @return
+     */
+    public ResultContent<ShopToSchoolModel> getSchoolBingShop(String shopOid) {
+        String oid = getCurrentOid();
+        Organization mainOrganization = organizationDao.findTopByOid(oid);
+        if (mainOrganization.getAuthType() != AuthType.School) {
+            return ResultContent.buildFail(String.format("当前机构不属于学校类型"));
+        }
+        // 商户信息
+        Organization relOrganization = organizationDao.findTopByOid(shopOid);
+        if (ObjectUtils.isEmpty(relOrganization)) {
+            return ResultContent.buildFail(String.format("商户oid不存在:%s", shopOid));
+        }
+        OrganizationRelation relation = organizationRelationDao.findTopByMainOrganizationAndRelOrganizationAndRelationType(
+                mainOrganization, relOrganization, OrganizationRelationType.ShopToSchool);
+        if (ObjectUtils.isEmpty(relation)) {
+            return ResultContent.buildFail(String.format("未找到对应数据:%s", shopOid));
+        }
+        ShopToSchoolModel model = toModel(relation);
+        return ResultContent.buildSuccess(model);
+    }
+
     @Override
     @Override
     public ResultContent<Page<ShopToSchoolModel>> page(OrganizationRelationSearch param, Pageable pageable) {
     public ResultContent<Page<ShopToSchoolModel>> page(OrganizationRelationSearch param, Pageable pageable) {
         String oid = getCurrentOid();
         String oid = getCurrentOid();