• 单据分页的实现


    单据分页的实现

    1. AceWzcgfkjtMaintainProxy.java

    在这里插入图片描述

    package nc.ui.jych.wzcgfkjt.ace.serviceproxy;
    
    import nc.bs.framework.common.NCLocator;
    import nc.itf.jych.IWzcgfkjtMaintain;
    import nc.ui.uif2.components.pagination.IPaginationQueryService;
    import nc.vo.jych.wzcgfkjt.AggWzcgfkjtVO;
    import nc.vo.pub.BusinessException;
    import nc.vo.pubapp.pattern.exception.ExceptionUtils;
    
    /**
     * 示例单据的操作代理
     * 
     * @author author
     * @version tempProject version
     */
    public class AceWzcgfkjtMaintainProxy implements IPaginationQueryService {
    
    	@Override
    	public Object[] queryObjectByPks(String[] pks)
    			throws BusinessException {
    		// TODO 自动生成的方法存根
    		AggWzcgfkjtVO[] aggvo = null;
    		IWzcgfkjtMaintain query = NCLocator.getInstance().lookup(IWzcgfkjtMaintain.class);
    		try {
    			aggvo = query.queryBillByPK(pks);
    		} catch (Exception e) {
    			ExceptionUtils.wrappException(e);
    		}
    		return aggvo;
    	}
    	
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    2. Wzcgfkjt_config.xml

    在这里插入图片描述

    在这里插入图片描述
    在这里插入图片描述

    
    
    
    
    	
    
    
    
    	
    
    
    
    
    
    
    
    
    
    	
    	
    	
    
    
    
    	
    	
    
    
    	
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32

    3. AceWzcgfkjtPubServiceImpl.java

    在这里插入图片描述

    package nc.impl.pub.ace;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import nc.bs.framework.common.InvocationInfoProxy;
    import nc.bs.framework.common.NCLocator;
    import nc.impl.pubapp.pattern.data.bill.BillQuery;
    import nc.impl.pubapp.pattern.database.DataAccessUtils;
    import nc.itf.uap.IUAPQueryBS;
    import nc.jdbc.framework.processor.ArrayListProcessor;
    import nc.jdbc.framework.processor.ColumnProcessor;
    import nc.ui.querytemplate.querytree.IQueryScheme;
    import nc.vo.jych.wzcgfkjt.AggWzcgfkjtVO;
    import nc.vo.pub.BusinessException;
    import nc.vo.pubapp.bill.pagination.util.PaginationUtils;
    import nc.vo.pubapp.pattern.data.IRowSet;
    import nc.vo.pubapp.pattern.exception.ExceptionUtils;
    import nc.vo.pubapp.pattern.pub.SqlBuilder;
    import nc.vo.pubapp.query2.sql.process.QuerySchemeProcessor;
    import nc.vo.zkch.utils.NullValueUtils;
    
    public abstract class AceWzcgfkjtPubServiceImpl {
    
    	 //分页查询方法,根据PK查单据
        public AggWzcgfkjtVO[] pubquerybillbypkbills(String[] pks) {
        	AggWzcgfkjtVO[] bills = null;
            BillQuery<AggWzcgfkjtVO> query =
                    new BillQuery<AggWzcgfkjtVO>(AggWzcgfkjtVO.class);
            bills = query.query(pks);
            return PaginationUtils.filterNotExistBills(bills, pks);
        }
    
        //分页查询方法,查询所有PK
        public String[] pubquerypkbills(IQueryScheme queryScheme) {
            // String beanId=(String) queryScheme.get(QueryConstants.BEAN_ID);
            StringBuffer sql = new StringBuffer();
            QuerySchemeProcessor processor = new QuerySchemeProcessor(queryScheme);
            String mainAlias = processor.getMainTableAlias();
            sql.append(" select distinct ");
            sql.append(mainAlias);
            sql.append(".");
            sql.append("pk_wzcgfkjt");
            sql.append(processor.getFinalFromWhere());
    
            //系统当前登录用户
            String userId = InvocationInfoProxy.getInstance().getUserId();
    
            //根据登录用户id查询对应的人员id
            IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
            String sql1 =
                    "select psndoc.pk_psndoc from bd_psndoc psndoc left join sm_user smuser on smuser.pk_psndoc = psndoc.pk_psndoc where smuser.cuserid = '"
                            + userId + "' and nvl(psndoc.dr,0) = 0 and nvl(smuser.dr,0) = 0";
            String pk_psndoc = "";
            
            List<String> yhlist = new ArrayList<String>();
            List<String> rylist = new ArrayList<String>();
            
            try {
            	pk_psndoc = NullValueUtils.getNullStringValue(bs.executeQuery(sql1, new ColumnProcessor()));
                
                if(!pk_psndoc.equals("")) {
                	
                    SqlBuilder sqlBuilder = new SqlBuilder();
                    sqlBuilder.append("	select distinct ry.pk_psndoc, yh.cuserid	");
                    sqlBuilder.append("	  from sm_user yh	");
                    sqlBuilder.append("	 inner join bd_psndoc ry	");
                    sqlBuilder.append("	    on yh.pk_psndoc = ry.pk_psndoc	");
                    sqlBuilder.append("	   and nvl(ry.dr, 0) = 0	");
                    sqlBuilder.append("	 where ry.def9 = '"+pk_psndoc+"'	");
                	List<Object[]> list = (List<Object[]>) bs.executeQuery(sqlBuilder.toString(), new ArrayListProcessor());
                	
                	if(list != null && list.size() > 0) {
                		for (int i = 0; i < list.size(); i++) {
                			Object[] objs = list.get(i);
                			yhlist.add(NullValueUtils.getNullStringValue(objs[1]));
                			rylist.add(NullValueUtils.getNullStringValue(objs[0]));
    					}
                	}
                	
                }
                
                
            } catch (BusinessException e) {
                ExceptionUtils.wrappBusinessException(e.getMessage());
            }
            
            yhlist.add(userId);
            rylist.add(pk_psndoc);
            
            SqlBuilder rytj = new SqlBuilder();
            rytj.append(" "+mainAlias+".pk_psndoc  ",rylist.toArray(new String[0]));
            
            SqlBuilder yhtj = new SqlBuilder();
            yhtj.append(" "+mainAlias+".creator  ",yhlist.toArray(new String[0]));
            
            //查询出制单人为当前登录人的记录(当前跟踪人为空)。
    //        sql.append(" and ( " +yhtj.toString()+" ) ");
            
            DataAccessUtils dao = new DataAccessUtils();
            IRowSet rowset = dao.query(sql.toString());
            String[] keys = rowset.toOneDimensionStringArray();
            return keys;
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106

    4. WzcgfkjtMaintainImpl.java

    在这里插入图片描述

    package nc.impl.jych;
    
    import java.util.Arrays;
    import java.util.List;
    
    import nc.impl.pub.ace.AceWzcgfkjtPubServiceImpl;
    import nc.itf.jych.IWzcgfkjtMaintain;
    import nc.ui.querytemplate.querytree.IQueryScheme;
    import nc.vo.jych.wzcgfkjt.AggWzcgfkjtVO;
    import nc.vo.pub.BusinessException;
    import nc.vo.pub.CircularlyAccessibleValueObject;
    import nc.vo.pub.IVOMeta;
    
    public class WzcgfkjtMaintainImpl extends AceWzcgfkjtPubServiceImpl
    implements IWzcgfkjtMaintain {
    
    	@Override
    	public AggWzcgfkjtVO[] queryBillByPK(String[] pks) throws BusinessException {
    		AggWzcgfkjtVO[] pubquerybillbypkbills = super.pubquerybillbypkbills(pks);
    		if (pubquerybillbypkbills != null && pubquerybillbypkbills.length > 0) {
    			for (AggWzcgfkjtVO aggVO : pubquerybillbypkbills) {
    				IVOMeta[] children = aggVO.getMetaData().getChildren();
    				if (children != null && children.length != 0) {
    					for (IVOMeta item : children) {
    						CircularlyAccessibleValueObject[] childrenVO = (CircularlyAccessibleValueObject[]) aggVO
    								.getChildren(item);
    //						@SuppressWarnings("unchecked")
    						List<CircularlyAccessibleValueObject> asList = Arrays.asList(childrenVO);
    //						asList.sort((x, y) -> Double.compare(
    //								x.getAttributeValue("rowno") == null ? 0
    //										: new Double(x.getAttributeValue("rowno").toString()),
    //								y.getAttributeValue("rowno") == null ? 0
    //										: new Double(y.getAttributeValue("rowno").toString())));
    					}
    				}
    			}
    		}
    		return super.pubquerybillbypkbills(pks);
    	}
    
    	@Override
    	public String[] queryPKs(IQueryScheme queryScheme) throws BusinessException {
    		return super.pubquerypkbills(queryScheme);
    	}
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
  • 相关阅读:
    PHP LFI 利用临时文件Getshell
    LeetCode笔记:Weekly Contest 322
    eval()方法字符串转对象; 分别取对象属性名和属性的方法
    Python快速上手爬虫的7大技巧
    pandas教程:Date Ranges, Frequencies, and Shifting 日期范围,频度,和位移
    基于51单片机的多功能智能语音循迹避障小车
    数据结构与算法之矩阵: Leetcode 134. 螺旋矩阵 (Typescript版)
    计算机毕业设计Java医院管理系统(源码+系统+mysql数据库+Lw文档)
    不同网络请求框架之间的对比
    java应用提速(速度与激情)
  • 原文地址:https://blog.csdn.net/weixin_45714641/article/details/136673702