diff --git a/src/main/java/com/zcloud/controller/system/DepartmentController.java b/src/main/java/com/zcloud/controller/system/DepartmentController.java index 7e86422..23324d4 100644 --- a/src/main/java/com/zcloud/controller/system/DepartmentController.java +++ b/src/main/java/com/zcloud/controller/system/DepartmentController.java @@ -61,6 +61,18 @@ public class DepartmentController extends BaseController { corpPage.put("CORPINFO_ID", corpinfoId); PageData corpInfo = corpInfoService.findById(corpPage); // {"deptName":"0226-wx","enterpriseId":4,"staffId":"","deptPhone":"","deptAddress":"","remark":"","deptDuty":""} + corpPage.put("enterpriseName",corpInfo.getString("CORP_NAME")); + if (Tools.isEmpty(corpInfo.getString("enterpriseId"))) { + JSONObject body = PLSUtil.GeneralPost("/deploy/enterprise/addDepEnterprise", corpPage, corpinfoId); + if (body != null) { + if (!"200".equals(body.getString("code"))) { + return ReturnMap.error("人员定位系统中部门新增失败"); + } + corpPage.put("enterpriseId", body.getString("data")); + corpInfo.put("enterpriseId", body.getString("data")); + corpInfoService.updateEnterpriseId(corpPage); + } + } PageData dept = new PageData(); dept.put("deptName", pd.getString("NAME")); dept.put("enterpriseId", corpInfo.get("enterpriseId")); @@ -69,7 +81,7 @@ public class DepartmentController extends BaseController { if (!"200".equals(body.getString("code"))) { return ReturnMap.error("人员定位系统中部门新增失败"); } - pd.put("deptId", body.getString("deptId")); + pd.put("deptId", body.getString("data")); } pd.put("DEPARTMENT_ID", this.get32UUID()); //主键 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 diff --git a/src/main/java/com/zcloud/mapper/datasource/corp/CorpInfoMapper.java b/src/main/java/com/zcloud/mapper/datasource/corp/CorpInfoMapper.java index b4743e2..2817958 100644 --- a/src/main/java/com/zcloud/mapper/datasource/corp/CorpInfoMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/corp/CorpInfoMapper.java @@ -73,5 +73,7 @@ public interface CorpInfoMapper { PageData getInfo(PageData corpCondition); PageData eightWorkBI(PageData pd); + + void updateEnterpriseId(PageData corpPage); } diff --git a/src/main/java/com/zcloud/service/corp/CorpInfoService.java b/src/main/java/com/zcloud/service/corp/CorpInfoService.java index 2b23be0..ed9f58f 100644 --- a/src/main/java/com/zcloud/service/corp/CorpInfoService.java +++ b/src/main/java/com/zcloud/service/corp/CorpInfoService.java @@ -70,5 +70,7 @@ public interface CorpInfoService { public PageData findByCode(PageData pd)throws Exception; PageData eightWorkBI(PageData pd)throws Exception; + + void updateEnterpriseId(PageData corpPage); } diff --git a/src/main/java/com/zcloud/service/corp/impl/CorpInfoServiceImpl.java b/src/main/java/com/zcloud/service/corp/impl/CorpInfoServiceImpl.java index 23e5619..09ffbc7 100644 --- a/src/main/java/com/zcloud/service/corp/impl/CorpInfoServiceImpl.java +++ b/src/main/java/com/zcloud/service/corp/impl/CorpInfoServiceImpl.java @@ -113,5 +113,10 @@ public class CorpInfoServiceImpl implements CorpInfoService { return corpinfoMapper.eightWorkBI(pd); } + @Override + public void updateEnterpriseId(PageData corpPage) { + corpinfoMapper.updateEnterpriseId(corpPage); + } + } diff --git a/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml b/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml index 9650d4b..c3f566a 100644 --- a/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml +++ b/src/main/resources/mybatis/datasource/corp/CorpInfoMapper.xml @@ -333,8 +333,16 @@ where CORPINFO_ID = #{CORPINFO_ID} + + update + + set + enterpriseId = #{enterpriseId} + where + CORPINFO_ID = #{CORPINFO_ID} + - +