expertTags = buildExpertTagDTOList(expertTagList);
@@ -273,6 +273,7 @@ public class ExpertUserInfoAssembler {
expertFullInfoAll.setExpertIntentionWorkRegionInfo(intentionWorkRegions);
expertFullInfoAll.setExpertApplyIntentionWorkRegionInfo(applyIntentionWorkRegions);
expertFullInfoAll.setExpertAvoidCompanyList(expertAvoidCompanyDTOList);
+ expertFullInfoAll.setBusinessStrips(BeanUtil.copyToList(businessStrips, GovBusinessStripVO.class));
return expertFullInfoAll;
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java
index 671cba0..ff5d292 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertGovBusinessStrip.java
@@ -1,10 +1,13 @@
package com.ningdatech.pmapi.expert.entity;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
+import java.time.LocalDateTime;
/**
*
@@ -14,9 +17,9 @@ import java.io.Serializable;
* @author Liuxinxin
* @since 2023-04-17
*/
-@TableName("expert_gov_business_strip")
@Data
-@ApiModel(value = "ExpertGovBusinessStrip对象", description = "")
+@TableName("expert_gov_business_strip")
+@ApiModel(value = "ExpertGovBusinessStrip对象")
public class ExpertGovBusinessStrip implements Serializable {
private static final long serialVersionUID = 1L;
@@ -28,4 +31,11 @@ public class ExpertGovBusinessStrip implements Serializable {
private String businessStripName;
private Long expertUserId;
+
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createOn;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Long createBy;
+
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java
index ae5c920..b2249e9 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java
@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.expert.model;
+import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -88,4 +89,8 @@ public class ExpertJobInfo {
@NotBlank
@ApiModelProperty("工作经历")
private String experience;
+
+ @ApiModelProperty("专家条线")
+ private List businessStrips;
+
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java
index 978d955..f13c1ed 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.expert.model.cmd;
import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO;
import com.ningdatech.pmapi.expert.model.dto.*;
+import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO;
import lombok.Data;
import java.util.List;
@@ -35,4 +36,6 @@ public class ExpertInfoModifyCmd {
private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO;
private ModifyApplyExtraInfoDTO modifyApplyExtraInfo;
+
+ private List businessStrips;
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java
index c7a2d90..0613820 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java
@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.expert.model.dto;
+import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO;
import lombok.Data;
import java.util.List;
@@ -35,5 +36,7 @@ public class ExpertFullInfoAllDTO {
*/
private List expertAvoidCompanyList;
+ private List businessStrips;
+
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java
index 3aaefd7..7174149 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertGovBusinessStripService.java
@@ -1,11 +1,16 @@
package com.ningdatech.pmapi.expert.service;
-import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
+
+import java.util.Collection;
+import java.util.List;
/**
*
- * 服务类
+ * 服务类
*
*
* @author Liuxinxin
@@ -13,4 +18,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IExpertGovBusinessStripService extends IService {
+ default List listByUserIds(Collection userIds) {
+ LambdaQueryWrapper query = Wrappers
+ .lambdaQuery(ExpertGovBusinessStrip.class)
+ .in(ExpertGovBusinessStrip::getExpertUserId, userIds);
+ return list(query);
+ }
+
+ default boolean removeByUserId(Long userId) {
+ LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertGovBusinessStrip.class)
+ .eq(ExpertGovBusinessStrip::getExpertUserId, userId);
+ return remove(query);
+ }
+
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
index 4000df0..feffb1d 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.expert.service.impl;
+import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.PhoneUtil;
import com.alibaba.fastjson.JSONObject;
@@ -76,6 +77,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService;
private final IUserInfoService userInfoService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
+ private final IExpertGovBusinessStripService expertGovBusinessStripService;
@Value("${login.url:}")
private String loginUrl;
@@ -319,8 +321,10 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
List expertAvoidCompanyList = iExpertAvoidCompanyService
.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId));
+ List businessStrips = expertGovBusinessStripService.listByUserIds(Collections.singletonList(userId));
+
return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList
- , expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList);
+ , expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList, businessStrips);
}
@@ -454,6 +458,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)
.in(ExpertTag::getUserId, userIds));
Map> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId);
+ List businessStrips = expertGovBusinessStripService.listByUserIds(userIds);
+ Map> stripMap = CollUtils.group(businessStrips, ExpertGovBusinessStrip::getExpertUserId);
// 所有专家字典字段
List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class)
.in(ExpertDictionary::getUserId, userIds));
@@ -478,7 +484,8 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()),
intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()),
metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()),
- avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList())))
+ avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()),
+ stripMap.getOrDefault(w.getUserId(), Collections.emptyList())))
.collect(Collectors.toList());
}
@@ -551,6 +558,16 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
// 重新保存
iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList);
}
+ // 保存专家条线
+ expertGovBusinessStripService.removeByUserId(userId);
+ if (CollUtil.isNotEmpty(cmd.getBusinessStrips())) {
+ List strips = CollUtils.convert(cmd.getBusinessStrips(), w -> {
+ ExpertGovBusinessStrip strip = BeanUtil.copyProperties(w, ExpertGovBusinessStrip.class);
+ strip.setExpertUserId(userId);
+ return strip;
+ });
+ expertGovBusinessStripService.saveBatch(strips);
+ }
// 敏感字段申请
ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = cmd.getExpertInfoSensitiveFieldCheckBO();
ModifyApplyExtraInfoDTO modifyApplyExtraInfo = cmd.getModifyApplyExtraInfo();
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java
new file mode 100644
index 0000000..2c1ff26
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/BelongOrgController.java
@@ -0,0 +1,48 @@
+package com.ningdatech.pmapi.gov.controller;
+
+
+import com.ningdatech.pmapi.gov.manage.BelongOrgManage;
+import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-18
+ */
+@Slf4j
+@Validated
+@RestController
+@RequiredArgsConstructor
+@Api(value = "BelongOrgController", tags = "单位所属条线")
+@RequestMapping("/api/v1/belong-org")
+public class BelongOrgController {
+
+ private final BelongOrgManage belongOrgManage;
+
+ @GetMapping("/business-strip/list")
+ @ApiOperation("获取条线列表")
+ public List getGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) {
+ return belongOrgManage.getGovBusinessStripList(businessStripName);
+ }
+
+ @GetMapping("/business-strip/expert/analysis")
+ @ApiOperation("分析专家数据")
+ public void analysisExpertOrg() {
+ belongOrgManage.analysisExpertOrg();
+ }
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java
new file mode 100644
index 0000000..377861c
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/BelongOrg.java
@@ -0,0 +1,44 @@
+package com.ningdatech.pmapi.gov.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-18
+ */
+@Data
+@TableName("belong_org")
+@ApiModel(value = "BelongOrg对象")
+public class BelongOrg implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty("组织code")
+ private String orgCode;
+
+ @ApiModelProperty("组织名称")
+ private String orgName;
+
+ @ApiModelProperty("所属组织code")
+ private String belongCode;
+
+ @ApiModelProperty("所属组织名称")
+ private String belongName;
+
+ @ApiModelProperty("组织类型")
+ private String orgType;
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java
new file mode 100644
index 0000000..779048e
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/entity/GovBusinessStrip.java
@@ -0,0 +1,78 @@
+package com.ningdatech.pmapi.gov.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+
+import java.io.Serializable;
+
+/**
+ *
+ *
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-13
+ */
+@TableName("gov_business_strip")
+@ApiModel(value = "GovBusinessStrip对象", description = "")
+public class GovBusinessStrip implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+
+ private String businessStripCode;
+
+ private String businessStripName;
+
+ private String parentCode;
+
+ private String parentName;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getBusinessStripCode() {
+ return businessStripCode;
+ }
+
+ public void setBusinessStripCode(String businessStripCode) {
+ this.businessStripCode = businessStripCode;
+ }
+ public String getBusinessStripName() {
+ return businessStripName;
+ }
+
+ public void setBusinessStripName(String businessStripName) {
+ this.businessStripName = businessStripName;
+ }
+ public String getParentCode() {
+ return parentCode;
+ }
+
+ public void setParentCode(String parentCode) {
+ this.parentCode = parentCode;
+ }
+ public String getParentName() {
+ return parentName;
+ }
+
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
+ }
+
+ @Override
+ public String toString() {
+ return "GovBusinessStrip{" +
+ "id=" + id +
+ ", businessStripCode=" + businessStripCode +
+ ", businessStripName=" + businessStripName +
+ ", parentCode=" + parentCode +
+ ", parentName=" + parentName +
+ "}";
+ }
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java
new file mode 100644
index 0000000..136ade5
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/enumeration/BelongTypeEnum.java
@@ -0,0 +1,20 @@
+package com.ningdatech.pmapi.gov.enumeration;
+
+/**
+ * @author liuxinxin
+ * @date 2023/4/18 下午2:48
+ */
+
+public enum BelongTypeEnum {
+
+ /**
+ * 组织
+ */
+ ORGANIZATION,
+
+ /**
+ * 条线
+ */
+ GOV_BUSINESS_STRIP
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java
new file mode 100644
index 0000000..2524980
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/helper/GovBusinessStripHelper.java
@@ -0,0 +1,44 @@
+package com.ningdatech.pmapi.gov.helper;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+import com.ningdatech.pmapi.gov.service.IBelongOrgService;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author liuxinxin
+ * @date 2023/4/21 下午2:07
+ */
+
+@Component
+@RequiredArgsConstructor
+public class GovBusinessStripHelper {
+
+ private final IBelongOrgService iBelongOrgService;
+
+ public List assemblerBusinessStripInfoList(List businessStripCodeList) {
+ List businessStripInfoList = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(businessStripCodeList)) {
+ Map codeNameMap = iBelongOrgService.list(Wrappers
+ .lambdaQuery(BelongOrg.class).in(BelongOrg::getOrgCode, businessStripCodeList))
+ .stream().collect(Collectors.toMap(BelongOrg::getOrgCode, BelongOrg::getOrgName));
+
+ businessStripCodeList.forEach(r -> {
+ ExpertGovBusinessStrip businessStripInfo = new ExpertGovBusinessStrip();
+ businessStripInfo.setBusinessStripCode(r);
+ businessStripInfo.setBusinessStripName(codeNameMap.get(r));
+ businessStripInfoList.add(businessStripInfo);
+ });
+ }
+ return businessStripInfoList;
+ }
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java
new file mode 100644
index 0000000..e045ccb
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/BelongOrgManage.java
@@ -0,0 +1,219 @@
+package com.ningdatech.pmapi.gov.manage;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Lists;
+import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
+import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
+import com.ningdatech.pmapi.expert.service.IExpertGovBusinessStripService;
+import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+import com.ningdatech.pmapi.gov.enumeration.BelongTypeEnum;
+import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO;
+import com.ningdatech.pmapi.gov.service.IBelongOrgService;
+import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
+import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author liuxinxin
+ * @date 2023/4/18 下午2:27
+ */
+
+@Component
+@RequiredArgsConstructor
+public class BelongOrgManage {
+
+ private final IBelongOrgService iBelongOrgService;
+ private final IExpertUserFullInfoService expertUserFullInfoService;
+ private final IDingOrganizationService dingOrganizationService;
+ private final IExpertGovBusinessStripService expertGovBusinessStripService;
+
+
+ public void generateBusinessStripOrg() {
+ // 条线Set
+ Set businessStripSet = new HashSet<>();
+
+ // 组织 Set
+ Set orgSet = new HashSet<>();
+
+ try {
+ //创建工作簿对象
+ XSSFWorkbook xssfWorkbook = new XSSFWorkbook(Files.newInputStream(Paths.get("/Users/liuxinxin/Desktop/gov_business_strip_inport.xlsx")));
+ //获取工作簿下sheet的个数
+ int sheetNum = xssfWorkbook.getNumberOfSheets();
+ System.out.println("该excel文件中总共有:" + sheetNum + "个sheet");
+ //遍历工作簿中的所有数据
+ for (int i = 0; i < sheetNum; i++) {
+ //读取第i个工作表
+ System.out.println("读取第" + (i + 1) + "个sheet");
+ XSSFSheet sheet = xssfWorkbook.getSheetAt(i);
+ //获取最后一行的num,即总行数。此处从0开始
+ int maxRow = sheet.getLastRowNum();
+
+ // 条线code
+ // 条线名称
+ String businessStripOrgCode = sheet.getRow(1).getCell(0) + "";
+ String businessStripOrgName = sheet.getRow(1).getCell(1) + "";
+ String uniqKey = businessStripOrgCode + "####" + businessStripOrgName;
+ businessStripSet.add(uniqKey);
+
+ for (int row = 1; row <= maxRow; row++) {
+ //获取最后单元格num,即总单元格数 ***注意:此处从1开始计数***
+
+ String cell2 = getCellStr(sheet, row, 2);
+ String cell3 = getCellStr(sheet, row, 3);
+ if (StringUtils.isNotBlank(cell2) && StringUtils.isNotBlank(cell3)) {
+ String orgUniqKey = uniqKey + "&&&" + cell2 + "####" + cell3;
+ orgSet.add(orgUniqKey);
+ }
+
+ String cell4 = getCellStr(sheet, row, 4);
+ String cell5 = getCellStr(sheet, row, 5);
+
+ if (StringUtils.isNotBlank(cell4) && StringUtils.isNotBlank(cell5)) {
+ String orgUniqKey = uniqKey + "&&&" + cell4 + "####" + cell5;
+ orgSet.add(orgUniqKey);
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ List orgList = orgSet.stream().map(BelongOrgManage::buildBelongOrg).collect(Collectors.toList());
+ List belongOrgList = businessStripSet.stream().map(BelongOrgManage::buildBusinessStrip).collect(Collectors.toList());
+
+ iBelongOrgService.saveBatch(orgList);
+ iBelongOrgService.saveBatch(belongOrgList);
+ }
+
+ public static BelongOrg buildBusinessStrip(String businessStripStr) {
+ String[] split = businessStripStr.split("&&&");
+ String busStrip = split[0];
+ String[] split1 = busStrip.split("####");
+ String belongOrgCode = split1[0];
+ String belongOrgName = split1[1];
+
+ BelongOrg belongOrg = new BelongOrg();
+ belongOrg.setOrgCode(belongOrgCode);
+ belongOrg.setOrgName(belongOrgName);
+ belongOrg.setBelongCode(belongOrgCode);
+ belongOrg.setBelongName(belongOrgName);
+ belongOrg.setOrgType(BelongTypeEnum.GOV_BUSINESS_STRIP.name());
+ return belongOrg;
+ }
+
+ public static BelongOrg buildBelongOrg(String orgStr) {
+ String[] split = orgStr.split("&&&");
+ String busStrip = split[0];
+ String[] split1 = busStrip.split("####");
+ String belongOrgCode = split1[0];
+ String belongOrgName = split1[1];
+
+ String org = split[1];
+ String[] split2 = org.split("####");
+ String orgCode = split2[0];
+ String orgName = split2[1];
+
+ BelongOrg belongOrg = new BelongOrg();
+ belongOrg.setOrgCode(orgCode);
+ belongOrg.setOrgName(orgName);
+ belongOrg.setBelongCode(belongOrgCode);
+ belongOrg.setBelongName(belongOrgName);
+ belongOrg.setOrgType(BelongTypeEnum.ORGANIZATION.name());
+ return belongOrg;
+ }
+
+ public static String getCellStr(XSSFSheet sheet, int row, int col) {
+ if (Objects.isNull(sheet)) {
+ return null;
+ }
+ XSSFRow row1 = sheet.getRow(row);
+ if (Objects.isNull(row1)) {
+ return null;
+ }
+ XSSFCell cell = row1.getCell(col);
+ if (Objects.isNull(cell)) {
+ return null;
+ }
+ return cell + "".trim();
+ }
+
+
+ public List getGovBusinessStripList(String businessStripName) {
+ LambdaQueryWrapper query = Wrappers.lambdaQuery(BelongOrg.class)
+ .like(StrUtil.isNotBlank(businessStripName), BelongOrg::getBelongName, businessStripName)
+ .eq(BelongOrg::getOrgType, BelongTypeEnum.GOV_BUSINESS_STRIP.name());
+ List belongOrgs = iBelongOrgService.list(query);
+ return belongOrgs.stream().map(r -> {
+ GovBusinessStripVO govBusinessStripVO = new GovBusinessStripVO();
+ govBusinessStripVO.setBusinessStripCode(r.getOrgCode());
+ govBusinessStripVO.setBusinessStripName(r.getOrgName());
+ return govBusinessStripVO;
+ }).collect(Collectors.toList());
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public void analysisExpertOrg() {
+ List expertUserFullInfoList = expertUserFullInfoService.list();
+ for (ExpertUserFullInfo userFullInfo : expertUserFullInfoList) {
+ String company = userFullInfo.getCompany();
+
+ if (StringUtils.isNotBlank(company)) {
+ // 获取专家信息
+ List dingOrganizationList = dingOrganizationService
+ .list(Wrappers.lambdaQuery(DingOrganization.class)
+ .eq(DingOrganization::getOrganizationName, company.trim()));
+
+ if (CollectionUtils.isNotEmpty(dingOrganizationList)) {
+ // 获取专家组织code
+ DingOrganization dingOrganization = dingOrganizationList.get(0);
+ String organizationCode = dingOrganization.getOrganizationCode();
+
+ List belongOrgList = iBelongOrgService
+ .list(Wrappers.lambdaQuery(BelongOrg.class)
+ .eq(BelongOrg::getOrgCode, organizationCode.trim()));
+ if (CollectionUtils.isNotEmpty(belongOrgList)) {
+ // 获取专家条线code
+ Set belongOrgSet = new HashSet<>();
+ List saveList = new ArrayList<>();
+ for (BelongOrg belongOrg : belongOrgList) {
+ if (belongOrgSet.add(belongOrg.getBelongCode())) {
+ saveList.add(belongOrg);
+ }
+ }
+ expertGovBusinessStripService.remove(Wrappers.lambdaQuery(ExpertGovBusinessStrip.class)
+ .eq(ExpertGovBusinessStrip::getExpertUserId, userFullInfo.getUserId()));
+
+ List expertBusinessStripSaveRecordList = saveList.stream().map(r -> {
+ ExpertGovBusinessStrip expertBusinessStrip = new ExpertGovBusinessStrip();
+ expertBusinessStrip.setExpertUserId(userFullInfo.getUserId());
+ expertBusinessStrip.setBusinessStripCode(r.getBelongCode());
+ expertBusinessStrip.setBusinessStripName(r.getBelongName());
+ return expertBusinessStrip;
+ }).collect(Collectors.toList());
+ expertGovBusinessStripService.saveBatch(expertBusinessStripSaveRecordList);
+ }
+ }
+ }
+
+ }
+ }
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java
new file mode 100644
index 0000000..8fbbac1
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/BelongOrgMapper.java
@@ -0,0 +1,16 @@
+package com.ningdatech.pmapi.gov.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-18
+ */
+public interface BelongOrgMapper extends BaseMapper {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java
new file mode 100644
index 0000000..5189107
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBusinessStripVO.java
@@ -0,0 +1,21 @@
+package com.ningdatech.pmapi.gov.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author Liuxinxin
+ * @since 2023-03-08
+ */
+@Data
+@ApiModel(value = "条线VO")
+public class GovBusinessStripVO {
+
+ @ApiModelProperty("条线code")
+ private String businessStripCode;
+
+ @ApiModelProperty("条线名称")
+ private String businessStripName;
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java
new file mode 100644
index 0000000..2a99871
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IBelongOrgService.java
@@ -0,0 +1,16 @@
+package com.ningdatech.pmapi.gov.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-18
+ */
+public interface IBelongOrgService extends IService {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java
new file mode 100644
index 0000000..cf67454
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/BelongOrgServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ningdatech.pmapi.gov.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+import com.ningdatech.pmapi.gov.mapper.BelongOrgMapper;
+import com.ningdatech.pmapi.gov.service.IBelongOrgService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author liuxinxin
+ * @since 2023-04-18
+ */
+@Service
+public class BelongOrgServiceImpl extends ServiceImpl implements IBelongOrgService {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java
index 22dd2eb..52e3203 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java
@@ -39,6 +39,9 @@ public class ExpertInviteAvoidRule implements Serializable {
@ApiModelProperty("回避条线ID")
private String avoidOrgIds;
+ @ApiModelProperty("回避类型")
+ private Integer avoidType;
+
@ApiModelProperty("每周参与次数")
private Integer weekInviteCount;
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java
index ada8371..f6afd52 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidRuleDTO.java
@@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
-import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@@ -19,19 +18,20 @@ import java.util.List;
@ApiModel("回避信息")
public class AvoidRuleDTO {
+
+ @ApiModelProperty("回避类型:1 回避同单位、2 回避同条线、3 不回避")
+ private Integer avoidType;
+
@ApiModelProperty("回避单位")
- @NotEmpty(message = "回避单位不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List avoidUnitIdList;
@ApiModelProperty("回避条线")
- @NotEmpty(message = "回避条线不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List avoidOrgIdList;
@ApiModelProperty("每周邀请次数")
private Integer weekInviteCount;
@ApiModelProperty("回避专家")
- @NotEmpty(message = "回避专家不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List expertIds;
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java
new file mode 100644
index 0000000..2d4a4d5
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/AvoidTypeEnum.java
@@ -0,0 +1,35 @@
+package com.ningdatech.pmapi.meeting.entity.enumeration;
+
+import com.ningdatech.basic.exception.BizException;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+
+/**
+ *
+ * AvoidTypeEnum
+ *
+ *
+ * @author WendyYang
+ * @since 2023/8/17
+ **/
+@Getter
+@AllArgsConstructor
+public enum AvoidTypeEnum {
+
+ CURR_UNIT(1, "同单位"),
+ CURR_STRIP(2, "同条线"),
+ NONE(3, "不回避");
+
+ private final Integer code;
+ private final String remark;
+
+ public static AvoidTypeEnum getByCode(int code) {
+ return Arrays.stream(values())
+ .filter(w -> w.getCode().equals(code))
+ .findFirst()
+ .orElseThrow(() -> BizException.wrap("回避类型无效"));
+ }
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java
index 44137e4..873ac28 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java
@@ -1,15 +1,14 @@
package com.ningdatech.pmapi.meeting.helper;
import cn.hutool.core.util.RandomUtil;
+import com.ningdatech.basic.util.CollUtils;
+import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.RandomUtils;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -74,6 +73,77 @@ public class ExpertRandomInviteAlgorithm {
}
}
+ public static List inviteGroupByStrip(Map> expertStripGroup,
+ List userFullInfoList,
+ List> expertsByRecentMeeting,
+ Integer count) {
+ if (MapUtils.isEmpty(expertStripGroup)) {
+ return Collections.emptyList();
+ }
+ Map userMap = CollUtils.listToMap(userFullInfoList, ExpertUserFullInfo::getUserId);
+ if (expertsByRecentMeeting.isEmpty()) {
+ return expertStripGroup.values().stream()
+ .map(w -> {
+ ExpertUserFullInfo euf;
+ while (true) {
+ ExpertGovBusinessStrip ele = RandomUtil.randomEle(w);
+ euf = userMap.remove(ele.getExpertUserId());
+ if (euf != null || w.isEmpty() || userMap.isEmpty()) {
+ break;
+ }
+ w.remove(ele);
+ }
+ return euf;
+ }).filter(Objects::nonNull)
+ .limit(count)
+ .collect(Collectors.toList());
+ } else {
+ List lockedUsers = new ArrayList<>();
+ List strips = new ArrayList<>(expertStripGroup.keySet());
+ for (int i = 0; i < count; i++) {
+ String strip = strips.get(RandomUtils.nextInt(0, strips.size()));
+ List expertsByStrip = expertStripGroup.get(strip);
+ for (int j = 0; j < expertsByRecentMeeting.size(); j++) {
+ List experts = expertsByRecentMeeting.get(j);
+ List notInvitedUsers = expertsByStrip.stream()
+ .map(w -> userMap.get(w.getExpertUserId()))
+ .filter(w -> w != null && expertMatchNone(experts, w))
+ .collect(Collectors.toList());
+ if (!notInvitedUsers.isEmpty()) {
+ ExpertUserFullInfo usf = RandomUtil.randomEle(notInvitedUsers);
+ // 防止一个专家多条线
+ userMap.remove(usf.getUserId());
+ lockedUsers.add(usf);
+ break;
+ } else if (j == (expertsByRecentMeeting.size() - 1)) {
+ ExpertUserFullInfo euf;
+ ExpertGovBusinessStrip egs = RandomUtil.randomEle(expertsByStrip);
+ while (true) {
+ euf = userMap.remove(egs.getExpertUserId());
+ if (euf != null || expertsByStrip.isEmpty() || userMap.isEmpty()) {
+ break;
+ }
+ expertsByStrip.remove(egs);
+ }
+ if (euf != null) {
+ lockedUsers.add(euf);
+ }
+ }
+ if (userMap.isEmpty()) {
+ return lockedUsers;
+ }
+ }
+ if (lockedUsers.size() < count) {
+ strips.remove(strip);
+ if (strips.isEmpty()) {
+ break;
+ }
+ }
+ }
+ return lockedUsers;
+ }
+ }
+
/**
* 随机抽取专家
*
@@ -103,7 +173,7 @@ public class ExpertRandomInviteAlgorithm {
userFullInfos.removeAll(notInvitedUsers);
}
}
- if (userFullInfos.size() == 0) {
+ if (userFullInfos.isEmpty()) {
return result;
}
int restCnt = Math.min(count - result.size(), userFullInfos.size());
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
index 74d5647..de744fb 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
@@ -8,8 +8,10 @@ import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany;
+import com.ningdatech.pmapi.expert.entity.ExpertGovBusinessStrip;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService;
+import com.ningdatech.pmapi.expert.service.IExpertGovBusinessStripService;
import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder;
@@ -17,8 +19,10 @@ import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.*;
+import com.ningdatech.pmapi.meeting.entity.enumeration.AvoidTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
+import com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm;
import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
@@ -41,7 +45,7 @@ import java.util.stream.Collectors;
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*;
import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;
-import static com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm.inviteGroupByCompany;
+import static com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm.*;
/**
*
@@ -66,6 +70,7 @@ public class ExpertInviteManage {
private final IMeetingService meetingService;
private final IExpertAvoidCompanyService expertAvoidCompanyService;
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper;
+ private final IExpertGovBusinessStripService expertGovBusinessStripService;
@Value("#{randomInviteProperties.recentMeetingCount}")
private Integer recentMeetingCount;
@@ -364,10 +369,29 @@ public class ExpertInviteManage {
if (userInfoList.isEmpty()) {
return result;
}
- Map> userGroupByUnit = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode);
- result.setTotal(userGroupByUnit.size());
-
- result.setExperts(inviteGroupByCompany(userGroupByUnit, expertsByRecentMeeting(), randomRule.getCount()));
+ AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType());
+ switch (avoidType) {
+ case NONE:
+ result.setExperts(inviteWithoutCompany(userInfoList, expertsByRecentMeeting(), randomRule.getCount()));
+ result.setTotal(userInfoList.size());
+ break;
+ case CURR_UNIT:
+ Map> unitGroup = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode);
+ result.setExperts(inviteGroupByCompany(unitGroup, expertsByRecentMeeting(), randomRule.getCount()));
+ result.setTotal(unitGroup.size());
+ break;
+ case CURR_STRIP:
+ List userIds = CollUtils.fieldList(userInfoList, ExpertUserFullInfo::getUserId);
+ List expertStrips = expertGovBusinessStripService.listByUserIds(userIds);
+ if (!expertStrips.isEmpty()) {
+ Map> stripGroup = CollUtils.group(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode);
+ result.setExperts(inviteGroupByStrip(stripGroup, userInfoList, expertsByRecentMeeting(), randomRule.getCount()));
+ result.setTotal(stripGroup.size());
+ } else {
+ result.setTotal(0);
+ }
+ break;
+ }
return result;
}
@@ -525,7 +549,7 @@ public class ExpertInviteManage {
AvoidRuleDTO avoidRule) {
List expertInserts = new ArrayList<>();
// 处理随机抽取规则
- if (CollectionUtils.isNotEmpty(randomRules)) {
+ if (CollUtil.isNotEmpty(randomRules)) {
List randoms = new ArrayList<>();
List expertsByRandom = new ArrayList<>();
List chooseExpertIds = new ArrayList<>();
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
index 50ca331..adcd1d9 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
@@ -253,6 +253,7 @@ public class MeetingManage {
avoidRule.setAvoidOrgIds(CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList()));
avoidRule.setAvoidUnitIds(CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList()));
avoidRule.setAvoidExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds()));
+ avoidRule.setAvoidType(avoidInfo.getAvoidType());
inviteAvoidRuleService.save(avoidRule);
} else {
// 指定邀请
diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java
index 2a5775e..dc4e571 100644
--- a/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java
+++ b/pmapi/src/test/java/com/ningdatech/pmapi/org/OrgTest.java
@@ -1,13 +1,23 @@
package com.ningdatech.pmapi.org;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import cn.hutool.poi.excel.ExcelReader;
+import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ningdatech.basic.util.SpringUtils;
import com.ningdatech.pmapi.AppTests;
+import com.ningdatech.pmapi.gov.entity.BelongOrg;
+import com.ningdatech.pmapi.gov.enumeration.BelongTypeEnum;
+import com.ningdatech.pmapi.gov.service.IBelongOrgService;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.List;
+
+import java.util.*;
/**
* @Classname RegionTest
@@ -19,16 +29,18 @@ public class OrgTest extends AppTests {
@Autowired
private IDingOrganizationService organizationService;
+ @Autowired
+ private IBelongOrgService belongOrgService;
@Test
- public void test(){
+ public void test() {
List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getDivisionCode, "331199"));
- for(DingOrganization org : orgs){
+ for (DingOrganization org : orgs) {
List inners = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getParentCode, org.getOrganizationCode()));
- for(DingOrganization inner : inners){
+ for (DingOrganization inner : inners) {
mergeRegionCode(inner);
}
}
@@ -40,12 +52,62 @@ public class OrgTest extends AppTests {
List is = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getParentCode, inner.getOrganizationCode()));
- if(CollUtil.isEmpty(is)){
+ if (CollUtil.isEmpty(is)) {
return;
}
- for(DingOrganization i : is){
+ for (DingOrganization i : is) {
mergeRegionCode(i);
}
}
+ @Test
+ public void businessStrip() {
+ String path = "/Users/wendy/Desktop/省市县条线单位梳理202303016.xlsx";
+ ExcelReader reader = ExcelUtil.getReader(path);
+ Set orgCodes = new HashSet<>();
+ List belongOrgs = new ArrayList<>();
+ for (int i = 0; i < reader.getSheetCount(); i++) {
+ reader.setSheet(i);
+ List