升级代码结构,采用Maven来管理jar包(10)

This commit is contained in:
季圣华
2017-02-15 22:55:46 +08:00
parent 11f18afad6
commit e85498f6f4
185 changed files with 19714 additions and 0 deletions

View File

@@ -0,0 +1,308 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Account;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Person;
import com.jsh.model.po.Supplier;
import com.jsh.model.vo.materials.AccountHeadModel;
import com.jsh.service.materials.AccountHeadIService;
import com.jsh.util.PageUtil;
import com.jsh.util.Tools;
/*
* 财务表头管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class AccountHeadAction extends BaseAction<AccountHeadModel>
{
private AccountHeadIService accountHeadService;
private AccountHeadModel model = new AccountHeadModel();
/*
* 获取MaxId
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getMaxId()
{
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try
{
accountHeadService.find(pageUtil,"maxId");
mapData.put("accountHeadMax", pageUtil.getPageList());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找最大的Id信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
/**
* 增加财务
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加财务信息方法create()===================");
Boolean flag = false;
try
{
AccountHead accountHead = new AccountHead();
accountHead.setType(model.getType());
if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
accountHead.setChangeAmount(model.getChangeAmount());
accountHead.setTotalPrice(model.getTotalPrice());
if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));}
accountHead.setBillNo(model.getBillNo());
try
{
accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd").getTime()));
}
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
}
accountHead.setRemark(model.getRemark());
accountHeadService.create(accountHead);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加财务信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加财务信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加财务", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加财务编号为 "+ model.getBillNo() + " " + tipMsg + "", "增加财务" + tipMsg));
Log.infoFileSync("==================结束调用增加财务方法create()===================");
}
/**
* 删除财务
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除财务信息方法delete()================");
try
{
accountHeadService.delete(model.getAccountHeadID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAccountHeadID() + " 的财务异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除财务", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除财务ID为 "+ model.getAccountHeadID() + " " + tipMsg + "", "删除财务" + tipMsg));
Log.infoFileSync("====================结束调用删除财务信息方法delete()================");
return SUCCESS;
}
/**
* 更新财务
* @return
*/
public void update()
{
Boolean flag = false;
try
{
AccountHead accountHead = accountHeadService.get(model.getAccountHeadID());
accountHead.setType(model.getType());
if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
accountHead.setChangeAmount(model.getChangeAmount());
accountHead.setTotalPrice(model.getTotalPrice());
if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));}
accountHead.setBillNo(model.getBillNo());
try
{
accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd").getTime()));
}
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
}
accountHead.setRemark(model.getRemark());
accountHeadService.update(accountHead);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改财务ID为 " + model.getAccountHeadID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改财务回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新财务", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新财务ID为 "+ model.getAccountHeadID() + " " + tipMsg + "", "更新财务" + tipMsg));
}
/**
* 批量删除指定ID财务
* @return
*/
public String batchDelete()
{
try
{
accountHeadService.batchDelete(model.getAccountHeadIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除财务ID为" + model.getAccountHeadIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除财务", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除财务ID为 "+ model.getAccountHeadIDs() + " " + tipMsg + "", "批量删除财务" + tipMsg));
return SUCCESS;
}
/**
* 查找财务信息
* @return
*/
public void findBy()
{
try
{
PageUtil<AccountHead> pageUtil = new PageUtil<AccountHead>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
accountHeadService.find(pageUtil);
List<AccountHead> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(AccountHead accountHead:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", accountHead.getId());
item.put("OrganId", accountHead.getOrganId()==null?"":accountHead.getOrganId().getId());
item.put("OrganName", accountHead.getOrganId()==null?"":accountHead.getOrganId().getSupplier());
item.put("HandsPersonId", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getId());
item.put("HandsPersonName", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getName());
item.put("AccountId", accountHead.getAccountId()==null?"":accountHead.getAccountId().getId());
item.put("AccountName", accountHead.getAccountId()==null?"":accountHead.getAccountId().getName());
item.put("BillNo", accountHead.getBillNo());
item.put("BillTime", Tools.getCurrentMonth(accountHead.getBillTime()));
item.put("ChangeAmount", accountHead.getChangeAmount()==null?"":Math.abs(accountHead.getChangeAmount()));
item.put("TotalPrice", accountHead.getTotalPrice()==null?"":Math.abs(accountHead.getTotalPrice()));
item.put("Remark", accountHead.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找财务信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询财务信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
{condition.put("BillNo_s_like", model.getBillNo());}
condition.put("Type_s_eq",model.getType());
condition.put("BillTime_s_gteq",model.getBeginTime());
condition.put("BillTime_s_lteq",model.getEndTime());
condition.put("Id_s_order","desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public AccountHeadModel getModel()
{
return model;
}
public void setAccountHeadService(AccountHeadIService accountHeadService)
{
this.accountHeadService = accountHeadService;
}
}

View File

@@ -0,0 +1,192 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.AccountItem;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Account;
import com.jsh.model.po.InOutItem;
import com.jsh.model.vo.materials.AccountItemModel;
import com.jsh.service.materials.AccountItemIService;
import com.jsh.util.PageUtil;
/*
* 财务明细管理(收支|收付款|转账)
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class AccountItemAction extends BaseAction<AccountItemModel>
{
private AccountItemIService accountItemService;
private AccountItemModel model = new AccountItemModel();
/**
* 保存明细
* @return
*/
public void saveDetials()
{
Log.infoFileSync("==================开始调用保存财务明细信息方法saveDetials()===================");
Boolean flag = false;
try
{
Long headerId=model.getHeaderId();
String inserted=model.getInserted();
String deleted=model.getDeleted();
String updated=model.getUpdated();
//转为json
JSONArray insertedJson = JSONArray.fromObject(inserted);
JSONArray deletedJson = JSONArray.fromObject(deleted);
JSONArray updatedJson = JSONArray.fromObject(updated);
if(null != insertedJson)
{
for(int i = 0;i < insertedJson.size(); i++)
{
AccountItem accountItem = new AccountItem();
JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i));
accountItem.setHeaderId(new AccountHead(headerId));
if(tempInsertedJson.get("AccountId")!=null&&!tempInsertedJson.get("AccountId").equals("")){accountItem.setAccountId(new Account(tempInsertedJson.getLong("AccountId")));}
if(tempInsertedJson.get("InOutItemId")!=null&&!tempInsertedJson.get("InOutItemId").equals("")){accountItem.setInOutItemId(new InOutItem(tempInsertedJson.getLong("InOutItemId")));}
if(tempInsertedJson.get("EachAmount")!=null){accountItem.setEachAmount(tempInsertedJson.getDouble("EachAmount"));}
accountItem.setRemark(tempInsertedJson.getString("Remark"));
accountItemService.create(accountItem);
}
}
if(null != deletedJson)
{
for(int i = 0;i < deletedJson.size(); i++)
{
JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i));
accountItemService.delete(tempDeletedJson.getLong("Id"));
}
}
if(null != updatedJson)
{
for(int i = 0;i < updatedJson.size(); i++)
{
JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i));
AccountItem accountItem = accountItemService.get(tempUpdatedJson.getLong("Id"));
accountItem.setHeaderId(new AccountHead(headerId));
if(tempUpdatedJson.get("AccountId")!=null&&!tempUpdatedJson.get("AccountId").equals("")){accountItem.setAccountId(new Account(tempUpdatedJson.getLong("AccountId")));}
if(tempUpdatedJson.get("InOutItemId")!=null&&!tempUpdatedJson.get("InOutItemId").equals("")){accountItem.setInOutItemId(new InOutItem(tempUpdatedJson.getLong("InOutItemId")));}
if(tempUpdatedJson.get("EachAmount")!=null){accountItem.setEachAmount(tempUpdatedJson.getDouble("EachAmount"));}
accountItem.setRemark(tempUpdatedJson.getString("Remark"));
accountItemService.create(accountItem);
}
}
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存财务明细信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>保存财务明细信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "保存财务明细", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "保存财务明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "", "保存财务明细" + tipMsg));
Log.infoFileSync("==================结束调用保存财务明细方法saveDetials()===================");
}
/**
* 查找财务信息
* @return
*/
public void findBy()
{
try
{
PageUtil<AccountItem> pageUtil = new PageUtil<AccountItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
accountItemService.find(pageUtil);
List<AccountItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(AccountItem accountItem:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", accountItem.getId());
item.put("AccountId", accountItem.getAccountId()==null?"":accountItem.getAccountId().getId());
item.put("AccountName", accountItem.getAccountId()==null?"":accountItem.getAccountId().getName());
item.put("InOutItemId", accountItem.getInOutItemId()==null?"":accountItem.getInOutItemId().getId());
item.put("InOutItemName", accountItem.getInOutItemId()==null?"":accountItem.getInOutItemId().getName());
item.put("EachAmount", accountItem.getEachAmount());
item.put("Remark", accountItem.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找财务信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询财务信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("HeaderId_n_eq", model.getHeaderId());
condition.put("Id_s_order","asc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public AccountItemModel getModel()
{
return model;
}
public void setAccountItemService(AccountItemIService accountItemService)
{
this.accountItemService = accountItemService;
}
}

View File

@@ -0,0 +1,374 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Account;
import com.jsh.model.po.Depot;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Person;
import com.jsh.model.po.Supplier;
import com.jsh.model.vo.materials.DepotHeadModel;
import com.jsh.service.materials.DepotHeadIService;
import com.jsh.util.PageUtil;
import com.jsh.util.Tools;
/*
* 单据表头管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class DepotHeadAction extends BaseAction<DepotHeadModel>
{
private DepotHeadIService depotHeadService;
private DepotHeadModel model = new DepotHeadModel();
/*
* 获取MaxId
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getMaxId()
{
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try
{
depotHeadService.find(pageUtil,"maxId");
mapData.put("depotHeadMax", pageUtil.getPageList());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找最大的Id信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
/**
* 增加仓管通
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加仓管通信息信息方法create()===================");
Boolean flag = false;
try
{
DepotHead depotHead = new DepotHead();
depotHead.setType(model.getType());
depotHead.setSubType(model.getSubType());
depotHead.setProjectId(new Depot(model.getProjectId()));
depotHead.setNumber(model.getNumber());
depotHead.setOperPersonName(getUser().getUsername());
depotHead.setCreateTime(new Timestamp(new Date().getTime()));
try
{
depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd").getTime()));
}
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
}
if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
if(model.getAccountId()!=null){depotHead.setAccountId(new Account(model.getAccountId()));}
depotHead.setChangeAmount(model.getChangeAmount());
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
depotHead.setTotalPrice(model.getTotalPrice());
depotHead.setRemark(model.getRemark());
depotHeadService.create(depotHead);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓管通信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加仓管通信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加仓管通", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加仓管通编号为 "+ model.getNumber() + " " + tipMsg + "", "增加仓管通" + tipMsg));
Log.infoFileSync("==================结束调用增加仓管通方法create()===================");
}
/**
* 删除仓管通
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除仓管通信息方法delete()================");
try
{
depotHeadService.delete(model.getDepotHeadID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotHeadID() + " 的仓管通异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除仓管通", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除仓管通ID为 "+ model.getDepotHeadID() + " " + tipMsg + "", "删除仓管通" + tipMsg));
Log.infoFileSync("====================结束调用删除仓管通信息方法delete()================");
return SUCCESS;
}
/**
* 更新仓管通
* @return
*/
public void update()
{
Boolean flag = false;
try
{
DepotHead depotHead = depotHeadService.get(model.getDepotHeadID());
depotHead.setType(model.getType());
depotHead.setSubType(model.getSubType());
depotHead.setProjectId(new Depot(model.getProjectId()));
depotHead.setNumber(model.getNumber());
depotHead.setOperPersonName(getUser().getUsername());
try
{
depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd").getTime()));
}
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析入库时间格式异常", e);
}
if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
if(model.getAccountId()!=null){depotHead.setAccountId(new Account(model.getAccountId()));}
depotHead.setChangeAmount(model.getChangeAmount());
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
depotHead.setTotalPrice(model.getTotalPrice());
depotHead.setRemark(model.getRemark());
depotHeadService.update(depotHead);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改仓管通ID为 " + model.getDepotHeadID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改仓管通回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新仓管通", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新仓管通ID为 "+ model.getDepotHeadID() + " " + tipMsg + "", "更新仓管通" + tipMsg));
}
/**
* 批量删除指定ID仓管通
* @return
*/
public String batchDelete()
{
try
{
depotHeadService.batchDelete(model.getDepotHeadIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除仓管通ID为" + model.getDepotHeadIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除仓管通", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除仓管通ID为 "+ model.getDepotHeadIDs() + " " + tipMsg + "", "批量删除仓管通" + tipMsg));
return SUCCESS;
}
/**
* 查找仓管通信息
* @return
*/
public void findBy()
{
try
{
PageUtil<DepotHead> pageUtil = new PageUtil<DepotHead>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
depotHeadService.find(pageUtil);
List<DepotHead> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotHead depotHead:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", depotHead.getId());
item.put("ProjectId", depotHead.getProjectId()==null?"":depotHead.getProjectId().getId());
item.put("ProjectName", depotHead.getProjectId()==null?"":depotHead.getProjectId().getName());
item.put("Number", depotHead.getNumber());
item.put("OperPersonName", depotHead.getOperPersonName());
item.put("CreateTime", Tools.getCurrentMonth(depotHead.getCreateTime()));
item.put("OperTime", Tools.getCurrentMonth(depotHead.getOperTime()));
item.put("OrganId", depotHead.getOrganId()==null?"":depotHead.getOrganId().getId());
item.put("OrganName", depotHead.getOrganId()==null?"":depotHead.getOrganId().getSupplier());
item.put("HandsPersonId", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getId());
item.put("HandsPersonName", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getName());
item.put("AccountId", depotHead.getAccountId()==null?"":depotHead.getAccountId().getId());
item.put("AccountName", depotHead.getAccountId()==null?"":depotHead.getAccountId().getName());
item.put("ChangeAmount", depotHead.getChangeAmount()==null?"":Math.abs(depotHead.getChangeAmount()));
item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId());
item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName());
item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice()));
item.put("Remark", depotHead.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
}
}
/**
* 查找进销存_根据月份(报表)
* @return
*/
public void findByMonth() {
try
{
PageUtil<DepotHead> pageUtil = new PageUtil<DepotHead>();
pageUtil.setPageSize(1000);
pageUtil.setCurPage(1);
pageUtil.setAdvSearch(getConditionHead());
depotHeadService.find(pageUtil);
List<DepotHead> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
String headId = "";
if(null != dataList)
{
for(DepotHead depotHead:dataList)
{
headId = headId + depotHead.getId() + ",";
}
}
if(headId!="") {
headId = headId.substring(0, headId.lastIndexOf(","));
}
outer.put("HeadIds", headId);
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
if(model.getAllocationProjectId()!=null)
{condition.put("AllocationProjectId_n_eq", model.getAllocationProjectId());}
if(model.getProjectId()!=null)
{condition.put("ProjectId_n_eq", model.getProjectId());}
condition.put("Type_s_eq",model.getType());
condition.put("SubType_s_eq",model.getSubType());
condition.put("Number_s_like",model.getNumber());
condition.put("OperTime_s_gteq",model.getBeginTime());
condition.put("OperTime_s_lteq",model.getEndTime());
condition.put("Id_s_order","desc");
return condition;
}
private Map<String,Object> getConditionHead()
{
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public DepotHeadModel getModel()
{
return model;
}
public void setDepotHeadService(DepotHeadIService depotHeadService)
{
this.depotHeadService = depotHeadService;
}
}

View File

@@ -0,0 +1,542 @@
package com.jsh.action.materials;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.util.AssetConstants;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Material;
import com.jsh.model.vo.materials.DepotItemModel;
import com.jsh.service.materials.DepotHeadIService;
import com.jsh.service.materials.DepotItemIService;
import com.jsh.util.PageUtil;
import com.jsh.util.Tools;
/*
* 单据明细管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class DepotItemAction extends BaseAction<DepotItemModel>
{
private DepotItemIService depotItemService;
private DepotItemModel model = new DepotItemModel();
/**
* action返回excel结果
*/
public static final String EXCEL = "excel";
/**
* 保存明细
* @return
*/
public void saveDetials()
{
Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()===================");
Boolean flag = false;
try
{
Long headerId=model.getHeaderId();
String inserted=model.getInserted();
String deleted=model.getDeleted();
String updated=model.getUpdated();
//转为json
JSONArray insertedJson = JSONArray.fromObject(inserted);
JSONArray deletedJson = JSONArray.fromObject(deleted);
JSONArray updatedJson = JSONArray.fromObject(updated);
if(null != insertedJson)
{
for(int i = 0;i < insertedJson.size(); i++)
{
DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i));
depotItem.setHeaderId(new DepotHead(headerId));
depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId")));
depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber"));
if(tempInsertedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice"));}
if(tempInsertedJson.get("AllPrice")!=null){depotItem.setAllPrice(tempInsertedJson.getDouble("AllPrice"));}
depotItem.setRemark(tempInsertedJson.getString("Remark"));
depotItemService.create(depotItem);
}
}
if(null != deletedJson)
{
for(int i = 0;i < deletedJson.size(); i++)
{
JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i));
depotItemService.delete(tempDeletedJson.getLong("Id"));
}
}
if(null != updatedJson)
{
for(int i = 0;i < updatedJson.size(); i++)
{
JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i));
DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId")));
depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber"));
if(tempUpdatedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice"));}
if(tempUpdatedJson.get("AllPrice")!=null){depotItem.setAllPrice(tempUpdatedJson.getDouble("AllPrice"));}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
depotItemService.create(depotItem);
}
}
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "", "保存仓管通明细" + tipMsg));
Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()===================");
}
/**
* 查找仓管通信息
* @return
*/
public void findBy()
{
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
String MaterialName = ((depotItem.getMaterialId().getModel().equals(""))?"":""+depotItem.getMaterialId().getModel())+" "+depotItem.getMaterialId().getName()
+((depotItem.getMaterialId().getColor() == null)?"(":"("+depotItem.getMaterialId().getColor()) + ")"
+((depotItem.getMaterialId().getUnit() == null)?"(":"("+depotItem.getMaterialId().getUnit()) + ")";
item.put("MaterialName", MaterialName);
item.put("OperNumber", depotItem.getOperNumber());
item.put("UnitPrice", depotItem.getUnitPrice());
item.put("AllPrice", depotItem.getAllPrice());
item.put("Remark", depotItem.getRemark());
item.put("Img", depotItem.getImg());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
}
}
/**
* 查找进销存
* @return
*/
public void findByAll()
{
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
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);
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
item.put("MaterialModel", depotItem.getMaterialId().getModel());
item.put("MaterialColor", depotItem.getMaterialId().getColor());
item.put("prevSum", prevSum);
item.put("InSum", InSum);
item.put("OutSum", OutSum);
item.put("thisSum", prevSum + InSum - OutSum);
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
item.put("UnitPrice", depotItem.getUnitPrice());
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
}
}
/**
* 进货统计
* @return
*/
public void buyIn()
{
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
JSONObject item = new JSONObject();
Integer InSum = sumNumberBuyOrSale("入库","采购",depotItem.getMaterialId().getId(),model.getMonthTime());
Integer OutSum = sumNumberBuyOrSale("出库","采购退货",depotItem.getMaterialId().getId(),model.getMonthTime());
Double InSumPrice = sumPriceBuyOrSale("入库","采购",depotItem.getMaterialId().getId(),model.getMonthTime());
Double OutSumPrice = sumPriceBuyOrSale("出库","采购退货",depotItem.getMaterialId().getId(),model.getMonthTime());
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
item.put("MaterialModel", depotItem.getMaterialId().getModel());
item.put("MaterialColor", depotItem.getMaterialId().getColor());
item.put("InSum", InSum);
item.put("OutSum", OutSum);
item.put("InSumPrice", InSumPrice);
item.put("OutSumPrice", OutSumPrice);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
}
}
/**
* 销售统计
* @return
*/
public void saleOut()
{
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
JSONObject item = new JSONObject();
Integer OutSum = sumNumberBuyOrSale("出库","销售",depotItem.getMaterialId().getId(),model.getMonthTime());
Integer InSum = sumNumberBuyOrSale("入库","销售退货",depotItem.getMaterialId().getId(),model.getMonthTime());
Double OutSumPrice = sumPriceBuyOrSale("出库","销售",depotItem.getMaterialId().getId(),model.getMonthTime());
Double InSumPrice = sumPriceBuyOrSale("入库","销售退货",depotItem.getMaterialId().getId(),model.getMonthTime());
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
item.put("MaterialModel", depotItem.getMaterialId().getModel());
item.put("MaterialColor", depotItem.getMaterialId().getColor());
item.put("OutSum", OutSum);
item.put("InSum", InSum);
item.put("OutSumPrice", OutSumPrice);
item.put("InSumPrice", InSumPrice);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
}
}
/**
* 统计总计金额
* @return
*/
public void totalCountMoney()
{
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
Double thisAllPrice = 0.0;
if(null != dataList)
{
for(DepotItem depotItem:dataList)
{
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);
thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum);
}
}
outer.put("totalCount", thisAllPrice);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
}
}
/**
* 导出excel表格
* @return
*/
@SuppressWarnings("unchecked")
public String exportExcel()
{
Log.infoFileSync("===================调用导出信息action方法exportExcel开始=======================");
try
{
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getConditionALL());
depotItemService.find(pageUtil);
List<DepotItem> dataList = pageUtil.getPageList();
//存放数据json数组
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);
item.put("Id", depotItem.getId());
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
item.put("MaterialName", depotItem.getMaterialId().getName());
item.put("MaterialModel", depotItem.getMaterialId().getModel());
item.put("MaterialColor", depotItem.getMaterialId().getColor());
item.put("prevSum", prevSum);
item.put("InSum", InSum);
item.put("OutSum", OutSum);
item.put("thisSum", prevSum + InSum - OutSum);
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
item.put("UnitPrice", depotItem.getUnitPrice());
dataArray.add(item);
}
}
String isCurrentPage = "allPage";
model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType()));
model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray));
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e);
model.getShowModel().setMsgTip("export excel exception");
}
Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
return EXCEL;
}
@SuppressWarnings("unchecked")
public Integer sumNumber(String type,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);
allNumber = pageUtil.getPageList().toString();
allNumber = allNumber.substring(1,allNumber.length()-1);
if(allNumber.equals("null")){
allNumber = "0";
}
allNumber = allNumber.replace(".0", "");
} catch (JshException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sumNumber = Integer.parseInt(allNumber);
return sumNumber;
}
@SuppressWarnings("unchecked")
public Integer sumNumberBuyOrSale(String type,String subType,Long MId,String MonthTime) {
Integer sumNumber = 0;
String allNumber = "";
String sumType = "Number";
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try {
depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType);
allNumber = pageUtil.getPageList().toString();
allNumber = allNumber.substring(1,allNumber.length()-1);
if(allNumber.equals("null")){
allNumber = "0";
}
allNumber = allNumber.replace(".0", "");
} catch (JshException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sumNumber = Integer.parseInt(allNumber);
return sumNumber;
}
@SuppressWarnings("unchecked")
public Double sumPriceBuyOrSale(String type,String subType,Long MId,String MonthTime) {
Double sumPrice = 0.0;
String allPrice = "";
String sumType = "Price";
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try {
depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType);
allPrice = pageUtil.getPageList().toString();
allPrice = allPrice.substring(1,allPrice.length()-1);
if(allPrice.equals("null")){
allPrice = "0";
}
allPrice = allPrice.replace(".0", "");
} catch (JshException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sumPrice = Double.parseDouble(allPrice);
return sumPrice;
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("HeaderId_n_eq", model.getHeaderId());
condition.put("Id_s_order","asc");
return condition;
}
private Map<String,Object> getConditionALL()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("HeaderId_s_in", model.getHeadIds());
condition.put("MaterialId_s_in", model.getMaterialIds());
condition.put("MaterialId_s_gb","aaa");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public DepotItemModel getModel()
{
return model;
}
public void setDepotItemService(DepotItemIService depotItemService)
{
this.depotItemService = depotItemService;
}
}

View File

@@ -0,0 +1,402 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.Material;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.MaterialCategory;
import com.jsh.model.po.Supplier;
import com.jsh.model.vo.materials.MaterialModel;
import com.jsh.service.materials.MaterialIService;
import com.jsh.util.PageUtil;
/*
* 商品管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class MaterialAction extends BaseAction<MaterialModel>
{
private MaterialIService materialService;
private MaterialModel model = new MaterialModel();
/**
* 增加商品
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加商品信息方法create()===================");
Boolean flag = false;
try
{
Material material = new Material();
material.setMaterialCategory(new MaterialCategory(model.getCategoryId()));
material.setName(model.getName());
material.setModel(model.getModel());
material.setColor(model.getColor());
material.setUnit(model.getUnit());
material.setRetailPrice(model.getRetailPrice());
material.setLowPrice(model.getLowPrice());
material.setPresetPriceOne(model.getPresetPriceOne());
material.setPresetPriceTwo(model.getPresetPriceTwo());
material.setRemark(model.getRemark());
materialService.create(material);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加商品信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加商品", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加商品名称为 "+ model.getName() + " " + tipMsg + "", "增加商品" + tipMsg));
Log.infoFileSync("==================结束调用增加商品方法create()===================");
}
/**
* 删除商品
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除商品信息方法delete()================");
try
{
materialService.delete(model.getMaterialID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialID() + " 的商品异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除商品", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除商品ID为 "+ model.getMaterialID() + " " + tipMsg + "", "删除商品" + tipMsg));
Log.infoFileSync("====================结束调用删除商品信息方法delete()================");
return SUCCESS;
}
/**
* 更新商品
* @return
*/
public void update()
{
Boolean flag = false;
try
{
Material material = materialService.get(model.getMaterialID());
material.setMaterialCategory(new MaterialCategory(model.getCategoryId()));
material.setName(model.getName());
material.setModel(model.getModel());
material.setColor(model.getColor());
material.setUnit(model.getUnit());
material.setRetailPrice(model.getRetailPrice());
material.setLowPrice(model.getLowPrice());
material.setPresetPriceOne(model.getPresetPriceOne());
material.setPresetPriceTwo(model.getPresetPriceTwo());
material.setRemark(model.getRemark());
material.setName(model.getName());
materialService.update(material);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改商品ID为 " + model.getMaterialID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改商品回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新商品", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新商品ID为 "+ model.getMaterialID() + " " + tipMsg + "", "更新商品" + tipMsg));
}
/**
* 批量删除指定ID商品
* @return
*/
public String batchDelete()
{
try
{
materialService.batchDelete(model.getMaterialIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除商品ID为" + model.getMaterialIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除商品", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除商品ID为 "+ model.getMaterialIDs() + " " + tipMsg + "", "批量删除商品" + tipMsg));
return SUCCESS;
}
/**
* 查找商品信息
* @return
*/
public void findBy()
{
try
{
PageUtil<Material> pageUtil = new PageUtil<Material>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
Long lei=model.getCategoryId();
if(1==lei) //判断值还真不能用String类型的判断
{
pageUtil.setAdvSearch(getCondition_all());
}
else if(1!=lei)
{
pageUtil.setAdvSearch(getCondition());
}
materialService.find(pageUtil);
List<Material> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Material material:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", material.getId());
item.put("Name", material.getName());
item.put("Model", material.getModel());
item.put("Color", material.getColor());
item.put("Unit", material.getUnit());
item.put("RetailPrice", material.getRetailPrice());
item.put("LowPrice", material.getLowPrice());
item.put("PresetPriceOne", material.getPresetPriceOne());
item.put("PresetPriceTwo", material.getPresetPriceTwo());
item.put("Remark", material.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e);
}
}
/**
* 查找商品信息-下拉框
* @return
*/
public void findBySelect()
{
try
{
PageUtil<Material> pageUtil = new PageUtil<Material>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_Select());
materialService.find(pageUtil);
List<Material> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Material material:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", material.getId());
//名称
String MaterialName = ((material.getModel().equals(""))?"":""+material.getModel()) +" "+ material.getName()
+ ((material.getColor() == null)?"":"("+material.getColor() + ")")
+ ((material.getUnit() == null)?"":"("+material.getUnit() + ")");
item.put("MaterialName", MaterialName);
dataArray.add(item);
}
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
}
}
/**
* 查找商品信息-统计排序
* @return
*/
public void findByOrder()
{
try
{
PageUtil<Material> pageUtil = new PageUtil<Material>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_Order());
materialService.find(pageUtil);
List<Material> dataList = pageUtil.getPageList();
//存放数据json数组
JSONObject outer = new JSONObject();
String mId = "";
if(null != dataList)
{
for(Material material:dataList)
{
mId = mId + material.getId() + ",";
}
}
if(mId!="") {
mId = mId.substring(0, mId.lastIndexOf(","));
}
outer.put("mIds", mId);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
}
}
/**
* 拼接搜索条件(查全部)
* @return
*/
private Map<String,Object> getCondition_all()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("Id_s_order", "asc");
return condition;
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("CategoryId_s_in", model.getCategoryIds());
condition.put("Id_s_order", "asc");
return condition;
}
/**
* 拼接搜索条件-下拉框
* @return
*/
private Map<String,Object> getCondition_Select()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("Id_s_order", "asc");
return condition;
}
/**
* 拼接搜索条件-下拉框
* @return
*/
private Map<String,Object> getCondition_Order()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("Name,Model_s_order", "asc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public MaterialModel getModel()
{
return model;
}
public void setMaterialService(MaterialIService materialService)
{
this.materialService = materialService;
}
}

View File

@@ -0,0 +1,275 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.MaterialCategory;
import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.materials.MaterialCategoryModel;
import com.jsh.service.materials.MaterialCategoryIService;
import com.jsh.util.PageUtil;
/*
* 商品类型管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
{
private MaterialCategoryIService materialCategoryService;
private MaterialCategoryModel model = new MaterialCategoryModel();
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getBasicData()
{
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try
{
Map<String,Object> condition = pageUtil.getAdvSearch();
condition.put("ParentId_n_eq", model.getParentId());
condition.put("Id_n_neq", 1);
condition.put("Id_s_order", "asc");
materialCategoryService.find(pageUtil);
mapData.put("materialCategoryList", pageUtil.getPageList());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找商品类别信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
/**
* 增加商品类别
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加商品类别信息方法create()===================");
Boolean flag = false;
try
{
MaterialCategory materialCategory = new MaterialCategory();
materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId()));
materialCategory.setCategoryLevel(model.getCategoryLevel());
materialCategory.setName(model.getName());
materialCategoryService.create(materialCategory);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品类别信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加商品类别信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加商品类别名称为 "+ model.getName() + " " + tipMsg + "", "增加商品类别" + tipMsg));
Log.infoFileSync("==================结束调用增加商品类别方法create()===================");
}
/**
* 删除商品类别
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除商品类别信息方法delete()================");
try
{
materialCategoryService.delete(model.getMaterialCategoryID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的商品类别异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "", "删除商品类别" + tipMsg));
Log.infoFileSync("====================结束调用删除商品类别信息方法delete()================");
return SUCCESS;
}
/**
* 更新商品类别
* @return
*/
public void update()
{
Boolean flag = false;
try
{
MaterialCategory materialCategory = materialCategoryService.get(model.getMaterialCategoryID());
materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId()));
materialCategory.setCategoryLevel(model.getCategoryLevel());
materialCategory.setName(model.getName());
materialCategoryService.update(materialCategory);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改商品类别ID为 " + model.getMaterialCategoryID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改商品类别回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "", "更新商品类别" + tipMsg));
}
/**
* 批量删除指定ID商品类别
* @return
*/
public String batchDelete()
{
try
{
materialCategoryService.batchDelete(model.getMaterialCategoryIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除商品类别ID为" + model.getMaterialCategoryIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除商品类别ID为 "+ model.getMaterialCategoryIDs() + " " + tipMsg + "", "批量删除商品类别" + tipMsg));
return SUCCESS;
}
/**
* 查找商品类别信息
* @return
*/
public void findBy()
{
try
{
PageUtil<MaterialCategory> pageUtil = new PageUtil<MaterialCategory>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
materialCategoryService.find(pageUtil);
List<MaterialCategory> dataList = pageUtil.getPageList();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(MaterialCategory materialCategory:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", materialCategory.getId());
item.put("ParentId", materialCategory.getMaterialCategory().getId());
item.put("ParentName", materialCategory.getMaterialCategory().getName());
item.put("CategoryLevel", materialCategory.getCategoryLevel());
item.put("Name", materialCategory.getName());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品类别信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品类别信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("ParentId_n_eq", model.getParentId());
condition.put("Id_n_neq", 1);
condition.put("Id_s_order", "asc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public MaterialCategoryModel getModel()
{
return model;
}
public void setMaterialCategoryService(MaterialCategoryIService materialCategoryService)
{
this.materialCategoryService = materialCategoryService;
}
}

View File

@@ -0,0 +1,287 @@
package com.jsh.action.materials;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Depot;
import com.jsh.model.po.Person;
import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.materials.PersonModel;
import com.jsh.service.materials.PersonIService;
import com.jsh.util.PageUtil;
/*
* 经手人管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings("serial")
public class PersonAction extends BaseAction<PersonModel>
{
private PersonIService personService;
private PersonModel model = new PersonModel();
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getBasicData()
{
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try
{
Map<String,Object> condition = pageUtil.getAdvSearch();
condition.put("Id_s_order", "asc");
personService.find(pageUtil);
mapData.put("personList", pageUtil.getPageList());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public String getPersonByType()
{
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
try
{
Map<String,Object> condition = pageUtil.getAdvSearch();
condition.put("Type_s_eq", model.getType());
condition.put("Id_s_order", "asc");
personService.find(pageUtil);
mapData.put("personList", pageUtil.getPageList());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
/**
* 增加经手人
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加经手人信息方法create()===================");
Boolean flag = false;
try
{
Person person = new Person();
person.setType(model.getType());
person.setName(model.getName());
personService.create(person);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加经手人信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加经手人信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加经手人", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加经手人名称为 "+ model.getName() + " " + tipMsg + "", "增加经手人" + tipMsg));
Log.infoFileSync("==================结束调用增加经手人方法create()===================");
}
/**
* 删除经手人
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除经手人信息方法delete()================");
try
{
personService.delete(model.getPersonID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getPersonID() + " 的经手人异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除经手人", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除经手人ID为 "+ model.getPersonID() + " " + tipMsg + "", "删除经手人" + tipMsg));
Log.infoFileSync("====================结束调用删除经手人信息方法delete()================");
return SUCCESS;
}
/**
* 更新经手人
* @return
*/
public void update()
{
Boolean flag = false;
try
{
Person person = personService.get(model.getPersonID());
person.setType(model.getType());
person.setName(model.getName());
personService.update(person);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改经手人ID为 " + model.getPersonID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改经手人回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新经手人", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新经手人ID为 "+ model.getPersonID() + " " + tipMsg + "", "更新经手人" + tipMsg));
}
/**
* 批量删除指定ID经手人
* @return
*/
public String batchDelete()
{
try
{
personService.batchDelete(model.getPersonIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除经手人ID为" + model.getPersonIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除经手人", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除经手人ID为 "+ model.getPersonIDs() + " " + tipMsg + "", "批量删除经手人" + tipMsg));
return SUCCESS;
}
/**
* 查找经手人信息
* @return
*/
public void findBy()
{
try
{
PageUtil<Person> pageUtil = new PageUtil<Person>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
personService.find(pageUtil);
List<Person> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Person person:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", person.getId());
item.put("Type", person.getType());
item.put("Name", person.getName());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找经手人信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询经手人信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("Name_s_like", model.getName());
condition.put("Type_s_eq", model.getType());
return condition;
}
//=============以下spring注入以及Model驱动公共方法与Action处理无关==================
@Override
public PersonModel getModel()
{
return model;
}
public void setPersonService(PersonIService personService)
{
this.personService = personService;
}
}