Prechádzať zdrojové kódy

[task-3216] 依据客户目前程序,在内网调核对并调整相应的流程 / 流程筛选候选人功能改进

Li Yuan 1 rok pred
rodič
commit
8e3a34747d

+ 41 - 0
ibps-bpmn-root/modules/bpmn-plugin/src/main/java/com/lc/ibps/bpmn/plugin/usercalc/pos/runtime/PosPlugin.java

@@ -21,13 +21,16 @@ import com.lc.ibps.bpmn.plugin.usercalc.pos.def.PosPluginDefine;
 import com.lc.ibps.cloud.entity.APIResult;
 import com.lc.ibps.org.api.IPartyEntityService;
 import com.lc.ibps.org.api.IPartyPositionService;
+import com.lc.ibps.org.party.persistence.entity.PartyEntityPo;
 import com.lc.ibps.org.party.persistence.entity.PartyEntityTreePo;
 import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
+import com.lc.ibps.org.vo.IdKeyVo;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -53,6 +56,9 @@ public class PosPlugin extends AbstractUserCalcPlugin
 	private BpmApprovalService bpmApprovalService;
 	@Autowired
 	private IPartyEntityService partyEntityService ;
+
+	@Value("${com.lc.plugin.pos.enabled}")
+	protected boolean posEnabled = false;
 	@Override
 	public List<BpmIdentity> queryByPluginDef(BpmUserCalcPluginSession pluginSession, IBpmPluginDefine pluginDef)
 	{
@@ -173,6 +179,41 @@ public class PosPlugin extends AbstractUserCalcPlugin
 			ExecutorVar executorVar = def.getExecutorVar();
 			UserCalcHelper uch = new UserCalcHelper();
 			List<String> pks = uch.getCalcsPKByExecutor(executorVar, pluginSession);
+
+			if(posEnabled) {
+				//使用第三级目录做筛选
+				if (BeanUtils.isEmpty(pks)) {
+					return list;
+				}
+				if (!pluginSession.getVariables().containsKey("extendPosition")) {
+					pluginSession.getVariables().put("extendPosition", new ArrayList<String>());
+				}
+				List<String> extendPosition = (List<String>) pluginSession.getVariables().get("extendPosition");
+				extendPosition.add(pks.get(0));
+				if (extendPosition.size() > 1) {
+					IdKeyVo ids = new IdKeyVo();
+					ids.setIds(extendPosition);
+					List<PartyEntityPo> entityPoList = partyEntityService.findByIds(ids).getData();
+					if (entityPoList.size() != 2) {
+						extendPosition.clear();
+						return list;
+					}
+					String parentId = null;
+					String didian = null;
+					for (PartyEntityPo d : entityPoList) {
+						if (d.getDepth().intValue() == 4) {
+							parentId = d.getParentId();
+						} else if (d.getDepth().intValue() == 2) {
+							didian = d.getId();
+						}
+					}
+					if (StringUtils.isNoneBlank(parentId, didian)) {
+						pks.clear();
+						pks.add(parentId);
+					}
+					extendPosition.clear();
+				}
+			}
 			String[] pkArray = pks.toArray(new String[pks.size()]);
 			//find all position nodes
 			APIResult<List<PartyEntityTreePo>> tree = partyEntityService.findTreeByType(PartyType.POSITION.getValue());

+ 3 - 0
ibps-provider-root/modules/provider-business/src/main/resources/config/application.yml

@@ -12,6 +12,9 @@ swagger:
     value: /ibps/business/v3
 com:
   lc:
+    plugin:
+      pos:
+        enabled: ${PLUGIN_POS_ENABLED:false}
     mq:
       command:
         producer: