diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java
index 66d2426..304b7f8 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java
@@ -4,7 +4,7 @@ import lombok.Data;
/**
*
- * OrgDTO-信创组织同步实体
+ * 信产组织同步实体
*
*
* @author WendyYang
@@ -13,12 +13,29 @@ import lombok.Data;
@Data
public class MhUnitDTO {
+ /**
+ * 单位排序号
+ */
private String sortNum;
-
+ /**
+ * 单位ID
+ */
private Long unitId;
-
+ /**
+ * 单位名称
+ */
private String unitName;
-
+ /**
+ * 父级单位ID
+ */
private Long unitPid;
+ /**
+ * 单位类型
+ */
+ private String type;
+ /**
+ * 统一社会信用代码
+ */
+ private String unifiedSocialCreditCode;
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java
new file mode 100644
index 0000000..ddfe5d8
--- /dev/null
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java
@@ -0,0 +1,90 @@
+package com.hz.pm.api.external.model.enumeration;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ *
+ * MhUnitTypeEnum
+ *
+ *
+ * @author WendyYang
+ * @since 09:11 2024/1/25
+ */
+@Getter
+@AllArgsConstructor
+public enum MhUnitTypeEnum {
+
+ REGION("A", "区域"),
+ NODE("N", "节点"),
+ UNIT("U", "单位"),
+ PFPI("Y", "公益一类事业单位"),
+ PSPI("S", "公益二类事业单位"),
+ DEPT("D", "部门"),
+ OFFICE("O", "科室"),
+ SASAC("G", "国资委"),
+ TWO_GOV_COMPANY("C", "一级国企"),
+ ONE_GOV_COMPANY("E", "二级国企"),
+ KEY_INDUSTRY("K", "重点行业"),
+ INDUSTRY_MANAGE_DEPT("Z", "行业主管部门"),
+ INDUSTRY_COMPANY_UNIT("Q", "行业企事业单位");
+
+ private final String code;
+ private final String val;
+
+ //==================================================================================================================
+
+ public static Optional getByCode(String code) {
+ return Arrays.stream(values()).filter(w -> w.getCode().equals(code)).findFirst();
+ }
+
+ private static final List INDUSTRIES;
+ private static final List GOV_COMPANIES;
+
+ static {
+ // 行业
+ INDUSTRIES = new ArrayList<>();
+ INDUSTRIES.add(KEY_INDUSTRY);
+ INDUSTRIES.add(INDUSTRY_MANAGE_DEPT);
+ INDUSTRIES.add(INDUSTRY_COMPANY_UNIT);
+
+ // 国资委
+ GOV_COMPANIES = new ArrayList<>();
+ GOV_COMPANIES.add(SASAC);
+ GOV_COMPANIES.add(ONE_GOV_COMPANY);
+ GOV_COMPANIES.add(TWO_GOV_COMPANY);
+ }
+
+ /**
+ * 是否是国企
+ *
+ * @return \
+ */
+ public boolean isGovCompany() {
+ return GOV_COMPANIES.contains(this);
+ }
+
+ /**
+ * 是否是行业
+ *
+ * @return \
+ */
+ public boolean isIndustry() {
+ return INDUSTRIES.contains(this);
+ }
+
+ /**
+ * 是否是党政
+ *
+ * @return \
+ */
+ public boolean isPartyOrGov() {
+ return !isGovCompany() && !isIndustry();
+ }
+
+}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java
index ef09dad..0a03057 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java
@@ -33,6 +33,15 @@ public class MhUnit implements Serializable {
private Short sort;
+ /**
+ * 单位类型
+ */
+ private String type;
+ /**
+ * 统一社会信用代码
+ */
+ private String unifiedSocialCreditCode;
+
private LocalDateTime createOn;
private LocalDateTime updateOn;
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
index b565e8e..afbac6c 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
@@ -116,16 +116,18 @@ public class SyncMhUserOrgManage {
log.info("未获取到组织信息");
return;
}
- List updateList = new ArrayList<>();
+ List updateUnits = new ArrayList<>();
for (MhUnitDTO org : mhUnits) {
MhUnit unit = new MhUnit();
unit.setSort((short) Double.parseDouble(org.getSortNum()));
unit.setName(org.getUnitName());
unit.setParentId(org.getUnitPid());
unit.setId(org.getUnitId());
- updateList.add(unit);
+ unit.setType(org.getType());
+ unit.setUnifiedSocialCreditCode(org.getUnifiedSocialCreditCode());
+ updateUnits.add(unit);
}
- mhUnitService.saveOrUpdateBatch(updateList);
+ mhUnitService.saveOrUpdateBatch(updateUnits);
} else {
log.error("同步组织信息失败:{}", JSONUtil.toJsonStr(mhRet));
}