|
|
@@ -35,6 +35,7 @@ import com.java110.job.adapt.hcGov.HcGovConstant;
|
|
|
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,44 +101,12 @@ public class AddStaffToHcGovAdapt extends DatabusAdaptImpl {
|
|
|
return;
|
|
|
}
|
|
|
storeUserDto = storeUserDtos.get(0);
|
|
|
- String artificialPerson = "";
|
|
|
- String registerTime = "";
|
|
|
- String idCard = "";
|
|
|
+
|
|
|
+ String extCompanyId = "";
|
|
|
+ String ACTION_TYPE = HcGovConstant.ADD_STAFF_ACTION;
|
|
|
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);
|
|
|
- if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
- artificialPerson = storeAttrDtos.get(0).getValue();
|
|
|
- }
|
|
|
- //查询商户属性 成立日期
|
|
|
- storeAttrDto.setStoreId(SoreId);
|
|
|
- storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_REGISTERTIME);
|
|
|
- storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
|
|
|
- if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
- registerTime = storeAttrDtos.get(0).getValue();
|
|
|
- }
|
|
|
- //查询商户属性 营业执照
|
|
|
- storeAttrDto.setStoreId(SoreId);
|
|
|
- storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_IDCARD);
|
|
|
- storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
|
|
|
- if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
- idCard = storeAttrDtos.get(0).getValue();
|
|
|
- }
|
|
|
- companyInfo.put("companyName", storeUserDto.getName());
|
|
|
- companyInfo.put("companyType", "2002");
|
|
|
- companyInfo.put("idCard", idCard);
|
|
|
- companyInfo.put("artificialPerson", artificialPerson);
|
|
|
- companyInfo.put("companyAddress", storeUserDto.getAddress());
|
|
|
- companyInfo.put("registerTime", registerTime);
|
|
|
- companyInfo.put("personName", artificialPerson);
|
|
|
- companyInfo.put("personTel", storeUserDto.getTel());
|
|
|
- companyInfo.put("personIdCard", idCard);
|
|
|
|
|
|
+ //查询商户对应的小区外部编码
|
|
|
CommunityMemberDto communityMemberDto = new CommunityMemberDto();
|
|
|
communityMemberDto.setMemberId(SoreId);
|
|
|
List<CommunityMemberDto> communityMemberDtos = communityInnerServiceSMOImpl.getCommunityMembers(communityMemberDto);
|
|
|
@@ -148,31 +117,23 @@ public class AddStaffToHcGovAdapt extends DatabusAdaptImpl {
|
|
|
if (extCommunityId == null || extCommunityId.size() < 1) {
|
|
|
return;
|
|
|
}
|
|
|
- String orgName = "";
|
|
|
- String relCd = "";
|
|
|
+ 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();
|
|
|
- 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();
|
|
|
+ if (StringUtil.isEmpty(extCompanyId)) {
|
|
|
+ body.put("companyInfo", getCarateStoreInfo(SoreId,storeUserDto));
|
|
|
+ ACTION_TYPE=HcGovConstant.ADD_COMPANY_ACTION;
|
|
|
}
|
|
|
- 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);
|
|
|
+
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
@@ -201,4 +162,75 @@ public class AddStaffToHcGovAdapt extends DatabusAdaptImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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 = "";
|
|
|
+ JSONObject companyInfo = new JSONObject();
|
|
|
+
|
|
|
+ StoreAttrDto storeAttrDto = new StoreAttrDto();
|
|
|
+ //查询商户属性 企业法人
|
|
|
+ storeAttrDto.setStoreId(SoreId);
|
|
|
+ storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_ARTIFICIALPERSON);
|
|
|
+ List<StoreAttrDto> storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
|
|
|
+ if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
+ artificialPerson = storeAttrDtos.get(0).getValue();
|
|
|
+ }
|
|
|
+ //查询商户属性 成立日期
|
|
|
+ storeAttrDto.setStoreId(SoreId);
|
|
|
+ storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_REGISTERTIME);
|
|
|
+ storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
|
|
|
+ if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
+ registerTime = storeAttrDtos.get(0).getValue();
|
|
|
+ }
|
|
|
+ //查询商户属性 营业执照
|
|
|
+ storeAttrDto.setStoreId(SoreId);
|
|
|
+ storeAttrDto.setSpecCd(HcGovConstant.STORE_ATTR_IDCARD);
|
|
|
+ storeAttrDtos = storeAttrInnerServiceSMOImpl.queryStoreAttrs(storeAttrDto);
|
|
|
+ if (storeAttrDtos != null && storeAttrDtos.size() > 0) {
|
|
|
+ idCard = storeAttrDtos.get(0).getValue();
|
|
|
+ }
|
|
|
+ companyInfo.put("companyName", storeUserDto.getName());
|
|
|
+ companyInfo.put("companyType", "2002");
|
|
|
+ companyInfo.put("idCard", idCard);
|
|
|
+ companyInfo.put("artificialPerson", artificialPerson);
|
|
|
+ companyInfo.put("companyAddress", storeUserDto.getAddress());
|
|
|
+ companyInfo.put("registerTime", registerTime);
|
|
|
+ companyInfo.put("personName", artificialPerson);
|
|
|
+ companyInfo.put("personTel", storeUserDto.getTel());
|
|
|
+ companyInfo.put("personIdCard", idCard);
|
|
|
+
|
|
|
+ return companyInfo;
|
|
|
+ }
|
|
|
+
|
|
|
}
|