初始化项目2
This commit is contained in:
parent
238bdf9c10
commit
f01f4f210f
517
src/com/jsh/action/asset/AssetAction.java
Normal file
517
src/com/jsh/action/asset/AssetAction.java
Normal file
@ -0,0 +1,517 @@
|
||||
package com.jsh.action.asset;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.util.Calendar;
|
||||
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.constants.asset.AssetConstants;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.Assetname;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.po.Supplier;
|
||||
import com.jsh.model.vo.asset.AssetModel;
|
||||
import com.jsh.service.asset.AssetIService;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AssetAction extends BaseAction<AssetModel>
|
||||
{
|
||||
private AssetModel model = new AssetModel();
|
||||
private AssetIService assetService;
|
||||
private CategoryIService categoryService;
|
||||
private SupplierIService supplierService;
|
||||
private UserIService userService;
|
||||
private AssetNameIService assetnameService;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String getBasicData()
|
||||
{
|
||||
Map<String,List> mapData = model.getShowModel().getMap();
|
||||
PageUtil pageUtil = new PageUtil();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
try
|
||||
{
|
||||
Map<String,Object> condition = pageUtil.getAdvSearch();
|
||||
condition.put("id_s_order", "desc");
|
||||
categoryService.find(pageUtil);
|
||||
mapData.put("categoryList", pageUtil.getPageList());
|
||||
supplierService.find(pageUtil);
|
||||
mapData.put("supplierList", pageUtil.getPageList());
|
||||
|
||||
condition.put("isystem_n_eq", 1);
|
||||
condition.put("id_s_order", "desc");
|
||||
userService.find(pageUtil);
|
||||
mapData.put("userList", pageUtil.getPageList());
|
||||
|
||||
//清除搜索条件 防止对查询有影响
|
||||
condition.remove("isystem_n_eq");
|
||||
|
||||
assetnameService.find(pageUtil);
|
||||
mapData.put("assetnameList", pageUtil.getPageList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
||||
model.getShowModel().setMsgTip("exceptoin");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加资产
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加资产方法===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Asset asset = new Asset();
|
||||
//添加设置
|
||||
asset.setAssetname(new Assetname(model.getAssetNameID()));
|
||||
|
||||
asset.setLocation(model.getLocation());
|
||||
asset.setStatus(model.getStatus());
|
||||
asset.setPrice(model.getPrice());
|
||||
|
||||
if(null != model.getUserID())
|
||||
{
|
||||
asset.setUser( new Basicuser(model.getUserID()));
|
||||
}
|
||||
try
|
||||
{
|
||||
//购买日期
|
||||
asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
|
||||
//有效日期
|
||||
asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
|
||||
//保修日期
|
||||
asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
|
||||
}
|
||||
|
||||
asset.setAssetnum(model.getAssetnum());
|
||||
asset.setSerialnum(model.getSerialnum());
|
||||
asset.setLabels(model.getLabels());
|
||||
|
||||
asset.setSupplier( new Supplier(model.getSupplierID()));
|
||||
asset.setDescription(model.getDescription());
|
||||
|
||||
asset.setCreatetime(new Timestamp(new Date().getTime()));
|
||||
asset.setCreator(getUser());
|
||||
asset.setUpdatetime(new Timestamp(new Date().getTime()));
|
||||
asset.setUpdator(getUser());
|
||||
asset.setAddMonth(Tools.getCurrentMonth());
|
||||
assetService.create(asset);
|
||||
//========标识位===========
|
||||
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, "增加资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "增加资产" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加资产方法===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除资产信息方法delete()================");
|
||||
try
|
||||
{
|
||||
assetService.delete(model.getAssetID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetID() + " 的资产异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除资产", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除资产ID为 "+ model.getAssetID() + " " + tipMsg + "!", "删除资产" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除资产信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Asset asset = assetService.get(model.getAssetID());
|
||||
|
||||
//设置要更新的熟悉值
|
||||
asset.setAssetname(new Assetname(model.getAssetNameID()));
|
||||
|
||||
asset.setLocation(model.getLocation());
|
||||
asset.setStatus(model.getStatus());
|
||||
asset.setPrice(model.getPrice());
|
||||
|
||||
if(null != model.getUserID())
|
||||
asset.setUser(new Basicuser(model.getUserID()));
|
||||
else
|
||||
asset.setUser(null);
|
||||
try
|
||||
{
|
||||
//购买日期
|
||||
asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
|
||||
//有效日期
|
||||
asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
|
||||
//保修日期
|
||||
asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
|
||||
}
|
||||
|
||||
asset.setAssetnum(model.getAssetnum());
|
||||
asset.setSerialnum(model.getSerialnum());
|
||||
asset.setLabels(model.getLabels());
|
||||
|
||||
asset.setSupplier(new Supplier(model.getSupplierID()));
|
||||
asset.setDescription(model.getDescription());
|
||||
|
||||
asset.setUpdatetime(new Timestamp(new Date().getTime()));
|
||||
asset.setUpdator(getUser());
|
||||
assetService.update(asset);
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改资产ID为 : " + model.getAssetID() + "信息失败", 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.getAssetID() + " " + tipMsg + "!", "更新资产" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID资产
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
assetService.batchDelete(model.getAssetIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除资产ID为:" + model.getAssetIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除资产", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除资产ID为 "+ model.getAssetIDs() + " " + tipMsg + "!", "批量删除资产" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找资产信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Asset> pageUtil = new PageUtil<Asset>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
assetService.find(pageUtil);
|
||||
|
||||
getSession().put("pageUtil", pageUtil);
|
||||
List<Asset> 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(Asset asset:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", asset.getId());
|
||||
//添加资产属性
|
||||
item.put("assetname", asset.getAssetname().getAssetname());
|
||||
item.put("assetnameID", asset.getAssetname().getId());
|
||||
//单价
|
||||
item.put("price", Tools.dealNullStr(asset.getPrice() + ""));
|
||||
//分类
|
||||
item.put("category", asset.getAssetname().getCategory().getAssetname());
|
||||
item.put("categoryID", asset.getAssetname().getCategory().getId());
|
||||
//资产的状态:0==在库,1==在用,2==消费
|
||||
item.put("status", getStatusInfo(asset.getStatus()));
|
||||
item.put("statushort", asset.getStatus());
|
||||
//在用用户名称
|
||||
item.put("username", asset.getUser()==null?"":asset.getUser().getUsername());
|
||||
item.put("userID", asset.getUser()==null?"":asset.getUser().getId());
|
||||
//位置
|
||||
item.put("location", Tools.dealNullStr(asset.getLocation()));
|
||||
|
||||
//购买日期
|
||||
item.put("purchasedate", asset.getPurchasedate()==null?"":Tools.getCurrentMonth(asset.getPurchasedate()));
|
||||
//有效日期
|
||||
item.put("periodofvalidity", asset.getPeriodofvalidity()==null?"":Tools.getCurrentMonth(asset.getPeriodofvalidity()));
|
||||
//保修日期
|
||||
item.put("warrantydate", asset.getWarrantydate()==null?"":Tools.getCurrentMonth(asset.getWarrantydate()));
|
||||
//资产编号
|
||||
item.put("assetnum", Tools.dealNullStr(asset.getAssetnum()));
|
||||
//资产序列号
|
||||
item.put("serialnum", Tools.dealNullStr(asset.getSerialnum()));
|
||||
//供应商
|
||||
item.put("supplier", asset.getSupplier()==null?"":asset.getSupplier().getSupplier());
|
||||
//供应商
|
||||
item.put("supplierID", asset.getSupplier()==null?"":asset.getSupplier().getId());
|
||||
//标签
|
||||
item.put("labels", Tools.dealNullStr(asset.getLabels()));
|
||||
item.put("description", Tools.dealNullStr(asset.getDescription()));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel表格
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public String exportExcel()
|
||||
{
|
||||
Log.infoFileSync("===================调用导出资产信息action方法exportExcel开始=======================");
|
||||
try
|
||||
{
|
||||
PageUtil<Asset> pageUtil = (PageUtil<Asset>)getSession().get("pageUtil");
|
||||
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
//pageUtil.setAdvSearch(getCondition());
|
||||
String isCurrentPage = model.getIsAllData();
|
||||
model.setFileName(Tools.changeUnicode(model.getFileName() + ".xls",model.getBrowserType()));
|
||||
model.setExcelStream(assetService.exmportExcel(isCurrentPage,pageUtil));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出资产信息action方法exportExcel异常",e);
|
||||
model.getShowModel().setMsgTip("export excel exception");
|
||||
}
|
||||
Log.infoFileSync("===================调用导出资产信息action方法exportExcel结束==================");
|
||||
return AssetConstants.BusinessForExcel.EXCEL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入资产excel表格内容
|
||||
*/
|
||||
public String importExcel()
|
||||
{
|
||||
//资产excel表格file
|
||||
Boolean result = false;
|
||||
String returnStr = "";
|
||||
try
|
||||
{
|
||||
InputStream in = assetService.importExcel(model.getAssetFile(), model.getIsCheck());
|
||||
|
||||
if(null != in)
|
||||
{
|
||||
model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls");
|
||||
model.setExcelStream(in);
|
||||
returnStr = AssetConstants.BusinessForExcel.EXCEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
try
|
||||
{
|
||||
toClient(result.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>回写导入资产信息结果异常", e);
|
||||
}
|
||||
//导入数据成功
|
||||
returnStr = SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
catch (AmsException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e);
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("assetname.id_n_eq", model.getAssetNameID());
|
||||
condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
|
||||
condition.put("user.id_n_eq", model.getUserID());
|
||||
condition.put("status_n_eq", model.getStatus());
|
||||
condition.put("supplier.id_n_eq", model.getSupplierID());
|
||||
condition.put("createtime_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码转化成说明字符串
|
||||
* 资产的状态:0==在库,1==在用,2==消费
|
||||
* @param statusCode
|
||||
* @return
|
||||
*/
|
||||
private String getStatusInfo(short statusCode)
|
||||
{
|
||||
String statusInfo = "";
|
||||
switch(statusCode)
|
||||
{
|
||||
case AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU:
|
||||
statusInfo = "在库";
|
||||
break;
|
||||
|
||||
case AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE:
|
||||
statusInfo = "在用";
|
||||
break;
|
||||
|
||||
case AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME:
|
||||
statusInfo = "消费";
|
||||
break;
|
||||
}
|
||||
return statusInfo;
|
||||
}
|
||||
|
||||
//=========Spring注入以及model驱动公共方法===========
|
||||
public void setAssetService(AssetIService assetService)
|
||||
{
|
||||
this.assetService = assetService;
|
||||
}
|
||||
|
||||
public void setCategoryService(CategoryIService categoryService)
|
||||
{
|
||||
this.categoryService = categoryService;
|
||||
}
|
||||
|
||||
public void setSupplierService(SupplierIService supplierService)
|
||||
{
|
||||
this.supplierService = supplierService;
|
||||
}
|
||||
|
||||
public void setUserService(UserIService userService)
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
public void setAssetnameService(AssetNameIService assetnameService)
|
||||
{
|
||||
this.assetnameService = assetnameService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
120
src/com/jsh/action/asset/ReportAction.java
Normal file
120
src/com/jsh/action/asset/ReportAction.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.jsh.action.asset;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.exception.AmsException;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ReportAction extends BaseAction<ReportModel>
|
||||
{
|
||||
private ReportModel model = new ReportModel();
|
||||
private ReportIService reportService;
|
||||
|
||||
/**
|
||||
* 查找资产信息
|
||||
* @return
|
||||
*/
|
||||
public String find()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Asset> pageUtil = new PageUtil<Asset>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
String reportType = getReportType(new HashMap<String,Object>());
|
||||
reportService.find(pageUtil,reportType.split("_")[0],reportType.split("_")[1]);
|
||||
model.getShowModel().setReportData(pageUtil.getPageList());
|
||||
}
|
||||
catch (AmsException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
|
||||
model.getShowModel().setMsgTip("get report data exception");
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("assetname.id_n_eq", model.getAssetNameID());
|
||||
condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
|
||||
condition.put("user.id_n_eq", model.getUsernameID());
|
||||
condition.put("status_n_eq", model.getStatus());
|
||||
condition.put("supplier.id_n_eq", model.getSupplierID());
|
||||
condition.put("dataSum_s_order","desc");
|
||||
//拼接统计数据条件
|
||||
getReportType(condition);
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计条件
|
||||
* @param condition
|
||||
*/
|
||||
private String getReportType(Map<String,Object> condition)
|
||||
{
|
||||
// <option value="0">资产状态</option>
|
||||
// <option value="1">资产类型</option>
|
||||
// <option value="2">供应商</option>
|
||||
// <option value="3">资产名称</option>
|
||||
// <option value="4">所属用户</option>
|
||||
int reportType = model.getReportType();
|
||||
String reportTypeInfo = "";
|
||||
String reportTypeName = "";
|
||||
switch(reportType)
|
||||
{
|
||||
case 0:
|
||||
condition.put("status_s_gb", "group");
|
||||
reportTypeInfo = "status";
|
||||
reportTypeName = "status";
|
||||
break;
|
||||
case 1:
|
||||
condition.put("assetname.category.id_s_gb", "group");
|
||||
reportTypeInfo = "assetname.category.id";
|
||||
reportTypeName = "assetname.category.assetname";
|
||||
break;
|
||||
case 2:
|
||||
condition.put("supplier.id_s_gb", "group");
|
||||
reportTypeInfo = "supplier.id";
|
||||
reportTypeName = "supplier.supplier";
|
||||
break;
|
||||
case 3:
|
||||
condition.put("assetname.id_s_gb", "group");
|
||||
reportTypeInfo = "assetname.id";
|
||||
reportTypeName = "assetname.assetname";
|
||||
break;
|
||||
case 4:
|
||||
condition.put("user.id_s_gb", "group");
|
||||
reportTypeInfo = "user.id";
|
||||
reportTypeName = "user.username";
|
||||
break;
|
||||
}
|
||||
return reportTypeInfo + "_" + reportTypeName;
|
||||
}
|
||||
//=========Spring注入以及model驱动公共方法===========
|
||||
public void setReportService(ReportIService reportService)
|
||||
{
|
||||
this.reportService = reportService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
544
src/com/jsh/action/basic/AppAction.java
Normal file
544
src/com/jsh/action/basic/AppAction.java
Normal file
@ -0,0 +1,544 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
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.AmsException;
|
||||
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.opensymphony.xwork2.ActionContext;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AppAction extends BaseAction<AppModel>
|
||||
{
|
||||
private AppIService appService;
|
||||
private UserBusinessIService userBusinessService;
|
||||
private AppModel model = new AppModel();
|
||||
|
||||
|
||||
/**
|
||||
* 增加应用
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加应用方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
App app = new App();
|
||||
app.setNumber(model.getNumber());
|
||||
app.setName(model.getName());
|
||||
app.setType(model.getType());
|
||||
|
||||
try {
|
||||
if(model.getIcon()!=null)
|
||||
{
|
||||
String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon");
|
||||
String iconName=model.getIcon();
|
||||
File file1 = new File(iconName); //文件
|
||||
String FileName = file1.getName(); //获取文件名
|
||||
app.setIcon(FileName); //设置图片ICON
|
||||
InputStream is = new FileInputStream(iconName);
|
||||
File file = new File(path, FileName);
|
||||
OutputStream os = new FileOutputStream(file);
|
||||
byte[] b = new byte[1024];
|
||||
int bs = 0;
|
||||
while ((bs = is.read(b)) > 0) {
|
||||
os.write(b, 0, bs);
|
||||
}
|
||||
is.close();
|
||||
os.close();
|
||||
}
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
app.setURL(model.getURL());
|
||||
app.setWidth(model.getWidth());
|
||||
app.setHeight(model.getHeight());
|
||||
app.setReSize(model.getReSize());
|
||||
app.setOpenMax(model.getOpenMax());
|
||||
app.setFlash(model.getFlash());
|
||||
app.setZL(model.getZL());
|
||||
app.setSort(model.getSort());
|
||||
app.setRemark(model.getRemark());
|
||||
app.setEnabled(model.getEnabled());
|
||||
appService.create(app);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
appService.delete(model.getAppID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除应用方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新仓库
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
App app = appService.get(model.getAppID());
|
||||
app.setNumber(model.getNumber());
|
||||
app.setName(model.getName());
|
||||
app.setType(model.getType());
|
||||
//app.setIcon(model.getIcon());
|
||||
app.setURL(model.getURL());
|
||||
app.setWidth(model.getWidth());
|
||||
app.setHeight(model.getHeight());
|
||||
app.setReSize(model.getReSize());
|
||||
app.setOpenMax(model.getOpenMax());
|
||||
app.setFlash(model.getFlash());
|
||||
app.setZL(model.getZL());
|
||||
app.setSort(model.getSort());
|
||||
app.setRemark(model.getRemark());
|
||||
app.setEnabled(model.getEnabled());
|
||||
appService.update(app);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", 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.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID应用
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
appService.batchDelete(model.getAppIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除应用ID为 "+ model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = appService.checkIsNameExist("name",model.getName(),"Id", model.getAppID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找应用信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<App> pageUtil = new PageUtil<App>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
appService.find(pageUtil);
|
||||
List<App> 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(App app:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", app.getId());
|
||||
//应用名称
|
||||
item.put("Number", app.getNumber());
|
||||
item.put("Name", app.getName());
|
||||
item.put("Type", app.getType());
|
||||
item.put("Icon", app.getIcon());
|
||||
item.put("URL", app.getURL());
|
||||
item.put("Width", app.getWidth());
|
||||
item.put("Height", app.getHeight());
|
||||
item.put("ReSize", app.getReSize());
|
||||
item.put("OpenMax", app.getOpenMax());
|
||||
item.put("Flash", app.getFlash());
|
||||
item.put("ZL", app.getZL());
|
||||
item.put("Sort", app.getSort());
|
||||
item.put("Remark", app.getRemark());
|
||||
item.put("Enabled", app.getEnabled());
|
||||
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 findDesk()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<App> pageUtil = new PageUtil<App>();
|
||||
pageUtil.setPageSize(100);
|
||||
//pageUtil.setCurPage(model.getPageNo());
|
||||
|
||||
JSONObject outer = new JSONObject();
|
||||
|
||||
//下面是dock
|
||||
pageUtil.setAdvSearch(getCondition_dock());
|
||||
appService.find(pageUtil);
|
||||
List<App> dataList1 = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
//存放数据json数组
|
||||
JSONArray dataArray1 = new JSONArray();
|
||||
if(null != dataList1)
|
||||
{
|
||||
for(App app:dataList1)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", app.getId());
|
||||
item.put("title", app.getName());
|
||||
item.put("type", app.getType());
|
||||
item.put("icon", "../../upload/images/deskIcon/"+app.getIcon());
|
||||
item.put("url", app.getURL());
|
||||
item.put("width", app.getWidth());
|
||||
item.put("height", app.getHeight());
|
||||
item.put("isresize", app.getReSize());
|
||||
item.put("isopenmax", app.getOpenMax());
|
||||
item.put("isflash", app.getFlash());
|
||||
dataArray1.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("dock", dataArray1);
|
||||
|
||||
//下面是desk
|
||||
pageUtil.setAdvSearch(getCondition_desk());
|
||||
appService.find(pageUtil);
|
||||
List<App> dataList2 = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
//存放数据json数组
|
||||
JSONArray dataArray2 = new JSONArray();
|
||||
if(null != dataList2)
|
||||
{
|
||||
for(App app:dataList2)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", app.getId());
|
||||
item.put("title", app.getName());
|
||||
item.put("type", app.getType());
|
||||
item.put("icon", "../../upload/images/deskIcon/"+app.getIcon());
|
||||
item.put("url", "../../pages/common/menu.jsp?appID="+app.getNumber()+"&id="+app.getId());
|
||||
item.put("width", app.getWidth());
|
||||
item.put("height", app.getHeight());
|
||||
item.put("isresize", app.getReSize());
|
||||
item.put("isopenmax", app.getOpenMax());
|
||||
item.put("isflash", app.getFlash());
|
||||
dataArray2.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("desk", dataArray2);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 角色对应应用显示
|
||||
* @return
|
||||
*/
|
||||
public void findRoleAPP()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<App> pageUtil = new PageUtil<App>();
|
||||
pageUtil.setPageSize(100);
|
||||
//pageUtil.setCurPage(model.getPageNo());
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleAPP());
|
||||
appService.find(pageUtil);
|
||||
List<App> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("id", 1);
|
||||
outer.put("text", "应用列表");
|
||||
outer.put("state", "open");
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(App app:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", app.getId());
|
||||
item.put("text", app.getName());
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+app.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item.put("checked", true);}
|
||||
//结束
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("children", dataArray);
|
||||
//回写查询结果
|
||||
toClient("["+outer.toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Name_s_like", model.getName());
|
||||
condition.put("Type_s_like", model.getType());
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-桌面dock
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_dock()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("ZL_s_eq", "dock");
|
||||
condition.put("Enabled_n_eq", 1);
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-桌面desk
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_desk()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("ZL_s_eq", "desk");
|
||||
condition.put("Enabled_n_eq", 1);
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-角色对应应用
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_RoleAPP()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Enabled_n_eq", 1);
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public AppModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setAppService(AppIService appService)
|
||||
{
|
||||
this.appService = appService;
|
||||
}
|
||||
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
|
||||
}
|
||||
289
src/com/jsh/action/basic/AssetNameAction.java
Normal file
289
src/com/jsh/action/basic/AssetNameAction.java
Normal file
@ -0,0 +1,289 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
273
src/com/jsh/action/basic/CategoryAction.java
Normal file
273
src/com/jsh/action/basic/CategoryAction.java
Normal file
@ -0,0 +1,273 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
380
src/com/jsh/action/basic/DepotAction.java
Normal file
380
src/com/jsh/action/basic/DepotAction.java
Normal file
@ -0,0 +1,380 @@
|
||||
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.exception.AmsException;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DepotAction extends BaseAction<DepotModel>
|
||||
{
|
||||
private DepotIService depotService;
|
||||
private UserBusinessIService userBusinessService;
|
||||
private DepotModel model = new DepotModel();
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String getBasicData()
|
||||
{
|
||||
Map<String,List> mapData = model.getShowModel().getMap();
|
||||
PageUtil pageUtil = new PageUtil();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
try
|
||||
{
|
||||
Map<String,Object> condition = pageUtil.getAdvSearch();
|
||||
condition.put("id_s_order", "asc");
|
||||
depotService.find(pageUtil);
|
||||
mapData.put("depotList", 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
|
||||
{
|
||||
Depot depot = new Depot();
|
||||
depot.setName(model.getName());
|
||||
depot.setSort(model.getSort());
|
||||
depot.setRemark(model.getRemark());
|
||||
depotService.create(depot);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
depotService.delete(model.getDepotID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除仓库信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新仓库
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Depot depot = depotService.get(model.getDepotID());
|
||||
depot.setName(model.getName());
|
||||
depot.setSort(model.getSort());
|
||||
depot.setRemark(model.getRemark());
|
||||
depotService.update(depot);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", 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.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID仓库
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
depotService.batchDelete(model.getDepotIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找仓库信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
depotService.find(pageUtil);
|
||||
List<Depot> 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(Depot depot:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", depot.getId());
|
||||
//供应商名称
|
||||
item.put("name", depot.getName());
|
||||
item.put("sort", depot.getSort());
|
||||
item.put("remark", depot.getRemark());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户对应部门显示
|
||||
* @return
|
||||
*/
|
||||
public void findUserDepot()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
||||
pageUtil.setPageSize(100);
|
||||
//pageUtil.setCurPage(model.getPageNo());
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_UserDepot());
|
||||
depotService.find(pageUtil);
|
||||
List<Depot> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("id", 1);
|
||||
outer.put("text", "部门列表");
|
||||
outer.put("state", "open");
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Depot depot:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", depot.getId());
|
||||
item.put("text", depot.getName());
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的部门:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item.put("checked", true);}
|
||||
//结束
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("children", dataArray);
|
||||
//回写查询结果
|
||||
toClient("["+outer.toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找部门异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询部门结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("name_s_like", model.getName());
|
||||
condition.put("remark_s_like", model.getRemark());
|
||||
condition.put("sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-用户对应部门
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_UserDepot()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public DepotModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setDepotService(DepotIService depotService)
|
||||
{
|
||||
this.depotService = depotService;
|
||||
}
|
||||
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
|
||||
}
|
||||
588
src/com/jsh/action/basic/FunctionsAction.java
Normal file
588
src/com/jsh/action/basic/FunctionsAction.java
Normal file
@ -0,0 +1,588 @@
|
||||
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.exception.AmsException;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FunctionsAction extends BaseAction<FunctionsModel>
|
||||
{
|
||||
private FunctionsIService functionsService;
|
||||
private UserBusinessIService userBusinessService;
|
||||
private FunctionsModel model = new FunctionsModel();
|
||||
/**
|
||||
* 增加功能
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加功能信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Functions functions = new Functions();
|
||||
functions.setNumber(model.getNumber());
|
||||
functions.setName(model.getName());
|
||||
functions.setPNumber(model.getPNumber());
|
||||
functions.setURL(model.getURL());
|
||||
functions.setState(model.getState());
|
||||
functions.setSort(model.getSort());
|
||||
functions.setEnabled(model.getEnabled());
|
||||
functions.setType(model.getType());
|
||||
|
||||
functionsService.create(functions);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
functionsService.delete(model.getFunctionsID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getFunctionsID() + " 的功能异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除功能", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除功能ID为 "+ model.getFunctionsID() + " " + tipMsg + "!", "删除功能" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除功能信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新功能
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Functions functions = functionsService.get(model.getFunctionsID());
|
||||
functions.setNumber(model.getNumber());
|
||||
functions.setName(model.getName());
|
||||
functions.setPNumber(model.getPNumber());
|
||||
functions.setURL(model.getURL());
|
||||
functions.setState(model.getState());
|
||||
functions.setSort(model.getSort());
|
||||
functions.setEnabled(model.getEnabled());
|
||||
functions.setType(model.getType());
|
||||
functionsService.update(functions);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改功能ID为 : " + model.getFunctionsID() + "信息失败", 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.getFunctionsID() + " " + tipMsg + "!", "更新功能" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID功能
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
functionsService.batchDelete(model.getFunctionsIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除功能ID为:" + model.getFunctionsIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除功能", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除功能ID为 "+ model.getFunctionsIDs() + " " + tipMsg + "!", "批量删除功能" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = functionsService.checkIsNameExist("Name",model.getName(),"Id", model.getFunctionsID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找功能信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Functions> pageUtil = new PageUtil<Functions>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> 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(Functions functions:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", functions.getId());
|
||||
item.put("Number", functions.getNumber());
|
||||
item.put("Name", functions.getName());
|
||||
item.put("PNumber", functions.getPNumber());
|
||||
item.put("URL", functions.getURL());
|
||||
item.put("State", functions.getState());
|
||||
item.put("Sort", functions.getSort());
|
||||
item.put("Enabled", functions.getEnabled());
|
||||
item.put("Type", functions.getType());
|
||||
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 findRoleFunctions()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Functions> pageUtil = new PageUtil<Functions>();
|
||||
pageUtil.setPageSize(200);
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions("0"));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("id", 1);
|
||||
outer.put("text", "功能列表");
|
||||
outer.put("state", "open");
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Functions functions:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", functions.getId());
|
||||
item.put("text", functions.getName());
|
||||
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item.put("checked", true);}
|
||||
//结束
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList1 = pageUtil.getPageList();
|
||||
JSONArray dataArray1 = new JSONArray();
|
||||
if(null != dataList1)
|
||||
{
|
||||
|
||||
for(Functions functions1:dataList1)
|
||||
{
|
||||
item.put("state", "open"); //如果不为空,节点不展开
|
||||
JSONObject item1 = new JSONObject();
|
||||
item1.put("id", functions1.getId());
|
||||
item1.put("text", functions1.getName());
|
||||
|
||||
//勾选判断2
|
||||
//Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions1.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item1.put("checked", true);}
|
||||
//结束
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList2 = pageUtil.getPageList();
|
||||
JSONArray dataArray2 = new JSONArray();
|
||||
if(null != dataList2)
|
||||
{
|
||||
|
||||
for(Functions functions2:dataList2)
|
||||
{
|
||||
item1.put("state", "closed"); //如果不为空,节点不展开
|
||||
JSONObject item2 = new JSONObject();
|
||||
item2.put("id", functions2.getId());
|
||||
item2.put("text", functions2.getName());
|
||||
|
||||
//勾选判断3
|
||||
//Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions2.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item2.put("checked", true);}
|
||||
//结束
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList3 = pageUtil.getPageList();
|
||||
JSONArray dataArray3 = new JSONArray();
|
||||
if(null != dataList3)
|
||||
{
|
||||
|
||||
for(Functions functions3:dataList3)
|
||||
{
|
||||
item2.put("state", "closed"); //如果不为空,节点不展开
|
||||
JSONObject item3 = new JSONObject();
|
||||
item3.put("id", functions3.getId());
|
||||
item3.put("text", functions3.getName());
|
||||
|
||||
//勾选判断4
|
||||
//Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions3.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item3.put("checked", true);}
|
||||
//结束
|
||||
|
||||
dataArray3.add(item3);
|
||||
item2.put("children", dataArray3);
|
||||
}
|
||||
}
|
||||
|
||||
dataArray2.add(item2);
|
||||
item1.put("children", dataArray2);
|
||||
}
|
||||
}
|
||||
|
||||
dataArray1.add(item1);
|
||||
item.put("children", dataArray1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dataArray.add(item);
|
||||
}
|
||||
outer.put("children", dataArray);
|
||||
}
|
||||
//回写查询结果
|
||||
toClient("["+outer.toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 页面显示菜单
|
||||
* @return
|
||||
*/
|
||||
public void findMenu()
|
||||
{
|
||||
try
|
||||
{
|
||||
String fc=model.getHasFunctions(); //当前用户所拥有的功能列表,格式如:[1][2][5]
|
||||
PageUtil<Functions> pageUtil = new PageUtil<Functions>();
|
||||
pageUtil.setPageSize(200);
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(model.getPNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList = pageUtil.getPageList();
|
||||
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Functions functions:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", functions.getId());
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList1 = pageUtil.getPageList();
|
||||
JSONArray dataArray1 = new JSONArray();
|
||||
if(dataList1.size()!=0)
|
||||
{
|
||||
item.put("text", functions.getName()); //是目录就没链接
|
||||
for(Functions functions1:dataList1)
|
||||
{
|
||||
item.put("state", "open"); //如果不为空,节点展开
|
||||
JSONObject item1 = new JSONObject();
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList2 = pageUtil.getPageList();
|
||||
if(fc.indexOf("["+functions1.getId().toString()+"]")!=-1||dataList2.size()!=0)
|
||||
{
|
||||
item1.put("id", functions1.getId());
|
||||
JSONArray dataArray2 = new JSONArray();
|
||||
if(dataList2.size()!=0)
|
||||
{
|
||||
item1.put("text", functions1.getName());//是目录就没链接
|
||||
for(Functions functions2:dataList2)
|
||||
{
|
||||
item1.put("state", "closed"); //如果不为空,节点不展开
|
||||
JSONObject item2 = new JSONObject();
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber()));
|
||||
functionsService.find(pageUtil);
|
||||
List<Functions> dataList3 = pageUtil.getPageList();
|
||||
if(fc.indexOf("["+functions2.getId().toString()+"]")!=-1||dataList3.size()!=0)
|
||||
{
|
||||
item2.put("id", functions2.getId());
|
||||
JSONArray dataArray3 = new JSONArray();
|
||||
if(dataList3.size()!=0)
|
||||
{
|
||||
item2.put("text", functions2.getName());//是目录就没链接
|
||||
for(Functions functions3:dataList3)
|
||||
{
|
||||
item2.put("state", "closed"); //如果不为空,节点不展开
|
||||
JSONObject item3 = new JSONObject();
|
||||
item3.put("id", functions3.getId());
|
||||
item3.put("text", functions3.getName());
|
||||
//
|
||||
dataArray3.add(item3);
|
||||
item2.put("children", dataArray3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//不是目录,有链接
|
||||
item2.put("text", "<a onclick=\"NewTab('"+functions2.getName()+"','"+functions2.getURL()+"')\">"+functions2.getName()+"</a>");
|
||||
}
|
||||
|
||||
dataArray2.add(item2);
|
||||
item1.put("children", dataArray2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//不是目录,有链接
|
||||
item1.put("text", "<a onclick=\"NewTab('"+functions1.getName()+"','"+functions1.getURL()+"')\">"+functions1.getName()+"</a>");
|
||||
}
|
||||
|
||||
dataArray1.add(item1);
|
||||
item.put("children", dataArray1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//不是目录,有链接
|
||||
item.put("text", "<a onclick=\"NewTab('"+functions.getName()+"','"+functions.getURL()+"')\">"+functions.getName()+"</a>");
|
||||
}
|
||||
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
//回写查询结果
|
||||
toClient(dataArray.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Name_s_like", model.getName());
|
||||
condition.put("Type_s_eq", model.getType());
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-角色对应功能
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_RoleFunctions(String num)
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Enabled_n_eq", 1);
|
||||
condition.put("PNumber_s_eq", num);
|
||||
condition.put("Sort_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public FunctionsModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setFunctionsService(FunctionsIService functionsService)
|
||||
{
|
||||
this.functionsService = functionsService;
|
||||
}
|
||||
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
|
||||
}
|
||||
192
src/com/jsh/action/basic/LogAction.java
Normal file
192
src/com/jsh/action/basic/LogAction.java
Normal file
@ -0,0 +1,192 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
347
src/com/jsh/action/basic/RoleAction.java
Normal file
347
src/com/jsh/action/basic/RoleAction.java
Normal file
@ -0,0 +1,347 @@
|
||||
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.exception.AmsException;
|
||||
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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class RoleAction extends BaseAction<RoleModel>
|
||||
{
|
||||
private RoleIService roleService;
|
||||
private UserBusinessIService userBusinessService;
|
||||
private RoleModel model = new RoleModel();
|
||||
/**
|
||||
* 增加角色
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加角色信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Role role = new Role();
|
||||
role.setName(model.getName());
|
||||
roleService.create(role);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
roleService.delete(model.getRoleID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除角色信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Role role = roleService.get(model.getRoleID());
|
||||
role.setName(model.getName());
|
||||
roleService.update(role);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", 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.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID角色
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
roleService.batchDelete(model.getRoleIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找角色信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
roleService.find(pageUtil);
|
||||
List<Role> 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(Role role:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", role.getId());
|
||||
//供应商名称
|
||||
item.put("Name", role.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
|
||||
*/
|
||||
public void findUserRole()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
||||
pageUtil.setPageSize(100);
|
||||
//pageUtil.setCurPage(model.getPageNo());
|
||||
|
||||
pageUtil.setAdvSearch(getCondition_UserRole());
|
||||
roleService.find(pageUtil);
|
||||
List<Role> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接json数据
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("id", 1);
|
||||
outer.put("text", "角色列表");
|
||||
outer.put("state", "open");
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Role role:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", role.getId());
|
||||
item.put("text", role.getName());
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||
}
|
||||
if (flag==true){item.put("checked", true);}
|
||||
//结束
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("children", dataArray);
|
||||
//回写查询结果
|
||||
toClient("["+outer.toString()+"]");
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Name_s_like", model.getName());
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-用户对应角色
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_UserRole()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public RoleModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setRoleService(RoleIService roleService)
|
||||
{
|
||||
this.roleService = roleService;
|
||||
}
|
||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||
this.userBusinessService = userBusinessService;
|
||||
}
|
||||
}
|
||||
402
src/com/jsh/action/basic/SupplierAction.java
Normal file
402
src/com/jsh/action/basic/SupplierAction.java
Normal file
@ -0,0 +1,402 @@
|
||||
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.po.Supplier;
|
||||
import com.jsh.model.vo.basic.SupplierModel;
|
||||
import com.jsh.service.basic.SupplierIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class SupplierAction extends BaseAction<SupplierModel>
|
||||
{
|
||||
private SupplierIService supplierService;
|
||||
private SupplierModel model = new SupplierModel();
|
||||
|
||||
/**
|
||||
* 增加供应商
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加供应商方法===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Supplier supplier = new Supplier();
|
||||
supplier.setContacts(model.getContacts());
|
||||
supplier.setType(model.getType());
|
||||
supplier.setDescription(model.getDescription());
|
||||
supplier.setEmail(model.getEmail());
|
||||
supplier.setIsystem((short)1);
|
||||
supplier.setPhonenum(model.getPhonenum());
|
||||
supplier.setSupplier(model.getSupplier());
|
||||
supplier.setEnabled(model.getEnabled());
|
||||
supplierService.create(supplier);
|
||||
|
||||
//========标识位===========
|
||||
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.getSupplier() + " " + tipMsg + "!", "增加供应商" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加供应商方法===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除供应商
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除供应商信息方法delete()================");
|
||||
try
|
||||
{
|
||||
supplierService.delete(model.getSupplierID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getSupplierID() + " 的供应商异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除供应商", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除供应商ID为 "+ model.getSupplierID() + ",名称为 " + model.getSupplier() + tipMsg + "!", "删除供应商" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除供应商信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新供应商
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Supplier supplier = supplierService.get(model.getSupplierID());
|
||||
supplier.setContacts(model.getContacts());
|
||||
supplier.setType(model.getType());
|
||||
supplier.setDescription(model.getDescription());
|
||||
supplier.setEmail(model.getEmail());
|
||||
supplier.setIsystem((short)1);
|
||||
supplier.setPhonenum(model.getPhonenum());
|
||||
supplier.setSupplier(model.getSupplier());
|
||||
supplier.setEnabled(model.getEnabled());
|
||||
supplierService.update(supplier);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", 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.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID供应商
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
supplierService.batchDelete(model.getSupplierIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除供应商ID为:" + model.getSupplierIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除供应商", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除供应商ID为 "+ model.getSupplierIDs() + " " + tipMsg + "!", "批量删除供应商" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查输入名称是否存在
|
||||
*/
|
||||
public void checkIsNameExist()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
flag = supplierService.checkIsNameExist("supplier",model.getSupplier(),"id", model.getSupplierID());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>回写检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Supplier> pageUtil = new PageUtil<Supplier>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
supplierService.find(pageUtil);
|
||||
List<Supplier> 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(Supplier supplier:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", supplier.getId());
|
||||
//供应商名称
|
||||
item.put("supplier", supplier.getSupplier());
|
||||
item.put("type", supplier.getType());
|
||||
item.put("contacts",supplier.getContacts());
|
||||
item.put("phonenum", supplier.getPhonenum());
|
||||
item.put("email", supplier.getEmail());
|
||||
item.put("isystem", supplier.getIsystem() == (short)0?"是":"否");
|
||||
item.put("description", supplier.getDescription());
|
||||
item.put("enabled", supplier.getEnabled());
|
||||
item.put("op", supplier.getIsystem());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找供应商信息-下拉框
|
||||
* @return
|
||||
*/
|
||||
public void findBySelect_sup()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Supplier> pageUtil = new PageUtil<Supplier>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getCondition_Select_sup());
|
||||
supplierService.find(pageUtil);
|
||||
List<Supplier> dataList = pageUtil.getPageList();
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Supplier supplier:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", supplier.getId());
|
||||
//供应商名称
|
||||
item.put("supplier", supplier.getSupplier());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
//回写查询结果
|
||||
toClient(dataArray.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查找客户信息-下拉框
|
||||
* @return
|
||||
*/
|
||||
public void findBySelect_cus()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Supplier> pageUtil = new PageUtil<Supplier>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getCondition_Select_cus());
|
||||
supplierService.find(pageUtil);
|
||||
List<Supplier> dataList = pageUtil.getPageList();
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Supplier supplier:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", supplier.getId());
|
||||
//客户名称
|
||||
item.put("supplier", supplier.getSupplier());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
//回写查询结果
|
||||
toClient(dataArray.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("supplier_s_like", model.getSupplier());
|
||||
condition.put("type_s_like", model.getType());
|
||||
condition.put("contacts_s_like", model.getContacts());
|
||||
condition.put("phonenum_s_like", model.getPhonenum());
|
||||
condition.put("email_s_like", model.getEmail());
|
||||
condition.put("description_s_like", model.getDescription());
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-下拉框-供应商
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_Select_sup()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("type_s_like", "供应商");
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
/**
|
||||
* 拼接搜索条件-下拉框-客户
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_Select_cus()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("type_s_like", "客户");
|
||||
condition.put("id_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public SupplierModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setSupplierService(SupplierIService supplierService)
|
||||
{
|
||||
this.supplierService = supplierService;
|
||||
}
|
||||
}
|
||||
480
src/com/jsh/action/basic/UserAction.java
Normal file
480
src/com/jsh/action/basic/UserAction.java
Normal file
@ -0,0 +1,480 @@
|
||||
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);
|
||||
}
|
||||
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 ="00000000";
|
||||
//因密码用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;
|
||||
}
|
||||
}
|
||||
229
src/com/jsh/action/basic/UserBusinessAction.java
Normal file
229
src/com/jsh/action/basic/UserBusinessAction.java
Normal file
@ -0,0 +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;
|
||||
}
|
||||
}
|
||||
267
src/com/jsh/action/basic/VisitAccountAction.java
Normal file
267
src/com/jsh/action/basic/VisitAccountAction.java
Normal file
@ -0,0 +1,267 @@
|
||||
package com.jsh.action.basic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
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.Category;
|
||||
import com.jsh.model.po.Depot;
|
||||
import com.jsh.model.po.VisitAccount;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.basic.VisitAccountModel;
|
||||
import com.jsh.service.basic.VisitAccountIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class VisitAccountAction extends BaseAction<VisitAccountModel>
|
||||
{
|
||||
private VisitAccountIService visitAccountService;
|
||||
private VisitAccountModel model = new VisitAccountModel();
|
||||
/**
|
||||
* 增加回访
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加回访信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
VisitAccount visitAccount = new VisitAccount();
|
||||
visitAccount.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
visitAccount.setLouHao(model.getLouHao());
|
||||
visitAccount.setHuHao(model.getHuHao());
|
||||
visitAccount.setHuiFang(model.getHuiFang());
|
||||
visitAccount.setLuoShi(model.getLuoShi());
|
||||
visitAccount.setName(model.getName());
|
||||
visitAccount.setTel(model.getTel());
|
||||
visitAccount.setAddTime(new Timestamp(new Date().getTime()));
|
||||
visitAccountService.create(visitAccount);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
visitAccountService.delete(model.getVisitAccountID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getVisitAccountID() + " 的回访异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除回访", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除回访ID为 "+ model.getVisitAccountID() + " " + tipMsg + "!", "删除回访" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除回访信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新回访
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
VisitAccount visitAccount = visitAccountService.get(model.getVisitAccountID());
|
||||
visitAccount.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
visitAccount.setLouHao(model.getLouHao());
|
||||
visitAccount.setHuHao(model.getHuHao());
|
||||
visitAccount.setHuiFang(model.getHuiFang());
|
||||
visitAccount.setLuoShi(model.getLuoShi());
|
||||
visitAccount.setName(model.getName());
|
||||
visitAccount.setTel(model.getTel());
|
||||
visitAccount.setAddTime(new Timestamp(new Date().getTime()));
|
||||
visitAccountService.update(visitAccount);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改回访ID为 : " + model.getVisitAccountID() + "信息失败", 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.getVisitAccountID() + " " + tipMsg + "!", "更新回访" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID回访
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
visitAccountService.batchDelete(model.getVisitAccountIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除回访ID为:" + model.getVisitAccountIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除回访", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除回访ID为 "+ model.getVisitAccountIDs() + " " + tipMsg + "!", "批量删除回访" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找回访信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<VisitAccount> pageUtil = new PageUtil<VisitAccount>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
visitAccountService.find(pageUtil);
|
||||
List<VisitAccount> 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(VisitAccount visitAccount:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", visitAccount.getId());
|
||||
item.put("ProjectId", visitAccount.getDepot().getId());
|
||||
item.put("ProjectName", visitAccount.getDepot().getName());
|
||||
item.put("LouHao", visitAccount.getLouHao());
|
||||
item.put("HuHao", visitAccount.getHuHao());
|
||||
item.put("HuiFang", visitAccount.getHuiFang());
|
||||
item.put("LuoShi", visitAccount.getLuoShi());
|
||||
item.put("Name", visitAccount.getName());
|
||||
item.put("Tel", visitAccount.getTel());
|
||||
item.put("AddTime", visitAccount.getAddTime());
|
||||
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("LouHao_s_like", model.getLouHao());
|
||||
condition.put("AddTime_s_order", "desc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public VisitAccountModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setVisitAccountService(VisitAccountIService visitAccountService)
|
||||
{
|
||||
this.visitAccountService = visitAccountService;
|
||||
}
|
||||
}
|
||||
277
src/com/jsh/action/materials/BuildingAction.java
Normal file
277
src/com/jsh/action/materials/BuildingAction.java
Normal file
@ -0,0 +1,277 @@
|
||||
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.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;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BuildingAction extends BaseAction<BuildingModel>
|
||||
{
|
||||
private BuildingIService buildingService;
|
||||
private BuildingModel model = new BuildingModel();
|
||||
|
||||
|
||||
@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");
|
||||
buildingService.find(pageUtil);
|
||||
mapData.put("buildingList", 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
|
||||
{
|
||||
Building building = new Building();
|
||||
building.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
building.setName(model.getName());
|
||||
building.setRemark(model.getRemark());
|
||||
building.setEnabled(model.getEnabled());
|
||||
buildingService.create(building);
|
||||
|
||||
//========标识位===========
|
||||
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
|
||||
{
|
||||
buildingService.delete(model.getBuildingID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getBuildingID() + " 的单元异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除单元", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "删除单元" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除单元信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新单元
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Building building = buildingService.get(model.getBuildingID());
|
||||
building.setDepot(new Depot(model.getProjectId()));
|
||||
|
||||
building.setName(model.getName());
|
||||
building.setRemark(model.getRemark());
|
||||
building.setEnabled(model.getEnabled());
|
||||
buildingService.update(building);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改单元ID为 : " + model.getBuildingID() + "信息失败", 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.getBuildingID() + " " + tipMsg + "!", "更新单元" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID单元
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
buildingService.batchDelete(model.getBuildingIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除单元ID为:" + model.getBuildingIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除单元", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除单元ID为 "+ model.getBuildingIDs() + " " + tipMsg + "!", "批量删除单元" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找单元信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Building> pageUtil = new PageUtil<Building>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
buildingService.find(pageUtil);
|
||||
List<Building> 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(Building building:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", building.getId());
|
||||
item.put("ProjectId", building.getDepot().getId());
|
||||
item.put("ProjectName", building.getDepot().getName());
|
||||
item.put("Name", building.getName());
|
||||
item.put("Remark", building.getRemark());
|
||||
item.put("Enabled", building.getEnabled());
|
||||
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("Name_s_like", model.getName());
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public BuildingModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setBuildingService(BuildingIService buildingService)
|
||||
{
|
||||
this.buildingService = buildingService;
|
||||
}
|
||||
}
|
||||
439
src/com/jsh/action/materials/DepotHeadAction.java
Normal file
439
src/com/jsh/action/materials/DepotHeadAction.java
Normal file
@ -0,0 +1,439 @@
|
||||
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.exception.AmsException;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.model.po.Building;
|
||||
import com.jsh.model.po.Depot;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
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;
|
||||
}
|
||||
}
|
||||
395
src/com/jsh/action/materials/DepotItemAction.java
Normal file
395
src/com/jsh/action/materials/DepotItemAction.java
Normal file
@ -0,0 +1,395 @@
|
||||
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.constants.asset.AssetConstants;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.po.Material;
|
||||
import com.jsh.model.vo.materials.DepotItemModel;
|
||||
import com.jsh.service.materials.DepotHeadIService;
|
||||
import com.jsh.service.materials.DepotItemIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.Tools;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||
{
|
||||
private DepotItemIService depotItemService;
|
||||
private DepotItemModel model = new DepotItemModel();
|
||||
/**
|
||||
* action返回excel结果
|
||||
*/
|
||||
public static final String EXCEL = "excel";
|
||||
|
||||
/**
|
||||
* 保存明细
|
||||
* @return
|
||||
*/
|
||||
public void saveDetials()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Long headerId=model.getHeaderId();
|
||||
String inserted=model.getInserted();
|
||||
String deleted=model.getDeleted();
|
||||
String updated=model.getUpdated();
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.fromObject(inserted);
|
||||
JSONArray deletedJson = JSONArray.fromObject(deleted);
|
||||
JSONArray updatedJson = JSONArray.fromObject(updated);
|
||||
if(null != insertedJson)
|
||||
{
|
||||
for(int i = 0;i < insertedJson.size(); i++)
|
||||
{
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i));
|
||||
depotItem.setHeaderId(new DepotHead(headerId));
|
||||
depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId")));
|
||||
depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber"));
|
||||
if(tempInsertedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice"));}
|
||||
if(tempInsertedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||
depotItem.setImg(tempInsertedJson.getString("Img"));
|
||||
depotItemService.create(depotItem);
|
||||
}
|
||||
}
|
||||
if(null != deletedJson)
|
||||
{
|
||||
for(int i = 0;i < deletedJson.size(); i++)
|
||||
{
|
||||
JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i));
|
||||
depotItemService.delete(tempDeletedJson.getLong("Id"));
|
||||
}
|
||||
}
|
||||
if(null != updatedJson)
|
||||
{
|
||||
for(int i = 0;i < updatedJson.size(); i++)
|
||||
{
|
||||
JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i));
|
||||
DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId")));
|
||||
depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber"));
|
||||
if(tempUpdatedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice"));}
|
||||
if(tempUpdatedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||
depotItem.setImg(tempUpdatedJson.getString("Img"));
|
||||
depotItemService.create(depotItem);
|
||||
}
|
||||
}
|
||||
|
||||
//========标识位===========
|
||||
flag = true;
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()===================");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找仓管通信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
depotItemService.find(pageUtil);
|
||||
List<DepotItem> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接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(DepotItem depotItem:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
item.put("MaterialName", ((depotItem.getMaterialId().getModel().equals(""))?"":""+depotItem.getMaterialId().getModel())+" "+depotItem.getMaterialId().getName()+((depotItem.getMaterialId().getColor() == null)?"(":"("+depotItem.getMaterialId().getColor()) + ")");
|
||||
item.put("OperNumber", depotItem.getOperNumber());
|
||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||
item.put("Incidentals", depotItem.getIncidentals());
|
||||
item.put("Remark", depotItem.getRemark());
|
||||
item.put("Img", depotItem.getImg());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找进销存
|
||||
* @return
|
||||
*/
|
||||
public void findByAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getConditionALL());
|
||||
depotItemService.find(pageUtil);
|
||||
List<DepotItem> dataList = pageUtil.getPageList();
|
||||
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("total", pageUtil.getTotalCount());
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(DepotItem depotItem:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||
item.put("prevSum", prevSum);
|
||||
item.put("InSum", InSum);
|
||||
item.put("OutSum", OutSum);
|
||||
item.put("thisSum", prevSum + InSum - OutSum);
|
||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计总计金额
|
||||
* @return
|
||||
*/
|
||||
public void totalCountMoney()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getConditionALL());
|
||||
depotItemService.find(pageUtil);
|
||||
List<DepotItem> dataList = pageUtil.getPageList();
|
||||
|
||||
JSONObject outer = new JSONObject();
|
||||
Double thisAllPrice = 0.0;
|
||||
if(null != dataList)
|
||||
{
|
||||
for(DepotItem depotItem:dataList)
|
||||
{
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum);
|
||||
}
|
||||
}
|
||||
outer.put("totalCount", thisAllPrice);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel表格
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public String exportExcel()
|
||||
{
|
||||
Log.infoFileSync("===================调用导出信息action方法exportExcel开始=======================");
|
||||
try
|
||||
{
|
||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
pageUtil.setAdvSearch(getConditionALL());
|
||||
depotItemService.find(pageUtil);
|
||||
List<DepotItem> dataList = pageUtil.getPageList();
|
||||
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(DepotItem depotItem:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
||||
Integer InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||
item.put("Id", depotItem.getId());
|
||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||
item.put("prevSum", prevSum);
|
||||
item.put("InSum", InSum);
|
||||
item.put("OutSum", OutSum);
|
||||
item.put("thisSum", prevSum + InSum - OutSum);
|
||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
String isCurrentPage = "allPage";
|
||||
model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType()));
|
||||
model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e);
|
||||
model.getShowModel().setMsgTip("export excel exception");
|
||||
}
|
||||
Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
|
||||
return EXCEL;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) {
|
||||
Integer sumNumber = 0;
|
||||
String allNumber = "";
|
||||
PageUtil pageUtil = new PageUtil();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
try {
|
||||
depotItemService.findByType(pageUtil, type, MId, MonthTime, isPrev);
|
||||
allNumber = pageUtil.getPageList().toString();
|
||||
allNumber = allNumber.substring(1,allNumber.length()-1);
|
||||
if(allNumber.equals("null")){
|
||||
allNumber = "0";
|
||||
}
|
||||
allNumber = allNumber.replace(".0", "");
|
||||
} catch (AmsException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
sumNumber = Integer.parseInt(allNumber);
|
||||
return sumNumber;
|
||||
}
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("HeaderId_n_eq", model.getHeaderId());
|
||||
condition.put("Id_s_order","asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
private Map<String,Object> getConditionALL()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("HeaderId_s_in", model.getHeadIds());
|
||||
condition.put("MaterialId_s_in", model.getMaterialIds());
|
||||
condition.put("MaterialId_s_gb","aaa");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public DepotItemModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setDepotItemService(DepotItemIService depotItemService)
|
||||
{
|
||||
this.depotItemService = depotItemService;
|
||||
}
|
||||
}
|
||||
391
src/com/jsh/action/materials/MaterialAction.java
Normal file
391
src/com/jsh/action/materials/MaterialAction.java
Normal file
@ -0,0 +1,391 @@
|
||||
package com.jsh.action.materials;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.Material;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.po.MaterialCategory;
|
||||
import com.jsh.model.po.Supplier;
|
||||
import com.jsh.model.vo.materials.MaterialModel;
|
||||
import com.jsh.service.materials.MaterialIService;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MaterialAction extends BaseAction<MaterialModel>
|
||||
{
|
||||
private MaterialIService materialService;
|
||||
private MaterialModel model = new MaterialModel();
|
||||
|
||||
/**
|
||||
* 增加物料
|
||||
* @return
|
||||
*/
|
||||
public void create()
|
||||
{
|
||||
Log.infoFileSync("==================开始调用增加物料信息方法create()===================");
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Material material = new Material();
|
||||
material.setMaterialCategory(new MaterialCategory(model.getCategoryId()));
|
||||
|
||||
material.setName(model.getName());
|
||||
material.setModel(model.getModel());
|
||||
material.setColor(model.getColor());
|
||||
material.setUnit(model.getUnit());
|
||||
material.setRemark(model.getRemark());
|
||||
materialService.create(material);
|
||||
|
||||
//========标识位===========
|
||||
flag = true;
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加物料信息异常", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>增加物料信息回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "增加物料", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "增加物料名称为 "+ model.getName() + " " + tipMsg + "!", "增加物料" + tipMsg));
|
||||
Log.infoFileSync("==================结束调用增加物料方法create()===================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物料
|
||||
* @return
|
||||
*/
|
||||
public String delete()
|
||||
{
|
||||
Log.infoFileSync("====================开始调用删除物料信息方法delete()================");
|
||||
try
|
||||
{
|
||||
materialService.delete(model.getMaterialID());
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialID() + " 的物料异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
model.getShowModel().setMsgTip(tipMsg);
|
||||
logService.create(new Logdetails(getUser(), "删除物料", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "删除物料ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "删除物料" + tipMsg));
|
||||
Log.infoFileSync("====================结束调用删除物料信息方法delete()================");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新物料
|
||||
* @return
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
Boolean flag = false;
|
||||
try
|
||||
{
|
||||
Material material = materialService.get(model.getMaterialID());
|
||||
material.setMaterialCategory(new MaterialCategory(model.getCategoryId()));
|
||||
|
||||
material.setName(model.getName());
|
||||
material.setModel(model.getModel());
|
||||
material.setColor(model.getColor());
|
||||
material.setUnit(model.getUnit());
|
||||
material.setRemark(model.getRemark());
|
||||
material.setName(model.getName());
|
||||
materialService.update(material);
|
||||
|
||||
flag = true;
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>修改物料ID为 : " + model.getMaterialID() + "信息失败", e);
|
||||
flag = false;
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
toClient(flag.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>修改物料回写客户端结果异常", e);
|
||||
}
|
||||
}
|
||||
logService.create(new Logdetails(getUser(), "更新物料", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "更新物料ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "更新物料" + tipMsg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除指定ID物料
|
||||
* @return
|
||||
*/
|
||||
public String batchDelete()
|
||||
{
|
||||
try
|
||||
{
|
||||
materialService.batchDelete(model.getMaterialIDs());
|
||||
model.getShowModel().setMsgTip("成功");
|
||||
//记录操作日志使用
|
||||
tipMsg = "成功";
|
||||
tipType = 0;
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>批量删除物料ID为:" + model.getMaterialIDs() + "信息异常", e);
|
||||
tipMsg = "失败";
|
||||
tipType = 1;
|
||||
}
|
||||
|
||||
logService.create(new Logdetails(getUser(), "批量删除物料", model.getClientIp(),
|
||||
new Timestamp(System.currentTimeMillis())
|
||||
, tipType, "批量删除物料ID为 "+ model.getMaterialIDs() + " " + tipMsg + "!", "批量删除物料" + tipMsg));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找物料信息
|
||||
* @return
|
||||
*/
|
||||
public void findBy()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Material> pageUtil = new PageUtil<Material>();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
Long lei=model.getCategoryId();
|
||||
if(1==lei) //判断值还真不能用String类型的判断
|
||||
{
|
||||
pageUtil.setAdvSearch(getCondition_all());
|
||||
}
|
||||
else if(1!=lei)
|
||||
{
|
||||
pageUtil.setAdvSearch(getCondition());
|
||||
}
|
||||
materialService.find(pageUtil);
|
||||
List<Material> dataList = pageUtil.getPageList();
|
||||
|
||||
//开始拼接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(Material material:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", material.getId());
|
||||
item.put("Name", material.getName());
|
||||
item.put("Model", material.getModel());
|
||||
item.put("Color", material.getColor());
|
||||
item.put("Unit", material.getUnit());
|
||||
item.put("Remark", material.getRemark());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找物料信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询物料信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找物料信息-下拉框
|
||||
* @return
|
||||
*/
|
||||
public void findBySelect()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Material> pageUtil = new PageUtil<Material>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getCondition_Select());
|
||||
materialService.find(pageUtil);
|
||||
List<Material> dataList = pageUtil.getPageList();
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Material material:dataList)
|
||||
{
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", material.getId());
|
||||
//供应商名称
|
||||
item.put("MaterialName", ((material.getModel().equals(""))?"":""+material.getModel()) +" "+ material.getName() + ((material.getColor() == null)?"":"("+material.getColor() + ")"));
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
//回写查询结果
|
||||
toClient(dataArray.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找物料信息-统计排序
|
||||
* @return
|
||||
*/
|
||||
public void findByOrder()
|
||||
{
|
||||
try
|
||||
{
|
||||
PageUtil<Material> pageUtil = new PageUtil<Material>();
|
||||
pageUtil.setPageSize(0);
|
||||
pageUtil.setCurPage(0);
|
||||
pageUtil.setAdvSearch(getCondition_Order());
|
||||
materialService.find(pageUtil);
|
||||
List<Material> dataList = pageUtil.getPageList();
|
||||
//存放数据json数组
|
||||
JSONObject outer = new JSONObject();
|
||||
String mId = "";
|
||||
if(null != dataList)
|
||||
{
|
||||
for(Material material:dataList)
|
||||
{
|
||||
mId = mId + material.getId() + ",";
|
||||
}
|
||||
}
|
||||
if(mId!="") {
|
||||
mId = mId.substring(0, mId.lastIndexOf(","));
|
||||
}
|
||||
outer.put("mIds", mId);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (DataAccessException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件(查全部)
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_all()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("CategoryId_s_in", model.getCategoryIds());
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-下拉框
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_Select()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Id_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件-下拉框
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> getCondition_Order()
|
||||
{
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("Name,Model_s_order", "asc");
|
||||
return condition;
|
||||
}
|
||||
|
||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||
@Override
|
||||
public MaterialModel getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setMaterialService(MaterialIService materialService)
|
||||
{
|
||||
this.materialService = materialService;
|
||||
}
|
||||
}
|
||||
275
src/com/jsh/action/materials/MaterialCategoryAction.java
Normal file
275
src/com/jsh/action/materials/MaterialCategoryAction.java
Normal file
@ -0,0 +1,275 @@
|
||||
package com.jsh.action.materials;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.base.BaseAction;
|
||||
import com.jsh.base.Log;
|
||||
import com.jsh.model.po.MaterialCategory;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
import com.jsh.model.vo.materials.MaterialCategoryModel;
|
||||
import com.jsh.service.materials.MaterialCategoryIService;
|
||||
import com.jsh.util.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;
|
||||
}
|
||||
}
|
||||
273
src/com/jsh/action/materials/PersonAction.java
Normal file
273
src/com/jsh/action/materials/PersonAction.java
Normal file
@ -0,0 +1,273 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
116
src/com/jsh/base/BaseAction.java
Normal file
116
src/com/jsh/base/BaseAction.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.ModelDriven;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.service.basic.LogIService;
|
||||
/**
|
||||
* struts2工具类
|
||||
* @author andy
|
||||
* struts2 base action 一些常用方法获取
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BaseAction<T> extends ActionSupport implements ModelDriven<T>
|
||||
{
|
||||
public LogIService logService;
|
||||
|
||||
/**
|
||||
* 操作日志使用 是否成功表示
|
||||
*/
|
||||
public String tipMsg = "成功";
|
||||
|
||||
/**
|
||||
* 操作日志使用 是否成功表示 0 ==成功 1==失败
|
||||
*/
|
||||
public short tipType = 0;
|
||||
|
||||
public void setLogService(LogIService logService)
|
||||
{
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取session
|
||||
* @return
|
||||
*/
|
||||
public static Map<String,Object> getSession()
|
||||
{
|
||||
return ActionContext.getContext().getSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取request
|
||||
* @return
|
||||
*/
|
||||
public static HttpServletRequest getRequest()
|
||||
{
|
||||
return ServletActionContext.getRequest();
|
||||
}
|
||||
/**
|
||||
* 获取response
|
||||
* @return response
|
||||
*/
|
||||
public static HttpServletResponse getResponse()
|
||||
{
|
||||
return ServletActionContext.getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加错误信息
|
||||
* @param anErrorMessage
|
||||
*/
|
||||
public void addActionError(String anErrorMessage)
|
||||
{
|
||||
super.addActionError(anErrorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加消息
|
||||
* @param aMessage
|
||||
*/
|
||||
public void addActionMessage(String aMessage)
|
||||
{
|
||||
clearErrorsAndMessages();
|
||||
super.addActionMessage(aMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字段错误
|
||||
* @param fieldName
|
||||
* @param errorMessage
|
||||
*/
|
||||
public void addFieldError(String fieldName, String errorMessage)
|
||||
{
|
||||
clearErrorsAndMessages();
|
||||
super.addFieldError(fieldName, errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
* @return 登录用户对象
|
||||
*/
|
||||
public Basicuser getUser()
|
||||
{
|
||||
return (Basicuser)getSession().get("user");
|
||||
}
|
||||
|
||||
/**
|
||||
* 回写客户端数据
|
||||
* @throws IOException
|
||||
*/
|
||||
public void toClient(String jsonData) throws IOException
|
||||
{
|
||||
HttpServletResponse response = ServletActionContext.getResponse();
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
response.getWriter().print(jsonData);
|
||||
}
|
||||
}
|
||||
137
src/com/jsh/base/BaseDAO.java
Normal file
137
src/com/jsh/base/BaseDAO.java
Normal file
@ -0,0 +1,137 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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;
|
||||
|
||||
public class BaseDAO<T> extends HibernateDaoSupport implements BaseIDAO<T>
|
||||
{
|
||||
protected Class<T> entityClass;
|
||||
|
||||
public void setPoJoClass(Class<T> c)
|
||||
{
|
||||
this.entityClass = c;
|
||||
}
|
||||
|
||||
protected Class<T> getEntityClass()
|
||||
{
|
||||
return this.entityClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable create(T t) throws DataAccessException
|
||||
{
|
||||
return this.getHibernateTemplate().save(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(T t) throws DataAccessException
|
||||
{
|
||||
this.getHibernateTemplate().delete(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(Long objID) throws DataAccessException
|
||||
{
|
||||
return (T) this.getHibernateTemplate().get(getEntityClass(), objID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(T t) throws DataAccessException
|
||||
{
|
||||
this.getHibernateTemplate().update(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDelete(String objIDs) throws DataAccessException
|
||||
{
|
||||
this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in ("+ objIDs + ")");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void find(PageUtil<T> pageUtil) throws DataAccessException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
|
||||
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+
|
||||
SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
|
||||
// 分页查询
|
||||
int pageNo = pageUtil.getCurPage();
|
||||
int pageSize = pageUtil.getPageSize();
|
||||
if (0 != pageNo && 0 != pageSize)
|
||||
{
|
||||
query.setFirstResult((pageNo - 1) * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<T> find(Map<String, Object> conditon)throws DataAccessException
|
||||
{
|
||||
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<T> find(String hql) throws DataAccessException
|
||||
{
|
||||
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<T> find(Map<String, Object> conditon, int pageSize, int pageNo)throws DataAccessException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
|
||||
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
|
||||
query.setFirstResult((pageNo - 1) * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<T> find(String hql, int pageSize, int pageNo)throws DataAccessException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
|
||||
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
|
||||
query.setFirstResult((pageNo - 1) * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Integer countSum(Map<String, Object> conditon)throws DataAccessException
|
||||
{
|
||||
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
|
||||
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)).list();
|
||||
return dataList ==null?0:dataList.size();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Integer countSum(String hql) throws DataAccessException
|
||||
{
|
||||
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
|
||||
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql).list();
|
||||
return dataList ==null?0:dataList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(T t) throws DataAccessException
|
||||
{
|
||||
this.getHibernateTemplate().save(t);
|
||||
}
|
||||
}
|
||||
124
src/com/jsh/base/BaseIDAO.java
Normal file
124
src/com/jsh/base/BaseIDAO.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
/**
|
||||
* 常用增删改查操作
|
||||
* @author andy
|
||||
* @param <T>
|
||||
*/
|
||||
public interface BaseIDAO<T>
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置操作类对象
|
||||
* @param paramClass
|
||||
*/
|
||||
void setPoJoClass(Class<T> paramClass);
|
||||
|
||||
/**
|
||||
* 增加
|
||||
* @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 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 conditon 查询条件
|
||||
* @return 查询列表数据
|
||||
*/
|
||||
List<T> find(Map<String,Object> conditon)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 根据hql查询 --没有分页信息
|
||||
* @param hql hibernate查询
|
||||
* @return 查询列表数据
|
||||
*/
|
||||
List<T> find(String hql)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 根据搜索条件查询--分页
|
||||
* @param conditon 查询条件
|
||||
* @param pageSize 每页个数
|
||||
* @param pageNo 页码
|
||||
* @return 查询列表数据
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
List<T> find(Map<String,Object> conditon,int pageSize,int pageNo)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 根据hql查询--分页
|
||||
* @param hql hibernate查询语句
|
||||
* @param pageSize 每页个数
|
||||
* @param pageNo 页码
|
||||
* @return 查询列表数据
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
List<T> find(String hql,int pageSize,int pageNo)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 查找符合条件的总数
|
||||
* @param conditon
|
||||
* @return
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Integer countSum(Map<String,Object> conditon)throws DataAccessException;
|
||||
|
||||
/**
|
||||
* 查找符合条件的总数
|
||||
* @param hql
|
||||
* @return
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
Integer countSum(String hql)throws DataAccessException;
|
||||
}
|
||||
105
src/com/jsh/base/BaseIService.java
Normal file
105
src/com/jsh/base/BaseIService.java
Normal file
@ -0,0 +1,105 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
137
src/com/jsh/base/BaseService.java
Normal file
137
src/com/jsh/base/BaseService.java
Normal file
@ -0,0 +1,137 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public abstract class BaseService<T> implements BaseIService<T>
|
||||
{
|
||||
/**
|
||||
* Dao对象
|
||||
*/
|
||||
private BaseIDAO<T> baseDao;
|
||||
|
||||
protected Class<T> entityClass;
|
||||
|
||||
public void setBaseDao(BaseIDAO<T> baseDao)
|
||||
{
|
||||
this.baseDao = baseDao;
|
||||
setPoJoClass(getEntityClass());
|
||||
}
|
||||
|
||||
protected BaseIDAO<T> getBaseDao()
|
||||
{
|
||||
return this.baseDao;
|
||||
}
|
||||
|
||||
private void setPoJoClass(Class<T> c)
|
||||
{
|
||||
this.baseDao.setPoJoClass(c);
|
||||
}
|
||||
|
||||
protected abstract Class<T> getEntityClass();
|
||||
|
||||
@Override
|
||||
public Serializable create(T t) throws DataAccessException
|
||||
{
|
||||
return baseDao.create(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(T t) throws DataAccessException
|
||||
{
|
||||
baseDao.save(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(T t) throws DataAccessException
|
||||
{
|
||||
baseDao.delete(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) throws DataAccessException
|
||||
{
|
||||
baseDao.batchDelete(id.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(Long objID) throws DataAccessException
|
||||
{
|
||||
return baseDao.get(objID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(T t) throws DataAccessException
|
||||
{
|
||||
baseDao.update(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDelete(String objIDs) throws DataAccessException
|
||||
{
|
||||
baseDao.batchDelete(objIDs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void find(PageUtil<T> pageUtil) throws DataAccessException
|
||||
{
|
||||
baseDao.find(pageUtil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkIsNameExist(String filedName, String filedVale,String idFiled,Long objectID) throws DataAccessException
|
||||
{
|
||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put(filedName + "_s_eq", filedVale);
|
||||
condition.put(idFiled + "_n_neq", objectID);
|
||||
pageUtil.setAdvSearch(condition);
|
||||
baseDao.find(pageUtil);
|
||||
|
||||
List<T> dataList = pageUtil.getPageList();
|
||||
if(null != dataList && dataList.size() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException
|
||||
{
|
||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put(TypeName + "_s_eq", TypeVale);
|
||||
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
||||
condition.put(UBName + "_s_like", UBValue);
|
||||
pageUtil.setAdvSearch(condition);
|
||||
baseDao.find(pageUtil);
|
||||
|
||||
List<T> dataList = pageUtil.getPageList();
|
||||
if(null != dataList && dataList.size() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException
|
||||
{
|
||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put(TypeName + "_s_eq", TypeVale);
|
||||
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
||||
pageUtil.setAdvSearch(condition);
|
||||
baseDao.find(pageUtil);
|
||||
|
||||
List<T> dataList = pageUtil.getPageList();
|
||||
if(null != dataList && dataList.size() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
174
src/com/jsh/base/Log.java
Normal file
174
src/com/jsh/base/Log.java
Normal file
@ -0,0 +1,174 @@
|
||||
package com.jsh.base;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* 封装log4j日志信息,打印日志信息类
|
||||
* @author andy
|
||||
* @since 2014-01-22
|
||||
*/
|
||||
public class Log
|
||||
{
|
||||
/**
|
||||
* 根据异常信息获取调用类的信息
|
||||
*/
|
||||
private static final Exception ex = new Exception();
|
||||
|
||||
/**
|
||||
* 获取Log4j实例
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger("ams");
|
||||
|
||||
/**
|
||||
* 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 = "##########";
|
||||
|
||||
/**
|
||||
* 打印deug日期信息
|
||||
* @param msg 日志信息
|
||||
*/
|
||||
public static void debugFileSync(Object msg)
|
||||
{
|
||||
log.debug(getLogDetail(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印debug异常信息
|
||||
* @param msg 日志信息
|
||||
* @param e 异常堆栈
|
||||
*/
|
||||
public static void debugFileSync(Object msg, Throwable e)
|
||||
{
|
||||
log.debug(getLogDetail(msg), e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印info日志信息
|
||||
* @param msg 日志信息
|
||||
*/
|
||||
public static void infoFileSync(Object msg)
|
||||
{
|
||||
log.info(getLogDetail(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印 info日志带异常信息
|
||||
* @param msg 日志信息
|
||||
* @param e 异常堆栈
|
||||
*/
|
||||
public static void infoFileSync(Object msg, Throwable e)
|
||||
{
|
||||
log.info(getLogDetail(msg), e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印warn日期信息
|
||||
* @param msg 日志信息
|
||||
*/
|
||||
public static void warnFileSync(Object msg)
|
||||
{
|
||||
log.warn(getLogDetail(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印warn日志信息带异常
|
||||
* @param msg日志信息
|
||||
* @param e 异常堆栈
|
||||
*/
|
||||
public static void warnFileSync(Object msg, Throwable e)
|
||||
{
|
||||
log.warn(getLogDetail(msg), e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印error日志信息
|
||||
* @param msg 日志信息
|
||||
*/
|
||||
public static void errorFileSync(Object msg)
|
||||
{
|
||||
log.error(getLogDetail(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印error日志信息带异常
|
||||
* @param msg 日志信息
|
||||
* @param e 异常堆栈
|
||||
*/
|
||||
public static void errorFileSync(Object msg, Throwable e)
|
||||
{
|
||||
log.error(getLogDetail(msg), e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印fatal日志信息
|
||||
* @param msg 日志信息
|
||||
*/
|
||||
public static void fatalFileSync(Object msg)
|
||||
{
|
||||
log.fatal(getLogDetail(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印fatal日志信息带异常
|
||||
* @param msg 日志信息
|
||||
* @param e 异常堆栈
|
||||
*/
|
||||
public static void fatalFileSync(Object msg, Throwable e)
|
||||
{
|
||||
log.fatal(getLogDetail(msg), e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼装日志详细信息
|
||||
* @param message 要打印的日志信息
|
||||
* @return 封装后的日志详细信息
|
||||
*/
|
||||
private static synchronized String getLogDetail(Object message)
|
||||
{
|
||||
String msg = "";
|
||||
if (null != message)
|
||||
msg = message.toString();
|
||||
StringBuffer bf = new StringBuffer();
|
||||
try
|
||||
{
|
||||
ex.fillInStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StackTraceElement[] trace = ex.getStackTrace();
|
||||
//获取异常堆栈中的调用类信息
|
||||
final int pos = 2;
|
||||
bf.append(msg);
|
||||
bf.append(" [class:");
|
||||
bf.append(trace[pos].getClassName());
|
||||
bf.append(" method:");
|
||||
bf.append(trace[pos].getMethodName());
|
||||
bf.append(" line:");
|
||||
bf.append(trace[pos].getLineNumber());
|
||||
bf.append("]");
|
||||
}
|
||||
return bf.toString();
|
||||
}
|
||||
}
|
||||
119
src/com/jsh/constants/asset/AssetConstants.java
Normal file
119
src/com/jsh/constants/asset/AssetConstants.java
Normal file
@ -0,0 +1,119 @@
|
||||
package com.jsh.constants.asset;
|
||||
|
||||
/**
|
||||
* 定义资产管理常量
|
||||
* @author andy
|
||||
*/
|
||||
public interface AssetConstants
|
||||
{
|
||||
/**
|
||||
* 公共常量
|
||||
* @author andy
|
||||
*/
|
||||
public class Common
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产常量--导入导出excel表格业务相关
|
||||
* @author andy
|
||||
*/
|
||||
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";
|
||||
}
|
||||
}
|
||||
35
src/com/jsh/constants/asset/ExcelConstantsCode.java
Normal file
35
src/com/jsh/constants/asset/ExcelConstantsCode.java
Normal file
@ -0,0 +1,35 @@
|
||||
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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
36
src/com/jsh/constants/common/AmsConstants.java
Normal file
36
src/com/jsh/constants/common/AmsConstants.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.jsh.constants.common;
|
||||
|
||||
public interface AmsConstants
|
||||
{
|
||||
/**
|
||||
* 定义资产管理公共常量
|
||||
* @author andy
|
||||
*/
|
||||
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 = "##########";
|
||||
}
|
||||
}
|
||||
35
src/com/jsh/constants/common/ExceptionCodeConstants.java
Normal file
35
src/com/jsh/constants/common/ExceptionCodeConstants.java
Normal file
@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
65
src/com/jsh/constants/common/LogModuleConstants.java
Normal file
65
src/com/jsh/constants/common/LogModuleConstants.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.jsh.constants.common;
|
||||
|
||||
public interface LogModuleConstants
|
||||
{
|
||||
/**
|
||||
* 系统管理模块名称定义
|
||||
* @author andy
|
||||
*/
|
||||
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 andy
|
||||
*/
|
||||
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 andy
|
||||
*/
|
||||
public class LogModuleNameCode
|
||||
{
|
||||
/**
|
||||
* 日志管理模块日志管理
|
||||
*/
|
||||
public static final String MODULE_LOG_MANAGE = "日志管理";
|
||||
}
|
||||
}
|
||||
17
src/com/jsh/dao/asset/AssetDAO.java
Normal file
17
src/com/jsh/dao/asset/AssetDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.asset;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Asset;
|
||||
|
||||
public class AssetDAO extends BaseDAO<Asset> implements AssetIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Asset> getEntityClass()
|
||||
{
|
||||
return Asset.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/asset/AssetIDAO.java
Normal file
9
src/com/jsh/dao/asset/AssetIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.asset;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Asset;
|
||||
|
||||
public interface AssetIDAO extends BaseIDAO<Asset>
|
||||
{
|
||||
|
||||
}
|
||||
21
src/com/jsh/dao/asset/ReportDAO.java
Normal file
21
src/com/jsh/dao/asset/ReportDAO.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.jsh.dao.asset;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
|
||||
public class ReportDAO extends HibernateDaoSupport implements ReportIDAO
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType +") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
}
|
||||
16
src/com/jsh/dao/asset/ReportIDAO.java
Normal file
16
src/com/jsh/dao/asset/ReportIDAO.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.jsh.dao.asset;
|
||||
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public interface ReportIDAO
|
||||
{
|
||||
/**
|
||||
* 查找资产列表
|
||||
* @param pageUtil 分页工具类
|
||||
* @param reportType 报表统计字段
|
||||
* @throws AmsException
|
||||
*/
|
||||
void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException;
|
||||
}
|
||||
17
src/com/jsh/dao/basic/AppDAO.java
Normal file
17
src/com/jsh/dao/basic/AppDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.App;
|
||||
|
||||
public class AppDAO extends BaseDAO<App> implements AppIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<App> getEntityClass()
|
||||
{
|
||||
return App.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/AppIDAO.java
Normal file
9
src/com/jsh/dao/basic/AppIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.App;
|
||||
|
||||
public interface AppIDAO extends BaseIDAO<App>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/AssetNameDAO.java
Normal file
17
src/com/jsh/dao/basic/AssetNameDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Assetname;
|
||||
|
||||
public class AssetNameDAO extends BaseDAO<Assetname> implements AssetNameIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Assetname> getEntityClass()
|
||||
{
|
||||
return Assetname.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/AssetNameIDAO.java
Normal file
9
src/com/jsh/dao/basic/AssetNameIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Assetname;
|
||||
|
||||
public interface AssetNameIDAO extends BaseIDAO<Assetname>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/CategoryDAO.java
Normal file
17
src/com/jsh/dao/basic/CategoryDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Category;
|
||||
|
||||
public class CategoryDAO extends BaseDAO<Category> implements CategoryIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Category> getEntityClass()
|
||||
{
|
||||
return Category.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/CategoryIDAO.java
Normal file
9
src/com/jsh/dao/basic/CategoryIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Category;
|
||||
|
||||
public interface CategoryIDAO extends BaseIDAO<Category>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/DepotDAO.java
Normal file
17
src/com/jsh/dao/basic/DepotDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Depot;
|
||||
|
||||
public class DepotDAO extends BaseDAO<Depot> implements DepotIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Depot> getEntityClass()
|
||||
{
|
||||
return Depot.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/DepotIDAO.java
Normal file
9
src/com/jsh/dao/basic/DepotIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Depot;
|
||||
|
||||
public interface DepotIDAO extends BaseIDAO<Depot>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/FunctionsDAO.java
Normal file
17
src/com/jsh/dao/basic/FunctionsDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Functions;
|
||||
|
||||
public class FunctionsDAO extends BaseDAO<Functions> implements FunctionsIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Functions> getEntityClass()
|
||||
{
|
||||
return Functions.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/FunctionsIDAO.java
Normal file
9
src/com/jsh/dao/basic/FunctionsIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Functions;
|
||||
|
||||
public interface FunctionsIDAO extends BaseIDAO<Functions>
|
||||
{
|
||||
|
||||
}
|
||||
18
src/com/jsh/dao/basic/LogDAO.java
Normal file
18
src/com/jsh/dao/basic/LogDAO.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
|
||||
public class LogDAO extends BaseDAO<Logdetails> implements LogIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Logdetails> getEntityClass()
|
||||
{
|
||||
return Logdetails.class;
|
||||
}
|
||||
|
||||
}
|
||||
13
src/com/jsh/dao/basic/LogIDAO.java
Normal file
13
src/com/jsh/dao/basic/LogIDAO.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Logdetails;
|
||||
|
||||
/**
|
||||
* 日志相关处理接口
|
||||
* @author angel
|
||||
*/
|
||||
public interface LogIDAO extends BaseIDAO<Logdetails>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/RoleDAO.java
Normal file
17
src/com/jsh/dao/basic/RoleDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Role;
|
||||
|
||||
public class RoleDAO extends BaseDAO<Role> implements RoleIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Role> getEntityClass()
|
||||
{
|
||||
return Role.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/RoleIDAO.java
Normal file
9
src/com/jsh/dao/basic/RoleIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Role;
|
||||
|
||||
public interface RoleIDAO extends BaseIDAO<Role>
|
||||
{
|
||||
|
||||
}
|
||||
19
src/com/jsh/dao/basic/SupplierDAO.java
Normal file
19
src/com/jsh/dao/basic/SupplierDAO.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Supplier;
|
||||
|
||||
public class SupplierDAO extends BaseDAO<Supplier> implements SupplierIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Supplier> getEntityClass()
|
||||
{
|
||||
return Supplier.class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
src/com/jsh/dao/basic/SupplierIDAO.java
Normal file
9
src/com/jsh/dao/basic/SupplierIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Supplier;
|
||||
|
||||
public interface SupplierIDAO extends BaseIDAO<Supplier>
|
||||
{
|
||||
|
||||
}
|
||||
32
src/com/jsh/dao/basic/UserBusinessDAO.java
Normal file
32
src/com/jsh/dao/basic/UserBusinessDAO.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.Asset;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
|
||||
public class UserBusinessDAO extends BaseDAO<UserBusiness> implements UserBusinessIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<UserBusiness> getEntityClass()
|
||||
{
|
||||
return UserBusiness.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(id),sum(id) from UserBusiness userBusiness where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
}
|
||||
14
src/com/jsh/dao/basic/UserBusinessIDAO.java
Normal file
14
src/com/jsh/dao/basic/UserBusinessIDAO.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public interface UserBusinessIDAO extends BaseIDAO<UserBusiness>
|
||||
{
|
||||
/*
|
||||
* 测试hql语句
|
||||
*/
|
||||
void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException;
|
||||
}
|
||||
19
src/com/jsh/dao/basic/UserDAO.java
Normal file
19
src/com/jsh/dao/basic/UserDAO.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
|
||||
public class UserDAO extends BaseDAO<Basicuser> implements UserIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Basicuser> getEntityClass()
|
||||
{
|
||||
return Basicuser.class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
src/com/jsh/dao/basic/UserIDAO.java
Normal file
9
src/com/jsh/dao/basic/UserIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Basicuser;
|
||||
|
||||
public interface UserIDAO extends BaseIDAO<Basicuser>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/basic/VisitAccountDAO.java
Normal file
17
src/com/jsh/dao/basic/VisitAccountDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.VisitAccount;
|
||||
|
||||
public class VisitAccountDAO extends BaseDAO<VisitAccount> implements VisitAccountIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<VisitAccount> getEntityClass()
|
||||
{
|
||||
return VisitAccount.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/basic/VisitAccountIDAO.java
Normal file
9
src/com/jsh/dao/basic/VisitAccountIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.VisitAccount;
|
||||
|
||||
public interface VisitAccountIDAO extends BaseIDAO<VisitAccount>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/materials/BuildingDAO.java
Normal file
17
src/com/jsh/dao/materials/BuildingDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Building;
|
||||
|
||||
public class BuildingDAO extends BaseDAO<Building> implements BuildingIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Building> getEntityClass()
|
||||
{
|
||||
return Building.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/materials/BuildingIDAO.java
Normal file
9
src/com/jsh/dao/materials/BuildingIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Building;
|
||||
|
||||
public interface BuildingIDAO extends BaseIDAO<Building>
|
||||
{
|
||||
|
||||
}
|
||||
32
src/com/jsh/dao/materials/DepotHeadDAO.java
Normal file
32
src/com/jsh/dao/materials/DepotHeadDAO.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
|
||||
public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<DepotHead> getEntityClass()
|
||||
{
|
||||
return DepotHead.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException
|
||||
{
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
}
|
||||
15
src/com/jsh/dao/materials/DepotHeadIDAO.java
Normal file
15
src/com/jsh/dao/materials/DepotHeadIDAO.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.UserBusiness;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
|
||||
{
|
||||
/*
|
||||
* 获取MaxId
|
||||
*/
|
||||
void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException;
|
||||
}
|
||||
59
src/com/jsh/dao/materials/DepotItemDAO.java
Normal file
59
src/com/jsh/dao/materials/DepotItemDAO.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
import com.jsh.util.common.SearchConditionUtil;
|
||||
|
||||
public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<DepotItem> getEntityClass()
|
||||
{
|
||||
return DepotItem.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws AmsException
|
||||
{
|
||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||
Query query;
|
||||
if(isPrev) {
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
else {
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"' and MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException
|
||||
{
|
||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select * from jsh_depotitem where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
|
||||
// 分页查询
|
||||
int pageNo = pageUtil.getCurPage();
|
||||
int pageSize = pageUtil.getPageSize();
|
||||
if (0 != pageNo && 0 != pageSize)
|
||||
{
|
||||
query.setFirstResult((pageNo - 1) * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
}
|
||||
14
src/com/jsh/dao/materials/DepotItemIDAO.java
Normal file
14
src/com/jsh/dao/materials/DepotItemIDAO.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.exception.AmsException;
|
||||
import com.jsh.model.po.DepotHead;
|
||||
import com.jsh.model.po.DepotItem;
|
||||
import com.jsh.util.common.PageUtil;
|
||||
|
||||
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
|
||||
{
|
||||
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException;
|
||||
|
||||
void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException;
|
||||
}
|
||||
17
src/com/jsh/dao/materials/MaterialCategoryDAO.java
Normal file
17
src/com/jsh/dao/materials/MaterialCategoryDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.MaterialCategory;
|
||||
|
||||
public class MaterialCategoryDAO extends BaseDAO<MaterialCategory> implements MaterialCategoryIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<MaterialCategory> getEntityClass()
|
||||
{
|
||||
return MaterialCategory.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/materials/MaterialCategoryIDAO.java
Normal file
9
src/com/jsh/dao/materials/MaterialCategoryIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.MaterialCategory;
|
||||
|
||||
public interface MaterialCategoryIDAO extends BaseIDAO<MaterialCategory>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/materials/MaterialDAO.java
Normal file
17
src/com/jsh/dao/materials/MaterialDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Material;
|
||||
|
||||
public class MaterialDAO extends BaseDAO<Material> implements MaterialIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Material> getEntityClass()
|
||||
{
|
||||
return Material.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/materials/MaterialIDAO.java
Normal file
9
src/com/jsh/dao/materials/MaterialIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Material;
|
||||
|
||||
public interface MaterialIDAO extends BaseIDAO<Material>
|
||||
{
|
||||
|
||||
}
|
||||
17
src/com/jsh/dao/materials/PersonDAO.java
Normal file
17
src/com/jsh/dao/materials/PersonDAO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Person;
|
||||
|
||||
public class PersonDAO extends BaseDAO<Person> implements PersonIDAO
|
||||
{
|
||||
/**
|
||||
* 设置dao映射基类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Class<Person> getEntityClass()
|
||||
{
|
||||
return Person.class;
|
||||
}
|
||||
}
|
||||
9
src/com/jsh/dao/materials/PersonIDAO.java
Normal file
9
src/com/jsh/dao/materials/PersonIDAO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.jsh.dao.materials;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Person;
|
||||
|
||||
public interface PersonIDAO extends BaseIDAO<Person>
|
||||
{
|
||||
|
||||
}
|
||||
73
src/com/jsh/exception/AmsException.java
Normal file
73
src/com/jsh/exception/AmsException.java
Normal file
@ -0,0 +1,73 @@
|
||||
package com.jsh.exception;
|
||||
|
||||
/**
|
||||
* @title: 平台异常基类
|
||||
* @description: 用于包装一些异常信息,打印日志等服务
|
||||
* @author andy
|
||||
* @since: 2014-01-24
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AmsException extends Exception
|
||||
{
|
||||
public long errorCode = -1;
|
||||
|
||||
public String message ;
|
||||
|
||||
public AmsException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public AmsException(String message)
|
||||
{
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AmsException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AmsException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public AmsException(long errorCode)
|
||||
{
|
||||
super();
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public AmsException(String message, long errorCode)
|
||||
{
|
||||
super(message);
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AmsException(String message, long errorCode, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.errorCode = errorCode;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AmsException(long errorCode, Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public long getErrorCode()
|
||||
{
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
}
|
||||
24
src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java
Normal file
24
src/com/jsh/filter/common/OpenSessionInViewFilterExtend.java
Normal file
@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
83
src/com/jsh/filter/user/UserFilter.java
Normal file
83
src/com/jsh/filter/user/UserFilter.java
Normal file
@ -0,0 +1,83 @@
|
||||
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 andy
|
||||
* @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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
90
src/com/jsh/junitest/AmsTAsset.hbm.xml
Normal file
90
src/com/jsh/junitest/AmsTAsset.hbm.xml
Normal file
@ -0,0 +1,90 @@
|
||||
<?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">
|
||||
<!--
|
||||
Mapping file autogenerated by MyEclipse Persistence Tools
|
||||
-->
|
||||
<hibernate-mapping>
|
||||
<class name="com.jsh.junitest.AmsTAsset" table="ams_t_asset" catalog="ams">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<many-to-one name="amsTAssetname" class="com.jsh.junitest.AmsTAssetname" fetch="select">
|
||||
<column name="assetnameID" not-null="true" />
|
||||
</many-to-one>
|
||||
<many-to-one name="amsTBasicuserByUpdator" class="com.jsh.junitest.AmsTBasicuser" fetch="select">
|
||||
<column name="updator" />
|
||||
</many-to-one>
|
||||
<many-to-one name="amsTBasicuserByCreator" class="com.jsh.junitest.AmsTBasicuser" fetch="select">
|
||||
<column name="creator" />
|
||||
</many-to-one>
|
||||
<many-to-one name="amsTSupplier" class="com.jsh.junitest.AmsTSupplier" fetch="select">
|
||||
<column name="supplier" />
|
||||
</many-to-one>
|
||||
<many-to-one name="amsTBasicuserByUserId" class="com.jsh.junitest.AmsTBasicuser" fetch="select">
|
||||
<column name="userID" />
|
||||
</many-to-one>
|
||||
<property name="location" type="java.lang.String">
|
||||
<column name="location">
|
||||
<comment>位置</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="labels" type="java.lang.String">
|
||||
<column name="labels">
|
||||
<comment>标签:以空格为分隔符</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="status" type="java.lang.Short">
|
||||
<column name="status">
|
||||
<comment>资产的状态:0==在库,1==在用,2==消费</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="price" type="java.lang.Long">
|
||||
<column name="price" precision="10" scale="0">
|
||||
<comment>购买价格</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="purchasedate" type="java.sql.Timestamp">
|
||||
<column name="purchasedate" length="19">
|
||||
<comment>购买日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="periodofvalidity" type="java.sql.Timestamp">
|
||||
<column name="periodofvalidity" length="19">
|
||||
<comment>有效日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="warrantydate" type="java.sql.Timestamp">
|
||||
<column name="warrantydate" length="19">
|
||||
<comment>保修日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="assetnum" type="java.lang.String">
|
||||
<column name="assetnum">
|
||||
<comment>资产编号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="serialnum" type="java.lang.String">
|
||||
<column name="serialnum">
|
||||
<comment>资产序列号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description">
|
||||
<comment>描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="addMonth" type="java.lang.String">
|
||||
<column name="addMonth" length="30">
|
||||
<comment>资产添加时间,统计报表使用</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="createtime" type="java.sql.Timestamp">
|
||||
<column name="createtime" length="19" />
|
||||
</property>
|
||||
<property name="updatetime" type="java.sql.Timestamp">
|
||||
<column name="updatetime" length="19" />
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
10
src/com/jsh/junitest/common/ExtendsTest.java
Normal file
10
src/com/jsh/junitest/common/ExtendsTest.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.jsh.junitest.common;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class ExtendsTest extends TestCase
|
||||
{
|
||||
public void testExtends()
|
||||
{
|
||||
}
|
||||
}
|
||||
14
src/com/jsh/junitest/common/ForTest.java
Normal file
14
src/com/jsh/junitest/common/ForTest.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.jsh.junitest.common;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class ForTest extends TestCase
|
||||
{
|
||||
public void testrrr()
|
||||
{
|
||||
String[] aa= {"111","222","333"};
|
||||
for(String str:aa)
|
||||
System.out.println(str);
|
||||
System.out.println("bbb");
|
||||
}
|
||||
}
|
||||
156
src/com/jsh/junitest/common/ImportExcelTest.java
Normal file
156
src/com/jsh/junitest/common/ImportExcelTest.java
Normal file
@ -0,0 +1,156 @@
|
||||
package com.jsh.junitest.common;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
import com.jsh.model.po.Asset;
|
||||
|
||||
public class ImportExcelTest
|
||||
{
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private static final String excelPath = "D:/movie/qq.xls";
|
||||
|
||||
/**
|
||||
* 解析后的data
|
||||
*/
|
||||
private static Map<String,Asset> data = new LinkedHashMap<String, Asset>();
|
||||
|
||||
|
||||
/**
|
||||
* 解析数据格式
|
||||
*/
|
||||
public static void paseData()
|
||||
{
|
||||
int total = 0;
|
||||
try
|
||||
{
|
||||
//创建对Excel工作簿文件的引用
|
||||
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(excelPath));
|
||||
//创建对工作表的引用,获取第一个工作表的内容
|
||||
HSSFSheet sheet = workbook.getSheetAt(0);
|
||||
/**
|
||||
* =====================================
|
||||
* 1、此处要增加报盘文件的验证,如果不是报盘文件需要进行特殊的处理,3列
|
||||
* 2、报盘文件内容为空处理
|
||||
* 3、如果是修改过的报盘文件内容
|
||||
*/
|
||||
Iterator<Row> itsheet = sheet.rowIterator();
|
||||
while(itsheet.hasNext())
|
||||
{
|
||||
System.out.println();
|
||||
Row row = itsheet.next();
|
||||
|
||||
//excel表格第几行数据 从1开始 0 是表头
|
||||
int rowNum = row.getRowNum();
|
||||
/**
|
||||
* 表头跳过不读
|
||||
*/
|
||||
if(0 == rowNum)
|
||||
continue;
|
||||
total ++;
|
||||
Iterator<Cell> it = row.cellIterator();
|
||||
// PreAuthExcelTip preAuth = new PreAuthExcelTip();
|
||||
// preAuth.setAuthState(authState);
|
||||
// preAuth.setWrongRow(rowNum);
|
||||
Cell cell = null;
|
||||
String preAuthMacAddr = "";
|
||||
//判断行号
|
||||
int i = 0;
|
||||
while(it.hasNext())
|
||||
{
|
||||
cell = it.next();
|
||||
i = cell.getColumnIndex();
|
||||
|
||||
System.out.print(cell.getCellType() + " " + cell.getStringCellValue());
|
||||
if(1 == i)
|
||||
{
|
||||
String contentValue = cell.getStringCellValue();
|
||||
if(null == contentValue || "".equals(contentValue))
|
||||
break;
|
||||
// preAuth.setSnNo(cell.getStringCellValue());
|
||||
}
|
||||
if(2 == i)
|
||||
{
|
||||
String contentValue = cell.getStringCellValue();
|
||||
if(null == contentValue || "".equals(contentValue))
|
||||
break;
|
||||
preAuthMacAddr = contentValue;
|
||||
// preAuth.setMacAddr(PreAuthUtil.changeMacFormt(preAuthMacAddr));
|
||||
}
|
||||
}
|
||||
System.out.println("此行总共有" + i + "列");
|
||||
//报盘文件为3列,否则不是报盘文件
|
||||
// if(i != 2)
|
||||
// {
|
||||
// PreAuthUtil.showMessageDialog("导入文件格式不合法,请重新选择文件进行操作!");
|
||||
// return null;
|
||||
// }
|
||||
// //MAC地址合法添加到正确的MAC地址数组
|
||||
// if(PreAuthUtil.isMacAddress(preAuthMacAddr))
|
||||
// {
|
||||
// if(allMacAddress.contains(preAuthMacAddr))
|
||||
// {
|
||||
// repeatPreAuth.add(preAuth);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// allMacAddress.add(preAuthMacAddr);
|
||||
// rightPreAuth.add(preAuth);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// wrongPreAuth.add(preAuth);
|
||||
// }
|
||||
}
|
||||
|
||||
// if((null==rightPreAuth || rightPreAuth.size()==0)&& (null == wrongPreAuth|| wrongPreAuth.size() ==0)&&(null == repeatPreAuth ||repeatPreAuth.size() ==0))
|
||||
// {
|
||||
// PreAuthUtil.showMessageDialog("报盘文件内容为空,请重新选择!");
|
||||
// return map;
|
||||
// }
|
||||
// //处理完读取文件,返回处理结果
|
||||
// map.put("rightMacAddr", rightPreAuth);
|
||||
// map.put("wrongMacAddr", wrongPreAuth);
|
||||
// map.put("repeatMacAddr", repeatPreAuth);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
System.out.println("预授权读取文件异常 : " + e );
|
||||
e.printStackTrace();
|
||||
// PreAuthUtil.showMessageDialog("预授权读取excel文件异常:找不到指定文件!");
|
||||
// return map;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("预授权读取文件IO异常 : " + e );
|
||||
e.printStackTrace();
|
||||
// PreAuthUtil.showMessageDialog("读取excel文件异常,请确认文件格式是否正确!");
|
||||
// return map;
|
||||
}
|
||||
|
||||
System.out.println("excel表格总共有 " + total + " 条记录!");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
new ImportExcelTest().paseData();
|
||||
}
|
||||
|
||||
}
|
||||
72
src/com/jsh/junitest/common/SumTest.java
Normal file
72
src/com/jsh/junitest/common/SumTest.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.jsh.junitest.common;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SumTest extends TestCase
|
||||
{
|
||||
public void testSum()
|
||||
{
|
||||
//================宋芳====================
|
||||
int[] songfang = {6,6,6,-4,-4,-6,3,12,6,-6,6,-12,3,-6,12};
|
||||
int songfangSum = 0;
|
||||
int songying = 0;
|
||||
int songshu = 0;
|
||||
for(int i = 0 ;i < songfang.length;i ++)
|
||||
{
|
||||
songfangSum += songfang[i];
|
||||
if(songfang[i] > 0)
|
||||
songying ++;
|
||||
else
|
||||
songshu ++;
|
||||
}
|
||||
|
||||
System.out.println("宋芳斗地主局数:" + songfang.length + ",赢" + songying + "局,输" + songshu +"局,统计玩牌的计分是:" + songfangSum);
|
||||
//================宋芳====================
|
||||
|
||||
//===============王维========================
|
||||
int[] wangwei = {-3,-3,-3,8,2,12,-6,-6,6,3,-3,6,-6,3,-6};
|
||||
int wangweiSum = 0;
|
||||
int wangweiying = 0;
|
||||
int wangweishu = 0;
|
||||
for(int i = 0 ;i < wangwei.length;i ++)
|
||||
{
|
||||
wangweiSum += wangwei[i];
|
||||
if(wangwei[i] > 0)
|
||||
wangweiying ++;
|
||||
else
|
||||
wangweishu ++;
|
||||
}
|
||||
System.out.println("王维斗地主局数:" + wangwei.length + ",赢" + wangweiying + "局,输" + wangweishu +"局,统计玩牌的计分是:" + wangweiSum);
|
||||
//===============王维========================
|
||||
|
||||
//===============王鹏========================
|
||||
int[] wangpeng = {-3,-3,-3,-4,2,-6,3,-6,-12,3,-3,6,3,3,-6};
|
||||
int wangpengSum = 0;
|
||||
int wangpengying = 0;
|
||||
int wangpengshu = 0;
|
||||
for(int i = 0 ;i < wangpeng.length;i ++)
|
||||
{
|
||||
wangpengSum += wangpeng[i];
|
||||
if(wangpeng[i] > 0)
|
||||
wangpengying ++;
|
||||
else
|
||||
wangpengshu ++;
|
||||
}
|
||||
System.out.println("王鹏斗地主局数:" + wangwei.length + ",赢" + wangpengying + "局,输" + wangpengshu +"局,统计玩牌的计分是:" + wangpengSum);
|
||||
//===============王鹏========================
|
||||
|
||||
int[] jishenghua={3,-6,2,5,-9,4,7,-8,-6,-1,4};
|
||||
int jishenghuaSum=0;
|
||||
int jishenghuaYing=0;
|
||||
int jishenghuaShu=0;
|
||||
for(int i=0;i<jishenghua.length;i++)
|
||||
{
|
||||
jishenghuaSum+=jishenghua[i];
|
||||
if(jishenghua[i]>0)
|
||||
jishenghuaYing++;
|
||||
else
|
||||
jishenghuaShu++;
|
||||
}
|
||||
System.out.println("季圣华斗地主局数:"+jishenghua.length+",赢"+jishenghuaYing+"局,输"+jishenghuaShu+"局,统计玩牌的计分是:"+jishenghuaSum);
|
||||
}
|
||||
}
|
||||
18
src/com/jsh/junitest/common/whileTest.java
Normal file
18
src/com/jsh/junitest/common/whileTest.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.jsh.junitest.common;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class whileTest extends TestCase
|
||||
{
|
||||
public void testWhile()
|
||||
{
|
||||
int i = 0;
|
||||
for(;;i ++)
|
||||
{
|
||||
while(i == 10)
|
||||
System.out.println("aa" + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
127
src/com/jsh/junitest/json/CableStream.java
Normal file
127
src/com/jsh/junitest/json/CableStream.java
Normal file
@ -0,0 +1,127 @@
|
||||
package com.jsh.junitest.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CableStream implements Serializable
|
||||
{
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 频点频率
|
||||
*/
|
||||
private Integer cablehz;
|
||||
|
||||
/**
|
||||
* 符号率
|
||||
*/
|
||||
private Integer symbolrate;
|
||||
|
||||
/**
|
||||
* 调制方式
|
||||
*/
|
||||
private Integer cableMode;
|
||||
|
||||
/**
|
||||
* 传输编号
|
||||
*/
|
||||
private Integer transNum;
|
||||
|
||||
/**
|
||||
* 服务编号
|
||||
*/
|
||||
private Integer serviceNum;
|
||||
|
||||
/**
|
||||
* 码率
|
||||
*/
|
||||
private Float rate;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private Short cablenorms;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getCablehz()
|
||||
{
|
||||
return cablehz;
|
||||
}
|
||||
|
||||
public void setCablehz(Integer cablehz)
|
||||
{
|
||||
this.cablehz = cablehz;
|
||||
}
|
||||
|
||||
public Integer getSymbolrate()
|
||||
{
|
||||
return symbolrate;
|
||||
}
|
||||
|
||||
public void setSymbolrate(Integer symbolrate)
|
||||
{
|
||||
this.symbolrate = symbolrate;
|
||||
}
|
||||
|
||||
public Integer getCableMode()
|
||||
{
|
||||
return cableMode;
|
||||
}
|
||||
|
||||
public void setCableMode(Integer cableMode)
|
||||
{
|
||||
this.cableMode = cableMode;
|
||||
}
|
||||
|
||||
public Integer getTransNum()
|
||||
{
|
||||
return transNum;
|
||||
}
|
||||
|
||||
public void setTransNum(Integer transNum)
|
||||
{
|
||||
this.transNum = transNum;
|
||||
}
|
||||
|
||||
public Integer getServiceNum()
|
||||
{
|
||||
return serviceNum;
|
||||
}
|
||||
|
||||
public void setServiceNum(Integer serviceNum)
|
||||
{
|
||||
this.serviceNum = serviceNum;
|
||||
}
|
||||
|
||||
public Float getRate()
|
||||
{
|
||||
return rate;
|
||||
}
|
||||
|
||||
public void setRate(Float rate)
|
||||
{
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public Short getCablenorms()
|
||||
{
|
||||
return cablenorms;
|
||||
}
|
||||
|
||||
public void setCablenorms(Short cablenorms)
|
||||
{
|
||||
this.cablenorms = cablenorms;
|
||||
}
|
||||
}
|
||||
185
src/com/jsh/junitest/json/Channel.java
Normal file
185
src/com/jsh/junitest/json/Channel.java
Normal file
@ -0,0 +1,185 @@
|
||||
package com.jsh.junitest.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Channel implements Serializable
|
||||
{
|
||||
/**
|
||||
* 频道ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 频道名称
|
||||
*/
|
||||
private String channelName ;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
private Long category;
|
||||
|
||||
/**
|
||||
* 台标路径
|
||||
*/
|
||||
private String tvLogo;
|
||||
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
private Long area;
|
||||
|
||||
/**
|
||||
* 频道类型 0==直播 1==虚拟
|
||||
*/
|
||||
private Short type;
|
||||
|
||||
/**
|
||||
* json字符串
|
||||
*/
|
||||
private String ipStreamJson;
|
||||
|
||||
/**
|
||||
* ip流列表
|
||||
*/
|
||||
private List<IPStream> ipStream;
|
||||
|
||||
/**
|
||||
* json字符串
|
||||
*/
|
||||
private String cableStreamJson;
|
||||
|
||||
/**
|
||||
* cable流列表
|
||||
*/
|
||||
private List<CableStream> cableStream;
|
||||
|
||||
|
||||
public Channel()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Channel(String channelName, Long category, String tvLogo,
|
||||
Long area, Short type, String ipStreamJson,
|
||||
List<IPStream> ipStream, String cableStreamJson,
|
||||
List<CableStream> cableStream)
|
||||
{
|
||||
super();
|
||||
this.channelName = channelName;
|
||||
this.category = category;
|
||||
this.tvLogo = tvLogo;
|
||||
this.area = area;
|
||||
this.type = type;
|
||||
this.ipStreamJson = ipStreamJson;
|
||||
this.ipStream = ipStream;
|
||||
this.cableStreamJson = cableStreamJson;
|
||||
this.cableStream = cableStream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getChannelName()
|
||||
{
|
||||
return channelName;
|
||||
}
|
||||
|
||||
public void setChannelName(String channelName)
|
||||
{
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
public Long getCategory()
|
||||
{
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(Long category)
|
||||
{
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getTvLogo()
|
||||
{
|
||||
return tvLogo;
|
||||
}
|
||||
|
||||
public void setTvLogo(String tvLogo)
|
||||
{
|
||||
this.tvLogo = tvLogo;
|
||||
}
|
||||
|
||||
public Long getArea()
|
||||
{
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(Long area)
|
||||
{
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public Short getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Short type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<IPStream> getIpStream()
|
||||
{
|
||||
return ipStream;
|
||||
}
|
||||
|
||||
public void setIpStream(List<IPStream> ipStream)
|
||||
{
|
||||
this.ipStream = ipStream;
|
||||
}
|
||||
|
||||
public List<CableStream> getCableStream()
|
||||
{
|
||||
return cableStream;
|
||||
}
|
||||
|
||||
public void setCableStream(List<CableStream> cableStream)
|
||||
{
|
||||
this.cableStream = cableStream;
|
||||
}
|
||||
|
||||
public String getIpStreamJson()
|
||||
{
|
||||
return ipStreamJson;
|
||||
}
|
||||
|
||||
public void setIpStreamJson(String ipStreamJson)
|
||||
{
|
||||
this.ipStreamJson = ipStreamJson;
|
||||
}
|
||||
|
||||
public String getCableStreamJson()
|
||||
{
|
||||
return cableStreamJson;
|
||||
}
|
||||
|
||||
public void setCableStreamJson(String cableStreamJson)
|
||||
{
|
||||
this.cableStreamJson = cableStreamJson;
|
||||
}
|
||||
}
|
||||
75
src/com/jsh/junitest/json/ChannelUtil.java
Normal file
75
src/com/jsh/junitest/json/ChannelUtil.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.jsh.junitest.json;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
public class ChannelUtil
|
||||
{
|
||||
/**
|
||||
* 解析页面json字符串为IPStream对象列表
|
||||
* @param ipStreamStr json字符串
|
||||
* @return IPStream对象列表
|
||||
*/
|
||||
public static List<IPStream> parseJson2IPStream(String ipStreamStr)
|
||||
{
|
||||
List<IPStream> ipList = new ArrayList<IPStream>();
|
||||
JSONArray ipJson = JSONObject.fromObject(ipStreamStr).getJSONArray("ipJsonData");
|
||||
if(null != ipJson)
|
||||
{
|
||||
for(int i = 0;i < ipJson.size(); i ++)
|
||||
{
|
||||
JSONObject tempJson = JSONObject.fromObject(ipJson.get(i));
|
||||
IPStream ip = new IPStream();
|
||||
ip.setIPformat(Short.parseShort(tempJson.getString("ipFomate")));
|
||||
ip.setIPnorms(Short.parseShort(tempJson.getString("IPnorms")));
|
||||
ip.setIPUrl(tempJson.getString("IPAddress"));
|
||||
ip.setPort(tempJson.getInt("port"));
|
||||
ip.setProtocol(Short.parseShort(tempJson.getString("protocol")));
|
||||
ip.setRate(Float.parseFloat(tempJson.getString("iprate")));
|
||||
ip.setType(Short.parseShort(tempJson.getString("inOrout")));
|
||||
ipList.add(ip);
|
||||
}
|
||||
}
|
||||
return ipList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析页面json字符串为cableStream对象列表
|
||||
* @param cableStreamStr json字符串
|
||||
* @return cableStream对象列表
|
||||
*/
|
||||
public static List<CableStream> parseJson2CableStream(String cableStreamStr)
|
||||
{
|
||||
List<CableStream> cableList = new ArrayList<CableStream>();
|
||||
JSONArray cableJson = JSONObject.fromObject(cableStreamStr).getJSONArray("cableJsonData");
|
||||
if(null != cableJson)
|
||||
{
|
||||
for(int i = 0;i < cableJson.size(); i ++)
|
||||
{
|
||||
JSONObject tempJson = JSONObject.fromObject(cableJson.get(i));
|
||||
CableStream cable = new CableStream();
|
||||
cable.setCablehz(tempJson.getInt("cablehz"));
|
||||
cable.setCableMode(tempJson.getInt("cableMode"));
|
||||
cable.setCablenorms(Short.parseShort(tempJson.getString("cablenorms")));
|
||||
cable.setRate(Float.parseFloat(tempJson.getString("cablerate")));
|
||||
cable.setServiceNum(tempJson.getInt("serviceNum"));
|
||||
cable.setSymbolrate(tempJson.getInt("symbolrate"));
|
||||
cable.setTransNum(tempJson.getInt("transNum"));
|
||||
cableList.add(cable);
|
||||
}
|
||||
}
|
||||
return cableList;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String ipStreamStr = "{ipJsonData : [{\"iprate\":\"512.00\",\"IPnorms\":\"0\",\"ipFomate\":\"0\",\"inOrout\":\"0\",\"port\":\"512\",\"IPAddress\":\"11.03.12.23\",\"protocol\":\"0\",\"ipJsonIndex\":0}]}";
|
||||
ChannelUtil.parseJson2IPStream(ipStreamStr);
|
||||
|
||||
String cableStreamStr = "{cableJsonData:[{\"cablenorms\":\"0\",\"cablerate\":\"54\",\"serviceNum\":\"45\",\"transNum\":\"57\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"45\",\"cableJsonIndex\":0},{\"cablenorms\":\"0\",\"cablerate\":\"548\",\"serviceNum\":\"236\",\"transNum\":\"256\",\"cableMode\":\"64\",\"symbolrate\":\"56\",\"cablehz\":\"85\",\"cableJsonIndex\":1}]}";
|
||||
ChannelUtil.parseJson2CableStream(cableStreamStr);
|
||||
}
|
||||
}
|
||||
127
src/com/jsh/junitest/json/IPStream.java
Normal file
127
src/com/jsh/junitest/json/IPStream.java
Normal file
@ -0,0 +1,127 @@
|
||||
package com.jsh.junitest.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class IPStream implements Serializable
|
||||
{
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 协议
|
||||
*/
|
||||
private Short protocol;
|
||||
|
||||
/**
|
||||
*IP地址
|
||||
*/
|
||||
private String IPUrl;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 类型--输入输出 0==输入 1==输出
|
||||
*/
|
||||
private Short type;
|
||||
|
||||
/**
|
||||
* 视频格式
|
||||
*/
|
||||
private Short IPformat;
|
||||
|
||||
/**
|
||||
* 视频规格 0==标清 1==高清
|
||||
*/
|
||||
private Short IPnorms;
|
||||
|
||||
/**
|
||||
* 码率
|
||||
*/
|
||||
private Float rate;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Short getProtocol()
|
||||
{
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(Short protocol)
|
||||
{
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getIPUrl()
|
||||
{
|
||||
return IPUrl;
|
||||
}
|
||||
|
||||
public void setIPUrl(String iPUrl)
|
||||
{
|
||||
IPUrl = iPUrl;
|
||||
}
|
||||
|
||||
public Integer getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Short getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Short type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Short getIPformat()
|
||||
{
|
||||
return IPformat;
|
||||
}
|
||||
|
||||
public void setIPformat(Short iPformat)
|
||||
{
|
||||
IPformat = iPformat;
|
||||
}
|
||||
|
||||
public Short getIPnorms()
|
||||
{
|
||||
return IPnorms;
|
||||
}
|
||||
|
||||
public void setIPnorms(Short iPnorms)
|
||||
{
|
||||
IPnorms = iPnorms;
|
||||
}
|
||||
|
||||
public Float getRate()
|
||||
{
|
||||
return rate;
|
||||
}
|
||||
|
||||
public void setRate(Float rate)
|
||||
{
|
||||
this.rate = rate;
|
||||
}
|
||||
}
|
||||
28
src/com/jsh/junitest/json/JsonTest.java
Normal file
28
src/com/jsh/junitest/json/JsonTest.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.jsh.junitest.json;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
public class JsonTest extends TestCase
|
||||
{
|
||||
public void testJson()
|
||||
{
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("total", 8);
|
||||
JSONArray json = new JSONArray();
|
||||
// {"total":28,"rows":[
|
||||
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
||||
// ]}
|
||||
|
||||
for(int i = 0 ;i < 10 ;i ++)
|
||||
{
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("name", "andy" + i);
|
||||
jo.put("sex", "false" + i);
|
||||
json.add(jo);
|
||||
}
|
||||
outer.put("rows", json);
|
||||
System.out.println(outer.toString());
|
||||
}
|
||||
}
|
||||
37
src/com/jsh/junitest/spring/SpringTest.java
Normal file
37
src/com/jsh/junitest/spring/SpringTest.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.jsh.junitest.spring;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SpringTest extends TestCase
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
// @SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
// public BaseService()
|
||||
// {
|
||||
// // //加载 已经加载过的 spring配置文件内容
|
||||
// // WebApplicationContext wac =
|
||||
// // ContextLoader.getCurrentWebApplicationContext();
|
||||
// // // wac.getBean(beanID);
|
||||
// // ApplicationContext factory = new
|
||||
// // ClassPathXmlApplicationContext("spring/*-applicationContext.xml");
|
||||
// // ApplicationContext factory = new ClassPathXmlApplicationContext(new
|
||||
// // String[]{"spring/basic-applicationContext.xml",
|
||||
// // "spring/dao-applicationContext.xml"});
|
||||
// // this.baseDao = (BaseIDAO) factory.getBean("baseDao");
|
||||
// // // this.baseDao =
|
||||
// // ((BaseIDAO)BeanFactoryUtil.getBeanByClassPathAndBeanName("spring/dao-applicationContext.xml",
|
||||
// // "baseDao"));
|
||||
// BeanFactoryUtil util = BeanFactoryUtil.getInstance();
|
||||
//
|
||||
// this.baseDao = ((BaseIDAO<T>) util.getBean("baseDao"));
|
||||
//// ApplicationContext factory = new ClassPathXmlApplicationContext(new
|
||||
//// String[]{"spring/basic-applicationContext.xml",
|
||||
//// "spring/dao-applicationContext.xml"});
|
||||
//// this.baseDao = (BaseIDAO) factory.getBean("baseDao");
|
||||
// Class c = getEntityClass();
|
||||
// setPoJoClass(c);
|
||||
// }
|
||||
}
|
||||
}
|
||||
81
src/com/jsh/model/po/App.hbm.xml
Normal file
81
src/com/jsh/model/po/App.hbm.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?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.App" table="jsh_app">
|
||||
<id name="Id" type="java.lang.Long">
|
||||
<column name="Id"/>
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<property generated="never" lazy="false" name="Number" type="java.lang.String">
|
||||
<column length="50" name="Number">
|
||||
<comment>代号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Name" type="java.lang.String">
|
||||
<column length="50" name="Name">
|
||||
<comment>名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Type" type="java.lang.String">
|
||||
<column length="50" name="Type">
|
||||
<comment>类型</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Icon" type="java.lang.String">
|
||||
<column length="50" name="Icon">
|
||||
<comment>图标</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="URL" type="java.lang.String">
|
||||
<column length="50" name="URL">
|
||||
<comment>链接</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Width" type="java.lang.String">
|
||||
<column length="50" name="Width">
|
||||
<comment>宽度</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Height" type="java.lang.String">
|
||||
<column length="50" name="Height">
|
||||
<comment>高度</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="ReSize" type="boolean">
|
||||
<column length="1" name="ReSize">
|
||||
<comment>拉伸</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="OpenMax" type="boolean">
|
||||
<column length="1" name="OpenMax">
|
||||
<comment>最大化</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Flash" type="boolean">
|
||||
<column length="1" name="Flash">
|
||||
<comment>Flash</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="ZL" type="java.lang.String">
|
||||
<column length="50" name="ZL">
|
||||
<comment>种类</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Sort" type="java.lang.String">
|
||||
<column length="50" name="Sort">
|
||||
<comment>排序号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Remark" type="java.lang.String">
|
||||
<column length="200" name="Remark">
|
||||
<comment>备注</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Enabled" type="boolean">
|
||||
<column length="1" name="Enabled">
|
||||
<comment>启用</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
174
src/com/jsh/model/po/App.java
Normal file
174
src/com/jsh/model/po/App.java
Normal file
@ -0,0 +1,174 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class App implements java.io.Serializable
|
||||
{
|
||||
private Long Id;
|
||||
private String Number;
|
||||
private String Name;
|
||||
private String Type;
|
||||
private String Icon;
|
||||
private String URL;
|
||||
private String Width;
|
||||
private String Height;
|
||||
private Boolean ReSize;
|
||||
private Boolean OpenMax;
|
||||
private Boolean Flash;
|
||||
private String ZL;
|
||||
private String Sort;
|
||||
private String Remark;
|
||||
private Boolean Enabled;
|
||||
|
||||
|
||||
public App()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public App(Long Id)
|
||||
{
|
||||
this.Id = Id ;
|
||||
}
|
||||
|
||||
public App(String Number, String Name, String Type, String Icon, String URL, String Width,
|
||||
String Height, Boolean ReSize, Boolean OpenMax, Boolean Flash, String ZL, String Sort,
|
||||
String Remark, Boolean Enabled)
|
||||
{
|
||||
this.Number = Number;
|
||||
this.Name = Name;
|
||||
this.Type = Type;
|
||||
this.Icon = Icon;
|
||||
this.URL = URL;
|
||||
this.Width = Width;
|
||||
this.Height = Height;
|
||||
this.ReSize = ReSize;
|
||||
this.OpenMax = OpenMax;
|
||||
this.Flash = Flash;
|
||||
this.ZL = ZL;
|
||||
this.Sort = Sort;
|
||||
this.Remark = Remark;
|
||||
this.Enabled = Enabled;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return Number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
Number = number;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return Icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
Icon = icon;
|
||||
}
|
||||
|
||||
public String getURL() {
|
||||
return URL;
|
||||
}
|
||||
|
||||
public void setURL(String uRL) {
|
||||
URL = uRL;
|
||||
}
|
||||
|
||||
public String getWidth() {
|
||||
return Width;
|
||||
}
|
||||
|
||||
public void setWidth(String width) {
|
||||
Width = width;
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
return Height;
|
||||
}
|
||||
|
||||
public void setHeight(String height) {
|
||||
Height = height;
|
||||
}
|
||||
|
||||
public Boolean getReSize() {
|
||||
return ReSize;
|
||||
}
|
||||
|
||||
public void setReSize(Boolean reSize) {
|
||||
ReSize = reSize;
|
||||
}
|
||||
|
||||
public Boolean getOpenMax() {
|
||||
return OpenMax;
|
||||
}
|
||||
|
||||
public void setOpenMax(Boolean openMax) {
|
||||
OpenMax = openMax;
|
||||
}
|
||||
|
||||
public Boolean getFlash() {
|
||||
return Flash;
|
||||
}
|
||||
|
||||
public void setFlash(Boolean flash) {
|
||||
Flash = flash;
|
||||
}
|
||||
|
||||
public String getZL() {
|
||||
return ZL;
|
||||
}
|
||||
|
||||
public void setZL(String zL) {
|
||||
ZL = zL;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return Sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
Sort = sort;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return Remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
96
src/com/jsh/model/po/Asset.hbm.xml
Normal file
96
src/com/jsh/model/po/Asset.hbm.xml
Normal file
@ -0,0 +1,96 @@
|
||||
<?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.Asset" table="ams_t_asset">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
|
||||
<many-to-one name="assetname" class="com.jsh.model.po.Assetname" lazy="false">
|
||||
<column name="assetnameID" not-null="true" />
|
||||
</many-to-one>
|
||||
|
||||
<property name="location" type="java.lang.String">
|
||||
<column name="location">
|
||||
<comment>位置</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="labels" type="java.lang.String">
|
||||
<column name="labels">
|
||||
<comment>标签:以空格为分隔符</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="status" type="java.lang.Short">
|
||||
<column name="status">
|
||||
<comment>资产的状态:0==在库,1==在用,2==消费</comment>
|
||||
</column>
|
||||
</property>
|
||||
|
||||
<many-to-one name="user" class="com.jsh.model.po.Basicuser" lazy="false">
|
||||
<column name="userID"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="price" type="java.lang.Double">
|
||||
<column name="price" precision="22" scale="2">
|
||||
<comment>购买价格</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="purchasedate" type="java.sql.Timestamp">
|
||||
<column name="purchasedate" length="19">
|
||||
<comment>购买日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="periodofvalidity" type="java.sql.Timestamp">
|
||||
<column name="periodofvalidity" length="19">
|
||||
<comment>有效日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="warrantydate" type="java.sql.Timestamp">
|
||||
<column name="warrantydate" length="19">
|
||||
<comment>保修日期</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="assetnum" type="java.lang.String">
|
||||
<column name="assetnum">
|
||||
<comment>资产编号</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="serialnum" type="java.lang.String">
|
||||
<column name="serialnum">
|
||||
<comment>资产序列号</comment>
|
||||
</column>
|
||||
</property>
|
||||
|
||||
<many-to-one name="supplier" class="com.jsh.model.po.Supplier" lazy="false">
|
||||
<column name="supplier"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="addMonth" type="java.lang.String">
|
||||
<column name="addMonth" length="500">
|
||||
<comment>资产添加时间,统计报表使用</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="createtime" type="java.sql.Timestamp">
|
||||
<column name="createtime" length="19" />
|
||||
</property>
|
||||
|
||||
<many-to-one name="creator" class="com.jsh.model.po.Basicuser" lazy="false">
|
||||
<column name="creator"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="updatetime" type="java.sql.Timestamp">
|
||||
<column name="updatetime" length="19" />
|
||||
</property>
|
||||
|
||||
<many-to-one name="updator" class="com.jsh.model.po.Basicuser" lazy="false">
|
||||
<column name="updator"/>
|
||||
</many-to-one>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
379
src/com/jsh/model/po/Asset.java
Normal file
379
src/com/jsh/model/po/Asset.java
Normal file
@ -0,0 +1,379 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Asset implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private Assetname assetname;
|
||||
private String location;
|
||||
private Short status;
|
||||
private Basicuser user;
|
||||
private Double price;
|
||||
private Timestamp purchasedate;
|
||||
private Timestamp periodofvalidity;
|
||||
private Timestamp warrantydate;
|
||||
private String assetnum;
|
||||
private String serialnum;
|
||||
private Supplier supplier;
|
||||
private String labels;
|
||||
private String description;
|
||||
private String addMonth;
|
||||
private Timestamp createtime;
|
||||
private Basicuser creator;
|
||||
private Timestamp updatetime;
|
||||
private Basicuser updator;
|
||||
|
||||
//----------以下属性导入exel表格使用--------------------
|
||||
/**
|
||||
* 类型 right--正确 warn--警告 wrong--错误
|
||||
*/
|
||||
private Map<Integer,String> cellInfo;
|
||||
|
||||
/**
|
||||
* 行号
|
||||
*/
|
||||
private Integer rowLineNum;
|
||||
|
||||
/**
|
||||
* 保存价格
|
||||
*/
|
||||
private String priceStr;
|
||||
|
||||
/**
|
||||
* 资产名称
|
||||
*/
|
||||
private String assetnameStr;
|
||||
|
||||
/**
|
||||
* 资产类型
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 购买日期
|
||||
*/
|
||||
private String purchasedateStr;
|
||||
|
||||
/**
|
||||
* 有效日期
|
||||
*/
|
||||
private String periodofvalidityStr;
|
||||
|
||||
/**
|
||||
* 保修日期
|
||||
*/
|
||||
private String warrantydateStr;
|
||||
|
||||
public Asset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Asset(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Asset(Assetname assetname, String location,
|
||||
Short status, Basicuser user, Double price, Timestamp purchasedate,
|
||||
Timestamp periodofvalidity, Timestamp warrantydate,
|
||||
String assetnum, String serialnum, Supplier supplier,
|
||||
String description, Timestamp createtime, Basicuser creator,
|
||||
Timestamp updatetime,String labels, Basicuser updator,String addMonth)
|
||||
{
|
||||
super();
|
||||
this.assetname = assetname;
|
||||
this.location = location;
|
||||
this.status = status;
|
||||
this.user = user;
|
||||
this.price = price;
|
||||
this.purchasedate = purchasedate;
|
||||
this.periodofvalidity = periodofvalidity;
|
||||
this.warrantydate = warrantydate;
|
||||
this.assetnum = assetnum;
|
||||
this.serialnum = serialnum;
|
||||
this.supplier = supplier;
|
||||
this.description = description;
|
||||
this.createtime = createtime;
|
||||
this.creator = creator;
|
||||
this.updatetime = updatetime;
|
||||
this.updator = updator;
|
||||
this.labels = labels;
|
||||
this.addMonth = addMonth;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Assetname getAssetname()
|
||||
{
|
||||
return assetname;
|
||||
}
|
||||
|
||||
public void setAssetname(Assetname assetname)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
}
|
||||
|
||||
public String getLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location)
|
||||
{
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Short getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Short status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Basicuser getUser()
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(Basicuser user)
|
||||
{
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Double getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Timestamp getPurchasedate()
|
||||
{
|
||||
return purchasedate;
|
||||
}
|
||||
|
||||
public void setPurchasedate(Timestamp purchasedate)
|
||||
{
|
||||
this.purchasedate = purchasedate;
|
||||
}
|
||||
|
||||
public Timestamp getPeriodofvalidity()
|
||||
{
|
||||
return periodofvalidity;
|
||||
}
|
||||
|
||||
public void setPeriodofvalidity(Timestamp periodofvalidity)
|
||||
{
|
||||
this.periodofvalidity = periodofvalidity;
|
||||
}
|
||||
|
||||
public Timestamp getWarrantydate()
|
||||
{
|
||||
return warrantydate;
|
||||
}
|
||||
|
||||
public void setWarrantydate(Timestamp warrantydate)
|
||||
{
|
||||
this.warrantydate = warrantydate;
|
||||
}
|
||||
|
||||
public String getAssetnum()
|
||||
{
|
||||
return assetnum;
|
||||
}
|
||||
|
||||
public void setAssetnum(String assetnum)
|
||||
{
|
||||
this.assetnum = assetnum;
|
||||
}
|
||||
|
||||
public String getSerialnum()
|
||||
{
|
||||
return serialnum;
|
||||
}
|
||||
|
||||
public void setSerialnum(String serialnum)
|
||||
{
|
||||
this.serialnum = serialnum;
|
||||
}
|
||||
|
||||
public Supplier getSupplier()
|
||||
{
|
||||
return supplier;
|
||||
}
|
||||
|
||||
public void setSupplier(Supplier supplier)
|
||||
{
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Timestamp getCreatetime()
|
||||
{
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreatetime(Timestamp createtime)
|
||||
{
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
public Basicuser getCreator()
|
||||
{
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(Basicuser creator)
|
||||
{
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public Timestamp getUpdatetime()
|
||||
{
|
||||
return updatetime;
|
||||
}
|
||||
|
||||
public void setUpdatetime(Timestamp updatetime)
|
||||
{
|
||||
this.updatetime = updatetime;
|
||||
}
|
||||
|
||||
public Basicuser getUpdator()
|
||||
{
|
||||
return updator;
|
||||
}
|
||||
|
||||
public void setUpdator(Basicuser updator)
|
||||
{
|
||||
this.updator = updator;
|
||||
}
|
||||
|
||||
public String getLabels()
|
||||
{
|
||||
return labels;
|
||||
}
|
||||
|
||||
public void setLabels(String labels)
|
||||
{
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
public String getAddMonth()
|
||||
{
|
||||
return addMonth;
|
||||
}
|
||||
|
||||
public void setAddMonth(String addMonth)
|
||||
{
|
||||
this.addMonth = addMonth;
|
||||
}
|
||||
|
||||
public Integer getRowLineNum()
|
||||
{
|
||||
return rowLineNum;
|
||||
}
|
||||
|
||||
public void setRowLineNum(Integer rowLineNum)
|
||||
{
|
||||
this.rowLineNum = rowLineNum;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getCellInfo()
|
||||
{
|
||||
return cellInfo;
|
||||
}
|
||||
|
||||
public void setCellInfo(Map<Integer, String> cellInfo)
|
||||
{
|
||||
this.cellInfo = cellInfo;
|
||||
}
|
||||
|
||||
public String getPriceStr()
|
||||
{
|
||||
return priceStr;
|
||||
}
|
||||
|
||||
public void setPriceStr(String priceStr)
|
||||
{
|
||||
this.priceStr = priceStr;
|
||||
}
|
||||
|
||||
public String getAssetnameStr()
|
||||
{
|
||||
return assetnameStr;
|
||||
}
|
||||
|
||||
public void setAssetnameStr(String assetnameStr)
|
||||
{
|
||||
this.assetnameStr = assetnameStr;
|
||||
}
|
||||
|
||||
public String getCategory()
|
||||
{
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category)
|
||||
{
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getPurchasedateStr()
|
||||
{
|
||||
return purchasedateStr;
|
||||
}
|
||||
|
||||
public void setPurchasedateStr(String purchasedateStr)
|
||||
{
|
||||
this.purchasedateStr = purchasedateStr;
|
||||
}
|
||||
|
||||
public String getPeriodofvalidityStr()
|
||||
{
|
||||
return periodofvalidityStr;
|
||||
}
|
||||
|
||||
public void setPeriodofvalidityStr(String periodofvalidityStr)
|
||||
{
|
||||
this.periodofvalidityStr = periodofvalidityStr;
|
||||
}
|
||||
|
||||
public String getWarrantydateStr()
|
||||
{
|
||||
return warrantydateStr;
|
||||
}
|
||||
|
||||
public void setWarrantydateStr(String warrantydateStr)
|
||||
{
|
||||
this.warrantydateStr = warrantydateStr;
|
||||
}
|
||||
}
|
||||
26
src/com/jsh/model/po/Assetcategory.hbm.xml
Normal file
26
src/com/jsh/model/po/Assetcategory.hbm.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?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.Assetcategory" table="ams_t_assetcategory">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<property name="assetname" type="java.lang.String">
|
||||
<column name="assetname" not-null="true">
|
||||
<comment>资产类型名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="isystem" type="java.lang.Short">
|
||||
<column name="isystem" not-null="true">
|
||||
<comment>是否系统自带 0==系统 1==非系统</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
67
src/com/jsh/model/po/Assetcategory.java
Normal file
67
src/com/jsh/model/po/Assetcategory.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Assetcategory implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private String assetname;
|
||||
private Short isystem;
|
||||
private String description;
|
||||
|
||||
public Assetcategory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Assetcategory(Long id)
|
||||
{
|
||||
this.id = id ;
|
||||
}
|
||||
|
||||
public Assetcategory(String assetname, Short isystem, String description)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
this.isystem = isystem;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAssetname()
|
||||
{
|
||||
return this.assetname;
|
||||
}
|
||||
|
||||
public void setAssetname(String assetname)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
}
|
||||
|
||||
public Short getIsystem()
|
||||
{
|
||||
return this.isystem;
|
||||
}
|
||||
|
||||
public void setIsystem(Short isystem)
|
||||
{
|
||||
this.isystem = isystem;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
34
src/com/jsh/model/po/Assetname.hbm.xml
Normal file
34
src/com/jsh/model/po/Assetname.hbm.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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.Assetname" table="ams_t_assetname">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<property name="assetname" type="java.lang.String">
|
||||
<column name="assetname" not-null="true">
|
||||
<comment>资产名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<many-to-one name="category" class="com.jsh.model.po.Category" lazy="false">
|
||||
<column name="assetcategoryID" not-null="true" />
|
||||
</many-to-one>
|
||||
<property name="isystem" type="java.lang.Short">
|
||||
<column name="isystem" not-null="true">
|
||||
<comment>是否系统自带 0==系统 1==非系统</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="isconsumables" type="java.lang.Short">
|
||||
<column name="isconsumables">
|
||||
<comment>是否为耗材 0==否 1==是 耗材状态只能是消费</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
93
src/com/jsh/model/po/Assetname.java
Normal file
93
src/com/jsh/model/po/Assetname.java
Normal file
@ -0,0 +1,93 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Assetname implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private String assetname;
|
||||
private Short isystem;
|
||||
private Category category;
|
||||
private String description;
|
||||
private Short isconsumables;
|
||||
|
||||
public Assetname()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Assetname(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Assetname(String assetname, Short isystem, String description,
|
||||
Short isconsumables,Category category)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
this.isystem = isystem;
|
||||
this.description = description;
|
||||
this.isconsumables = isconsumables;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAssetname()
|
||||
{
|
||||
return this.assetname;
|
||||
}
|
||||
|
||||
public void setAssetname(String assetname)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
}
|
||||
|
||||
public Short getIsystem()
|
||||
{
|
||||
return this.isystem;
|
||||
}
|
||||
|
||||
public void setIsystem(Short isystem)
|
||||
{
|
||||
this.isystem = isystem;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Short getIsconsumables()
|
||||
{
|
||||
return this.isconsumables;
|
||||
}
|
||||
|
||||
public void setIsconsumables(Short isconsumables)
|
||||
{
|
||||
this.isconsumables = isconsumables;
|
||||
}
|
||||
|
||||
public Category getCategory()
|
||||
{
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(Category category)
|
||||
{
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
}
|
||||
69
src/com/jsh/model/po/Basicuser.hbm.xml
Normal file
69
src/com/jsh/model/po/Basicuser.hbm.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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.Basicuser" table="ams_t_basicuser">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<property name="username" type="java.lang.String">
|
||||
<column name="username" not-null="true">
|
||||
<comment>用户姓名--例如张三</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="loginame" type="java.lang.String">
|
||||
<column name="loginame">
|
||||
<comment>登录用户名--可能为空</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="password" type="java.lang.String">
|
||||
<column name="password" length="30" not-null="true">
|
||||
<comment>登陆密码</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="position" type="java.lang.String">
|
||||
<column name="position" length="200">
|
||||
<comment>职位</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="department" type="java.lang.String">
|
||||
<column name="department">
|
||||
<comment>所属部门</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="email" type="java.lang.String">
|
||||
<column name="email" length="100">
|
||||
<comment>电子邮箱</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="phonenum" type="java.lang.String">
|
||||
<column name="phonenum" length="100">
|
||||
<comment>手机号码</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="ismanager" type="java.lang.Short">
|
||||
<column name="ismanager" not-null="true">
|
||||
<comment>是否为管理者 0==管理者 1==员工</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="isystem" type="java.lang.Short">
|
||||
<column name="isystem" not-null="true">
|
||||
<comment>是否系统自带数据</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="status" type="java.lang.Short">
|
||||
<column name="status">
|
||||
<comment>用户状态</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>用户描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="remark" type="java.lang.String">
|
||||
<column name="remark" length="500" />
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
177
src/com/jsh/model/po/Basicuser.java
Normal file
177
src/com/jsh/model/po/Basicuser.java
Normal file
@ -0,0 +1,177 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Basicuser implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private String username;
|
||||
private String loginame;
|
||||
private String password;
|
||||
private String position;
|
||||
private String department;
|
||||
private String email;
|
||||
private String phonenum;
|
||||
private Short ismanager;
|
||||
private Short isystem;
|
||||
private Short status;
|
||||
private String description;
|
||||
private String remark;
|
||||
|
||||
public Basicuser()
|
||||
{
|
||||
}
|
||||
|
||||
public Basicuser(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Basicuser(String username, String loginame, String password,
|
||||
String position, String department, String email, String phonenum,
|
||||
Short ismanager, Short isystem, Short status, String description,
|
||||
String remark)
|
||||
{
|
||||
this.username = username;
|
||||
this.loginame = loginame;
|
||||
this.password = password;
|
||||
this.position = position;
|
||||
this.department = department;
|
||||
this.email = email;
|
||||
this.phonenum = phonenum;
|
||||
this.ismanager = ismanager;
|
||||
this.isystem = isystem;
|
||||
this.status = status;
|
||||
this.description = description;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getLoginame()
|
||||
{
|
||||
return this.loginame;
|
||||
}
|
||||
|
||||
public void setLoginame(String loginame)
|
||||
{
|
||||
this.loginame = loginame;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPosition()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public void setPosition(String position)
|
||||
{
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public String getDepartment()
|
||||
{
|
||||
return this.department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department)
|
||||
{
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhonenum()
|
||||
{
|
||||
return this.phonenum;
|
||||
}
|
||||
|
||||
public void setPhonenum(String phonenum)
|
||||
{
|
||||
this.phonenum = phonenum;
|
||||
}
|
||||
|
||||
public Short getIsmanager()
|
||||
{
|
||||
return this.ismanager;
|
||||
}
|
||||
|
||||
public void setIsmanager(Short ismanager)
|
||||
{
|
||||
this.ismanager = ismanager;
|
||||
}
|
||||
|
||||
public Short getIsystem()
|
||||
{
|
||||
return this.isystem;
|
||||
}
|
||||
|
||||
public void setIsystem(Short isystem)
|
||||
{
|
||||
this.isystem = isystem;
|
||||
}
|
||||
|
||||
public Short getStatus()
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Short status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
29
src/com/jsh/model/po/Building.hbm.xml
Normal file
29
src/com/jsh/model/po/Building.hbm.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?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.Building" table="jsh_building">
|
||||
<id name="Id" type="java.lang.Long">
|
||||
<column name="Id"/>
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<many-to-one name="depot" class="com.jsh.model.po.Depot" lazy="false">
|
||||
<column name="ProjectId" not-null="true" />
|
||||
</many-to-one>
|
||||
<property generated="never" lazy="false" name="Name" type="java.lang.String">
|
||||
<column length="20" name="Name">
|
||||
<comment>名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Remark" type="java.lang.String">
|
||||
<column length="50" name="Remark">
|
||||
<comment>备注</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="Enabled" type="boolean">
|
||||
<column length="1" name="Enabled">
|
||||
<comment>启用</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
70
src/com/jsh/model/po/Building.java
Normal file
70
src/com/jsh/model/po/Building.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Building implements java.io.Serializable
|
||||
{
|
||||
private Long Id;
|
||||
private Depot depot;
|
||||
private String Name;
|
||||
private String Remark;
|
||||
private Boolean Enabled;
|
||||
|
||||
public Building()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Building(Long Id)
|
||||
{
|
||||
this.Id = Id;
|
||||
}
|
||||
|
||||
public Building(Depot depot, String name, String remark, Boolean enabled) {
|
||||
super();
|
||||
this.depot = depot;
|
||||
Name = name;
|
||||
Remark = remark;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Depot getDepot() {
|
||||
return depot;
|
||||
}
|
||||
|
||||
public void setDepot(Depot depot) {
|
||||
this.depot = depot;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return Remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
Remark = remark;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return Enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
}
|
||||
26
src/com/jsh/model/po/Category.hbm.xml
Normal file
26
src/com/jsh/model/po/Category.hbm.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?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.Category" table="ams_t_assetcategory">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<property name="assetname" type="java.lang.String">
|
||||
<column name="assetname" not-null="true">
|
||||
<comment>资产类型名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="isystem" type="java.lang.Short">
|
||||
<column name="isystem" not-null="true">
|
||||
<comment>是否系统自带 0==系统 1==非系统</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>描述信息</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
67
src/com/jsh/model/po/Category.java
Normal file
67
src/com/jsh/model/po/Category.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Category implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private String assetname;
|
||||
private Short isystem;
|
||||
private String description;
|
||||
|
||||
public Category()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Category(Long id)
|
||||
{
|
||||
this.id = id ;
|
||||
}
|
||||
|
||||
public Category(String assetname, Short isystem, String description)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
this.isystem = isystem;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAssetname()
|
||||
{
|
||||
return this.assetname;
|
||||
}
|
||||
|
||||
public void setAssetname(String assetname)
|
||||
{
|
||||
this.assetname = assetname;
|
||||
}
|
||||
|
||||
public Short getIsystem()
|
||||
{
|
||||
return this.isystem;
|
||||
}
|
||||
|
||||
public void setIsystem(Short isystem)
|
||||
{
|
||||
this.isystem = isystem;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
26
src/com/jsh/model/po/Department.hbm.xml
Normal file
26
src/com/jsh/model/po/Department.hbm.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?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.Department" table="ams_t_department">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id" />
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<property name="deptname" type="java.lang.String">
|
||||
<column name="deptname" not-null="true">
|
||||
<comment>部门名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="description" type="java.lang.String">
|
||||
<column name="description" length="500">
|
||||
<comment>部门描述</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property name="isystem" type="java.lang.Short">
|
||||
<column name="isystem" not-null="true">
|
||||
<comment>是否系统自带 0==系统 1==非系统</comment>
|
||||
</column>
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
69
src/com/jsh/model/po/Department.java
Normal file
69
src/com/jsh/model/po/Department.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.jsh.model.po;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Department implements java.io.Serializable
|
||||
{
|
||||
private Long id;
|
||||
private String deptname;
|
||||
private Short isystem;
|
||||
private String description;
|
||||
|
||||
public Department()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Department(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Department(String deptname, Short isystem, String description)
|
||||
{
|
||||
super();
|
||||
this.deptname = deptname;
|
||||
this.isystem = isystem;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Short getIsystem()
|
||||
{
|
||||
return isystem;
|
||||
}
|
||||
|
||||
public void setIsystem(Short isystem)
|
||||
{
|
||||
this.isystem = isystem;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDeptname()
|
||||
{
|
||||
return this.deptname;
|
||||
}
|
||||
|
||||
public void setDeptname(String deptname)
|
||||
{
|
||||
this.deptname = deptname;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
26
src/com/jsh/model/po/Depot.hbm.xml
Normal file
26
src/com/jsh/model/po/Depot.hbm.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?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.Depot" table="ams_t_depot">
|
||||
<id name="id" type="java.lang.Long">
|
||||
<column name="id"/>
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<property generated="never" lazy="false" name="name" type="java.lang.String">
|
||||
<column length="20" name="name">
|
||||
<comment>仓库名称</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="sort" type="java.lang.String">
|
||||
<column length="10" name="sort">
|
||||
<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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user