|
|
@@ -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());
|