пре 5 година
родитељ
комит
1609352561

+ 29 - 2
bms/src/main/java/com/hssx/bms/controller/InstitutionalInformationController.java

@@ -3,6 +3,7 @@ package com.hssx.bms.controller;
 
 import com.hssx.bms.entity.InstitutionalInformation;
 import com.hssx.bms.entity.InstitutionalPic;
+import com.hssx.bms.entity.SystemUser;
 import com.hssx.bms.entity.vo.InstitutionalInformationVO;
 import com.hssx.bms.service.InstitutionalInformationService;
 import com.hssx.bms.service.InstitutionalPicService;
@@ -33,8 +34,21 @@ public class InstitutionalInformationController {
     private InstitutionalPicService institutionalPicService;
 
     /**
-     * 教育机构的添加
-     * 参数:account 账号,name 名称,address 地址,lng 经度 lat 纬度
+     * 教育机构账号的添加
+     * 参数:account 账号 id 机构的id
+     * @return
+     */
+    @ApiOperation(value = "教育机构账号的添加", notes = "教育机构账号的添加方法")
+    @RequestMapping("/addAccount")
+    @ResponseBody
+    public HttpRespMsg addInstitutionalAccount(SystemUser systemUser){
+        HttpRespMsg msg = institutionalService.addAccount(systemUser);
+        return msg;
+    }
+
+    /**
+     * 教育机构的的添加
+     * 参数:name 名称,address 地址,lng 经度 lat 纬度
      *      phone 电话,
      * @return
      */
@@ -99,6 +113,19 @@ public class InstitutionalInformationController {
         return msg;
     }
 
+    /**
+     * 教育机构信息列表
+     * 参数:id 机构id
+     * @return
+     */
+    @ApiOperation(value = "教育机构信息详情", notes = "教育机构信息详情方法")
+    @RequestMapping("/detail")
+    @ResponseBody
+    public HttpRespMsg detail(SystemUser systemUser){
+        HttpRespMsg msg = institutionalService.getInstitutionDetail(systemUser);
+        return msg;
+    }
+
 
 
 }

+ 5 - 0
bms/src/main/java/com/hssx/bms/service/InstitutionalInformationService.java

@@ -2,6 +2,7 @@ package com.hssx.bms.service;
 
 import com.hssx.bms.entity.InstitutionalInformation;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.bms.entity.SystemUser;
 import com.hssx.bms.entity.vo.InstitutionalInformationVO;
 import com.hssx.bms.until.HttpRespMsg;
 import com.hssx.bms.until.PageUtil;
@@ -22,4 +23,8 @@ public interface InstitutionalInformationService extends IService<InstitutionalI
     HttpRespMsg updateInstitutionalInformation(InstitutionalInformation institutionalInformation,MultipartFile file);
 
     HttpRespMsg getInstitutionList(PageUtil page);
+
+    HttpRespMsg getInstitutionDetail(SystemUser systemUser);
+
+    HttpRespMsg addAccount(SystemUser systemUser);
 }

+ 29 - 9
bms/src/main/java/com/hssx/bms/service/impl/InstitutionalInformationServiceImpl.java

@@ -45,20 +45,13 @@ public class InstitutionalInformationServiceImpl extends ServiceImpl<Institution
     @Override
     public HttpRespMsg add(InstitutionalInformationVO institutionalInformationVO) {
         HttpRespMsg msg = new HttpRespMsg();
-        SystemUser institution = new SystemUser();
-        Integer count = systemUserMapper.selectCount(new QueryWrapper<SystemUser>().eq("account", institutionalInformationVO.getAccount()));
+        Integer count = institutionalMapper.selectCount(new QueryWrapper<InstitutionalInformation>().eq("name", institutionalInformationVO.getName()));
         if(count > 0){
-            msg.setError("账号已存在!");
+            msg.setError("此机构已存在,请添加其他机构");
             return msg;
         }
-        institution.setAccount(institutionalInformationVO.getAccount());
-        institution.setRoleName(institutionalInformationVO.getName());
-        institution.setPassword(MD5Util.getPassword("000000"));
-        institution.setRoleType(1);
-        systemUserMapper.insert(institution);
         InstitutionalInformation information = new InstitutionalInformation();
         BeanUtils.copyProperties(institutionalInformationVO,information);
-        information.setSysId(institution.getId());
         institutionalMapper.insert(information);
         return msg;
     }
@@ -111,4 +104,31 @@ public class InstitutionalInformationServiceImpl extends ServiceImpl<Institution
         return msg;
     }
 
+    @Override
+    public HttpRespMsg getInstitutionDetail(SystemUser systemUser) {
+        HttpRespMsg msg = new HttpRespMsg();
+        InstitutionalInformationVO vo = institutionalMapper.selectDetail(systemUser.getId());
+        msg.data = vo;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg addAccount(SystemUser systemUser) {
+        HttpRespMsg msg = new HttpRespMsg();
+        InstitutionalInformation information = new InstitutionalInformation();
+        information.setId(systemUser.getId());
+        Integer count = systemUserMapper.selectCount(new QueryWrapper<SystemUser>().eq("account", systemUser.getAccount()));
+        if(count > 0){
+            msg.setError("账号已存在!");
+            return msg;
+        }
+        systemUser.setPassword(MD5Util.getPassword("000000"));
+        systemUser.setRoleType(1);
+        systemUser.setId(null);
+        systemUserMapper.insert(systemUser);
+        information.setSysId(systemUser.getId());
+        institutionalMapper.updateById(information);
+        return msg;
+    }
+
 }