更新供应商和客户的累计应收应付的算法

This commit is contained in:
季圣华
2017-04-09 16:52:02 +08:00
parent bd5deee8ba
commit 33bb4e06ef
29 changed files with 293 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import org.hibernate.Query;
import com.jsh.base.BaseDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
import com.jsh.util.SearchConditionUtil;
@@ -22,11 +23,26 @@ public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadI
}
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<AccountHead> pageUtil,String maxid) throws JshException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from AccountHead accountHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
public void findAllMoney(PageUtil<AccountHead> pageUtil, Integer supplierId, String type, String mode) throws JshException
{
Query query;
String modeName = "";
if(mode.equals("实际")){
modeName = "ChangeAmount";
}
else if(mode.equals("合计")){
modeName = "TotalPrice";
}
query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from AccountHead accountHead where Type='" + type + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
}

View File

@@ -3,6 +3,7 @@ package com.jsh.dao.materials;
import com.jsh.base.BaseIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
@@ -12,4 +13,6 @@ public interface AccountHeadIDAO extends BaseIDAO<AccountHead>
* 获取MaxId
*/
void find(PageUtil<AccountHead> pageUtil,String maxid) throws JshException;
void findAllMoney(PageUtil<AccountHead> pageUtil, Integer supplierId, String type, String mode) throws JshException;
}

View File

@@ -22,11 +22,26 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
}
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
public void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException
{
Query query;
String modeName = "";
if(mode.equals("实际")){
modeName = "ChangeAmount";
}
else if(mode.equals("合计")){
modeName = "TotalPrice";
}
query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from DepotHead depotHead where Type='" + type + "' and SubType = '" + subType + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
}

View File

@@ -12,4 +12,7 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
* 获取MaxId
*/
void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException;
void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException;
}

View File

@@ -8,7 +8,7 @@ import com.jsh.util.PageUtil;
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
{
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException;
public void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException;
}