From 8397d0fd9cecec3553a19582a37bc302393cb81f Mon Sep 17 00:00:00 2001
From: 1098226878 <1098226878@qq.com>
Date: 星期六, 11 九月 2021 12:31:09 +0800
Subject: [PATCH] 完善商户与员工信息上传
---
service-job/src/main/java/com/java110/job/adapt/hcGov/staff/AddStaffToHcGovAdapt.java | 160 ++++++++++++++++++++++++++++++++---------------------
1 files changed, 96 insertions(+), 64 deletions(-)
diff --git a/service-job/src/main/java/com/java110/job/adapt/hcGov/staff/AddStaffToHcGovAdapt.java b/service-job/src/main/java/com/java110/job/adapt/hcGov/staff/AddStaffToHcGovAdapt.java
index 71fc1b5..02fa8e3 100644
--- a/service-job/src/main/java/com/java110/job/adapt/hcGov/staff/AddStaffToHcGovAdapt.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcGov/staff/AddStaffToHcGovAdapt.java
@@ -35,6 +35,7 @@
import com.java110.job.adapt.hcGov.asyn.BaseHcGovSendAsyn;
import com.java110.po.user.UserPo;
import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -100,14 +101,105 @@
return;
}
storeUserDto = storeUserDtos.get(0);
+
+ String extCompanyId = "";
+ String ACTION_TYPE = HcGovConstant.ADD_STAFF_ACTION;
+ String SoreId = storeUserDto.getStoreId();
+
+ //鏌ヨ鍟嗘埛瀵瑰簲鐨勫皬鍖哄閮ㄧ紪鐮�
+ CommunityMemberDto communityMemberDto = new CommunityMemberDto();
+ communityMemberDto.setMemberId(SoreId);
+ List<CommunityMemberDto> communityMemberDtos = communityInnerServiceSMOImpl.getCommunityMembers(communityMemberDto);
+ JSONArray extCommunityId = new JSONArray();
+ //
+ getCommunityExtId(communityMemberDtos, extCommunityId);
+
+ if (extCommunityId == null || extCommunityId.size() < 1) {
+ return;
+ }
+ StoreAttrDto storeAttrDto = new StoreAttrDto();
+ //鏌ヨ鍟嗘埛灞炴�� 澶栭儴缂栫爜
+ storeAttrDto.setStoreId(SoreId);
+ storeAttrDto.setSpecCd(HcGovConstant.EXT_COMMUNITY_ID);
+ List<StoreAttrDto> storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
+ if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
+ extCompanyId = storeAttrDtos.get(0).getValue();
+ }
+ JSONObject body = new JSONObject();
+ if (StringUtil.isEmpty(extCompanyId)) {
+ body.put("companyInfo", getCarateStoreInfo(SoreId,storeUserDto));
+ ACTION_TYPE=HcGovConstant.ADD_COMPANY_ACTION;
+ }
+
+ body.put("staffInfo", getCarateStaffInfo(userPo));
+
+ JSONObject kafkaData = baseHcGovSendAsynImpl.createHeadersOrBody(body, extCommunityId.getString(0), ACTION_TYPE, HcGovConstant.COMMUNITY_SECURE);
+ baseHcGovSendAsynImpl.sendKafka(HcGovConstant.GOV_TOPIC, kafkaData, extCommunityId.getString(0), SoreId, HcGovConstant.COMMUNITY_SECURE);
+ }
+
+ public void getCommunityExtId(List<CommunityMemberDto> communityMemberDtos, JSONArray extCommunityId) {
+ if (communityMemberDtos == null || communityMemberDtos.size() == 0) {
+ return;
+ }
+ for (CommunityMemberDto communityMember : communityMemberDtos) {
+ CommunityDto communityDto = new CommunityDto();
+ communityDto.setCommunityId(communityMember.getCommunityId());
+ List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+ if (communityDtos == null || communityDtos.size() == 0) {
+ continue;
+ }
+ extracted(extCommunityId, communityDtos);
+ }
+ }
+
+ private void extracted(JSONArray extCommunityId, List<CommunityDto> communityDtos) {
+ for (CommunityDto community : communityDtos) {
+ for (CommunityAttrDto communityAttrDto : community.getCommunityAttrDtos()) {
+ if (HcGovConstant.EXT_COMMUNITY_ID.equals(communityAttrDto.getSpecCd())) {
+ extCommunityId.add(communityAttrDto.getValue());
+ }
+ }
+ }
+ }
+
+ private JSONObject getCarateStaffInfo(UserPo userPo) {
+
+ String orgName = "";
+ String relCd = "";
+ JSONObject staffInfo = new JSONObject();
+
+ staffInfo.put("PersonName", userPo.getName());
+ staffInfo.put("PersonTel", userPo.getTel());
+ staffInfo.put("PersonSex", userPo.getSex());
+ staffInfo.put("prePersonName", userPo.getName());
+
+ OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
+ orgStaffRelDto.setStaffId(userPo.getUserId());
+ List<OrgStaffRelDto> orgStaffRelDtos = orgStaffRelInnerServiceSMOImpl.queryOrgStaffRels(orgStaffRelDto);
+ if (orgStaffRelDtos != null || orgStaffRelDtos.size() > 0) {
+ OrgDto orgDto = new OrgDto();
+ orgDto.setOrgId(orgStaffRelDtos.get(0).getOrgId());
+ List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto);
+ if (orgDtos != null || orgDtos.size() > 0) {
+ orgName = orgDtos.get(0).getOrgName();
+ }
+ relCd = orgStaffRelDtos.get(0).getRelCd();
+ }
+ staffInfo.put("govOrgName", orgName);
+ staffInfo.put("relCd", relCd);
+
+ return staffInfo;
+ }
+
+ private JSONObject getCarateStoreInfo(String SoreId, StoreUserDto storeUserDto) {
+
String artificialPerson = "";
String registerTime = "";
String idCard = "";
- String SoreId = storeUserDto.getStoreId();
JSONObject companyInfo = new JSONObject();
- JSONObject staffInfo = new JSONObject();
- //鏌ヨ鍟嗘埛灞炴�� 浼佷笟娉曚汉
+
StoreAttrDto storeAttrDto = new StoreAttrDto();
+ //鏌ヨ鍟嗘埛灞炴�� 浼佷笟娉曚汉
storeAttrDto.setStoreId(SoreId);
storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_ARTIFICIALPERSON);
List<StoreAttrDto> storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
@@ -138,67 +230,7 @@
companyInfo.put("personTel", storeUserDto.getTel());
companyInfo.put("personIdCard", idCard);
- CommunityMemberDto communityMemberDto = new CommunityMemberDto();
- communityMemberDto.setMemberId(SoreId);
- List<CommunityMemberDto> communityMemberDtos = communityInnerServiceSMOImpl.getCommunityMembers(communityMemberDto);
- JSONArray extCommunityId = new JSONArray();
- //
- getCommunityExtId(communityMemberDtos, extCommunityId);
-
- if (extCommunityId == null || extCommunityId.size() < 1) {
- return;
- }
- String orgName = "";
- String relCd = "";
- JSONObject body = new JSONObject();
- staffInfo.put("PersonName", userPo.getName());
- staffInfo.put("PersonTel", userPo.getTel());
- staffInfo.put("PersonSex", userPo.getSex());
- staffInfo.put("prePersonName", userPo.getName());
-
- OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
- orgStaffRelDto.setStaffId(userPo.getUserId());
- List<OrgStaffRelDto> orgStaffRelDtos = orgStaffRelInnerServiceSMOImpl.queryOrgStaffRels(orgStaffRelDto);
- if (orgStaffRelDtos != null || orgStaffRelDtos.size() > 0) {
- OrgDto orgDto = new OrgDto();
- orgDto.setOrgId(orgStaffRelDtos.get(0).getOrgId());
- List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto);
- if (orgDtos != null || orgDtos.size() > 0) {
- orgName = orgDtos.get(0).getOrgName();
- }
- relCd = orgStaffRelDtos.get(0).getRelCd();
- }
- staffInfo.put("govOrgName", orgName);
- staffInfo.put("relCd", relCd);
- body.put("companyInfo",companyInfo);
- body.put("staffInfo",staffInfo);
- JSONObject kafkaData = baseHcGovSendAsynImpl.createHeadersOrBody(body, extCommunityId.getString(0), HcGovConstant.ADD_OWNER_ACTION, HcGovConstant.COMMUNITY_SECURE);
- baseHcGovSendAsynImpl.sendKafka(HcGovConstant.GOV_TOPIC, kafkaData, extCommunityId.getString(0), SoreId, HcGovConstant.COMMUNITY_SECURE);
- }
-
- public void getCommunityExtId(List<CommunityMemberDto> communityMemberDtos, JSONArray extCommunityId) {
- if (communityMemberDtos == null || communityMemberDtos.size() == 0) {
- return;
- }
- for (CommunityMemberDto communityMember : communityMemberDtos) {
- CommunityDto communityDto = new CommunityDto();
- communityDto.setCommunityId(communityMember.getCommunityId());
- List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
- if (communityDtos == null || communityDtos.size() == 0) {
- continue;
- }
- extracted(extCommunityId, communityDtos);
- }
- }
-
- private void extracted(JSONArray extCommunityId, List<CommunityDto> communityDtos) {
- for (CommunityDto community : communityDtos) {
- for (CommunityAttrDto communityAttrDto : community.getCommunityAttrDtos()) {
- if (HcGovConstant.EXT_COMMUNITY_ID.equals(communityAttrDto.getSpecCd())) {
- extCommunityId.add(communityAttrDto.getValue());
- }
- }
- }
+ return companyInfo;
}
}
--
Gitblit v1.8.0