no commit message
This commit is contained in:
@@ -17,8 +17,8 @@ import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.constants.asset.AssetConstants;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.AssetConstants;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.Assetname;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
@@ -30,8 +30,8 @@ import com.jsh.service.basic.AssetNameIService;
|
||||
import com.jsh.service.basic.CategoryIService;
|
||||
import com.jsh.service.basic.SupplierIService;
|
||||
import com.jsh.service.basic.UserIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AssetAction extends BaseAction<AssetModel>
|
||||
|
||||
@@ -5,11 +5,11 @@ import java.util.Map;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.vo.asset.ReportModel;
|
||||
import com.jsh.service.asset.ReportIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ReportAction extends BaseAction<ReportModel>
|
||||
|
||||
@@ -5,22 +5,19 @@ 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.Logdetails;
|
||||
import com.jsh.model.po.Account;
|
||||
import com.jsh.model.vo.basic.AccountModel;
|
||||
import com.jsh.service.basic.AccountIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 结算账户
|
||||
* @author ji sheng hua
|
||||
* @author ji sheng hua qq752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountAction extends BaseAction<AccountModel>
|
||||
@@ -28,6 +25,28 @@ public class AccountAction extends BaseAction<AccountModel>
|
||||
private AccountIService accountService;
|
||||
private AccountModel model = new AccountModel();
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String getAccount()
|
||||
{
|
||||
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");
|
||||
accountService.find(pageUtil);
|
||||
mapData.put("accountList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找账户信息异常", e);
|
||||
model.getShowModel().setMsgTip("exception");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加结算账户
|
||||
* @return
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -6,30 +7,26 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
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.apache.struts2.ServletActionContext;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.App;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.AppModel;
|
||||
import com.jsh.service.basic.AppIService;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 应用
|
||||
* @author ji_sheng_hua
|
||||
* @author ji_sheng_hua qq752 718 920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AppAction extends BaseAction<AppModel>
|
||||
|
||||
@@ -1,289 +1,286 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Assetname;
|
||||
import com.jsh.model.po.Category;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.AssetNameModel;
|
||||
import com.jsh.service.basic.AssetNameIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AssetNameAction extends BaseAction<AssetNameModel>
|
||||
{
|
||||
private AssetNameModel model = new AssetNameModel();
|
||||
|
||||
private AssetNameIService assetnameService;
|
||||
/**
|
||||
* 增加资产名称
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加资产名称方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Assetname assetname = new Assetname();
|
||||
assetname.setAssetname(model.getAssetName());
|
||||
//增加资产类型
|
||||
assetname.setCategory(new Category(model.getCategoryID()));
|
||||
|
||||
assetname.setIsystem((short)1);
|
||||
assetname.setIsconsumables(model.getConsumable());
|
||||
assetname.setDescription(model.getDescription());
|
||||
assetnameService.create(assetname);
|
||||
|
||||
//========标识位===========
|
||||
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.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加资产名称方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产名称
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================");
|
||||
try
|
||||
{
|
||||
assetnameService.delete(model.getAssetNameID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产名称
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Assetname assetname = assetnameService.get(model.getAssetNameID());
|
||||
//增加资产类型
|
||||
assetname.setCategory(new Category(model.getCategoryID()));
|
||||
assetname.setAssetname(model.getAssetName());
|
||||
assetname.setIsconsumables(model.getConsumable());
|
||||
assetname.setDescription(model.getDescription());
|
||||
assetnameService.update(assetname);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", 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.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID资产名称
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
assetnameService.batchDelete(model.getAssetNameIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Assetname> pageUtil = new PageUtil<Assetname>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
assetnameService.find(pageUtil);
|
||||
List<Assetname> 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(Assetname assetname:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", assetname.getId());
|
||||
//供应商名称
|
||||
item.put("assetname", assetname.getAssetname());
|
||||
item.put("isystem", assetname.getIsystem() == (short)0?"是":"否");
|
||||
item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否");
|
||||
item.put("consumableStatus", assetname.getIsconsumables());
|
||||
item.put("description", assetname.getDescription());
|
||||
item.put("categoryID", assetname.getCategory().getId());
|
||||
item.put("category", assetname.getCategory().getAssetname());
|
||||
item.put("op", assetname.getIsystem());
|
||||
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("assetname_s_like", model.getAssetName());
|
||||
condition.put("isconsumables_n_eq", model.getConsumable());
|
||||
condition.put("description_s_like", model.getDescription());
|
||||
condition.put("category.id_n_eq", model.getCategoryID());
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public AssetNameModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setAssetnameService(AssetNameIService assetnameService)
|
||||
{
|
||||
this.assetnameService = assetnameService;
|
||||
}
|
||||
}
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Assetname;
|
||||
import com.jsh.model.po.Category;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.AssetNameModel;
|
||||
import com.jsh.service.basic.AssetNameIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AssetNameAction extends BaseAction<AssetNameModel>
|
||||
{
|
||||
private AssetNameModel model = new AssetNameModel();
|
||||
|
||||
private AssetNameIService assetnameService;
|
||||
/**
|
||||
* 增加资产名称
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加资产名称方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Assetname assetname = new Assetname();
|
||||
assetname.setAssetname(model.getAssetName());
|
||||
//增加资产类型
|
||||
assetname.setCategory(new Category(model.getCategoryID()));
|
||||
|
||||
assetname.setIsystem((short)1);
|
||||
assetname.setIsconsumables(model.getConsumable());
|
||||
assetname.setDescription(model.getDescription());
|
||||
assetnameService.create(assetname);
|
||||
|
||||
//========标识位===========
|
||||
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.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加资产名称方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产名称
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================");
|
||||
try
|
||||
{
|
||||
assetnameService.delete(model.getAssetNameID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产名称
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Assetname assetname = assetnameService.get(model.getAssetNameID());
|
||||
//增加资产类型
|
||||
assetname.setCategory(new Category(model.getCategoryID()));
|
||||
assetname.setAssetname(model.getAssetName());
|
||||
assetname.setIsconsumables(model.getConsumable());
|
||||
assetname.setDescription(model.getDescription());
|
||||
assetnameService.update(assetname);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", 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.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID资产名称
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
assetnameService.batchDelete(model.getAssetNameIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Assetname> pageUtil = new PageUtil<Assetname>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
assetnameService.find(pageUtil);
|
||||
List<Assetname> 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(Assetname assetname:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", assetname.getId());
|
||||
//供应商名称
|
||||
item.put("assetname", assetname.getAssetname());
|
||||
item.put("isystem", assetname.getIsystem() == (short)0?"是":"否");
|
||||
item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否");
|
||||
item.put("consumableStatus", assetname.getIsconsumables());
|
||||
item.put("description", assetname.getDescription());
|
||||
item.put("categoryID", assetname.getCategory().getId());
|
||||
item.put("category", assetname.getCategory().getAssetname());
|
||||
item.put("op", assetname.getIsystem());
|
||||
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("assetname_s_like", model.getAssetName());
|
||||
condition.put("isconsumables_n_eq", model.getConsumable());
|
||||
condition.put("description_s_like", model.getDescription());
|
||||
condition.put("category.id_n_eq", model.getCategoryID());
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public AssetNameModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setAssetnameService(AssetNameIService assetnameService)
|
||||
{
|
||||
this.assetnameService = assetnameService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,273 +1,272 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Category;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.CategoryModel;
|
||||
import com.jsh.service.basic.CategoryIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CategoryAction extends BaseAction<CategoryModel>
|
||||
{
|
||||
private CategoryIService categoryService;
|
||||
private CategoryModel model = new CategoryModel();
|
||||
/**
|
||||
* 增加资产类型
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Category category = new Category();
|
||||
category.setAssetname(model.getCategoryName());
|
||||
category.setIsystem((short)1);
|
||||
category.setDescription(model.getDescription());
|
||||
categoryService.create(category);
|
||||
|
||||
//========标识位===========
|
||||
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.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产类型
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
|
||||
try
|
||||
{
|
||||
categoryService.delete(model.getCategoryID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产类型
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Category category = categoryService.get(model.getCategoryID());
|
||||
category.setAssetname(model.getCategoryName());
|
||||
category.setDescription(model.getDescription());
|
||||
categoryService.update(category);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", 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.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID资产类型
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
categoryService.batchDelete(model.getCategoryIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Category> pageUtil = new PageUtil<Category>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
categoryService.find(pageUtil);
|
||||
List<Category> 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(Category category:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", category.getId());
|
||||
//供应商名称
|
||||
item.put("categoryname", category.getAssetname());
|
||||
item.put("isystem", category.getIsystem() == (short)0?"是":"否");
|
||||
item.put("description", category.getDescription());
|
||||
item.put("op", category.getIsystem());
|
||||
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("assetname_s_like", model.getCategoryName());
|
||||
condition.put("description_s_like", model.getDescription());
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public CategoryModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setCategoryService(CategoryIService categoryService)
|
||||
{
|
||||
this.categoryService = categoryService;
|
||||
}
|
||||
}
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Category;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.CategoryModel;
|
||||
import com.jsh.service.basic.CategoryIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CategoryAction extends BaseAction<CategoryModel>
|
||||
{
|
||||
private CategoryIService categoryService;
|
||||
private CategoryModel model = new CategoryModel();
|
||||
/**
|
||||
* 增加资产类型
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Category category = new Category();
|
||||
category.setAssetname(model.getCategoryName());
|
||||
category.setIsystem((short)1);
|
||||
category.setDescription(model.getDescription());
|
||||
categoryService.create(category);
|
||||
|
||||
//========标识位===========
|
||||
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.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产类型
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
|
||||
try
|
||||
{
|
||||
categoryService.delete(model.getCategoryID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产类型
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Category category = categoryService.get(model.getCategoryID());
|
||||
category.setAssetname(model.getCategoryName());
|
||||
category.setDescription(model.getDescription());
|
||||
categoryService.update(category);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", 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.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID资产类型
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
categoryService.batchDelete(model.getCategoryIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Category> pageUtil = new PageUtil<Category>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
categoryService.find(pageUtil);
|
||||
List<Category> 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(Category category:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", category.getId());
|
||||
//供应商名称
|
||||
item.put("categoryname", category.getAssetname());
|
||||
item.put("isystem", category.getIsystem() == (short)0?"是":"否");
|
||||
item.put("description", category.getDescription());
|
||||
item.put("op", category.getIsystem());
|
||||
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("assetname_s_like", model.getCategoryName());
|
||||
condition.put("description_s_like", model.getDescription());
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public CategoryModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setCategoryService(CategoryIService categoryService)
|
||||
{
|
||||
this.categoryService = categoryService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,22 @@ 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.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Depot;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.po.Role;
|
||||
import com.jsh.model.vo.basic.DepotModel;
|
||||
import com.jsh.service.basic.DepotIService;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 仓库
|
||||
* @author ji sheng hua
|
||||
* 仓库管理
|
||||
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DepotAction extends BaseAction<DepotModel>
|
||||
|
||||
@@ -5,23 +5,23 @@ 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.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.App;
|
||||
import com.jsh.model.po.Functions;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.FunctionsModel;
|
||||
import com.jsh.service.basic.FunctionsIService;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* 功能管理
|
||||
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FunctionsAction extends BaseAction<FunctionsModel>
|
||||
{
|
||||
|
||||
@@ -5,22 +5,19 @@ 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.Logdetails;
|
||||
import com.jsh.model.po.InOutItem;
|
||||
import com.jsh.model.vo.basic.InOutItemModel;
|
||||
import com.jsh.service.basic.InOutItemIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 收支项目
|
||||
* @author ji*sheng*hua
|
||||
* @author ji*sheng*hua qq 7.5.2.7.1.8.9.2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class InOutItemAction extends BaseAction<InOutItemModel>
|
||||
@@ -266,9 +263,9 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
|
||||
for(InOutItem inOutItem:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", inOutItem.getId());
|
||||
item.put("Id", inOutItem.getId());
|
||||
//收支项目名称
|
||||
item.put("name", inOutItem.getName());
|
||||
item.put("InOutItemName", inOutItem.getName());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,192 +1,193 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Logdetails;
|
||||
import com.jsh.model.vo.basic.LogModel;
|
||||
import com.jsh.service.basic.UserIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LogAction extends BaseAction<LogModel>
|
||||
{
|
||||
private LogModel model = new LogModel();
|
||||
private UserIService userService;
|
||||
|
||||
@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.clear();
|
||||
condition.put("ismanager_n_eq", 0);
|
||||
userService.find(pageUtil);
|
||||
mapData.put("userList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除日志
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除日志信息方法delete()================");
|
||||
try
|
||||
{
|
||||
logService.delete(model.getLogID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除日志ID为 "+ model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除日志信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID日志
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
logService.batchDelete(model.getLogIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除日志ID为 "+ model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找日志信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Logdetails> pageUtil = new PageUtil<Logdetails>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
logService.find(pageUtil);
|
||||
List<Logdetails> 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(Logdetails log:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", log.getId());
|
||||
item.put("clientIP", log.getClientIp());
|
||||
item.put("details", log.getContentdetails());
|
||||
item.put("createTime", Tools.getCenternTime(log.getCreatetime()));
|
||||
item.put("operation", log.getOperation());
|
||||
item.put("remark", log.getRemark());
|
||||
item.put("status", log.getStatus() == 0 ?"成功":"失败");
|
||||
item.put("statusShort", log.getStatus());
|
||||
item.put("username", log.getUser()==null?"":log.getUser().getUsername());
|
||||
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("user.id_n_eq", model.getUsernameID());
|
||||
condition.put("createtime_s_gteq", model.getBeginTime());
|
||||
condition.put("createtime_s_lteq", model.getEndTime());
|
||||
condition.put("operation_s_like", model.getOperation());
|
||||
condition.put("clientIp_s_like", model.getClientIp());
|
||||
condition.put("status_n_eq", model.getStatus());
|
||||
condition.put("contentdetails_s_like", model.getContentdetails());
|
||||
condition.put("remark_s_like", model.getRemark());
|
||||
condition.put("createtime_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
public void setUserService(UserIService userService)
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
package com.jsh.action.basic;
|
||||
|
||||
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.Logdetails;
|
||||
import com.jsh.model.vo.basic.LogModel;
|
||||
import com.jsh.service.basic.UserIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
|
||||
/*
|
||||
*日志管理
|
||||
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LogAction extends BaseAction<LogModel>
|
||||
{
|
||||
private LogModel model = new LogModel();
|
||||
private UserIService userService;
|
||||
|
||||
@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.clear();
|
||||
condition.put("ismanager_n_eq", 0);
|
||||
userService.find(pageUtil);
|
||||
mapData.put("userList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除日志
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除日志信息方法delete()================");
|
||||
try
|
||||
{
|
||||
logService.delete(model.getLogID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除日志ID为 "+ model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除日志信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID日志
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
logService.batchDelete(model.getLogIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除日志ID为 "+ model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找日志信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Logdetails> pageUtil = new PageUtil<Logdetails>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
logService.find(pageUtil);
|
||||
List<Logdetails> 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(Logdetails log:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", log.getId());
|
||||
item.put("clientIP", log.getClientIp());
|
||||
item.put("details", log.getContentdetails());
|
||||
item.put("createTime", Tools.getCenternTime(log.getCreatetime()));
|
||||
item.put("operation", log.getOperation());
|
||||
item.put("remark", log.getRemark());
|
||||
item.put("status", log.getStatus() == 0 ?"成功":"失败");
|
||||
item.put("statusShort", log.getStatus());
|
||||
item.put("username", log.getUser()==null?"":log.getUser().getUsername());
|
||||
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("user.id_n_eq", model.getUsernameID());
|
||||
condition.put("createtime_s_gteq", model.getBeginTime());
|
||||
condition.put("createtime_s_lteq", model.getEndTime());
|
||||
condition.put("operation_s_like", model.getOperation());
|
||||
condition.put("clientIp_s_like", model.getClientIp());
|
||||
condition.put("status_n_eq", model.getStatus());
|
||||
condition.put("contentdetails_s_like", model.getContentdetails());
|
||||
condition.put("remark_s_like", model.getRemark());
|
||||
condition.put("createtime_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
public void setUserService(UserIService userService)
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,23 +5,23 @@ 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.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.App;
|
||||
import com.jsh.model.po.Role;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.RoleModel;
|
||||
import com.jsh.service.basic.RoleIService;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* 角色管理
|
||||
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class RoleAction extends BaseAction<RoleModel>
|
||||
{
|
||||
|
||||
@@ -5,20 +5,20 @@ 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.Logdetails;
|
||||
import com.jsh.model.po.Supplier;
|
||||
import com.jsh.model.vo.basic.SupplierModel;
|
||||
import com.jsh.service.basic.SupplierIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* 单位管理
|
||||
* @author jishenghua qq:752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SupplierAction extends BaseAction<SupplierModel>
|
||||
{
|
||||
|
||||
@@ -1,481 +1,481 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
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.constants.common.ExceptionCodeConstants;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.UserModel;
|
||||
import com.jsh.service.basic.UserIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class UserAction extends BaseAction<UserModel>
|
||||
{
|
||||
private UserModel model = new UserModel();
|
||||
private UserIService userService;
|
||||
|
||||
/**
|
||||
* 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面
|
||||
* @return
|
||||
*/
|
||||
public String login()
|
||||
{
|
||||
Log.infoFileSync("============用户登录 login 方法调用开始==============");
|
||||
String username = model.getLoginame().trim();
|
||||
String password = model.getPassword().trim();
|
||||
//因密码用MD5加密,需要对密码进行转化
|
||||
try
|
||||
{
|
||||
password = Tools.md5Encryp(password);
|
||||
System.out.println(password);
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
|
||||
}
|
||||
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
Basicuser sessionUser = (Basicuser)getSession().get("user");
|
||||
if(null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame())
|
||||
&& sessionUser.getPassword().equals(password))
|
||||
{
|
||||
Log.infoFileSync("====用户 "+ username + "已经登录过, login 方法调用结束====");
|
||||
model.getShowModel().setMsgTip("user already login");
|
||||
/*return "login";*/
|
||||
}
|
||||
|
||||
//获取用户状态
|
||||
int userStatus = -1;
|
||||
try
|
||||
{
|
||||
userStatus = userService.validateUser(username, password);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====",e);
|
||||
model.getShowModel().setMsgTip("access service exception");
|
||||
}
|
||||
switch (userStatus)
|
||||
{
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
|
||||
model.getShowModel().setMsgTip("user is not exist");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
|
||||
model.getShowModel().setMsgTip("user password error");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
|
||||
model.getShowModel().setMsgTip("user is black");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
|
||||
model.getShowModel().setMsgTip("access service error");
|
||||
break;
|
||||
default:
|
||||
try
|
||||
{
|
||||
//验证通过 ,可以登录,放入session,记录登录日志
|
||||
Basicuser user = userService.getUser(username);
|
||||
logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis()), (short)0,"管理用户:" + username + " 登录系统",username + " 登录系统"));
|
||||
model.getShowModel().setMsgTip("user can login");
|
||||
getSession().put("user", user);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*if(ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT == userStatus)
|
||||
return "login";*/
|
||||
Log.infoFileSync("===============用户登录 login 方法调用结束===============");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户退出登录
|
||||
* @return
|
||||
*/
|
||||
public String logout()
|
||||
{
|
||||
logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis()), (short)0,
|
||||
"管理用户:" + getUser().getLoginame() + " 退出系统",getUser().getLoginame() + " 退出系统"));
|
||||
getSession().remove("user");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加用户
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加用户方法===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Basicuser user = new Basicuser();
|
||||
user.setDepartment(model.getDepartment());
|
||||
user.setDescription(model.getDescription());
|
||||
user.setEmail(model.getEmail());
|
||||
// user.setIsmanager(model.getIsmanager());
|
||||
user.setIsystem((short)1);
|
||||
user.setIsmanager((short)1);
|
||||
user.setLoginame(model.getLoginame());
|
||||
String password ="123456";
|
||||
//因密码用MD5加密,需要对密码进行转化
|
||||
try
|
||||
{
|
||||
password=Tools.md5Encryp(password);
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
|
||||
}
|
||||
user.setPassword(password);
|
||||
|
||||
user.setPhonenum(model.getPhonenum());
|
||||
user.setPosition(model.getPosition());
|
||||
user.setUsername(model.getUsername());
|
||||
|
||||
userService.create(user);
|
||||
//========标识位===========
|
||||
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.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加用户方法===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除用户信息方法delete()================");
|
||||
try
|
||||
{
|
||||
userService.delete(model.getUserID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除用户信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Basicuser user = userService.get(model.getUserID());
|
||||
user.setDepartment(model.getDepartment());
|
||||
user.setDescription(model.getDescription());
|
||||
user.setEmail(model.getEmail());
|
||||
//user.setIsmanager(model.getIsmanager());
|
||||
user.setLoginame(model.getLoginame());
|
||||
//user.setPassword(model.getPassword());
|
||||
user.setPhonenum(model.getPhonenum());
|
||||
user.setPosition(model.getPosition());
|
||||
user.setUsername(model.getUsername());
|
||||
userService.update(user);
|
||||
|
||||
//看是否需要更新seesion中user
|
||||
if(getUser().getId() == model.getUserID())
|
||||
{
|
||||
getSession().put("user", user);
|
||||
}
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "信息失败", 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.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
public void updatePwd()
|
||||
{
|
||||
Integer flag = 0;
|
||||
try
|
||||
{
|
||||
Basicuser user = getUser();
|
||||
String orgPassword = Tools.md5Encryp(model.getOrgpwd());
|
||||
String md5Pwd = Tools.md5Encryp(model.getPassword());
|
||||
//必须和原始密码一致才可以更新密码
|
||||
if(orgPassword.equalsIgnoreCase(user.getPassword()))
|
||||
{
|
||||
|
||||
user.setPassword(md5Pwd);
|
||||
userService.update(user);
|
||||
|
||||
//看是否需要更新seesion中user
|
||||
// if(getUser().getId() == model.getUserID())
|
||||
// {
|
||||
// getSession().put("user", user);
|
||||
// }
|
||||
|
||||
flag = 1;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = 2;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e);
|
||||
flag = 3;
|
||||
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.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID用户
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
userService.batchDelete(model.getUserIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除用户ID为 "+ model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
String fieldName = "";
|
||||
String fieldValue = "";
|
||||
try
|
||||
{
|
||||
if(0 == model.getCheckFlag())
|
||||
{
|
||||
fieldName = "username";
|
||||
fieldValue = model.getUsername();
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldName = "loginame";
|
||||
fieldValue = model.getLoginame();
|
||||
}
|
||||
flag = userService.checkIsNameExist(fieldName,fieldValue, model.getUserID());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找用户信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Basicuser> pageUtil = new PageUtil<Basicuser>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
userService.find(pageUtil);
|
||||
List<Basicuser> 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(Basicuser user:dataList)
|
||||
{
|
||||
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", user.getId());
|
||||
item.put("username", user.getUsername());
|
||||
item.put("loginame", Tools.dealNullStr(user.getLoginame()));
|
||||
item.put("password", Tools.dealNullStr(user.getPassword()));
|
||||
item.put("position", Tools.dealNullStr(user.getPosition()));
|
||||
item.put("department", Tools.dealNullStr(user.getDepartment()));
|
||||
item.put("email", Tools.dealNullStr(user.getEmail()));
|
||||
item.put("phonenum", Tools.dealNullStr(user.getPhonenum()));
|
||||
item.put("ismanager", user.getIsmanager()== (short)0?"是":"否");
|
||||
item.put("isystem",user.getIsystem() == (short)0?"是":"否");
|
||||
item.put("status", user.getStatus());
|
||||
item.put("description", Tools.dealNullStr(user.getDescription()));
|
||||
item.put("remark",user.getRemark());
|
||||
item.put("op", user.getIsystem());
|
||||
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("username_s_like", model.getUsername());
|
||||
condition.put("loginame_s_like", model.getLoginame());
|
||||
condition.put("id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public UserModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setUserService(UserIService userService)
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
}
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
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.util.ExceptionCodeConstants;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.UserModel;
|
||||
import com.jsh.service.basic.UserIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
/*
|
||||
* 用户管理
|
||||
* @author jishenghua qq:752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UserAction extends BaseAction<UserModel>
|
||||
{
|
||||
private UserModel model = new UserModel();
|
||||
private UserIService userService;
|
||||
|
||||
/**
|
||||
* 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面
|
||||
* @return
|
||||
*/
|
||||
public String login()
|
||||
{
|
||||
Log.infoFileSync("============用户登录 login 方法调用开始==============");
|
||||
String username = model.getLoginame().trim();
|
||||
String password = model.getPassword().trim();
|
||||
//因密码用MD5加密,需要对密码进行转化
|
||||
try
|
||||
{
|
||||
password = Tools.md5Encryp(password);
|
||||
System.out.println(password);
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
|
||||
}
|
||||
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
Basicuser sessionUser = (Basicuser)getSession().get("user");
|
||||
if(null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame())
|
||||
&& sessionUser.getPassword().equals(password))
|
||||
{
|
||||
Log.infoFileSync("====用户 "+ username + "已经登录过, login 方法调用结束====");
|
||||
model.getShowModel().setMsgTip("user already login");
|
||||
/*return "login";*/
|
||||
}
|
||||
|
||||
//获取用户状态
|
||||
int userStatus = -1;
|
||||
try
|
||||
{
|
||||
userStatus = userService.validateUser(username, password);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====",e);
|
||||
model.getShowModel().setMsgTip("access service exception");
|
||||
}
|
||||
switch (userStatus)
|
||||
{
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
|
||||
model.getShowModel().setMsgTip("user is not exist");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
|
||||
model.getShowModel().setMsgTip("user password error");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
|
||||
model.getShowModel().setMsgTip("user is black");
|
||||
break;
|
||||
case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
|
||||
model.getShowModel().setMsgTip("access service error");
|
||||
break;
|
||||
default:
|
||||
try
|
||||
{
|
||||
//验证通过 ,可以登录,放入session,记录登录日志
|
||||
Basicuser user = userService.getUser(username);
|
||||
logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis()), (short)0,"管理用户:" + username + " 登录系统",username + " 登录系统"));
|
||||
model.getShowModel().setMsgTip("user can login");
|
||||
getSession().put("user", user);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*if(ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT == userStatus)
|
||||
return "login";*/
|
||||
Log.infoFileSync("===============用户登录 login 方法调用结束===============");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户退出登录
|
||||
* @return
|
||||
*/
|
||||
public String logout()
|
||||
{
|
||||
logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis()), (short)0,
|
||||
"管理用户:" + getUser().getLoginame() + " 退出系统",getUser().getLoginame() + " 退出系统"));
|
||||
getSession().remove("user");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加用户
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加用户方法===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Basicuser user = new Basicuser();
|
||||
user.setDepartment(model.getDepartment());
|
||||
user.setDescription(model.getDescription());
|
||||
user.setEmail(model.getEmail());
|
||||
// user.setIsmanager(model.getIsmanager());
|
||||
user.setIsystem((short)1);
|
||||
user.setIsmanager((short)1);
|
||||
user.setLoginame(model.getLoginame());
|
||||
String password ="123456";
|
||||
//因密码用MD5加密,需要对密码进行转化
|
||||
try
|
||||
{
|
||||
password=Tools.md5Encryp(password);
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
|
||||
}
|
||||
user.setPassword(password);
|
||||
|
||||
user.setPhonenum(model.getPhonenum());
|
||||
user.setPosition(model.getPosition());
|
||||
user.setUsername(model.getUsername());
|
||||
|
||||
userService.create(user);
|
||||
//========标识位===========
|
||||
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.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加用户方法===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除用户信息方法delete()================");
|
||||
try
|
||||
{
|
||||
userService.delete(model.getUserID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除用户信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Basicuser user = userService.get(model.getUserID());
|
||||
user.setDepartment(model.getDepartment());
|
||||
user.setDescription(model.getDescription());
|
||||
user.setEmail(model.getEmail());
|
||||
//user.setIsmanager(model.getIsmanager());
|
||||
user.setLoginame(model.getLoginame());
|
||||
//user.setPassword(model.getPassword());
|
||||
user.setPhonenum(model.getPhonenum());
|
||||
user.setPosition(model.getPosition());
|
||||
user.setUsername(model.getUsername());
|
||||
userService.update(user);
|
||||
|
||||
//看是否需要更新seesion中user
|
||||
if(getUser().getId() == model.getUserID())
|
||||
{
|
||||
getSession().put("user", user);
|
||||
}
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "信息失败", 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.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
public void updatePwd()
|
||||
{
|
||||
Integer flag = 0;
|
||||
try
|
||||
{
|
||||
Basicuser user = getUser();
|
||||
String orgPassword = Tools.md5Encryp(model.getOrgpwd());
|
||||
String md5Pwd = Tools.md5Encryp(model.getPassword());
|
||||
//必须和原始密码一致才可以更新密码
|
||||
if(orgPassword.equalsIgnoreCase(user.getPassword()))
|
||||
{
|
||||
|
||||
user.setPassword(md5Pwd);
|
||||
userService.update(user);
|
||||
|
||||
//看是否需要更新seesion中user
|
||||
// if(getUser().getId() == model.getUserID())
|
||||
// {
|
||||
// getSession().put("user", user);
|
||||
// }
|
||||
|
||||
flag = 1;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = 2;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e);
|
||||
flag = 3;
|
||||
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.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID用户
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
userService.batchDelete(model.getUserIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除用户ID为 "+ model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
String fieldName = "";
|
||||
String fieldValue = "";
|
||||
try
|
||||
{
|
||||
if(0 == model.getCheckFlag())
|
||||
{
|
||||
fieldName = "username";
|
||||
fieldValue = model.getUsername();
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldName = "loginame";
|
||||
fieldValue = model.getLoginame();
|
||||
}
|
||||
flag = userService.checkIsNameExist(fieldName,fieldValue, model.getUserID());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找用户信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Basicuser> pageUtil = new PageUtil<Basicuser>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
userService.find(pageUtil);
|
||||
List<Basicuser> 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(Basicuser user:dataList)
|
||||
{
|
||||
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", user.getId());
|
||||
item.put("username", user.getUsername());
|
||||
item.put("loginame", Tools.dealNullStr(user.getLoginame()));
|
||||
item.put("password", Tools.dealNullStr(user.getPassword()));
|
||||
item.put("position", Tools.dealNullStr(user.getPosition()));
|
||||
item.put("department", Tools.dealNullStr(user.getDepartment()));
|
||||
item.put("email", Tools.dealNullStr(user.getEmail()));
|
||||
item.put("phonenum", Tools.dealNullStr(user.getPhonenum()));
|
||||
item.put("ismanager", user.getIsmanager()== (short)0?"是":"否");
|
||||
item.put("isystem",user.getIsystem() == (short)0?"是":"否");
|
||||
item.put("status", user.getStatus());
|
||||
item.put("description", Tools.dealNullStr(user.getDescription()));
|
||||
item.put("remark",user.getRemark());
|
||||
item.put("op", user.getIsystem());
|
||||
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("username_s_like", model.getUsername());
|
||||
condition.put("loginame_s_like", model.getLoginame());
|
||||
condition.put("id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public UserModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setUserService(UserIService userService)
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,229 +1,229 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.UserBusinessModel;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class UserBusinessAction extends BaseAction<UserBusinessModel>
|
||||
{
|
||||
private UserBusinessIService userBusinessService;
|
||||
private UserBusinessModel model = new UserBusinessModel();
|
||||
|
||||
@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("KeyId_s_eq", model.getKeyId());
|
||||
condition.put("Type_s_eq", model.getType());
|
||||
userBusinessService.find(pageUtil);
|
||||
mapData.put("userBusinessList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* 测试hql语句的写法
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String getceshi()
|
||||
{
|
||||
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());
|
||||
userBusinessService.find(pageUtil,"ceshi");
|
||||
mapData.put("userBusinessList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加UserBusiness
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加UserBusiness信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setType(model.getType());
|
||||
userBusiness.setKeyId(model.getKeyId());
|
||||
userBusiness.setValue(model.getValue());
|
||||
userBusinessService.create(userBusiness);
|
||||
|
||||
//========标识位===========
|
||||
flag = true;
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "增加UserBusiness", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "增加UserBusiness为 "+ model.getType() + " " + tipMsg + "!", "增加UserBusiness" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加UserBusiness方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新UserBusiness
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
Long id=0l;
|
||||
try
|
||||
{
|
||||
PageUtil<UserBusiness> pageUtil = new PageUtil<UserBusiness>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition_RoleAPP());
|
||||
userBusinessService.find(pageUtil);
|
||||
List<UserBusiness> dataList = pageUtil.getPageList();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(UserBusiness userBusiness:dataList)
|
||||
{
|
||||
id=userBusiness.getId();
|
||||
}
|
||||
UserBusiness userBusiness = userBusinessService.get(id);
|
||||
userBusiness.setType(model.getType());
|
||||
userBusiness.setKeyId(model.getKeyId());
|
||||
userBusiness.setValue(model.getValue());
|
||||
userBusinessService.update(userBusiness);
|
||||
}
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改UserBusiness的ID为 : " + id + "信息失败", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>修改UserBusiness回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
logService.create(new Logdetails(getUser(), "更新UserBusiness", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "更新UserBusiness的ID为 "+ id + " " + tipMsg + "!", "更新UserBusiness" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-RoleAPP
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_RoleAPP()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Type_s_eq", model.getType());
|
||||
condition.put("KeyId_s_eq", model.getKeyId());
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查角色对应应用/功能是否存在
|
||||
*/
|
||||
public void checkIsValueExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsValueExist("Type",model.getType(),"KeyId", model.getKeyId());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public UserBusinessModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService)
|
||||
{
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
}
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.UserBusinessModel;
|
||||
import com.jsh.service.basic.UserBusinessIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* 权限关系管理
|
||||
* @author jishenghua qq:752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UserBusinessAction extends BaseAction<UserBusinessModel>
|
||||
{
|
||||
private UserBusinessIService userBusinessService;
|
||||
private UserBusinessModel model = new UserBusinessModel();
|
||||
|
||||
@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("KeyId_s_eq", model.getKeyId());
|
||||
condition.put("Type_s_eq", model.getType());
|
||||
userBusinessService.find(pageUtil);
|
||||
mapData.put("userBusinessList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* 测试hql语句的写法
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String getceshi()
|
||||
{
|
||||
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());
|
||||
userBusinessService.find(pageUtil,"ceshi");
|
||||
mapData.put("userBusinessList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加UserBusiness
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加UserBusiness信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setType(model.getType());
|
||||
userBusiness.setKeyId(model.getKeyId());
|
||||
userBusiness.setValue(model.getValue());
|
||||
userBusinessService.create(userBusiness);
|
||||
|
||||
//========标识位===========
|
||||
flag = true;
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "增加UserBusiness", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "增加UserBusiness为 "+ model.getType() + " " + tipMsg + "!", "增加UserBusiness" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加UserBusiness方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新UserBusiness
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
Long id=0l;
|
||||
try
|
||||
{
|
||||
PageUtil<UserBusiness> pageUtil = new PageUtil<UserBusiness>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition_RoleAPP());
|
||||
userBusinessService.find(pageUtil);
|
||||
List<UserBusiness> dataList = pageUtil.getPageList();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(UserBusiness userBusiness:dataList)
|
||||
{
|
||||
id=userBusiness.getId();
|
||||
}
|
||||
UserBusiness userBusiness = userBusinessService.get(id);
|
||||
userBusiness.setType(model.getType());
|
||||
userBusiness.setKeyId(model.getKeyId());
|
||||
userBusiness.setValue(model.getValue());
|
||||
userBusinessService.update(userBusiness);
|
||||
}
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改UserBusiness的ID为 : " + id + "信息失败", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>修改UserBusiness回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
logService.create(new Logdetails(getUser(), "更新UserBusiness", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "更新UserBusiness的ID为 "+ id + " " + tipMsg + "!", "更新UserBusiness" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-RoleAPP
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_RoleAPP()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Type_s_eq", model.getType());
|
||||
condition.put("KeyId_s_eq", model.getKeyId());
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查角色对应应用/功能是否存在
|
||||
*/
|
||||
public void checkIsValueExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsValueExist("Type",model.getType(),"KeyId", model.getKeyId());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public UserBusinessModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService)
|
||||
{
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
}
|
||||
|
||||
306
src/com/jsh/action/materials/AccountHeadAction.java
Normal file
306
src/com/jsh/action/materials/AccountHeadAction.java
Normal file
@@ -0,0 +1,306 @@
|
||||
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.Building;
|
||||
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());
|
||||
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());
|
||||
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());
|
||||
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;
|
||||
}
|
||||
}
|
||||
199
src/com/jsh/action/materials/AccountItemAction.java
Normal file
199
src/com/jsh/action/materials/AccountItemAction.java
Normal file
@@ -0,0 +1,199 @@
|
||||
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.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.AccountHeadIService;
|
||||
import com.jsh.service.materials.AccountItemIService;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
/*
|
||||
* 财务明细管理(收支|收付款|转账)
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,9 @@ 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;
|
||||
@@ -18,7 +15,7 @@ import com.jsh.model.po.Building;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.materials.BuildingModel;
|
||||
import com.jsh.service.materials.BuildingIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BuildingAction extends BaseAction<BuildingModel>
|
||||
|
||||
@@ -1,436 +1,436 @@
|
||||
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.Building;
|
||||
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.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
|
||||
@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.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));}
|
||||
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
|
||||
if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));}
|
||||
depotHead.setSettlementWay(model.getSettlementWay());
|
||||
depotHead.setRemark(model.getRemark());
|
||||
depotHead.setState("草稿");
|
||||
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.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));}
|
||||
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
|
||||
if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));}
|
||||
depotHead.setSettlementWay(model.getSettlementWay());
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @return
|
||||
*/
|
||||
public void submit()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用更新状态仓管通信息方法submit()================");
|
||||
Boolean flag = false;
|
||||
String changeId="";
|
||||
try
|
||||
{
|
||||
String DepotHeadIDs=model.getDepotHeadIDs();
|
||||
String[] DepotHeadID=DepotHeadIDs.split(",");
|
||||
for(int i=0;i<DepotHeadID.length;i++)
|
||||
{
|
||||
changeId=DepotHeadID[i].toString();
|
||||
DepotHead depotHead = depotHeadService.get(Long.parseLong(changeId));
|
||||
String state=model.getState();
|
||||
depotHead.setState(state); //状态
|
||||
String userName=state.equals("未通过")?getUser().getUsername():""; //判断状态
|
||||
depotHead.setReAuditPersonName(userName); //撤审人
|
||||
depotHead.setReason(model.getReason()); //撤审原因
|
||||
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, "更新状态-"+model.getState()+"-ID为 "+ changeId + " " + tipMsg + "!", "更新状态仓管通" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用更新状态仓管通信息方法submit()================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定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();
|
||||
|
||||
//开始拼接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(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("WareHousePersonId", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getId());
|
||||
item.put("WareHousePersonName", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getName());
|
||||
item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId());
|
||||
item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName());
|
||||
item.put("BuildingId", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getId());
|
||||
item.put("BuildingName", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getName()); //单元名称
|
||||
item.put("SettlementWay", depotHead.getSettlementWay());
|
||||
item.put("Remark", depotHead.getRemark());
|
||||
item.put("State", depotHead.getState());
|
||||
item.put("ReAuditPersonName", depotHead.getReAuditPersonName());
|
||||
item.put("Reason", depotHead.getReason());
|
||||
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("State_s_eq", model.getState());
|
||||
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;
|
||||
}
|
||||
}
|
||||
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.Building;
|
||||
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.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));}
|
||||
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
|
||||
if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));}
|
||||
depotHead.setSettlementWay(model.getSettlementWay());
|
||||
depotHead.setRemark(model.getRemark());
|
||||
depotHead.setState("草稿");
|
||||
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.getWareHousePersonId()!=null){depotHead.setWareHousePersonId(new Person(model.getWareHousePersonId()));}
|
||||
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
|
||||
if(model.getBuildingId()!=null){depotHead.setBuildingId(new Building(model.getBuildingId()));}
|
||||
depotHead.setSettlementWay(model.getSettlementWay());
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @return
|
||||
*/
|
||||
public void submit()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用更新状态仓管通信息方法submit()================");
|
||||
Boolean flag = false;
|
||||
String changeId="";
|
||||
try
|
||||
{
|
||||
String DepotHeadIDs=model.getDepotHeadIDs();
|
||||
String[] DepotHeadID=DepotHeadIDs.split(",");
|
||||
for(int i=0;i<DepotHeadID.length;i++)
|
||||
{
|
||||
changeId=DepotHeadID[i].toString();
|
||||
DepotHead depotHead = depotHeadService.get(Long.parseLong(changeId));
|
||||
String state=model.getState();
|
||||
depotHead.setState(state); //状态
|
||||
String userName=state.equals("未通过")?getUser().getUsername():""; //判断状态
|
||||
depotHead.setReAuditPersonName(userName); //撤审人
|
||||
depotHead.setReason(model.getReason()); //撤审原因
|
||||
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, "更新状态-"+model.getState()+"-ID为 "+ changeId + " " + tipMsg + "!", "更新状态仓管通" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用更新状态仓管通信息方法submit()================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定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();
|
||||
|
||||
//开始拼接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(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("WareHousePersonId", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getId());
|
||||
item.put("WareHousePersonName", depotHead.getWareHousePersonId()==null?"":depotHead.getWareHousePersonId().getName());
|
||||
item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId());
|
||||
item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName());
|
||||
item.put("BuildingId", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getId());
|
||||
item.put("BuildingName", depotHead.getBuildingId()==null?"":depotHead.getBuildingId().getName()); //单元名称
|
||||
item.put("SettlementWay", depotHead.getSettlementWay());
|
||||
item.put("Remark", depotHead.getRemark());
|
||||
item.put("State", depotHead.getState());
|
||||
item.put("ReAuditPersonName", depotHead.getReAuditPersonName());
|
||||
item.put("Reason", depotHead.getReason());
|
||||
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("State_s_eq", model.getState());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,14 @@ 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.constants.asset.AssetConstants;
|
||||
import com.jsh.exception.JshException;
|
||||
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;
|
||||
@@ -26,9 +22,12 @@ 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.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
/*
|
||||
* 单据明细管理
|
||||
* @author jishenghua qq:752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
{
|
||||
|
||||
@@ -5,12 +5,9 @@ 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;
|
||||
@@ -20,8 +17,11 @@ 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.common.PageUtil;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/*
|
||||
* 商品管理
|
||||
* @author jishenghua qq:752718920
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MaterialAction extends BaseAction<MaterialModel>
|
||||
{
|
||||
|
||||
@@ -1,275 +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.common.PageUtil;
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,273 +1,296 @@
|
||||
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.common.PageUtil;
|
||||
|
||||
@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("ProjectId_n_eq", model.getProjectId());
|
||||
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.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
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.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
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();
|
||||
|
||||
//开始拼接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(Person person:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", person.getId());
|
||||
item.put("ProjectId", person.getDepot().getId());
|
||||
item.put("ProjectName", person.getDepot().getName());
|
||||
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("ProjectId_n_eq", model.getProjectId());
|
||||
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;
|
||||
}
|
||||
}
|
||||
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("ProjectId_n_eq", model.getProjectId());
|
||||
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.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
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.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
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();
|
||||
|
||||
//开始拼接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(Person person:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", person.getId());
|
||||
item.put("ProjectId", person.getDepot().getId());
|
||||
item.put("ProjectName", person.getDepot().getName());
|
||||
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("ProjectId_n_eq", model.getProjectId());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.service.basic.LogIService;
|
||||
/**
|
||||
* struts2工具类
|
||||
* @author jishenghua
|
||||
* @author jishenghua qq752718920
|
||||
* struts2 base action 一些常用方法获取
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
@@ -8,11 +8,11 @@ import org.hibernate.Query;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
/**
|
||||
* 基础dao
|
||||
* @author ji_sheng_hua
|
||||
* @author ji_sheng_hua qq:752718920
|
||||
*/
|
||||
public class BaseDAO<T> extends HibernateDaoSupport implements BaseIDAO<T>
|
||||
{
|
||||
|
||||
@@ -6,11 +6,11 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
/**
|
||||
* 常用增删改查操作
|
||||
* @author ji-sheng-hua
|
||||
* @author ji-sheng-hua qq752718920
|
||||
* @param <T>
|
||||
*/
|
||||
public interface BaseIDAO<T>
|
||||
|
||||
@@ -1,105 +1,109 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public interface BaseIService<T>
|
||||
{
|
||||
/**
|
||||
* 增加
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Serializable create(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void save(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void delete(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id 对象ID
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void delete(Long id)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param objID ID
|
||||
* @return 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
T get(Long objID)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 修改信息
|
||||
* @param t 要修改的对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void update(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 批量删除信息
|
||||
* @param 以逗号分割的ID
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void batchDelete(String objIDs)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 查找列表
|
||||
* @param pageUtil 分页工具类
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void find(PageUtil<T> pageUtil) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查名称是否存在,页面唯一性效验使用
|
||||
* @param filedName 效验的字段名称
|
||||
* @param filedVale 校验值
|
||||
* @param idFiled ID字段名称
|
||||
* @param objectID 修改时对象ID
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsNameExist(String filedName,String filedVale,String idFiled,Long objectID) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查UserBusiness是否存在,页面唯一性效验使用
|
||||
* @param TypeName 类型名称
|
||||
* @param TypeVale 类型值
|
||||
* @param KeyIdName 关键id
|
||||
* @param KeyIdValue 关键值
|
||||
* @param UBName 关系名称
|
||||
* @param UBValue 关系值
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查UserBusiness是否存在,页面唯一性效验使用
|
||||
* @param TypeName 类型名称
|
||||
* @param TypeVale 类型值
|
||||
* @param KeyIdName 关键id
|
||||
* @param KeyIdValue 关键值
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 服务层底层接口
|
||||
* @author ji-sheng-hua qq752718920
|
||||
* @param <T>
|
||||
*/
|
||||
public interface BaseIService<T>
|
||||
{
|
||||
/**
|
||||
* 增加
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Serializable create(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void save(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param t 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void delete(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id 对象ID
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void delete(Long id)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param objID ID
|
||||
* @return 对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
T get(Long objID)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 修改信息
|
||||
* @param t 要修改的对象
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void update(T t)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 批量删除信息
|
||||
* @param 以逗号分割的ID
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void batchDelete(String objIDs)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 查找列表
|
||||
* @param pageUtil 分页工具类
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
void find(PageUtil<T> pageUtil) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查名称是否存在,页面唯一性效验使用
|
||||
* @param filedName 效验的字段名称
|
||||
* @param filedVale 校验值
|
||||
* @param idFiled ID字段名称
|
||||
* @param objectID 修改时对象ID
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsNameExist(String filedName,String filedVale,String idFiled,Long objectID) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查UserBusiness是否存在,页面唯一性效验使用
|
||||
* @param TypeName 类型名称
|
||||
* @param TypeVale 类型值
|
||||
* @param KeyIdName 关键id
|
||||
* @param KeyIdValue 关键值
|
||||
* @param UBName 关系名称
|
||||
* @param UBValue 关系值
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 检查UserBusiness是否存在,页面唯一性效验使用
|
||||
* @param TypeName 类型名称
|
||||
* @param TypeVale 类型值
|
||||
* @param KeyIdName 关键id
|
||||
* @param KeyIdValue 关键值
|
||||
* @return true==存在 false==不存在
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,14 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
import com.jsh.util.PageUtil;
|
||||
/**
|
||||
* 底层服务层
|
||||
* @author ji-sheng-hua qq752718920
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class BaseService<T> implements BaseIService<T>
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* 封装log4j日志信息,打印日志信息类
|
||||
* @author ji/sheng/hua
|
||||
* @author ji/sheng/hua qq_752718920
|
||||
* @since 2014-01-22
|
||||
*/
|
||||
public class Log
|
||||
@@ -17,7 +17,7 @@ public class Log
|
||||
/**
|
||||
* 获取Log4j实例
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger("ams");
|
||||
private static final Logger log = Logger.getLogger("jsh");
|
||||
|
||||
/**
|
||||
* Info级别日志前缀
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.jsh.constants.asset;
|
||||
|
||||
/**
|
||||
* 定义资产管理常量
|
||||
* @author jishenghua
|
||||
*/
|
||||
public interface AssetConstants
|
||||
{
|
||||
/**
|
||||
* 公共常量
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class Common
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产常量--导入导出excel表格业务相关
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class BusinessForExcel
|
||||
{
|
||||
/**
|
||||
* 资产名称常量
|
||||
*/
|
||||
public static final int EXCEL_ASSETNAME = 0;
|
||||
|
||||
/**
|
||||
* 资产类型常量
|
||||
*/
|
||||
public static final int EXCEL_CATEGORY = 1;
|
||||
|
||||
/**
|
||||
* 资产单价
|
||||
*/
|
||||
public static final int EXCEL_PRICE = 2;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
public static final int EXCEL_USER = 3;
|
||||
|
||||
/**
|
||||
* 购买日期
|
||||
*/
|
||||
public static final int EXCEL_PURCHASE_DATE = 4;
|
||||
|
||||
/**
|
||||
* 资产状态
|
||||
*/
|
||||
public static final int EXCEL_STATUS = 5;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
public static final int EXCEL_LOCATION = 6;
|
||||
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
public static final int EXCEL_NUM = 7;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
public static final int EXCEL_SERIALNO = 8;
|
||||
|
||||
/**
|
||||
* 有效日期
|
||||
*/
|
||||
public static final int EXCEL_EXPIRATION_DATE = 9;
|
||||
|
||||
/**
|
||||
* 保修日期
|
||||
*/
|
||||
public static final int EXCEL_WARRANTY_DATE = 10;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
public static final int EXCEL_SUPPLIER = 11;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
public static final int EXCEL_LABLE = 12;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public static final int EXCEL_DESC = 13;
|
||||
|
||||
/**
|
||||
* 表头
|
||||
*/
|
||||
public static final int EXCEL_TABLE_HEAD = 0;
|
||||
|
||||
/**
|
||||
* 状态 --在库
|
||||
*/
|
||||
public static final int EXCEl_STATUS_ZAIKU = 0;
|
||||
|
||||
/**
|
||||
* 状态 --在用
|
||||
*/
|
||||
public static final int EXCEl_STATUS_INUSE = 1;
|
||||
|
||||
/**
|
||||
* 状态 -- 消费
|
||||
*/
|
||||
public static final int EXCEl_STATUS_CONSUME = 2;
|
||||
|
||||
/**
|
||||
* action返回excel结果
|
||||
*/
|
||||
public static final String EXCEL = "excel";
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.jsh.constants.asset;
|
||||
|
||||
public interface ExcelConstantsCode
|
||||
{
|
||||
/**
|
||||
* 导入excel表格常量定义
|
||||
*/
|
||||
public class ImportExcelCode
|
||||
{
|
||||
/**
|
||||
* 表格正确
|
||||
*/
|
||||
public static final String RIGHT = "right";
|
||||
|
||||
/**
|
||||
* 表格错误
|
||||
*/
|
||||
public static final String WRONG = "wrong";
|
||||
|
||||
/**
|
||||
* 表格警告
|
||||
*/
|
||||
public static final String WARN = "warn";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel表格常量定义
|
||||
* @author angel
|
||||
*
|
||||
*/
|
||||
public class ExportExcelCode
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.jsh.constants.common;
|
||||
|
||||
public interface AmsConstants
|
||||
{
|
||||
/**
|
||||
* 定义资产管理公共常量
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class Common
|
||||
{
|
||||
/**
|
||||
* Info级别日志前缀
|
||||
*/
|
||||
public static final String LOG_INFO_PREFIX = "==========";
|
||||
|
||||
/**
|
||||
* error级别日志前缀
|
||||
*/
|
||||
public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>";
|
||||
|
||||
/**
|
||||
* debug级别日志前缀
|
||||
*/
|
||||
public static final String LOG_DEBUG_PREFIX = "-----------";
|
||||
|
||||
/**
|
||||
* fatal级别日志前缀
|
||||
*/
|
||||
public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$";
|
||||
|
||||
/**
|
||||
* warn级别日志前缀
|
||||
*/
|
||||
public static final String LOG_WARN_PREFIX = "##########";
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.jsh.constants.common;
|
||||
|
||||
public interface ExceptionCodeConstants
|
||||
{
|
||||
/**
|
||||
* 用户错误码定义
|
||||
*/
|
||||
public class UserExceptionCode
|
||||
{
|
||||
/**
|
||||
* 用户不存在
|
||||
*/
|
||||
public static final int USER_NOT_EXIST = 1;
|
||||
|
||||
/**
|
||||
* 用户密码错误
|
||||
*/
|
||||
public static final int USER_PASSWORD_ERROR = 2;
|
||||
|
||||
/**
|
||||
* 被加入黑名单
|
||||
*/
|
||||
public static final int BLACK_USER = 3;
|
||||
|
||||
/**
|
||||
* 可以登录
|
||||
*/
|
||||
public static final int USER_CONDITION_FIT = 4;
|
||||
|
||||
/**
|
||||
* 访问数据库异常
|
||||
*/
|
||||
public static final int USER_ACCESS_EXCEPTION = 5;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.jsh.constants.common;
|
||||
|
||||
public interface LogModuleConstants
|
||||
{
|
||||
/**
|
||||
* 系统管理模块名称定义
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class ManageModuleNameCode
|
||||
{
|
||||
/**
|
||||
* 管理模块资产名称
|
||||
*/
|
||||
public static final String MODULE_MANAGE_ASSETNAME = "资产名称";
|
||||
|
||||
/**
|
||||
* 管理模块供应商
|
||||
*/
|
||||
public static final String MODULE_MANAGE_SUPPLIER = "供应商";
|
||||
|
||||
/**
|
||||
* 管理模块资产类型
|
||||
*/
|
||||
public static final String MODULE_MANAGE_CATEGORY = "资产类型";
|
||||
|
||||
/**
|
||||
* 管理模块用户管理
|
||||
*/
|
||||
public static final String MODULE_MANAGE_USER = "用户管理";
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产管理模块名称定义
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class AssetModuleNameCode
|
||||
{
|
||||
/**
|
||||
* 资产管理模块资产管理
|
||||
*/
|
||||
public static final String MODULE_ASSET_MANAGE = "资产管理";
|
||||
|
||||
/**
|
||||
* 资产管理模块资产报表
|
||||
*/
|
||||
public static final String MODULE_ASSET_REPORT = "资产报表";
|
||||
|
||||
/**
|
||||
* 资产管理模块资产概况
|
||||
*/
|
||||
public static final String MODULE_ASSET_GENERAL = "资产概况";
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志管理模块名称定义
|
||||
* @author jishenghua
|
||||
*/
|
||||
public class LogModuleNameCode
|
||||
{
|
||||
/**
|
||||
* 日志管理模块日志管理
|
||||
*/
|
||||
public static final String MODULE_LOG_MANAGE = "日志管理";
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package com.jsh.dao.asset;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class ReportDAO extends HibernateDaoSupport implements ReportIDAO
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.jsh.dao.asset;
|
||||
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface ReportIDAO
|
||||
{
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.jsh.dao.basic;
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class UserBusinessDAO extends BaseDAO<UserBusiness> implements UserBusinessIDAO
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface UserBusinessIDAO extends BaseIDAO<UserBusiness>
|
||||
{
|
||||
|
||||
32
src/com/jsh/dao/materials/AccountHeadDAO.java
Normal file
32
src/com/jsh/dao/materials/AccountHeadDAO.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
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.UserBusiness;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<AccountHead> getEntityClass()
|
||||
{
|
||||
return AccountHead.class;
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
15
src/com/jsh/dao/materials/AccountHeadIDAO.java
Normal file
15
src/com/jsh/dao/materials/AccountHeadIDAO.java
Normal file
@@ -0,0 +1,15 @@
|
||||
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.UserBusiness;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountHeadIDAO extends BaseIDAO<AccountHead>
|
||||
{
|
||||
/*
|
||||
* 获取MaxId
|
||||
*/
|
||||
void find(PageUtil<AccountHead> pageUtil,String maxid) throws JshException;
|
||||
}
|
||||
22
src/com/jsh/dao/materials/AccountItemDAO.java
Normal file
22
src/com/jsh/dao/materials/AccountItemDAO.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.AccountItem;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class AccountItemDAO extends BaseDAO<AccountItem> implements AccountItemIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<AccountItem> getEntityClass()
|
||||
{
|
||||
return AccountItem.class;
|
||||
}
|
||||
}
|
||||
12
src/com/jsh/dao/materials/AccountItemIDAO.java
Normal file
12
src/com/jsh/dao/materials/AccountItemIDAO.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.AccountItem;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountItemIDAO extends BaseIDAO<AccountItem>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.jsh.dao.materials;
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
|
||||
{
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.jsh.dao.materials;
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
|
||||
public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
|
||||
{
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.jsh.exception;
|
||||
|
||||
/**
|
||||
* @title: 平台异常基类
|
||||
* @description: 用于包装一些异常信息,打印日志等服务
|
||||
* @author jishenghua
|
||||
* @since: 2014-01-24
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JshException extends Exception
|
||||
{
|
||||
public long errorCode = -1;
|
||||
|
||||
public String message ;
|
||||
|
||||
public JshException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public JshException(String message)
|
||||
{
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public JshException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public JshException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public JshException(long errorCode)
|
||||
{
|
||||
super();
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public JshException(String message, long errorCode)
|
||||
{
|
||||
super(message);
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public JshException(String message, long errorCode, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public JshException(long errorCode, Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public long getErrorCode()
|
||||
{
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.jsh.filter.common;
|
||||
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;
|
||||
|
||||
public class OpenSessionInViewFilterExtend extends OpenSessionInViewFilter
|
||||
{
|
||||
@Override
|
||||
protected Session getSession(SessionFactory sessionFactory)
|
||||
throws DataAccessResourceFailureException
|
||||
{
|
||||
this.setFlushMode(FlushMode.AUTO);
|
||||
return super.getSession(sessionFactory);
|
||||
}
|
||||
@Override
|
||||
protected void closeSession(Session session, SessionFactory sessionFactory)
|
||||
{
|
||||
session.flush();
|
||||
super.closeSession(session, sessionFactory);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.jsh.filter.user;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
/**
|
||||
* 用户登录session处理类
|
||||
* 过滤session是否超时
|
||||
* @author jishenghua
|
||||
* @version [版本号, 2012-3-6]
|
||||
* @see [相关类/方法]
|
||||
* @since
|
||||
*/
|
||||
public class UserFilter implements Filter
|
||||
{
|
||||
/**
|
||||
* 初始化过滤器 暂不处理
|
||||
* 重载方法
|
||||
* @param arg0
|
||||
* @throws ServletException
|
||||
*/
|
||||
|
||||
public void init(FilterConfig arg0)
|
||||
throws ServletException
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* 判断用户session是否存在 不存在则跳转到登录页面
|
||||
* 重载方法
|
||||
* @param srequest
|
||||
* @param sresponse
|
||||
* @param chain
|
||||
* @throws IOException
|
||||
* @throws ServletException
|
||||
*/
|
||||
public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
HttpServletRequest request = (HttpServletRequest) srequest;
|
||||
HttpServletResponse response = (HttpServletResponse) sresponse;
|
||||
HttpSession session = request.getSession();
|
||||
// //定义登录页面不被过滤===后续考虑
|
||||
// List<String> notFilterFile = new ArrayList<String>();
|
||||
// notFilterFile.add("/login.jsp");
|
||||
// notFilterFile.add("/logout.jsp");
|
||||
// notFilterFile.add("/css/*");
|
||||
// notFilterFile.add("/css/zTreeStyle/*");
|
||||
// notFilterFile.add("/css/zTreeStyle/img/*");
|
||||
// notFilterFile.add("/css/zTreeStyle/img/diy/*");
|
||||
|
||||
//获取工程路径
|
||||
String path = request.getContextPath();
|
||||
String requestURl = request.getRequestURI();
|
||||
|
||||
//提示用户没有权限操作
|
||||
// response.setCharacterEncoding("utf-8");
|
||||
// PrintWriter pw=response.getWriter();
|
||||
// pw.write("<script language='javascript'>alert('您没有权限进行此项操作!')</script>");
|
||||
//session中有值则不进行处理
|
||||
if(requestURl.contains("/pages") &&null != session.getAttribute("user"))
|
||||
chain.doFilter(request, response);
|
||||
else
|
||||
response.sendRedirect(path + "/logout.jsp");
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁过滤器
|
||||
*/
|
||||
public void destroy()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
51
src/com/jsh/model/po/AccountHead.hbm.xml
Normal file
51
src/com/jsh/model/po/AccountHead.hbm.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping>
|
||||
<class name="com.jsh.model.po.AccountHead" table="jsh_accounthead">
|
||||
<id name="Id" type="java.lang.Long">
|
||||
<column name="Id"/>
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<property generated="never" lazy="false" name="Type" type="java.lang.String">
|
||||
<column length="50" name="Type">
|
||||
<comment>类型(支出/收入/收款/付款/转账)</comment>
|
||||
</column>
|
||||
</property>
|
||||
<many-to-one name="OrganId" class="com.jsh.model.po.Supplier" lazy="false">
|
||||
<column name="OrganId">
|
||||
<comment>单位Id(收款/付款单位)</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<many-to-one name="HandsPersonId" class="com.jsh.model.po.Person" lazy="false">
|
||||
<column name="HandsPersonId">
|
||||
<comment>经手人Id</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<property generated="never" lazy="false" name="ChangeAmount" type="java.lang.Double">
|
||||
<column name="ChangeAmount" precision="22" scale="3">
|
||||
<comment>变动金额(优惠/收款/付款/实付)</comment>
|
||||
</column>
|
||||
</property>
|
||||
<many-to-one name="AccountId" class="com.jsh.model.po.Account" lazy="false">
|
||||
<column name="AccountId">
|
||||
<comment>账户(收款/付款)</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<property generated="never" lazy="false" name="BillNo" type="java.lang.String">
|
||||
<column length="50" name="BillNo">
|
||||
<comment>单据编号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="BillTime" type="java.sql.Timestamp">
|
||||
<column length="19" name="BillTime">
|
||||
<comment>单据日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Remark" type="java.lang.String">
|
||||
<column length="100" name="Remark">
|
||||
<comment>备注</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
133
src/com/jsh/model/po/AccountHead.java
Normal file
133
src/com/jsh/model/po/AccountHead.java
Normal file
@@ -0,0 +1,133 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountHead implements java.io.Serializable
|
||||
{
|
||||
private Long Id;
|
||||
private String Type;
|
||||
private Supplier OrganId;
|
||||
private Person HandsPersonId;
|
||||
private Double ChangeAmount;
|
||||
private Account AccountId;
|
||||
private String BillNo;
|
||||
private Timestamp BillTime;
|
||||
private String Remark;
|
||||
|
||||
public AccountHead()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AccountHead(Long Id)
|
||||
{
|
||||
this.Id = Id ;
|
||||
}
|
||||
|
||||
public AccountHead(String type, Supplier organId,
|
||||
Person handsPersonId, Double changeAmount, Account accountId,
|
||||
String billNo, Timestamp billTime, String remark)
|
||||
{
|
||||
super();
|
||||
Type = type;
|
||||
OrganId = organId;
|
||||
HandsPersonId = handsPersonId;
|
||||
ChangeAmount = changeAmount;
|
||||
AccountId = accountId;
|
||||
BillNo = billNo;
|
||||
BillTime = billTime;
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
|
||||
public void setOrganId(Supplier organId)
|
||||
{
|
||||
OrganId = organId;
|
||||
}
|
||||
|
||||
public Supplier getOrganId()
|
||||
{
|
||||
return OrganId;
|
||||
}
|
||||
|
||||
public void setHandsPersonId(Person handsPersonId)
|
||||
{
|
||||
HandsPersonId = handsPersonId;
|
||||
}
|
||||
|
||||
public Person getHandsPersonId()
|
||||
{
|
||||
return HandsPersonId;
|
||||
}
|
||||
|
||||
public void setChangeAmount(Double changeAmount)
|
||||
{
|
||||
ChangeAmount = changeAmount;
|
||||
}
|
||||
|
||||
public Double getChangeAmount()
|
||||
{
|
||||
return ChangeAmount;
|
||||
}
|
||||
|
||||
public void setAccountId(Account accountId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
}
|
||||
|
||||
public Account getAccountId()
|
||||
{
|
||||
return AccountId;
|
||||
}
|
||||
|
||||
public void setBillNo(String billNo)
|
||||
{
|
||||
BillNo = billNo;
|
||||
}
|
||||
|
||||
public String getBillNo()
|
||||
{
|
||||
return BillNo;
|
||||
}
|
||||
|
||||
public void setBillTime(Timestamp billTime)
|
||||
{
|
||||
BillTime = billTime;
|
||||
}
|
||||
|
||||
public Timestamp getBillTime()
|
||||
{
|
||||
return BillTime;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return Remark;
|
||||
}
|
||||
|
||||
}
|
||||
36
src/com/jsh/model/po/AccountItem.hbm.xml
Normal file
36
src/com/jsh/model/po/AccountItem.hbm.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping>
|
||||
<class name="com.jsh.model.po.AccountItem" table="jsh_accountitem">
|
||||
<id name="Id" type="java.lang.Long">
|
||||
<column name="Id"/>
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<many-to-one name="HeaderId" class="com.jsh.model.po.AccountHead" lazy="false">
|
||||
<column name="HeaderId" not-null="true">
|
||||
<comment>表头Id</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<many-to-one name="AccountId" class="com.jsh.model.po.Account" lazy="false">
|
||||
<column name="AccountId">
|
||||
<comment>账户Id</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<many-to-one name="InOutItemId" class="com.jsh.model.po.InOutItem" lazy="false">
|
||||
<column name="InOutItemId">
|
||||
<comment>收支项目Id</comment>
|
||||
</column>
|
||||
</many-to-one>
|
||||
<property generated="never" lazy="false" name="EachAmount" type="java.lang.Double">
|
||||
<column name="EachAmount" precision="22" scale="3">
|
||||
<comment>单项金额</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Remark" type="java.lang.String">
|
||||
<column length="100" name="Remark">
|
||||
<comment>单据备注</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
94
src/com/jsh/model/po/AccountItem.java
Normal file
94
src/com/jsh/model/po/AccountItem.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountItem implements java.io.Serializable
|
||||
{
|
||||
private Long Id;
|
||||
private AccountHead HeaderId;
|
||||
private Account AccountId;
|
||||
private InOutItem InOutItemId;
|
||||
private Double EachAmount;
|
||||
private String Remark;
|
||||
|
||||
public AccountItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AccountItem(Long Id)
|
||||
{
|
||||
this.Id = Id ;
|
||||
}
|
||||
|
||||
public AccountItem(AccountHead headerId, Account accountId,
|
||||
InOutItem inOutItemId, Double eachAmount, String remark)
|
||||
{
|
||||
super();
|
||||
HeaderId = headerId;
|
||||
AccountId = accountId;
|
||||
InOutItemId = inOutItemId;
|
||||
EachAmount = eachAmount;
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setHeaderId(AccountHead headerId)
|
||||
{
|
||||
HeaderId = headerId;
|
||||
}
|
||||
|
||||
public AccountHead getHeaderId()
|
||||
{
|
||||
return HeaderId;
|
||||
}
|
||||
|
||||
public void setAccountId(Account accountId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
}
|
||||
|
||||
public Account getAccountId()
|
||||
{
|
||||
return AccountId;
|
||||
}
|
||||
|
||||
public void setInOutItemId(InOutItem inOutItemId)
|
||||
{
|
||||
InOutItemId = inOutItemId;
|
||||
}
|
||||
|
||||
public InOutItem getInOutItemId()
|
||||
{
|
||||
return InOutItemId;
|
||||
}
|
||||
|
||||
public void setEachAmount(Double eachAmount)
|
||||
{
|
||||
EachAmount = eachAmount;
|
||||
}
|
||||
|
||||
public Double getEachAmount()
|
||||
{
|
||||
return EachAmount;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return Remark;
|
||||
}
|
||||
|
||||
}
|
||||
216
src/com/jsh/model/vo/materials/AccountHeadModel.java
Normal file
216
src/com/jsh/model/vo/materials/AccountHeadModel.java
Normal file
@@ -0,0 +1,216 @@
|
||||
package com.jsh.model.vo.materials;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountHeadModel implements Serializable
|
||||
{
|
||||
private AccountHeadShowModel showModel = new AccountHeadShowModel();
|
||||
|
||||
/**======开始接受页面参数=================**/
|
||||
private String Type;
|
||||
private Long OrganId;
|
||||
private Long HandsPersonId;
|
||||
private Double ChangeAmount;
|
||||
private Long AccountId;
|
||||
private String BillNo;
|
||||
private String BillTime;
|
||||
private String Remark;
|
||||
private String BeginTime; //查询开始时间
|
||||
private String EndTime; //查询结束时间
|
||||
private String MonthTime; //查询月份
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long accountHeadID = 0l;
|
||||
|
||||
/**
|
||||
* 分类IDs 批量操作使用
|
||||
*/
|
||||
private String accountHeadIDs = "";
|
||||
|
||||
/**
|
||||
* 每页显示的个数
|
||||
*/
|
||||
private int pageSize = 10;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private int pageNo = 1;
|
||||
|
||||
/**
|
||||
* 用户IP,用户记录操作日志
|
||||
*/
|
||||
private String clientIp = "";
|
||||
|
||||
public void setShowModel(AccountHeadShowModel showModel)
|
||||
{
|
||||
this.showModel = showModel;
|
||||
}
|
||||
|
||||
public AccountHeadShowModel getShowModel()
|
||||
{
|
||||
return showModel;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
|
||||
public void setOrganId(Long organId)
|
||||
{
|
||||
OrganId = organId;
|
||||
}
|
||||
|
||||
public Long getOrganId()
|
||||
{
|
||||
return OrganId;
|
||||
}
|
||||
|
||||
public void setHandsPersonId(Long handsPersonId)
|
||||
{
|
||||
HandsPersonId = handsPersonId;
|
||||
}
|
||||
|
||||
public Long getHandsPersonId()
|
||||
{
|
||||
return HandsPersonId;
|
||||
}
|
||||
|
||||
public void setChangeAmount(Double changeAmount)
|
||||
{
|
||||
ChangeAmount = changeAmount;
|
||||
}
|
||||
|
||||
public Double getChangeAmount()
|
||||
{
|
||||
return ChangeAmount;
|
||||
}
|
||||
|
||||
public void setAccountId(Long accountId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
}
|
||||
|
||||
public Long getAccountId()
|
||||
{
|
||||
return AccountId;
|
||||
}
|
||||
|
||||
public void setBillNo(String billNo)
|
||||
{
|
||||
BillNo = billNo;
|
||||
}
|
||||
|
||||
public String getBillNo()
|
||||
{
|
||||
return BillNo;
|
||||
}
|
||||
|
||||
public void setBillTime(String billTime)
|
||||
{
|
||||
BillTime = billTime;
|
||||
}
|
||||
|
||||
public String getBillTime()
|
||||
{
|
||||
return BillTime;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return Remark;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime)
|
||||
{
|
||||
BeginTime = beginTime;
|
||||
}
|
||||
|
||||
public String getBeginTime()
|
||||
{
|
||||
return BeginTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime)
|
||||
{
|
||||
EndTime = endTime;
|
||||
}
|
||||
|
||||
public String getEndTime()
|
||||
{
|
||||
return EndTime;
|
||||
}
|
||||
|
||||
public void setMonthTime(String monthTime)
|
||||
{
|
||||
MonthTime = monthTime;
|
||||
}
|
||||
|
||||
public String getMonthTime()
|
||||
{
|
||||
return MonthTime;
|
||||
}
|
||||
|
||||
public void setAccountHeadID(Long accountHeadID)
|
||||
{
|
||||
this.accountHeadID = accountHeadID;
|
||||
}
|
||||
|
||||
public Long getAccountHeadID()
|
||||
{
|
||||
return accountHeadID;
|
||||
}
|
||||
|
||||
public void setAccountHeadIDs(String accountHeadIDs)
|
||||
{
|
||||
this.accountHeadIDs = accountHeadIDs;
|
||||
}
|
||||
|
||||
public String getAccountHeadIDs()
|
||||
{
|
||||
return accountHeadIDs;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize)
|
||||
{
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageSize()
|
||||
{
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageNo(int pageNo)
|
||||
{
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
|
||||
public int getPageNo()
|
||||
{
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
|
||||
public void setClientIp(String clientIp)
|
||||
{
|
||||
this.clientIp = clientIp;
|
||||
}
|
||||
|
||||
public String getClientIp()
|
||||
{
|
||||
return clientIp;
|
||||
}}
|
||||
42
src/com/jsh/model/vo/materials/AccountHeadShowModel.java
Normal file
42
src/com/jsh/model/vo/materials/AccountHeadShowModel.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.jsh.model.vo.materials;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountHeadShowModel implements Serializable
|
||||
{
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
private String msgTip = "";
|
||||
|
||||
/**
|
||||
* 系统数据
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Map<String,List> map = new HashMap<String,List>();
|
||||
|
||||
public String getMsgTip()
|
||||
{
|
||||
return msgTip;
|
||||
}
|
||||
|
||||
public void setMsgTip(String msgTip)
|
||||
{
|
||||
this.msgTip = msgTip;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Map<String, List> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setMap(Map<String, List> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
}
|
||||
251
src/com/jsh/model/vo/materials/AccountItemModel.java
Normal file
251
src/com/jsh/model/vo/materials/AccountItemModel.java
Normal file
@@ -0,0 +1,251 @@
|
||||
package com.jsh.model.vo.materials;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountItemModel implements Serializable
|
||||
{
|
||||
private AccountItemShowModel showModel = new AccountItemShowModel();
|
||||
|
||||
/**======开始接受页面参数=================**/
|
||||
private Long HeaderId;
|
||||
private Long AccountId;
|
||||
private Long InOutItemId;
|
||||
private Double EachAmount;
|
||||
private String Remark = "";
|
||||
|
||||
private String Inserted = ""; //json插入记录
|
||||
private String Deleted = ""; //json删除记录
|
||||
private String Updated = ""; //json修改记录
|
||||
|
||||
private String HeadIds = ""; //表头集合列表
|
||||
private String MonthTime = ""; //月份
|
||||
private String browserType = "";
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName = "";
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long accountItemID = 0l;
|
||||
|
||||
/**
|
||||
* 分类IDs 批量操作使用
|
||||
*/
|
||||
private String accountItemIDs = "";
|
||||
|
||||
/**
|
||||
* 每页显示的个数
|
||||
*/
|
||||
private int pageSize = 800;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private int pageNo = 1;
|
||||
|
||||
/**
|
||||
* 用户IP,用户记录操作日志
|
||||
*/
|
||||
private String clientIp = "";
|
||||
|
||||
|
||||
/**
|
||||
* 输入流,导出excel文件
|
||||
*/
|
||||
private InputStream excelStream;
|
||||
|
||||
public void setShowModel(AccountItemShowModel showModel)
|
||||
{
|
||||
this.showModel = showModel;
|
||||
}
|
||||
|
||||
public AccountItemShowModel getShowModel()
|
||||
{
|
||||
return showModel;
|
||||
}
|
||||
|
||||
public void setHeaderId(Long headerId)
|
||||
{
|
||||
HeaderId = headerId;
|
||||
}
|
||||
|
||||
public Long getHeaderId()
|
||||
{
|
||||
return HeaderId;
|
||||
}
|
||||
|
||||
public void setAccountId(Long accountId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
}
|
||||
|
||||
public Long getAccountId()
|
||||
{
|
||||
return AccountId;
|
||||
}
|
||||
|
||||
public void setInOutItemId(Long inOutItemId)
|
||||
{
|
||||
InOutItemId = inOutItemId;
|
||||
}
|
||||
|
||||
public Long getInOutItemId()
|
||||
{
|
||||
return InOutItemId;
|
||||
}
|
||||
|
||||
public void setEachAmount(Double eachAmount)
|
||||
{
|
||||
EachAmount = eachAmount;
|
||||
}
|
||||
|
||||
public Double getEachAmount()
|
||||
{
|
||||
return EachAmount;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return Remark;
|
||||
}
|
||||
|
||||
public void setInserted(String inserted)
|
||||
{
|
||||
Inserted = inserted;
|
||||
}
|
||||
|
||||
public String getInserted()
|
||||
{
|
||||
return Inserted;
|
||||
}
|
||||
|
||||
public void setDeleted(String deleted)
|
||||
{
|
||||
Deleted = deleted;
|
||||
}
|
||||
|
||||
public String getDeleted()
|
||||
{
|
||||
return Deleted;
|
||||
}
|
||||
|
||||
public void setUpdated(String updated)
|
||||
{
|
||||
Updated = updated;
|
||||
}
|
||||
|
||||
public String getUpdated()
|
||||
{
|
||||
return Updated;
|
||||
}
|
||||
|
||||
public void setHeadIds(String headIds)
|
||||
{
|
||||
HeadIds = headIds;
|
||||
}
|
||||
|
||||
public String getHeadIds()
|
||||
{
|
||||
return HeadIds;
|
||||
}
|
||||
|
||||
public void setMonthTime(String monthTime)
|
||||
{
|
||||
MonthTime = monthTime;
|
||||
}
|
||||
|
||||
public String getMonthTime()
|
||||
{
|
||||
return MonthTime;
|
||||
}
|
||||
|
||||
public void setBrowserType(String browserType)
|
||||
{
|
||||
this.browserType = browserType;
|
||||
}
|
||||
|
||||
public String getBrowserType()
|
||||
{
|
||||
return browserType;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setAccountItemID(Long accountItemID)
|
||||
{
|
||||
this.accountItemID = accountItemID;
|
||||
}
|
||||
|
||||
public Long getAccountItemID()
|
||||
{
|
||||
return accountItemID;
|
||||
}
|
||||
|
||||
public void setAccountItemIDs(String accountItemIDs)
|
||||
{
|
||||
this.accountItemIDs = accountItemIDs;
|
||||
}
|
||||
|
||||
public String getAccountItemIDs()
|
||||
{
|
||||
return accountItemIDs;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize)
|
||||
{
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageSize()
|
||||
{
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageNo(int pageNo)
|
||||
{
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
|
||||
public int getPageNo()
|
||||
{
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public void setClientIp(String clientIp)
|
||||
{
|
||||
this.clientIp = clientIp;
|
||||
}
|
||||
|
||||
public String getClientIp()
|
||||
{
|
||||
return clientIp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setExcelStream(InputStream excelStream)
|
||||
{
|
||||
this.excelStream = excelStream;
|
||||
}
|
||||
|
||||
public InputStream getExcelStream()
|
||||
{
|
||||
return excelStream;
|
||||
}
|
||||
}
|
||||
22
src/com/jsh/model/vo/materials/AccountItemShowModel.java
Normal file
22
src/com/jsh/model/vo/materials/AccountItemShowModel.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.jsh.model.vo.materials;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountItemShowModel implements Serializable
|
||||
{
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
private String msgTip = "";
|
||||
|
||||
public String getMsgTip()
|
||||
{
|
||||
return msgTip;
|
||||
}
|
||||
|
||||
public void setMsgTip(String msgTip)
|
||||
{
|
||||
this.msgTip = msgTip;
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AssetIService extends BaseIService<Asset>
|
||||
{
|
||||
|
||||
@@ -33,19 +33,19 @@ import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.constants.asset.AssetConstants;
|
||||
import com.jsh.util.AssetConstants;
|
||||
import com.jsh.dao.asset.AssetIDAO;
|
||||
import com.jsh.dao.basic.AssetNameIDAO;
|
||||
import com.jsh.dao.basic.CategoryIDAO;
|
||||
import com.jsh.dao.basic.SupplierIDAO;
|
||||
import com.jsh.dao.basic.UserIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.Assetname;
|
||||
import com.jsh.model.po.Category;
|
||||
import com.jsh.model.po.Supplier;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
|
||||
public class AssetService extends BaseService<Asset> implements AssetIService
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.jsh.service.asset;
|
||||
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface ReportIService
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jsh.service.asset;
|
||||
|
||||
import com.jsh.dao.asset.ReportIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class ReportService implements ReportIService
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.jsh.service.basic;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
|
||||
public interface LogIService extends BaseIService<Logdetails>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jsh.service.basic;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface UserBusinessIService extends BaseIService<UserBusiness>
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.jsh.service.basic;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.dao.basic.UserBusinessIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class UserBusinessService extends BaseService<UserBusiness> implements UserBusinessIService
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.jsh.service.basic;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
|
||||
public interface UserIService extends BaseIService<Basicuser>
|
||||
|
||||
@@ -6,12 +6,12 @@ import java.util.Map;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.constants.common.ExceptionCodeConstants;
|
||||
import com.jsh.util.ExceptionCodeConstants;
|
||||
import com.jsh.dao.basic.UserBusinessIDAO;
|
||||
import com.jsh.dao.basic.UserIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class UserService extends BaseService<Basicuser> implements UserIService
|
||||
{
|
||||
|
||||
15
src/com/jsh/service/materials/AccountHeadIService.java
Normal file
15
src/com/jsh/service/materials/AccountHeadIService.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.jsh.service.materials;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.AccountHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountHeadIService extends BaseIService<AccountHead>
|
||||
{
|
||||
/*
|
||||
* 获取MaxId
|
||||
*/
|
||||
void find(PageUtil<AccountHead> accountHead,String maxid)throws JshException;
|
||||
}
|
||||
32
src/com/jsh/service/materials/AccountHeadService.java
Normal file
32
src/com/jsh/service/materials/AccountHeadService.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.jsh.service.materials;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.dao.materials.AccountHeadIDAO;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.AccountHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class AccountHeadService extends BaseService<AccountHead> implements AccountHeadIService
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
private AccountHeadIDAO accountHeadDao;
|
||||
|
||||
|
||||
public void setAccountHeadDao(AccountHeadIDAO accountHeadDao) {
|
||||
this.accountHeadDao = accountHeadDao;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Class<AccountHead> getEntityClass()
|
||||
{
|
||||
return AccountHead.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void find(PageUtil<AccountHead> pageUtil, String maxid) throws JshException
|
||||
{
|
||||
accountHeadDao.find(pageUtil, maxid);
|
||||
}
|
||||
}
|
||||
18
src/com/jsh/service/materials/AccountItemIService.java
Normal file
18
src/com/jsh/service/materials/AccountItemIService.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.jsh.service.materials;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.AccountHead;
|
||||
import com.jsh.model.po.AccountItem;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountItemIService extends BaseIService<AccountItem>
|
||||
{
|
||||
|
||||
}
|
||||
38
src/com/jsh/service/materials/AccountItemService.java
Normal file
38
src/com/jsh/service/materials/AccountItemService.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.jsh.service.materials;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.util.AssetConstants;
|
||||
import com.jsh.dao.materials.AccountItemIDAO;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.AccountHead;
|
||||
import com.jsh.model.po.AccountItem;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
|
||||
public class AccountItemService extends BaseService<AccountItem> implements AccountItemIService
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
private AccountItemIDAO accoumtItemDao;
|
||||
|
||||
|
||||
public void setAccountItemDao(AccountItemIDAO accoumtItemDao) {
|
||||
this.accoumtItemDao = accoumtItemDao;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Class<AccountItem> getEntityClass()
|
||||
{
|
||||
return AccountItem.class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.jsh.service.materials;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface DepotHeadIService extends BaseIService<DepotHead>
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.jsh.service.materials;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.dao.materials.DepotHeadIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class DepotHeadService extends BaseService<DepotHead> implements DepotHeadIService
|
||||
{
|
||||
|
||||
@@ -6,11 +6,11 @@ import java.util.List;
|
||||
import net.sf.json.JSONArray;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.exception.JshException;
|
||||
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.util.common.PageUtil;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface DepotItemIService extends BaseIService<DepotItem>
|
||||
{
|
||||
|
||||
@@ -18,14 +18,14 @@ import jxl.write.WritableWorkbook;
|
||||
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.constants.asset.AssetConstants;
|
||||
import com.jsh.util.AssetConstants;
|
||||
import com.jsh.dao.materials.DepotItemIDAO;
|
||||
import com.jsh.exception.JshException;
|
||||
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.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.Tools;
|
||||
|
||||
public class DepotItemService extends BaseService<DepotItem> implements DepotItemIService
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user