|
@@ -0,0 +1,110 @@
|
|
|
+package nccloud.zjnytwo_cd.zjnytwo_cd.tool;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.lang.UFBoolean;
|
|
|
+import nc.vo.tmpub.util.SqlUtil;
|
|
|
+import nccloud.framework.core.exception.ExceptionUtils;
|
|
|
+import nccloud.framework.service.ServiceLocator;
|
|
|
+import nccloud.framework.web.container.ClientInfo;
|
|
|
+import nccloud.framework.web.container.SessionContext;
|
|
|
+import nccloud.framework.web.processor.IRefSqlBuilder;
|
|
|
+import nccloud.framework.web.processor.refgrid.RefQueryInfo;
|
|
|
+import nccloud.framework.web.ui.meta.RefMeta;
|
|
|
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
|
|
|
+import nccloud.pubitf.cmp.informer.INCCInformerManageService;
|
|
|
+import nccloud.pubitf.platform.db.SqlParameterCollection;
|
|
|
+import nccloud.pubitf.ssctp.sscbd.lientage.ISSClientageMatchService;
|
|
|
+import nccloud.pubitf.ssctp.sscbd.lientage.ISSClientageMatchService.BusiUnitTypeEnum;
|
|
|
+
|
|
|
+public class bankRefBuilder implements IRefSqlBuilder {
|
|
|
+ @Override
|
|
|
+ public String getExtraSql(RefQueryInfo para, RefMeta meta) {
|
|
|
+ Map<String, String> map = para.getQueryCondition();
|
|
|
+ String appcode = SessionContext.getInstance().getAppcode();
|
|
|
+ String isSSCOrg = null;
|
|
|
+ if (map != null && !map.isEmpty()) {
|
|
|
+ isSSCOrg = (String) map.get("isSSCOrg");
|
|
|
+ }
|
|
|
+
|
|
|
+ ClientInfo user = SessionContext.getInstance().getClientInfo();
|
|
|
+ String userid = user.getUserid();
|
|
|
+ String pk_group = user.getPk_group();
|
|
|
+
|
|
|
+ try {
|
|
|
+ IAppAndOrgPermQueryPubService service = (IAppAndOrgPermQueryPubService) ServiceLocator
|
|
|
+ .find(IAppAndOrgPermQueryPubService.class);
|
|
|
+ String[] orgs = service.queryUserPermOrgPksByApp(userid, appcode, pk_group);
|
|
|
+ if (orgs.length == 0) {
|
|
|
+ return "and 1=2";
|
|
|
+ }
|
|
|
+
|
|
|
+ INCCInformerManageService sccservice = (INCCInformerManageService) ServiceLocator
|
|
|
+ .find(INCCInformerManageService.class);
|
|
|
+ UFBoolean isInstallSCC = sccservice.isInstallSSC();
|
|
|
+ if (isInstallSCC.booleanValue()) {
|
|
|
+ ISSClientageMatchService sscservice = (ISSClientageMatchService) ServiceLocator
|
|
|
+ .find(ISSClientageMatchService.class);
|
|
|
+ Map<String, UFBoolean> org_map = sscservice.queryUnitsByBusiUnitAndPkOrgs(pk_group, orgs,
|
|
|
+ BusiUnitTypeEnum.CMP);
|
|
|
+ List<String> orgslist = new ArrayList();
|
|
|
+ Iterator var16;
|
|
|
+ String pk_org;
|
|
|
+ if (isSSCOrg.equals("N")) {
|
|
|
+ var16 = org_map.keySet().iterator();
|
|
|
+
|
|
|
+ while (var16.hasNext()) {
|
|
|
+ pk_org = (String) var16.next();
|
|
|
+ if (!((UFBoolean) org_map.get(pk_org)).booleanValue()) {
|
|
|
+ orgslist.add(pk_org);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (isSSCOrg.equals("Y")) {
|
|
|
+ var16 = org_map.keySet().iterator();
|
|
|
+
|
|
|
+ while (var16.hasNext()) {
|
|
|
+ pk_org = (String) var16.next();
|
|
|
+ if (((UFBoolean) org_map.get(pk_org)).booleanValue()) {
|
|
|
+ orgslist.add(pk_org);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (orgslist.size() == 0) {
|
|
|
+ return "and 1=2";
|
|
|
+ }
|
|
|
+
|
|
|
+ String sql = SqlUtil.buildSqlForIn("pk_org", (String[]) orgslist.toArray(new String[0]));
|
|
|
+ if (sql != null) {
|
|
|
+ return "and " + sql;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!isSSCOrg.equals("N")) {
|
|
|
+ return "and 1=2";
|
|
|
+ }
|
|
|
+
|
|
|
+ String sql = SqlUtil.buildSqlForIn("pk_org", orgs);
|
|
|
+ if (sql != null) {
|
|
|
+ return "and " + sql;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (BusinessException var18) {
|
|
|
+ ExceptionUtils.wrapException(var18);
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public SqlParameterCollection getExtraSqlParameter(RefQueryInfo para, RefMeta meta) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getOrderSql(RefQueryInfo para, RefMeta meta) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|