18870042648 2 年 前
コミット
0aa629be70
13 ファイル変更570 行追加26 行削除
  1. 40 4
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOImportAction.java
  2. 58 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOQueryListAction.java
  3. 20 5
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOSaveAction.java
  4. 39 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOImportAction.java
  5. 58 1
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOQueryListAction.java
  6. 16 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOSaveAction.java
  7. 39 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOImportAction.java
  8. 58 1
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOQueryListAction.java
  9. 15 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOSaveAction.java
  10. 39 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOImportAction.java
  11. 58 1
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOQueryListAction.java
  12. 20 2
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOSaveAction.java
  13. 110 0
      zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/tool/bankRefBuilder.java

+ 40 - 4
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOImportAction.java

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
 
 import nc.bs.dao.BaseDAO;
 import nc.bs.dao.DAOException;
+import nc.bs.framework.common.InvocationInfoProxy;
 import nc.bs.framework.common.NCLocator;
 import nc.bs.logging.Logger;
 import nc.jdbc.framework.processor.ColumnProcessor;
@@ -25,6 +26,7 @@ import nccloud.framework.core.exception.ExceptionUtils;
 import nccloud.framework.core.io.WebFile;
 import nccloud.framework.web.action.itf.ICommonAction;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.pubitf.riart.pflow.CloudPFlowContext;
 import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
 import nccloud.vo.zjnytwo_cd.zjnytwo_cd.BankaccountsHVOConst;
@@ -117,7 +119,7 @@ public class BankaccountsHVOImportAction implements ICommonAction {
 	   * 校验单位映射是否正确
 	   */
 	  public void judgment(BankaccountsBillVO bankaccountsBillVO) throws DAOException {
-			
+		
 		String unit = "";
 		String accountunit = "";
 		String unitfather = "";
@@ -180,7 +182,11 @@ public class BankaccountsHVOImportAction implements ICommonAction {
 	 */
 	private BankaccountsBillVO showBankaccountsBillVOs() throws MetaDataException {
 		
-		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		Date date = new Date();
+		SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+        String year = SimpleDate.format(date);
+		
+		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 		
 		BankaccountsBillVO oldBankaccountsBillVO = getVO(sql);
 		
@@ -213,6 +219,7 @@ public class BankaccountsHVOImportAction implements ICommonAction {
 	/*
 	 * 导入表头
 	 */
+	@SuppressWarnings("static-access")
 	private BankaccountsHVO sethead(JSONArray headArray) throws Exception {
 		
 		BankaccountsHVO bankaccountsHVO = new BankaccountsHVO();
@@ -266,17 +273,46 @@ public class BankaccountsHVOImportAction implements ICommonAction {
 		bankaccountsHVO.setInputdate(new UFDate(Inputdate));//导入日期
 		bankaccountsHVO.setDbilldate(new UFDateTime(Dbilldate));//单据日期
 		
-//		String cuserid = AppContext.getInstance().getPkUser();
+		String cuserid = SessionContext.getInstance().getClientInfo().getUserid();
 		
-		bankaccountsHVO.setInputman(SqlQuery("cuserid", "sm_user", "user_code", headObject.getString("导入人"),"导入人"));
+		bankaccountsHVO.setInputman(cuserid);
 		bankaccountsHVO.setCode(headObject.getString("编码"));
 		bankaccountsHVO.setName(headObject.getString("名称"));
 		bankaccountsHVO.setVnote(headObject.getString("备注"));
 		
+		if(headObject.getString("年份")==null) {
+			SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+	        String year = SimpleDate.format(date);
+			bankaccountsHVO.setDef1(year);
+		}else {
+			if (this.isNumber(headObject.getString("年份"))) {
+				bankaccountsHVO.setDef1(headObject.getString("年份"));
+			}
+		}
+		
 		return bankaccountsHVO;
 		
 	}
 	
+	/**
+	 * 判断年份
+	 * @param str
+	 * @return
+	 * @throws Exception
+	 */
+	private static boolean isNumber(String str) throws Exception{
+        String reg = "^[0-9]+(.[0-9]+)?$";
+        if(str.matches(reg)) {
+        	if (str.length()>4 || str.length()<4) {
+				throw new Exception("请输入正确的年份!");
+			}else {
+				return true;
+			}
+        }else {
+        	throw new Exception("年份只允许填入数字,请检查!");
+		}
+    }
+	
 	/*
 	 * 导入表体
 	 */

+ 58 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOQueryListAction.java

@@ -2,6 +2,7 @@
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankaccountshvo.action;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import nc.bs.logging.Logger;
@@ -12,12 +13,16 @@ import nc.vo.pub.BusinessException;
 import nc.vo.pubapp.pattern.pub.Constructor;
 import nccloud.base.exception.ExceptionUtils;
 import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO;
+import nccloud.framework.service.ServiceLocator;
 import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.ClientInfo;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.framework.web.json.JsonFactory;
 import nccloud.framework.web.querytemplet.QueryUtil4NCC;
 import nccloud.framework.web.ui.pattern.grid.Grid;
 import nccloud.framework.web.ui.pattern.grid.GridOperator;
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankaccountshvo.zjnytwo_cd.bean.PageQueryVO;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankaccountshvo.zjnytwo_cd.util.CommonUtil;
 
@@ -32,12 +37,13 @@ public class BankaccountsHVOQueryListAction implements ICommonAction {
     PageQueryVO page = null;
     QueryTreeFormatVO queryParam = this.getQueryParam(paramIRequest);
     try {
-
       // 1、 获取scheme
       IQueryScheme scheme = this.getScheme(queryParam);
       // 2、调用服务,获取VO信息(平台默认生成方法,有效率问题,最佳实现要改掉)
-      BankaccountsBillVO[] aggvos =
+      BankaccountsBillVO[] vos =
           CommonUtil.getFinancingcostMaintainService().query(scheme);
+      //#组织权限校验
+      BankaccountsBillVO[] aggvos = refBuilder(vos);
       // 查询服务(scheme);
       if ((aggvos != null) && (aggvos.length > 0)) {
         // 3、处理分页
@@ -60,6 +66,56 @@ public class BankaccountsHVOQueryListAction implements ICommonAction {
     }
     return null;
   }
+  
+  /**
+   * 组织权限校验
+   * @param aggvos
+   * @return
+   * @throws BusinessException
+   */
+  private BankaccountsBillVO[] refBuilder(BankaccountsBillVO[] aggvos) throws BusinessException {
+	  
+	  BankaccountsBillVO[] vos = new BankaccountsBillVO[aggvos.length];
+	  
+	  ClientInfo user = SessionContext.getInstance().getClientInfo();
+	  String userid = user.getUserid();
+	  String pk_group = user.getPk_group();
+	  String appcode = SessionContext.getInstance().getAppcode();
+	  Integer num = 0;
+	  
+	  IAppAndOrgPermQueryPubService service = (IAppAndOrgPermQueryPubService) ServiceLocator
+			  .find(IAppAndOrgPermQueryPubService.class);
+	  
+	  String[] orgs = service.queryUserPermOrgPksByApp(userid, appcode, pk_group);
+	  
+	  for (int i = 0; i < aggvos.length; i++) {
+		  String pk_org = aggvos[i].getParentVO().getPk_org();
+		  for (int j = 0; j < orgs.length; j++) {
+			  if (pk_org.equals(orgs[j])) {
+				  vos[num] = aggvos[i];
+				  num++;
+			}
+		}
+	}
+	  return removeArrayEmpty(vos);
+  }
+  
+  /**
+   * 去除数组空值
+   * @param strArray
+   * @return
+   */
+  private static BankaccountsBillVO[] removeArrayEmpty(BankaccountsBillVO[] strArray) {
+      List<BankaccountsBillVO> strList= Arrays.asList(strArray);
+      List<BankaccountsBillVO> strListNew=new ArrayList<>();
+      for (int i = 0; i <strList.size(); i++) {
+          if (strList.get(i)!=null){
+              strListNew.add(strList.get(i));
+          }
+      }
+      BankaccountsBillVO[] strNewArray = strListNew.toArray(new BankaccountsBillVO[strListNew.size()]);
+      return   strNewArray;
+  }
 
   /**
    * 转换Grid信息

+ 20 - 5
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankaccountshvo/action/BankaccountsHVOSaveAction.java

@@ -1,8 +1,10 @@
 
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankaccountshvo.action;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 
 import nc.bs.dao.BaseDAO;
 import nc.bs.dao.DAOException;
@@ -35,13 +37,19 @@ import nccloud.zjnytwo_cd.zjnytwo_cd.bankaccountshvo.zjnytwo_cd.util.CommonUtil;
 public class BankaccountsHVOSaveAction implements ICommonAction {
 
 	String deletePk = "";
+	String year = "";
 	
   @Override
   public Object doAction(IRequest paramIRequest) {
     try {
+    	
+      Date date = new Date();
+  	  SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+      year = SimpleDate.format(date);
+    	
       BillCardOperator billCardOperator = new BillCardOperator();
       // 1、获取AGGVO (request转换主子VO)
-BankaccountsBillVO vo = billCardOperator.toBill(paramIRequest);
+      BankaccountsBillVO vo = billCardOperator.toBill(paramIRequest);
       this.doBefore(vo);
       //#表头表体单位一致校验
       uniform(vo);
@@ -49,6 +57,11 @@ BankaccountsBillVO vo = billCardOperator.toBill(paramIRequest);
       judgment(vo);
       //#判断月份
       judgmentmonth(vo);
+      //#添加年份
+      String parentPk = vo.getPrimaryKey();
+      if (parentPk == null || "".equals(parentPk)) {
+    	  vo.getParentVO().setDef1(year);
+      }
       // 2、调用单据的保存动作脚本(savebase),得到保存后结果
       BankaccountsBillVO rtnObj = this.callActionScript(vo);
       // 3、处理返回结果(包含功能:根据模板转换前端BillCard,参照翻译,显示公式处理)
@@ -169,7 +182,9 @@ BankaccountsBillVO vo = billCardOperator.toBill(paramIRequest);
           obj.setAttributeValue("pk_bankaccount", parentPk);
         }
       }
-    }
+    }else {
+		
+	}
   }
   
   /**
@@ -187,11 +202,11 @@ BankaccountsBillVO vo = billCardOperator.toBill(paramIRequest);
 	  String month = String.valueOf(vo.getParentVO().getMonth());
 	  String org = vo.getParentVO().getPk_org();
 	  String bankaccount = vo.getParentVO().getPk_bankaccount();
-	  
+
 	  if (bankaccount!=null) {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankaccount != '"+bankaccount+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankaccount != '"+bankaccount+"' and dr = '0' and def1 = '"+year+"'";
 	  }else {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 	  }
 		
 	  BankaccountsBillVO oldBankaccountsBillVO = getVO(sql);

+ 39 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOImportAction.java

@@ -25,6 +25,7 @@ import nccloud.framework.core.exception.ExceptionUtils;
 import nccloud.framework.core.io.WebFile;
 import nccloud.framework.web.action.itf.ICommonAction;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.pubitf.riart.pflow.CloudPFlowContext;
 import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
 import nccloud.vo.zjnytwo_cd.zjnytwo_cd.BankcreditHVOConst;
@@ -179,7 +180,11 @@ public class BankcreditHVOImportAction implements ICommonAction {
 	 */
 	private BankcreditBillVO showBankcreditBillVOs() throws MetaDataException {
 		
-		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		Date date = new Date();
+		SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+        String year = SimpleDate.format(date);
+		
+		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 		
 		BankcreditBillVO oldBankcreditBillVO = getVO(sql);
 		
@@ -212,6 +217,7 @@ public class BankcreditHVOImportAction implements ICommonAction {
 	/*
 	 * 导入表头
 	 */
+	@SuppressWarnings("static-access")
 	private BankcreditHVO sethead(JSONArray headArray) throws Exception {
 		
 		BankcreditHVO bankcreditHVO = new BankcreditHVO();
@@ -260,14 +266,45 @@ public class BankcreditHVOImportAction implements ICommonAction {
 		bankcreditHVO.setInputdate(new UFDate(Inputdate));//导入日期
 		bankcreditHVO.setDbilldate(new UFDate(Inputdate));//单据日期
 		
-		bankcreditHVO.setInputman(SqlQuery("cuserid", "sm_user", "user_code", headObject.getString("导入人"),"导入人"));
+		String cuserid = SessionContext.getInstance().getClientInfo().getUserid();
+		
+		bankcreditHVO.setInputman(cuserid);
 		bankcreditHVO.setCode(headObject.getString("编码"));
 		bankcreditHVO.setName(headObject.getString("名称"));
 		bankcreditHVO.setVnote(headObject.getString("备注"));
 		
+		if(headObject.getString("年份")==null) {
+			SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+	        String year = SimpleDate.format(date);
+	        bankcreditHVO.setDef1(year);
+		}else {
+			if (this.isNumber(headObject.getString("年份"))) {
+				bankcreditHVO.setDef1(headObject.getString("年份"));
+			}
+		}
+		
 		return bankcreditHVO;
 	}
 	
+	/**
+	 * 判断年份
+	 * @param str
+	 * @return
+	 * @throws Exception
+	 */
+	private static boolean isNumber(String str) throws Exception{
+        String reg = "^[0-9]+(.[0-9]+)?$";
+        if(str.matches(reg)) {
+        	if (str.length()>4 || str.length()<4) {
+				throw new Exception("请输入正确的年份!");
+			}else {
+				return true;
+			}
+        }else {
+        	throw new Exception("年份只允许填入数字,请检查!");
+		}
+    }
+	
 	/*
 	 * 导入表体
 	 */

+ 58 - 1
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOQueryListAction.java

@@ -2,6 +2,7 @@
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankcredithvo.action;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import nc.bs.logging.Logger;
@@ -12,12 +13,16 @@ import nc.vo.pub.BusinessException;
 import nc.vo.pubapp.pattern.pub.Constructor;
 import nccloud.base.exception.ExceptionUtils;
 import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO;
+import nccloud.framework.service.ServiceLocator;
 import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.ClientInfo;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.framework.web.json.JsonFactory;
 import nccloud.framework.web.querytemplet.QueryUtil4NCC;
 import nccloud.framework.web.ui.pattern.grid.Grid;
 import nccloud.framework.web.ui.pattern.grid.GridOperator;
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankcredithvo.zjnytwo_cd.bean.PageQueryVO;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankcredithvo.zjnytwo_cd.util.CommonUtil;
 
@@ -36,8 +41,10 @@ public class BankcreditHVOQueryListAction implements ICommonAction {
       // 1、 获取scheme
       IQueryScheme scheme = this.getScheme(queryParam);
       // 2、调用服务,获取VO信息(平台默认生成方法,有效率问题,最佳实现要改掉)
-      BankcreditBillVO[] aggvos =
+      BankcreditBillVO[] vos =
           CommonUtil.getFinancingcostMaintainService().query(scheme);
+      //#组织权限校验
+      BankcreditBillVO[] aggvos = refBuilder(vos);
       // 查询服务(scheme);
       if ((aggvos != null) && (aggvos.length > 0)) {
         // 3、处理分页
@@ -60,6 +67,56 @@ public class BankcreditHVOQueryListAction implements ICommonAction {
     }
     return null;
   }
+  
+  /**
+   * 组织权限校验
+   * @param aggvos
+   * @return
+   * @throws BusinessException
+   */
+  private BankcreditBillVO[] refBuilder(BankcreditBillVO[] aggvos) throws BusinessException {
+	  
+	  BankcreditBillVO[] vos = new BankcreditBillVO[aggvos.length];
+	  
+	  ClientInfo user = SessionContext.getInstance().getClientInfo();
+	  String userid = user.getUserid();
+	  String pk_group = user.getPk_group();
+	  String appcode = SessionContext.getInstance().getAppcode();
+	  Integer num = 0;
+	  
+	  IAppAndOrgPermQueryPubService service = (IAppAndOrgPermQueryPubService) ServiceLocator
+			  .find(IAppAndOrgPermQueryPubService.class);
+	  
+	  String[] orgs = service.queryUserPermOrgPksByApp(userid, appcode, pk_group);
+	  
+	  for (int i = 0; i < aggvos.length; i++) {
+		  String pk_org = aggvos[i].getParentVO().getPk_org();
+		  for (int j = 0; j < orgs.length; j++) {
+			  if (pk_org.equals(orgs[j])) {
+				  vos[num] = aggvos[i];
+				  num++;
+			}
+		}
+	}
+	  return removeArrayEmpty(vos);
+  }
+  
+  /**
+   * 去除数组空值
+   * @param strArray
+   * @return
+   */
+  private static BankcreditBillVO[] removeArrayEmpty(BankcreditBillVO[] strArray) {
+      List<BankcreditBillVO> strList= Arrays.asList(strArray);
+      List<BankcreditBillVO> strListNew=new ArrayList<>();
+      for (int i = 0; i <strList.size(); i++) {
+          if (strList.get(i)!=null){
+              strListNew.add(strList.get(i));
+          }
+      }
+      BankcreditBillVO[] strNewArray = strListNew.toArray(new BankcreditBillVO[strListNew.size()]);
+      return   strNewArray;
+  }
 
   /**
    * 转换Grid信息

+ 16 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankcredithvo/action/BankcreditHVOSaveAction.java

@@ -1,8 +1,11 @@
 
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankcredithvo.action;
 
+import java.text.SimpleDateFormat;
+import java.time.Year;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 
 import nc.bs.dao.BaseDAO;
 import nc.bs.dao.DAOException;
@@ -38,10 +41,16 @@ import nccloud.zjnytwo_cd.zjnytwo_cd.bankcredithvo.zjnytwo_cd.util.CommonUtil;
 public class BankcreditHVOSaveAction implements ICommonAction {
 
 	String deletePk = "";
+	String year = "";
 	
   @Override
   public Object doAction(IRequest paramIRequest) {
     try {
+    	
+      Date date = new Date();
+  	  SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+      year = SimpleDate.format(date);
+    	
       BillCardOperator billCardOperator = new BillCardOperator();
       // 1、获取AGGVO (request转换主子VO)
       BankcreditBillVO vo = billCardOperator.toBill(paramIRequest);
@@ -52,6 +61,11 @@ public class BankcreditHVOSaveAction implements ICommonAction {
       judgment(vo);
       //#判断月份
       judgmentmonth(vo);
+      //#添加年份
+      String parentPk = vo.getPrimaryKey();
+      if ((parentPk == null) || "".equals(parentPk)) {
+    	  vo.getParentVO().setDef1(year);
+      }
       // 2、调用单据的保存动作脚本(savebase),得到保存后结果
       BankcreditBillVO rtnObj = this.callActionScript(vo);
       // 3、处理返回结果(包含功能:根据模板转换前端BillCard,参照翻译,显示公式处理)
@@ -186,9 +200,9 @@ public class BankcreditHVOSaveAction implements ICommonAction {
 	  String sql = "";
 	  
 	  if(bankcredit != null) {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankcredit != '"+bankcredit+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankcredit != '"+bankcredit+"' and dr = '0' and def1 = '"+year+"'";
 	  }else {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 	  }
 		
 	  BankcreditBillVO oldBankcreditBillVO = getVO(sql);

+ 39 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOImportAction.java

@@ -25,6 +25,7 @@ import nccloud.framework.core.exception.ExceptionUtils;
 import nccloud.framework.core.io.WebFile;
 import nccloud.framework.web.action.itf.ICommonAction;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.pubitf.riart.pflow.CloudPFlowContext;
 import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
 import nccloud.vo.zjnytwo_cd.zjnytwo_cd.BankloanHVOConst;
@@ -179,7 +180,11 @@ public class BankloanHVOImportAction implements ICommonAction {
 	 */
 	private BankloanBillVO showBankloanBillVOs() throws MetaDataException {
 		
-		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		Date date = new Date();
+		SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+        String year = SimpleDate.format(date);
+		
+        String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 		
 		BankloanBillVO oldBankloanBillVO = getVO(sql);
 		
@@ -212,6 +217,7 @@ public class BankloanHVOImportAction implements ICommonAction {
 	/*
 	 * 导入表头
 	 */
+	@SuppressWarnings("static-access")
 	private BankloanHVO sethead(JSONArray headArray) throws Exception {
 		
 		BankloanHVO bankloantHVO = new BankloanHVO();
@@ -261,14 +267,45 @@ public class BankloanHVOImportAction implements ICommonAction {
 		bankloantHVO.setInputdate(new UFDate(Inputdate));//导入日期
 		bankloantHVO.setDbilldate(new UFDate(Inputdate));//单据日期
 		
-		bankloantHVO.setInputman(SqlQuery("cuserid", "sm_user", "user_code", headObject.getString("导入人"),"导入人"));
+		String cuserid = SessionContext.getInstance().getClientInfo().getUserid();
+		
+		bankloantHVO.setInputman(cuserid);
 		bankloantHVO.setCode(headObject.getString("编码"));
 		bankloantHVO.setName(headObject.getString("名称"));
 		bankloantHVO.setVnote(headObject.getString("备注"));
 		
+		if(headObject.getString("年份")==null) {
+			SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+	        String year = SimpleDate.format(date);
+	        bankloantHVO.setDef1(year);
+		}else {
+			if (this.isNumber(headObject.getString("年份"))) {
+				bankloantHVO.setDef1(headObject.getString("年份"));
+			}
+		}
+		
 		return bankloantHVO;
 	}
 	
+	/**
+	 * 判断年份
+	 * @param str
+	 * @return
+	 * @throws Exception
+	 */
+	private static boolean isNumber(String str) throws Exception{
+        String reg = "^[0-9]+(.[0-9]+)?$";
+        if(str.matches(reg)) {
+        	if (str.length()>4 || str.length()<4) {
+				throw new Exception("请输入正确的年份!");
+			}else {
+				return true;
+			}
+        }else {
+        	throw new Exception("年份只允许填入数字,请检查!");
+		}
+    }
+	
 	/*
 	 * 导入表体
 	 */

+ 58 - 1
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOQueryListAction.java

@@ -2,6 +2,7 @@
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankloanhvo.action;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import nc.bs.logging.Logger;
@@ -12,12 +13,16 @@ import nc.vo.pub.BusinessException;
 import nc.vo.pubapp.pattern.pub.Constructor;
 import nccloud.base.exception.ExceptionUtils;
 import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO;
+import nccloud.framework.service.ServiceLocator;
 import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.ClientInfo;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.framework.web.json.JsonFactory;
 import nccloud.framework.web.querytemplet.QueryUtil4NCC;
 import nccloud.framework.web.ui.pattern.grid.Grid;
 import nccloud.framework.web.ui.pattern.grid.GridOperator;
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankloanhvo.zjnytwo_cd.bean.PageQueryVO;
 import nccloud.zjnytwo_cd.zjnytwo_cd.bankloanhvo.zjnytwo_cd.util.CommonUtil;
 
@@ -36,8 +41,10 @@ public class BankloanHVOQueryListAction implements ICommonAction {
       // 1、 获取scheme
       IQueryScheme scheme = this.getScheme(queryParam);
       // 2、调用服务,获取VO信息(平台默认生成方法,有效率问题,最佳实现要改掉)
-      BankloanBillVO[] aggvos =
+      BankloanBillVO[] vos =
           CommonUtil.getFinancingcostMaintainService().query(scheme);
+      //#组织权限校验
+      BankloanBillVO[] aggvos = refBuilder(vos);
       // 查询服务(scheme);
       if ((aggvos != null) && (aggvos.length > 0)) {
         // 3、处理分页
@@ -60,6 +67,56 @@ public class BankloanHVOQueryListAction implements ICommonAction {
     }
     return null;
   }
+  
+  /**
+   * 组织权限校验
+   * @param aggvos
+   * @return
+   * @throws BusinessException
+   */
+  private BankloanBillVO[] refBuilder(BankloanBillVO[] aggvos) throws BusinessException {
+	  
+	  BankloanBillVO[] vos = new BankloanBillVO[aggvos.length];
+	  
+	  ClientInfo user = SessionContext.getInstance().getClientInfo();
+	  String userid = user.getUserid();
+	  String pk_group = user.getPk_group();
+	  String appcode = SessionContext.getInstance().getAppcode();
+	  Integer num = 0;
+	  
+	  IAppAndOrgPermQueryPubService service = (IAppAndOrgPermQueryPubService) ServiceLocator
+			  .find(IAppAndOrgPermQueryPubService.class);
+	  
+	  String[] orgs = service.queryUserPermOrgPksByApp(userid, appcode, pk_group);
+	  
+	  for (int i = 0; i < aggvos.length; i++) {
+		  String pk_org = aggvos[i].getParentVO().getPk_org();
+		  for (int j = 0; j < orgs.length; j++) {
+			  if (pk_org.equals(orgs[j])) {
+				  vos[num] = aggvos[i];
+				  num++;
+			}
+		}
+	}
+	  return removeArrayEmpty(vos);
+  }
+  
+  /**
+   * 去除数组空值
+   * @param strArray
+   * @return
+   */
+  private static BankloanBillVO[] removeArrayEmpty(BankloanBillVO[] strArray) {
+      List<BankloanBillVO> strList= Arrays.asList(strArray);
+      List<BankloanBillVO> strListNew=new ArrayList<>();
+      for (int i = 0; i <strList.size(); i++) {
+          if (strList.get(i)!=null){
+              strListNew.add(strList.get(i));
+          }
+      }
+      BankloanBillVO[] strNewArray = strListNew.toArray(new BankloanBillVO[strListNew.size()]);
+      return   strNewArray;
+  }
 
   /**
    * 转换Grid信息

+ 15 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/bankloanhvo/action/BankloanHVOSaveAction.java

@@ -1,8 +1,10 @@
 
 package nccloud.zjnytwo_cd.zjnytwo_cd.bankloanhvo.action;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 
 import nc.bs.dao.BaseDAO;
 import nc.bs.dao.DAOException;
@@ -37,10 +39,16 @@ import nccloud.zjnytwo_cd.zjnytwo_cd.bankloanhvo.zjnytwo_cd.util.CommonUtil;
 public class BankloanHVOSaveAction implements ICommonAction {
 
 	String deletePk = "";
+	String year = "";
 	
   @Override
   public Object doAction(IRequest paramIRequest) {
     try {
+    	
+      Date date = new Date();
+  	  SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+      year = SimpleDate.format(date);
+    	
       BillCardOperator billCardOperator = new BillCardOperator();
       // 1、获取AGGVO (request转换主子VO)
       BankloanBillVO vo = billCardOperator.toBill(paramIRequest);
@@ -51,6 +59,11 @@ public class BankloanHVOSaveAction implements ICommonAction {
       judgment(vo);
       //#判断月份
       judgmentmonth(vo);
+      //#添加年份
+      String parentPk = vo.getPrimaryKey();
+      if ((parentPk == null) || "".equals(parentPk)) {
+    	  vo.getParentVO().setDef1(year);
+      }
       // 2、调用单据的保存动作脚本(savebase),得到保存后结果
       BankloanBillVO rtnObj = this.callActionScript(vo);
       // 3、处理返回结果(包含功能:根据模板转换前端BillCard,参照翻译,显示公式处理)
@@ -209,9 +222,9 @@ public class BankloanHVOSaveAction implements ICommonAction {
 	  String sql;
 		
 	  if (bankloan != null) {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankloan != '"+bankloan+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_bankloan != '"+bankloan+"' and dr = '0' and def1 = '"+year+"'";
 	  }else {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 	  }
 		
 	  BankloanBillVO oldBankloanBillVO = getVO(sql);

+ 39 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOImportAction.java

@@ -26,6 +26,7 @@ import nccloud.framework.core.exception.ExceptionUtils;
 import nccloud.framework.core.io.WebFile;
 import nccloud.framework.web.action.itf.ICommonAction;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.pubitf.riart.pflow.CloudPFlowContext;
 import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
 import nccloud.vo.zjnytwo_cd.zjnytwo_cd.LettercreditHVOConst;
@@ -180,7 +181,11 @@ public class LettercreditHVOImportAction implements ICommonAction {
 	 */
 	private LettercreditBillVO showLettercreditBillVOs() throws MetaDataException {
 		
-		String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		Date date = new Date();
+		SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+        String year = SimpleDate.format(date);
+		
+        String sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 		
 		LettercreditBillVO oldBankloanBillVO = getVO(sql);
 		
@@ -213,6 +218,7 @@ public class LettercreditHVOImportAction implements ICommonAction {
 	/*
 	 * 导入表头
 	 */
+	@SuppressWarnings("static-access")
 	private LettercreditHVO sethead(JSONArray headArray) throws Exception {
 		
 		LettercreditHVO lettercreditHVO = new LettercreditHVO();
@@ -263,14 +269,45 @@ public class LettercreditHVOImportAction implements ICommonAction {
 		lettercreditHVO.setInputdate(new UFDate(Inputdate));//导入日期
 		lettercreditHVO.setDbilldate(new UFDateTime(Dbilldate));//单据日期
 		
-		lettercreditHVO.setInputman(SqlQuery("cuserid", "sm_user", "user_code", headObject.getString("导入人"),"导入人"));
+		String cuserid = SessionContext.getInstance().getClientInfo().getUserid();
+		
+		lettercreditHVO.setInputman(cuserid);
 		lettercreditHVO.setCode(headObject.getString("编码"));
 		lettercreditHVO.setName(headObject.getString("名称"));
 		lettercreditHVO.setVnote(headObject.getString("备注"));
 		
+		if(headObject.getString("年份")==null) {
+			SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+	        String year = SimpleDate.format(date);
+	        lettercreditHVO.setDef1(year);
+		}else {
+			if (this.isNumber(headObject.getString("年份"))) {
+				lettercreditHVO.setDef1(headObject.getString("年份"));
+			}
+		}
+		
 		return lettercreditHVO;
 	}
 	
+	/**
+	 * 判断年份
+	 * @param str
+	 * @return
+	 * @throws Exception
+	 */
+	private static boolean isNumber(String str) throws Exception{
+        String reg = "^[0-9]+(.[0-9]+)?$";
+        if(str.matches(reg)) {
+        	if (str.length()>4 || str.length()<4) {
+				throw new Exception("请输入正确的年份!");
+			}else {
+				return true;
+			}
+        }else {
+        	throw new Exception("年份只允许填入数字,请检查!");
+		}
+    }
+	
 	/*
 	 * 导入表体
 	 */

+ 58 - 1
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOQueryListAction.java

@@ -2,6 +2,7 @@
 package nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.action;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import nc.bs.logging.Logger;
@@ -12,12 +13,16 @@ import nc.vo.pub.BusinessException;
 import nc.vo.pubapp.pattern.pub.Constructor;
 import nccloud.base.exception.ExceptionUtils;
 import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO;
+import nccloud.framework.service.ServiceLocator;
 import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.ClientInfo;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.framework.web.json.JsonFactory;
 import nccloud.framework.web.querytemplet.QueryUtil4NCC;
 import nccloud.framework.web.ui.pattern.grid.Grid;
 import nccloud.framework.web.ui.pattern.grid.GridOperator;
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
 import nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.zjnytwo_cd.bean.PageQueryVO;
 import nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.zjnytwo_cd.util.CommonUtil;
 
@@ -36,8 +41,10 @@ public class LettercreditHVOQueryListAction implements ICommonAction {
       // 1、 获取scheme
       IQueryScheme scheme = this.getScheme(queryParam);
       // 2、调用服务,获取VO信息(平台默认生成方法,有效率问题,最佳实现要改掉)
-      LettercreditBillVO[] aggvos =
+      LettercreditBillVO[] vos =
           CommonUtil.getFinancingcostMaintainService().query(scheme);
+      //#组织权限校验
+      LettercreditBillVO[] aggvos = refBuilder(vos);
       // 查询服务(scheme);
       if ((aggvos != null) && (aggvos.length > 0)) {
         // 3、处理分页
@@ -60,6 +67,56 @@ public class LettercreditHVOQueryListAction implements ICommonAction {
     }
     return null;
   }
+  
+  /**
+   * 组织权限校验
+   * @param aggvos
+   * @return
+   * @throws BusinessException
+   */
+  private LettercreditBillVO[] refBuilder(LettercreditBillVO[] aggvos) throws BusinessException {
+	  
+	  LettercreditBillVO[] vos = new LettercreditBillVO[aggvos.length];
+	  
+	  ClientInfo user = SessionContext.getInstance().getClientInfo();
+	  String userid = user.getUserid();
+	  String pk_group = user.getPk_group();
+	  String appcode = SessionContext.getInstance().getAppcode();
+	  Integer num = 0;
+	  
+	  IAppAndOrgPermQueryPubService service = (IAppAndOrgPermQueryPubService) ServiceLocator
+			  .find(IAppAndOrgPermQueryPubService.class);
+	  
+	  String[] orgs = service.queryUserPermOrgPksByApp(userid, appcode, pk_group);
+	  
+	  for (int i = 0; i < aggvos.length; i++) {
+		  String pk_org = aggvos[i].getParentVO().getPk_org();
+		  for (int j = 0; j < orgs.length; j++) {
+			  if (pk_org.equals(orgs[j])) {
+				  vos[num] = aggvos[i];
+				  num++;
+			}
+		}
+	}
+	  return removeArrayEmpty(vos);
+  }
+  
+  /**
+   * 去除数组空值
+   * @param strArray
+   * @return
+   */
+  private static LettercreditBillVO[] removeArrayEmpty(LettercreditBillVO[] strArray) {
+      List<LettercreditBillVO> strList= Arrays.asList(strArray);
+      List<LettercreditBillVO> strListNew=new ArrayList<>();
+      for (int i = 0; i <strList.size(); i++) {
+          if (strList.get(i)!=null){
+              strListNew.add(strList.get(i));
+          }
+      }
+      LettercreditBillVO[] strNewArray = strListNew.toArray(new LettercreditBillVO[strListNew.size()]);
+      return   strNewArray;
+  }
 
   /**
    * 转换Grid信息

+ 20 - 2
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/lettercredithvo/action/LettercreditHVOSaveAction.java

@@ -1,8 +1,12 @@
 
 package nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.action;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Date;
+import java.util.List;
 
 import nc.bs.dao.BaseDAO;
 import nc.bs.dao.DAOException;
@@ -22,10 +26,13 @@ import nc.vo.pub.CircularlyAccessibleValueObject;
 import nccloud.framework.core.exception.ExceptionUtils;
 import nccloud.framework.service.ServiceLocator;
 import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.ClientInfo;
 import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
 import nccloud.framework.web.ui.model.row.Cell;
 import nccloud.framework.web.ui.pattern.billcard.BillCard;
 import nccloud.framework.web.ui.pattern.billcard.BillCardOperator;
+import nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService;
 import nccloud.pubitf.riart.pflow.CloudPFlowContext;
 import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
 import nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.zjnytwo_cd.util.CommonUtil;
@@ -37,10 +44,16 @@ import nccloud.zjnytwo_cd.zjnytwo_cd.lettercredithvo.zjnytwo_cd.util.CommonUtil;
 public class LettercreditHVOSaveAction implements ICommonAction {
 	
 	String deletePk = "";
+	String year = "";
 
   @Override
   public Object doAction(IRequest paramIRequest) {
     try {
+    	
+      Date date = new Date();
+      SimpleDateFormat SimpleDate = new SimpleDateFormat("yyyy");
+      year = SimpleDate.format(date);
+        
       BillCardOperator billCardOperator = new BillCardOperator();
       // 1、获取AGGVO (request转换主子VO)
       LettercreditBillVO vo = billCardOperator.toBill(paramIRequest);
@@ -51,6 +64,11 @@ public class LettercreditHVOSaveAction implements ICommonAction {
       judgment(vo);
       //#判断月份
       judgmentmonth(vo);
+      //添加年份
+      String parentPk = vo.getPrimaryKey();
+      if ((parentPk == null) || "".equals(parentPk)) {
+    	  vo.getParentVO().setDef1(year);
+      }
       // 2、调用单据的保存动作脚本(savebase),得到保存后结果
       LettercreditBillVO rtnObj = this.callActionScript(vo);
       // 3、处理返回结果(包含功能:根据模板转换前端BillCard,参照翻译,显示公式处理)
@@ -266,9 +284,9 @@ public class LettercreditHVOSaveAction implements ICommonAction {
 	  String sql = "";
 		
 	  if (lettercredit != null) {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_lettercredit != '"+lettercredit+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and pk_lettercredit != '"+lettercredit+"' and dr = '0' and def1 = '"+year+"'";
 	  }else {
-		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0'";
+		  sql = "month = '"+String.valueOf(month)+"' and pk_org = '"+org+"' and dr = '0' and def1 = '"+year+"'";
 	  }
 	  
 		

+ 110 - 0
zjnytwo_cd/zjnytwo_cd/src/client/nccloud/zjnytwo_cd/zjnytwo_cd/tool/bankRefBuilder.java

@@ -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;
+	}
+}