From 887cfcad4d6d906d4f3aff5c76e86469d9d0048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 1 Nov 2017 00:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B4=A6=E6=88=B7=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsh/action/basic/AccountAction.java | 41 +++++++ .../java/com/jsh/dao/basic/AccountDAO.java | 54 +++++++++ .../java/com/jsh/dao/basic/AccountIDAO.java | 7 +- .../jsh/service/basic/AccountIService.java | 4 +- .../com/jsh/service/basic/AccountService.java | 6 + src/main/webapp/pages/manage/account.jsp | 2 +- .../webapp/pages/reports/account_report.jsp | 108 +++++++++++++++++- 7 files changed, 213 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/jsh/action/basic/AccountAction.java b/src/main/java/com/jsh/action/basic/AccountAction.java index 80203fce..0bbb712c 100644 --- a/src/main/java/com/jsh/action/basic/AccountAction.java +++ b/src/main/java/com/jsh/action/basic/AccountAction.java @@ -9,6 +9,7 @@ import java.text.*; import com.jsh.model.po.AccountHead; import com.jsh.model.po.AccountItem; +import com.jsh.util.JshException; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.dao.DataAccessException; @@ -470,6 +471,46 @@ public class AccountAction extends BaseAction } } + /** + * 账户流水信息 + */ + public void findAccountInOutList(){ + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + Long accountId = model.getAccountID(); + try{ + accountService.findAccountInOutList(pageUtil, accountId); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if(dataList!=null){ + for(Integer i=0; i>>>>>>>>>>>>>>>>>>查找信息异常", e); + } + catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } + /** * 拼接搜索条件 * @return diff --git a/src/main/java/com/jsh/dao/basic/AccountDAO.java b/src/main/java/com/jsh/dao/basic/AccountDAO.java index 8af8992b..f3ea6c4c 100644 --- a/src/main/java/com/jsh/dao/basic/AccountDAO.java +++ b/src/main/java/com/jsh/dao/basic/AccountDAO.java @@ -2,6 +2,10 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Account; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; public class AccountDAO extends BaseDAO implements AccountIDAO { @@ -14,4 +18,54 @@ public class AccountDAO extends BaseDAO implements AccountIDAO { return Account.class; } + + @SuppressWarnings("unchecked") + public void findAccountInOutList(PageUtil pageUtil, Long accountId) throws JshException { + StringBuffer queryString = new StringBuffer(); + queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime " + + " from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id where 1=1 "); + if(accountId!=null && !accountId.equals("")) { + queryString.append(" and dh.AccountId='"+ accountId +"' "); + } + queryString.append("UNION ALL " + + "select ah.BillNo,ah.Type as newType,s.supplier,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " + + " from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id where 1=1 "); + if(accountId!=null && !accountId.equals("")) { + queryString.append(" and ah.AccountId='"+ accountId +"' "); + } + queryString.append("UNION ALL " + + "select ah.BillNo,ah.Type as newType,s.supplier,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " + + " from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id " + + " inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + + " where ah.Type in ('收款','付款','收预付款') "); + if(accountId!=null && !accountId.equals("")) { + queryString.append(" and ai.AccountId='"+ accountId +"' "); + } + queryString.append("UNION ALL " + + "select ah.BillNo,ah.Type as newType, '' as sName,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " + + " from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + + " where ah.Type='转账' "); + if(accountId!=null && !accountId.equals("")) { + queryString.append(" and ah.AccountId='"+ accountId +"' "); + } + queryString.append("UNION ALL " + + "select ah.BillNo,ah.Type as newType, '' as sName,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " + + " from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + + " where ah.Type='转账' "); + if(accountId!=null && !accountId.equals("")) { + queryString.append(" and ai.AccountId='"+ accountId +"' "); + } + queryString.append(" ORDER BY oTime desc"); + Query query; + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); + // 分页查询 + int pageNo = pageUtil.getCurPage(); + int pageSize = pageUtil.getPageSize(); + if (0 != pageNo && 0 != pageSize) { + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + } + pageUtil.setPageList(query.list()); + } } diff --git a/src/main/java/com/jsh/dao/basic/AccountIDAO.java b/src/main/java/com/jsh/dao/basic/AccountIDAO.java index a6f90bd5..b6f31978 100644 --- a/src/main/java/com/jsh/dao/basic/AccountIDAO.java +++ b/src/main/java/com/jsh/dao/basic/AccountIDAO.java @@ -2,8 +2,11 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Account; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; -public interface AccountIDAO extends BaseIDAO -{ +public interface AccountIDAO extends BaseIDAO { + + public void findAccountInOutList(PageUtil pageUtil, Long accountId) throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/AccountIService.java b/src/main/java/com/jsh/service/basic/AccountIService.java index 48cf1404..d3811429 100644 --- a/src/main/java/com/jsh/service/basic/AccountIService.java +++ b/src/main/java/com/jsh/service/basic/AccountIService.java @@ -2,8 +2,10 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Account; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; public interface AccountIService extends BaseIService { - + public void findAccountInOutList(PageUtil depotHead, Long accountId)throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/AccountService.java b/src/main/java/com/jsh/service/basic/AccountService.java index 8d1d133b..f5c03f8d 100644 --- a/src/main/java/com/jsh/service/basic/AccountService.java +++ b/src/main/java/com/jsh/service/basic/AccountService.java @@ -2,6 +2,8 @@ package com.jsh.service.basic; import com.jsh.base.BaseService; import com.jsh.dao.basic.AccountIDAO; import com.jsh.model.po.Account; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; public class AccountService extends BaseService implements AccountIService { @@ -19,4 +21,8 @@ public class AccountService extends BaseService implements AccountIServ return Account.class; } + public void findAccountInOutList(PageUtil pageUtil, Long accountId) throws JshException { + accountDao.findAccountInOutList(pageUtil, accountId); + } + } diff --git a/src/main/webapp/pages/manage/account.jsp b/src/main/webapp/pages/manage/account.jsp index c2f85fef..0f8117fc 100644 --- a/src/main/webapp/pages/manage/account.jsp +++ b/src/main/webapp/pages/manage/account.jsp @@ -125,7 +125,7 @@ columns:[[ { field: 'id',width:35,align:"center",checkbox:true}, { title: '名称',field: 'name',width:100}, - { title: '编号', field: 'serialNo',width:100,align:"center"}, + { title: '编号', field: 'serialNo',width:150,align:"center"}, { title: '期初金额', field: 'initialAmount',width:100,align:"center"}, { title: '当前余额', field: 'currentAmount',width:100,align:"center"}, { title: '备注',field: 'remark',width:100}, diff --git a/src/main/webapp/pages/reports/account_report.jsp b/src/main/webapp/pages/reports/account_report.jsp index 3bb76c50..9c1085e1 100644 --- a/src/main/webapp/pages/reports/account_report.jsp +++ b/src/main/webapp/pages/reports/account_report.jsp @@ -51,6 +51,10 @@
+ +
+
+