礼品卡管理模块

This commit is contained in:
季圣华
2017-07-15 00:33:28 +08:00
parent 8f4cac02ef
commit 883890eb00
21 changed files with 1402 additions and 52 deletions

View File

@@ -64,6 +64,7 @@ public class DepotAction extends BaseAction<DepotModel>
{
Depot depot = new Depot();
depot.setName(model.getName());
depot.setType(model.getType());
depot.setSort(model.getSort());
depot.setRemark(model.getRemark());
depotService.create(depot);
@@ -137,6 +138,7 @@ public class DepotAction extends BaseAction<DepotModel>
{
Depot depot = depotService.get(model.getDepotID());
depot.setName(model.getName());
depot.setType(model.getType());
depot.setSort(model.getSort());
depot.setRemark(model.getRemark());
depotService.update(depot);
@@ -249,6 +251,7 @@ public class DepotAction extends BaseAction<DepotModel>
item.put("id", depot.getId());
//供应商名称
item.put("name", depot.getName());
item.put("type", depot.getType());
item.put("sort", depot.getSort());
item.put("remark", depot.getRemark());
item.put("op", 1);
@@ -268,6 +271,46 @@ public class DepotAction extends BaseAction<DepotModel>
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
}
}
/**
* 查找礼品卡-虚拟仓库
* @return
*/
public void findGiftByType()
{
try
{
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getConditionByType());
depotService.find(pageUtil);
List<Depot> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Depot depot:dataList)
{
JSONObject item = new JSONObject();
item.put("id", depot.getId());
//仓库名称
item.put("name", depot.getName());
dataArray.add(item);
}
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e);
}
}
/**
* 用户对应仓库显示
@@ -340,9 +383,25 @@ public class DepotAction extends BaseAction<DepotModel>
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("name_s_like", model.getName());
condition.put("remark_s_like", model.getRemark());
condition.put("type_n_eq", model.getType()); //0-仓库1-礼品卡
condition.put("sort_s_order", "asc");
return condition;
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getConditionByType()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("type_n_eq", model.getType()); //0-仓库1-礼品卡
condition.put("sort_s_order", "asc");
return condition;
}
/**
* 拼接搜索条件-用户对应部门

View File

@@ -439,6 +439,46 @@ public class SupplierAction extends BaseAction<SupplierModel>
Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e);
}
}
/**
* 查找非会员的id
*/
public void findBySelectRetailNoPeople()
{
try
{
PageUtil<Supplier> pageUtil = new PageUtil<Supplier>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_Select_retail_no_people());
supplierService.find(pageUtil);
List<Supplier> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Supplier supplier:dataList)
{
JSONObject item = new JSONObject();
item.put("id", supplier.getId());
//客户名称
item.put("supplier", supplier.getSupplier());
item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额
dataArray.add(item);
}
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找客户信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e);
}
}
/**
* 拼接搜索条件
@@ -505,6 +545,22 @@ public class SupplierAction extends BaseAction<SupplierModel>
condition.put("id_s_order", "desc");
return condition;
}
/**
* 拼接搜索条件-非会员
* @return
*/
private Map<String,Object> getCondition_Select_retail_no_people()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("type_s_like", "散户");
condition.put("isystem_n_eq", 0);
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override

View File

@@ -436,6 +436,9 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
private Map<String,Object> getConditionHead()
{
Map<String,Object> condition = new HashMap<String,Object>();
if(model.getProjectId()!=null) {
condition.put("ProjectId_n_eq", model.getProjectId());
}
condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00");
return condition;
}

View File

@@ -198,18 +198,19 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
Integer pid = model.getProjectId();
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
JSONObject item = new JSONObject();
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
Integer prevSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true);
Integer InSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Integer OutSum = sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false);
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
@@ -369,14 +370,15 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
Integer pid = model.getProjectId();
Double thisAllPrice = 0.0;
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false);
thisAllPrice = thisAllPrice + (prevPrice + InPrice - OutPrice);
}
}
@@ -412,18 +414,19 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
List<DepotItem> dataList = pageUtil.getPageList();
//存放数据json数组
Integer pid = model.getProjectId();
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
JSONObject item = new JSONObject();
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double prevPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库", depotItem.getMaterialId().getId(), model.getMonthTime(), false);
Integer prevSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true);
Integer InSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Integer OutSum = sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", pid,depotItem.getMaterialId().getId(), model.getMonthTime(), true);
Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false);
Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false);
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
@@ -462,14 +465,14 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
* @return
*/
@SuppressWarnings("unchecked")
public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) {
public Integer sumNumber(String type,Integer ProjectId,Long MId,String MonthTime, Boolean isPrev) {
Integer sumNumber = 0;
String allNumber = "";
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try {
depotItemService.findByType(pageUtil, type, MId, MonthTime, isPrev);
depotItemService.findByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev);
allNumber = pageUtil.getPageList().toString();
allNumber = allNumber.substring(1,allNumber.length()-1);
if(allNumber.equals("null")){
@@ -493,14 +496,14 @@ public class DepotItemAction extends BaseAction<DepotItemModel>
* @return
*/
@SuppressWarnings("unchecked")
public Double sumPrice(String type,Long MId,String MonthTime, Boolean isPrev) {
public Double sumPrice(String type,Integer ProjectId,Long MId,String MonthTime, Boolean isPrev) {
Double sumPrice = 0.0;
String allPrice = "";
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try {
depotItemService.findPriceByType(pageUtil, type, MId, MonthTime, isPrev);
depotItemService.findPriceByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev);
allPrice = pageUtil.getPageList().toString();
allPrice = allPrice.substring(1,allPrice.length()-1);
if(allPrice.equals("null")){

View File

@@ -23,15 +23,26 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
String queryString;
if(isPrev) {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
else {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " ;
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
@@ -39,15 +50,26 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
String queryString;
if(isPrev) {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
else {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());

View File

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

View File

@@ -5,6 +5,7 @@ public class Depot implements java.io.Serializable
{
private Long id;
private String name;
private Integer type;
private String sort;
private String remark;
@@ -18,9 +19,10 @@ public class Depot implements java.io.Serializable
this.id = id ;
}
public Depot(String name, String sort, String remark)
public Depot(String name,Integer type, String sort, String remark)
{
this.name = name;
this.type = type;
this.sort = sort;
this.remark = remark;
}
@@ -41,6 +43,14 @@ public class Depot implements java.io.Serializable
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getSort() {
return sort;
}

View File

@@ -17,6 +17,11 @@ public class DepotModel implements Serializable
* 排序
*/
private String sort = "";
/**
* 类型
*/
private Integer type = 0;
/**
* 描述
@@ -74,6 +79,14 @@ public class DepotModel implements Serializable
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getSort() {
return sort;
}

View File

@@ -24,6 +24,7 @@ public class DepotItemModel implements Serializable
private String HeadIds = ""; //表头集合列表
private String MaterialIds = ""; //材料列表
private String MonthTime = ""; //月份
private Integer ProjectId = null;
private String browserType = "";
/**
* 文件名称
@@ -204,6 +205,14 @@ public class DepotItemModel implements Serializable
MonthTime = monthTime;
}
public Integer getProjectId() {
return ProjectId;
}
public void setProjectId(Integer projectId) {
ProjectId = projectId;
}
public String getMaterialIds() {
return MaterialIds;
}

View File

@@ -14,9 +14,9 @@ import com.jsh.util.PageUtil;
public interface DepotItemIService extends BaseIService<DepotItem>
{
void findByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void findByType(PageUtil<DepotItem> depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void findPriceByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void findPriceByType(PageUtil<DepotItem> depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void buyOrSale(PageUtil<DepotItem> depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException;

View File

@@ -45,15 +45,15 @@ public class DepotItemService extends BaseService<DepotItem> implements DepotIte
}
@Override
public void findByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws JshException
public void findByType(PageUtil<DepotItem> pageUtil, String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException
{
depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev);
depotItemDao.findByType(pageUtil, type, ProjectId, MId, MonthTime,isPrev);
}
@Override
public void findPriceByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws JshException
public void findPriceByType(PageUtil<DepotItem> pageUtil, String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException
{
depotItemDao.findPriceByType(pageUtil, type, MId, MonthTime,isPrev);
depotItemDao.findPriceByType(pageUtil, type, ProjectId, MId, MonthTime,isPrev);
}
@Override