整理代码
This commit is contained in:
parent
46b75fecc6
commit
55135acaaa
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
WebRoot/WEB-INF/classes/com/jsh/exception/JshException.class
Normal file
BIN
WebRoot/WEB-INF/classes/com/jsh/exception/JshException.class
Normal file
Binary file not shown.
@ -18,7 +18,7 @@
|
|||||||
</column>
|
</column>
|
||||||
</property>
|
</property>
|
||||||
<property name="password" type="java.lang.String">
|
<property name="password" type="java.lang.String">
|
||||||
<column name="password" length="30" not-null="true">
|
<column name="password" length="50" not-null="true">
|
||||||
<comment>登陆密码</comment>
|
<comment>登陆密码</comment>
|
||||||
</column>
|
</column>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,120 +1,120 @@
|
|||||||
package com.jsh.action.asset;
|
package com.jsh.action.asset;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.jsh.base.BaseAction;
|
import com.jsh.base.BaseAction;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.model.vo.asset.ReportModel;
|
import com.jsh.model.vo.asset.ReportModel;
|
||||||
import com.jsh.service.asset.ReportIService;
|
import com.jsh.service.asset.ReportIService;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ReportAction extends BaseAction<ReportModel>
|
public class ReportAction extends BaseAction<ReportModel>
|
||||||
{
|
{
|
||||||
private ReportModel model = new ReportModel();
|
private ReportModel model = new ReportModel();
|
||||||
private ReportIService reportService;
|
private ReportIService reportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找资产信息
|
* 查找资产信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String find()
|
public String find()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Asset> pageUtil = new PageUtil<Asset>();
|
PageUtil<Asset> pageUtil = new PageUtil<Asset>();
|
||||||
pageUtil.setPageSize(0);
|
pageUtil.setPageSize(0);
|
||||||
pageUtil.setCurPage(0);
|
pageUtil.setCurPage(0);
|
||||||
pageUtil.setAdvSearch(getCondition());
|
pageUtil.setAdvSearch(getCondition());
|
||||||
String reportType = getReportType(new HashMap<String,Object>());
|
String reportType = getReportType(new HashMap<String,Object>());
|
||||||
reportService.find(pageUtil,reportType.split("_")[0],reportType.split("_")[1]);
|
reportService.find(pageUtil,reportType.split("_")[0],reportType.split("_")[1]);
|
||||||
model.getShowModel().setReportData(pageUtil.getPageList());
|
model.getShowModel().setReportData(pageUtil.getPageList());
|
||||||
}
|
}
|
||||||
catch (AmsException e)
|
catch (JshException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
|
Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
|
||||||
model.getShowModel().setMsgTip("get report data exception");
|
model.getShowModel().setMsgTip("get report data exception");
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition()
|
private Map<String,Object> getCondition()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("assetname.id_n_eq", model.getAssetNameID());
|
condition.put("assetname.id_n_eq", model.getAssetNameID());
|
||||||
condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
|
condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
|
||||||
condition.put("user.id_n_eq", model.getUsernameID());
|
condition.put("user.id_n_eq", model.getUsernameID());
|
||||||
condition.put("status_n_eq", model.getStatus());
|
condition.put("status_n_eq", model.getStatus());
|
||||||
condition.put("supplier.id_n_eq", model.getSupplierID());
|
condition.put("supplier.id_n_eq", model.getSupplierID());
|
||||||
condition.put("dataSum_s_order","desc");
|
condition.put("dataSum_s_order","desc");
|
||||||
//拼接统计数据条件
|
//拼接统计数据条件
|
||||||
getReportType(condition);
|
getReportType(condition);
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取统计条件
|
* 获取统计条件
|
||||||
* @param condition
|
* @param condition
|
||||||
*/
|
*/
|
||||||
private String getReportType(Map<String,Object> condition)
|
private String getReportType(Map<String,Object> condition)
|
||||||
{
|
{
|
||||||
// <option value="0">资产状态</option>
|
// <option value="0">资产状态</option>
|
||||||
// <option value="1">资产类型</option>
|
// <option value="1">资产类型</option>
|
||||||
// <option value="2">供应商</option>
|
// <option value="2">供应商</option>
|
||||||
// <option value="3">资产名称</option>
|
// <option value="3">资产名称</option>
|
||||||
// <option value="4">所属用户</option>
|
// <option value="4">所属用户</option>
|
||||||
int reportType = model.getReportType();
|
int reportType = model.getReportType();
|
||||||
String reportTypeInfo = "";
|
String reportTypeInfo = "";
|
||||||
String reportTypeName = "";
|
String reportTypeName = "";
|
||||||
switch(reportType)
|
switch(reportType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
condition.put("status_s_gb", "group");
|
condition.put("status_s_gb", "group");
|
||||||
reportTypeInfo = "status";
|
reportTypeInfo = "status";
|
||||||
reportTypeName = "status";
|
reportTypeName = "status";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
condition.put("assetname.category.id_s_gb", "group");
|
condition.put("assetname.category.id_s_gb", "group");
|
||||||
reportTypeInfo = "assetname.category.id";
|
reportTypeInfo = "assetname.category.id";
|
||||||
reportTypeName = "assetname.category.assetname";
|
reportTypeName = "assetname.category.assetname";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
condition.put("supplier.id_s_gb", "group");
|
condition.put("supplier.id_s_gb", "group");
|
||||||
reportTypeInfo = "supplier.id";
|
reportTypeInfo = "supplier.id";
|
||||||
reportTypeName = "supplier.supplier";
|
reportTypeName = "supplier.supplier";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
condition.put("assetname.id_s_gb", "group");
|
condition.put("assetname.id_s_gb", "group");
|
||||||
reportTypeInfo = "assetname.id";
|
reportTypeInfo = "assetname.id";
|
||||||
reportTypeName = "assetname.assetname";
|
reportTypeName = "assetname.assetname";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
condition.put("user.id_s_gb", "group");
|
condition.put("user.id_s_gb", "group");
|
||||||
reportTypeInfo = "user.id";
|
reportTypeInfo = "user.id";
|
||||||
reportTypeName = "user.username";
|
reportTypeName = "user.username";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return reportTypeInfo + "_" + reportTypeName;
|
return reportTypeInfo + "_" + reportTypeName;
|
||||||
}
|
}
|
||||||
//=========Spring注入以及model驱动公共方法===========
|
//=========Spring注入以及model驱动公共方法===========
|
||||||
public void setReportService(ReportIService reportService)
|
public void setReportService(ReportIService reportService)
|
||||||
{
|
{
|
||||||
this.reportService = reportService;
|
this.reportService = reportService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReportModel getModel()
|
public ReportModel getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,380 +1,380 @@
|
|||||||
package com.jsh.action.basic;
|
package com.jsh.action.basic;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.base.BaseAction;
|
import com.jsh.base.BaseAction;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Depot;
|
import com.jsh.model.po.Depot;
|
||||||
import com.jsh.model.po.Logdetails;
|
import com.jsh.model.po.Logdetails;
|
||||||
import com.jsh.model.po.Role;
|
import com.jsh.model.po.Role;
|
||||||
import com.jsh.model.vo.basic.DepotModel;
|
import com.jsh.model.vo.basic.DepotModel;
|
||||||
import com.jsh.service.basic.DepotIService;
|
import com.jsh.service.basic.DepotIService;
|
||||||
import com.jsh.service.basic.UserBusinessIService;
|
import com.jsh.service.basic.UserBusinessIService;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class DepotAction extends BaseAction<DepotModel>
|
public class DepotAction extends BaseAction<DepotModel>
|
||||||
{
|
{
|
||||||
private DepotIService depotService;
|
private DepotIService depotService;
|
||||||
private UserBusinessIService userBusinessService;
|
private UserBusinessIService userBusinessService;
|
||||||
private DepotModel model = new DepotModel();
|
private DepotModel model = new DepotModel();
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public String getBasicData()
|
public String getBasicData()
|
||||||
{
|
{
|
||||||
Map<String,List> mapData = model.getShowModel().getMap();
|
Map<String,List> mapData = model.getShowModel().getMap();
|
||||||
PageUtil pageUtil = new PageUtil();
|
PageUtil pageUtil = new PageUtil();
|
||||||
pageUtil.setPageSize(0);
|
pageUtil.setPageSize(0);
|
||||||
pageUtil.setCurPage(0);
|
pageUtil.setCurPage(0);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Map<String,Object> condition = pageUtil.getAdvSearch();
|
Map<String,Object> condition = pageUtil.getAdvSearch();
|
||||||
condition.put("id_s_order", "asc");
|
condition.put("id_s_order", "asc");
|
||||||
depotService.find(pageUtil);
|
depotService.find(pageUtil);
|
||||||
mapData.put("depotList", pageUtil.getPageList());
|
mapData.put("depotList", pageUtil.getPageList());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
||||||
model.getShowModel().setMsgTip("exceptoin");
|
model.getShowModel().setMsgTip("exceptoin");
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加仓库
|
* 增加仓库
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void create()
|
public void create()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("==================开始调用增加仓库信息方法create()===================");
|
Log.infoFileSync("==================开始调用增加仓库信息方法create()===================");
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Depot depot = new Depot();
|
Depot depot = new Depot();
|
||||||
depot.setName(model.getName());
|
depot.setName(model.getName());
|
||||||
depot.setSort(model.getSort());
|
depot.setSort(model.getSort());
|
||||||
depot.setRemark(model.getRemark());
|
depot.setRemark(model.getRemark());
|
||||||
depotService.create(depot);
|
depotService.create(depot);
|
||||||
|
|
||||||
//========标识位===========
|
//========标识位===========
|
||||||
flag = true;
|
flag = true;
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "增加仓库名称为 "+ model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg));
|
, tipType, "增加仓库名称为 "+ model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg));
|
||||||
Log.infoFileSync("==================结束调用增加仓库方法create()===================");
|
Log.infoFileSync("==================结束调用增加仓库方法create()===================");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除仓库
|
* 删除仓库
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String delete()
|
public String delete()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("====================开始调用删除仓库信息方法delete()================");
|
Log.infoFileSync("====================开始调用删除仓库信息方法delete()================");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
depotService.delete(model.getDepotID());
|
depotService.delete(model.getDepotID());
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e);
|
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
model.getShowModel().setMsgTip(tipMsg);
|
model.getShowModel().setMsgTip(tipMsg);
|
||||||
logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg));
|
, tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg));
|
||||||
Log.infoFileSync("====================结束调用删除仓库信息方法delete()================");
|
Log.infoFileSync("====================结束调用删除仓库信息方法delete()================");
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新仓库
|
* 更新仓库
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Depot depot = depotService.get(model.getDepotID());
|
Depot depot = depotService.get(model.getDepotID());
|
||||||
depot.setName(model.getName());
|
depot.setName(model.getName());
|
||||||
depot.setSort(model.getSort());
|
depot.setSort(model.getSort());
|
||||||
depot.setRemark(model.getRemark());
|
depot.setRemark(model.getRemark());
|
||||||
depotService.update(depot);
|
depotService.update(depot);
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e);
|
Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "更新仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg));
|
, tipType, "更新仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除指定ID仓库
|
* 批量删除指定ID仓库
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String batchDelete()
|
public String batchDelete()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
depotService.batchDelete(model.getDepotIDs());
|
depotService.batchDelete(model.getDepotIDs());
|
||||||
model.getShowModel().setMsgTip("成功");
|
model.getShowModel().setMsgTip("成功");
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg));
|
, tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查输入名称是否存在
|
* 检查输入名称是否存在
|
||||||
*/
|
*/
|
||||||
public void checkIsNameExist()
|
public void checkIsNameExist()
|
||||||
{
|
{
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID());
|
flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!");
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e);
|
Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找仓库信息
|
* 查找仓库信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findBy()
|
public void findBy()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getCondition());
|
pageUtil.setAdvSearch(getCondition());
|
||||||
depotService.find(pageUtil);
|
depotService.find(pageUtil);
|
||||||
List<Depot> dataList = pageUtil.getPageList();
|
List<Depot> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
// {"total":28,"rows":[
|
// {"total":28,"rows":[
|
||||||
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
||||||
// ]}
|
// ]}
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(Depot depot:dataList)
|
for(Depot depot:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("id", depot.getId());
|
item.put("id", depot.getId());
|
||||||
//供应商名称
|
//供应商名称
|
||||||
item.put("name", depot.getName());
|
item.put("name", depot.getName());
|
||||||
item.put("sort", depot.getSort());
|
item.put("sort", depot.getSort());
|
||||||
item.put("remark", depot.getRemark());
|
item.put("remark", depot.getRemark());
|
||||||
item.put("op", 1);
|
item.put("op", 1);
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("rows", dataArray);
|
outer.put("rows", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对应部门显示
|
* 用户对应部门显示
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findUserDepot()
|
public void findUserDepot()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
PageUtil<Depot> pageUtil = new PageUtil<Depot>();
|
||||||
pageUtil.setPageSize(100);
|
pageUtil.setPageSize(100);
|
||||||
//pageUtil.setCurPage(model.getPageNo());
|
//pageUtil.setCurPage(model.getPageNo());
|
||||||
|
|
||||||
pageUtil.setAdvSearch(getCondition_UserDepot());
|
pageUtil.setAdvSearch(getCondition_UserDepot());
|
||||||
depotService.find(pageUtil);
|
depotService.find(pageUtil);
|
||||||
List<Depot> dataList = pageUtil.getPageList();
|
List<Depot> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("id", 1);
|
outer.put("id", 1);
|
||||||
outer.put("text", "部门列表");
|
outer.put("text", "部门列表");
|
||||||
outer.put("state", "open");
|
outer.put("state", "open");
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(Depot depot:dataList)
|
for(Depot depot:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("id", depot.getId());
|
item.put("id", depot.getId());
|
||||||
item.put("text", depot.getName());
|
item.put("text", depot.getName());
|
||||||
//勾选判断1
|
//勾选判断1
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]");
|
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]");
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的部门:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的部门:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||||
}
|
}
|
||||||
if (flag==true){item.put("checked", true);}
|
if (flag==true){item.put("checked", true);}
|
||||||
//结束
|
//结束
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("children", dataArray);
|
outer.put("children", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient("["+outer.toString()+"]");
|
toClient("["+outer.toString()+"]");
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找部门异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找部门异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询部门结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询部门结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition()
|
private Map<String,Object> getCondition()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("name_s_like", model.getName());
|
condition.put("name_s_like", model.getName());
|
||||||
condition.put("remark_s_like", model.getRemark());
|
condition.put("remark_s_like", model.getRemark());
|
||||||
condition.put("sort_s_order", "asc");
|
condition.put("sort_s_order", "asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件-用户对应部门
|
* 拼接搜索条件-用户对应部门
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition_UserDepot()
|
private Map<String,Object> getCondition_UserDepot()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("Id_s_order", "asc");
|
condition.put("Id_s_order", "asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||||
@Override
|
@Override
|
||||||
public DepotModel getModel()
|
public DepotModel getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
public void setDepotService(DepotIService depotService)
|
public void setDepotService(DepotIService depotService)
|
||||||
{
|
{
|
||||||
this.depotService = depotService;
|
this.depotService = depotService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||||
this.userBusinessService = userBusinessService;
|
this.userBusinessService = userBusinessService;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,347 +1,347 @@
|
|||||||
package com.jsh.action.basic;
|
package com.jsh.action.basic;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.base.BaseAction;
|
import com.jsh.base.BaseAction;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.App;
|
import com.jsh.model.po.App;
|
||||||
import com.jsh.model.po.Role;
|
import com.jsh.model.po.Role;
|
||||||
import com.jsh.model.po.Logdetails;
|
import com.jsh.model.po.Logdetails;
|
||||||
import com.jsh.model.vo.basic.RoleModel;
|
import com.jsh.model.vo.basic.RoleModel;
|
||||||
import com.jsh.service.basic.RoleIService;
|
import com.jsh.service.basic.RoleIService;
|
||||||
import com.jsh.service.basic.UserBusinessIService;
|
import com.jsh.service.basic.UserBusinessIService;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class RoleAction extends BaseAction<RoleModel>
|
public class RoleAction extends BaseAction<RoleModel>
|
||||||
{
|
{
|
||||||
private RoleIService roleService;
|
private RoleIService roleService;
|
||||||
private UserBusinessIService userBusinessService;
|
private UserBusinessIService userBusinessService;
|
||||||
private RoleModel model = new RoleModel();
|
private RoleModel model = new RoleModel();
|
||||||
/**
|
/**
|
||||||
* 增加角色
|
* 增加角色
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void create()
|
public void create()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("==================开始调用增加角色信息方法create()===================");
|
Log.infoFileSync("==================开始调用增加角色信息方法create()===================");
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Role role = new Role();
|
Role role = new Role();
|
||||||
role.setName(model.getName());
|
role.setName(model.getName());
|
||||||
roleService.create(role);
|
roleService.create(role);
|
||||||
|
|
||||||
//========标识位===========
|
//========标识位===========
|
||||||
flag = true;
|
flag = true;
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "增加角色名称为 "+ model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg));
|
, tipType, "增加角色名称为 "+ model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg));
|
||||||
Log.infoFileSync("==================结束调用增加角色方法create()===================");
|
Log.infoFileSync("==================结束调用增加角色方法create()===================");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除角色
|
* 删除角色
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String delete()
|
public String delete()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("====================开始调用删除角色信息方法delete()================");
|
Log.infoFileSync("====================开始调用删除角色信息方法delete()================");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
roleService.delete(model.getRoleID());
|
roleService.delete(model.getRoleID());
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e);
|
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
model.getShowModel().setMsgTip(tipMsg);
|
model.getShowModel().setMsgTip(tipMsg);
|
||||||
logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg));
|
, tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg));
|
||||||
Log.infoFileSync("====================结束调用删除角色信息方法delete()================");
|
Log.infoFileSync("====================结束调用删除角色信息方法delete()================");
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新角色
|
* 更新角色
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Role role = roleService.get(model.getRoleID());
|
Role role = roleService.get(model.getRoleID());
|
||||||
role.setName(model.getName());
|
role.setName(model.getName());
|
||||||
roleService.update(role);
|
roleService.update(role);
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e);
|
Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "更新角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg));
|
, tipType, "更新角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除指定ID角色
|
* 批量删除指定ID角色
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String batchDelete()
|
public String batchDelete()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
roleService.batchDelete(model.getRoleIDs());
|
roleService.batchDelete(model.getRoleIDs());
|
||||||
model.getShowModel().setMsgTip("成功");
|
model.getShowModel().setMsgTip("成功");
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg));
|
, tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查输入名称是否存在
|
* 检查输入名称是否存在
|
||||||
*/
|
*/
|
||||||
public void checkIsNameExist()
|
public void checkIsNameExist()
|
||||||
{
|
{
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID());
|
flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!");
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e);
|
Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找角色信息
|
* 查找角色信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findBy()
|
public void findBy()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getCondition());
|
pageUtil.setAdvSearch(getCondition());
|
||||||
roleService.find(pageUtil);
|
roleService.find(pageUtil);
|
||||||
List<Role> dataList = pageUtil.getPageList();
|
List<Role> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
// {"total":28,"rows":[
|
// {"total":28,"rows":[
|
||||||
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
||||||
// ]}
|
// ]}
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(Role role:dataList)
|
for(Role role:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("Id", role.getId());
|
item.put("Id", role.getId());
|
||||||
//供应商名称
|
//供应商名称
|
||||||
item.put("Name", role.getName());
|
item.put("Name", role.getName());
|
||||||
item.put("op", 1);
|
item.put("op", 1);
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("rows", dataArray);
|
outer.put("rows", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对应角色显示
|
* 用户对应角色显示
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findUserRole()
|
public void findUserRole()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
PageUtil<Role> pageUtil = new PageUtil<Role>();
|
||||||
pageUtil.setPageSize(100);
|
pageUtil.setPageSize(100);
|
||||||
//pageUtil.setCurPage(model.getPageNo());
|
//pageUtil.setCurPage(model.getPageNo());
|
||||||
|
|
||||||
pageUtil.setAdvSearch(getCondition_UserRole());
|
pageUtil.setAdvSearch(getCondition_UserRole());
|
||||||
roleService.find(pageUtil);
|
roleService.find(pageUtil);
|
||||||
List<Role> dataList = pageUtil.getPageList();
|
List<Role> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("id", 1);
|
outer.put("id", 1);
|
||||||
outer.put("text", "角色列表");
|
outer.put("text", "角色列表");
|
||||||
outer.put("state", "open");
|
outer.put("state", "open");
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(Role role:dataList)
|
for(Role role:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("id", role.getId());
|
item.put("id", role.getId());
|
||||||
item.put("text", role.getName());
|
item.put("text", role.getName());
|
||||||
//勾选判断1
|
//勾选判断1
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]");
|
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]");
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
|
||||||
}
|
}
|
||||||
if (flag==true){item.put("checked", true);}
|
if (flag==true){item.put("checked", true);}
|
||||||
//结束
|
//结束
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("children", dataArray);
|
outer.put("children", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient("["+outer.toString()+"]");
|
toClient("["+outer.toString()+"]");
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition()
|
private Map<String,Object> getCondition()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("Name_s_like", model.getName());
|
condition.put("Name_s_like", model.getName());
|
||||||
condition.put("Id_s_order", "asc");
|
condition.put("Id_s_order", "asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件-用户对应角色
|
* 拼接搜索条件-用户对应角色
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition_UserRole()
|
private Map<String,Object> getCondition_UserRole()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("Id_s_order", "asc");
|
condition.put("Id_s_order", "asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||||
@Override
|
@Override
|
||||||
public RoleModel getModel()
|
public RoleModel getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
public void setRoleService(RoleIService roleService)
|
public void setRoleService(RoleIService roleService)
|
||||||
{
|
{
|
||||||
this.roleService = roleService;
|
this.roleService = roleService;
|
||||||
}
|
}
|
||||||
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
public void setUserBusinessService(UserBusinessIService userBusinessService) {
|
||||||
this.userBusinessService = userBusinessService;
|
this.userBusinessService = userBusinessService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ public class UserAction extends BaseAction<UserModel>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
password = Tools.md5Encryp(password);
|
password = Tools.md5Encryp(password);
|
||||||
|
System.out.println(password);
|
||||||
}
|
}
|
||||||
catch (NoSuchAlgorithmException e)
|
catch (NoSuchAlgorithmException e)
|
||||||
{
|
{
|
||||||
@ -136,7 +137,7 @@ public class UserAction extends BaseAction<UserModel>
|
|||||||
user.setIsystem((short)1);
|
user.setIsystem((short)1);
|
||||||
user.setIsmanager((short)1);
|
user.setIsmanager((short)1);
|
||||||
user.setLoginame(model.getLoginame());
|
user.setLoginame(model.getLoginame());
|
||||||
String password ="00000000";
|
String password ="123456";
|
||||||
//因密码用MD5加密,需要对密码进行转化
|
//因密码用MD5加密,需要对密码进行转化
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,277 +1,277 @@
|
|||||||
package com.jsh.action.materials;
|
package com.jsh.action.materials;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.base.BaseAction;
|
import com.jsh.base.BaseAction;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.model.po.Depot;
|
import com.jsh.model.po.Depot;
|
||||||
import com.jsh.model.po.Building;
|
import com.jsh.model.po.Building;
|
||||||
import com.jsh.model.po.Logdetails;
|
import com.jsh.model.po.Logdetails;
|
||||||
import com.jsh.model.vo.materials.BuildingModel;
|
import com.jsh.model.vo.materials.BuildingModel;
|
||||||
import com.jsh.service.materials.BuildingIService;
|
import com.jsh.service.materials.BuildingIService;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class BuildingAction extends BaseAction<BuildingModel>
|
public class BuildingAction extends BaseAction<BuildingModel>
|
||||||
{
|
{
|
||||||
private BuildingIService buildingService;
|
private BuildingIService buildingService;
|
||||||
private BuildingModel model = new BuildingModel();
|
private BuildingModel model = new BuildingModel();
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public String getBasicData()
|
public String getBasicData()
|
||||||
{
|
{
|
||||||
Map<String,List> mapData = model.getShowModel().getMap();
|
Map<String,List> mapData = model.getShowModel().getMap();
|
||||||
PageUtil pageUtil = new PageUtil();
|
PageUtil pageUtil = new PageUtil();
|
||||||
pageUtil.setPageSize(0);
|
pageUtil.setPageSize(0);
|
||||||
pageUtil.setCurPage(0);
|
pageUtil.setCurPage(0);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Map<String,Object> condition = pageUtil.getAdvSearch();
|
Map<String,Object> condition = pageUtil.getAdvSearch();
|
||||||
condition.put("ProjectId_n_eq", model.getProjectId());
|
condition.put("ProjectId_n_eq", model.getProjectId());
|
||||||
condition.put("Id_s_order", "asc");
|
condition.put("Id_s_order", "asc");
|
||||||
buildingService.find(pageUtil);
|
buildingService.find(pageUtil);
|
||||||
mapData.put("buildingList", pageUtil.getPageList());
|
mapData.put("buildingList", pageUtil.getPageList());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
|
||||||
model.getShowModel().setMsgTip("exceptoin");
|
model.getShowModel().setMsgTip("exceptoin");
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 增加单元
|
* 增加单元
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void create()
|
public void create()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("==================开始调用增加单元信息方法create()===================");
|
Log.infoFileSync("==================开始调用增加单元信息方法create()===================");
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Building building = new Building();
|
Building building = new Building();
|
||||||
building.setDepot(new Depot(model.getProjectId()));
|
building.setDepot(new Depot(model.getProjectId()));
|
||||||
|
|
||||||
building.setName(model.getName());
|
building.setName(model.getName());
|
||||||
building.setRemark(model.getRemark());
|
building.setRemark(model.getRemark());
|
||||||
building.setEnabled(model.getEnabled());
|
building.setEnabled(model.getEnabled());
|
||||||
buildingService.create(building);
|
buildingService.create(building);
|
||||||
|
|
||||||
//========标识位===========
|
//========标识位===========
|
||||||
flag = true;
|
flag = true;
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加单元信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加单元信息异常", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>增加单元信息回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>增加单元信息回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "增加单元", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "增加单元", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "增加单元名称为 "+ model.getName() + " " + tipMsg + "!", "增加单元" + tipMsg));
|
, tipType, "增加单元名称为 "+ model.getName() + " " + tipMsg + "!", "增加单元" + tipMsg));
|
||||||
Log.infoFileSync("==================结束调用增加单元方法create()===================");
|
Log.infoFileSync("==================结束调用增加单元方法create()===================");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除单元
|
* 删除单元
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String delete()
|
public String delete()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("====================开始调用删除单元信息方法delete()================");
|
Log.infoFileSync("====================开始调用删除单元信息方法delete()================");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
buildingService.delete(model.getBuildingID());
|
buildingService.delete(model.getBuildingID());
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getBuildingID() + " 的单元异常", e);
|
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getBuildingID() + " 的单元异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
model.getShowModel().setMsgTip(tipMsg);
|
model.getShowModel().setMsgTip(tipMsg);
|
||||||
logService.create(new Logdetails(getUser(), "删除单元", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "删除单元", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "删除单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "删除单元" + tipMsg));
|
, tipType, "删除单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "删除单元" + tipMsg));
|
||||||
Log.infoFileSync("====================结束调用删除单元信息方法delete()================");
|
Log.infoFileSync("====================结束调用删除单元信息方法delete()================");
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新单元
|
* 更新单元
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Building building = buildingService.get(model.getBuildingID());
|
Building building = buildingService.get(model.getBuildingID());
|
||||||
building.setDepot(new Depot(model.getProjectId()));
|
building.setDepot(new Depot(model.getProjectId()));
|
||||||
|
|
||||||
building.setName(model.getName());
|
building.setName(model.getName());
|
||||||
building.setRemark(model.getRemark());
|
building.setRemark(model.getRemark());
|
||||||
building.setEnabled(model.getEnabled());
|
building.setEnabled(model.getEnabled());
|
||||||
buildingService.update(building);
|
buildingService.update(building);
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>修改单元ID为 : " + model.getBuildingID() + "信息失败", e);
|
Log.errorFileSync(">>>>>>>>>>>>>修改单元ID为 : " + model.getBuildingID() + "信息失败", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>修改单元回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>修改单元回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logService.create(new Logdetails(getUser(), "更新单元", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "更新单元", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "更新单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "更新单元" + tipMsg));
|
, tipType, "更新单元ID为 "+ model.getBuildingID() + " " + tipMsg + "!", "更新单元" + tipMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除指定ID单元
|
* 批量删除指定ID单元
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String batchDelete()
|
public String batchDelete()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
buildingService.batchDelete(model.getBuildingIDs());
|
buildingService.batchDelete(model.getBuildingIDs());
|
||||||
model.getShowModel().setMsgTip("成功");
|
model.getShowModel().setMsgTip("成功");
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>批量删除单元ID为:" + model.getBuildingIDs() + "信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>批量删除单元ID为:" + model.getBuildingIDs() + "信息异常", e);
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "批量删除单元", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "批量删除单元", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "批量删除单元ID为 "+ model.getBuildingIDs() + " " + tipMsg + "!", "批量删除单元" + tipMsg));
|
, tipType, "批量删除单元ID为 "+ model.getBuildingIDs() + " " + tipMsg + "!", "批量删除单元" + tipMsg));
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找单元信息
|
* 查找单元信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findBy()
|
public void findBy()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<Building> pageUtil = new PageUtil<Building>();
|
PageUtil<Building> pageUtil = new PageUtil<Building>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getCondition());
|
pageUtil.setAdvSearch(getCondition());
|
||||||
buildingService.find(pageUtil);
|
buildingService.find(pageUtil);
|
||||||
List<Building> dataList = pageUtil.getPageList();
|
List<Building> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
// {"total":28,"rows":[
|
// {"total":28,"rows":[
|
||||||
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
||||||
// ]}
|
// ]}
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(Building building:dataList)
|
for(Building building:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("Id", building.getId());
|
item.put("Id", building.getId());
|
||||||
item.put("ProjectId", building.getDepot().getId());
|
item.put("ProjectId", building.getDepot().getId());
|
||||||
item.put("ProjectName", building.getDepot().getName());
|
item.put("ProjectName", building.getDepot().getName());
|
||||||
item.put("Name", building.getName());
|
item.put("Name", building.getName());
|
||||||
item.put("Remark", building.getRemark());
|
item.put("Remark", building.getRemark());
|
||||||
item.put("Enabled", building.getEnabled());
|
item.put("Enabled", building.getEnabled());
|
||||||
item.put("op", 1);
|
item.put("op", 1);
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("rows", dataArray);
|
outer.put("rows", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单元信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单元信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单元信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单元信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition()
|
private Map<String,Object> getCondition()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("ProjectId_n_eq", model.getProjectId());
|
condition.put("ProjectId_n_eq", model.getProjectId());
|
||||||
condition.put("Name_s_like", model.getName());
|
condition.put("Name_s_like", model.getName());
|
||||||
condition.put("Id_s_order", "asc");
|
condition.put("Id_s_order", "asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||||
@Override
|
@Override
|
||||||
public BuildingModel getModel()
|
public BuildingModel getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
public void setBuildingService(BuildingIService buildingService)
|
public void setBuildingService(BuildingIService buildingService)
|
||||||
{
|
{
|
||||||
this.buildingService = buildingService;
|
this.buildingService = buildingService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,395 +1,395 @@
|
|||||||
package com.jsh.action.materials;
|
package com.jsh.action.materials;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.base.BaseAction;
|
import com.jsh.base.BaseAction;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.constants.asset.AssetConstants;
|
import com.jsh.constants.asset.AssetConstants;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.DepotItem;
|
import com.jsh.model.po.DepotItem;
|
||||||
import com.jsh.model.po.Logdetails;
|
import com.jsh.model.po.Logdetails;
|
||||||
import com.jsh.model.po.Material;
|
import com.jsh.model.po.Material;
|
||||||
import com.jsh.model.vo.materials.DepotItemModel;
|
import com.jsh.model.vo.materials.DepotItemModel;
|
||||||
import com.jsh.service.materials.DepotHeadIService;
|
import com.jsh.service.materials.DepotHeadIService;
|
||||||
import com.jsh.service.materials.DepotItemIService;
|
import com.jsh.service.materials.DepotItemIService;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.Tools;
|
import com.jsh.util.common.Tools;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class DepotItemAction extends BaseAction<DepotItemModel>
|
public class DepotItemAction extends BaseAction<DepotItemModel>
|
||||||
{
|
{
|
||||||
private DepotItemIService depotItemService;
|
private DepotItemIService depotItemService;
|
||||||
private DepotItemModel model = new DepotItemModel();
|
private DepotItemModel model = new DepotItemModel();
|
||||||
/**
|
/**
|
||||||
* action返回excel结果
|
* action返回excel结果
|
||||||
*/
|
*/
|
||||||
public static final String EXCEL = "excel";
|
public static final String EXCEL = "excel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存明细
|
* 保存明细
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void saveDetials()
|
public void saveDetials()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()===================");
|
Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()===================");
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Long headerId=model.getHeaderId();
|
Long headerId=model.getHeaderId();
|
||||||
String inserted=model.getInserted();
|
String inserted=model.getInserted();
|
||||||
String deleted=model.getDeleted();
|
String deleted=model.getDeleted();
|
||||||
String updated=model.getUpdated();
|
String updated=model.getUpdated();
|
||||||
//转为json
|
//转为json
|
||||||
JSONArray insertedJson = JSONArray.fromObject(inserted);
|
JSONArray insertedJson = JSONArray.fromObject(inserted);
|
||||||
JSONArray deletedJson = JSONArray.fromObject(deleted);
|
JSONArray deletedJson = JSONArray.fromObject(deleted);
|
||||||
JSONArray updatedJson = JSONArray.fromObject(updated);
|
JSONArray updatedJson = JSONArray.fromObject(updated);
|
||||||
if(null != insertedJson)
|
if(null != insertedJson)
|
||||||
{
|
{
|
||||||
for(int i = 0;i < insertedJson.size(); i++)
|
for(int i = 0;i < insertedJson.size(); i++)
|
||||||
{
|
{
|
||||||
DepotItem depotItem = new DepotItem();
|
DepotItem depotItem = new DepotItem();
|
||||||
JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i));
|
JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i));
|
||||||
depotItem.setHeaderId(new DepotHead(headerId));
|
depotItem.setHeaderId(new DepotHead(headerId));
|
||||||
depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId")));
|
depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId")));
|
||||||
depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber"));
|
depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber"));
|
||||||
if(tempInsertedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice"));}
|
if(tempInsertedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice"));}
|
||||||
if(tempInsertedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
if(tempInsertedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
||||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||||
depotItem.setImg(tempInsertedJson.getString("Img"));
|
depotItem.setImg(tempInsertedJson.getString("Img"));
|
||||||
depotItemService.create(depotItem);
|
depotItemService.create(depotItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(null != deletedJson)
|
if(null != deletedJson)
|
||||||
{
|
{
|
||||||
for(int i = 0;i < deletedJson.size(); i++)
|
for(int i = 0;i < deletedJson.size(); i++)
|
||||||
{
|
{
|
||||||
JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i));
|
JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i));
|
||||||
depotItemService.delete(tempDeletedJson.getLong("Id"));
|
depotItemService.delete(tempDeletedJson.getLong("Id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(null != updatedJson)
|
if(null != updatedJson)
|
||||||
{
|
{
|
||||||
for(int i = 0;i < updatedJson.size(); i++)
|
for(int i = 0;i < updatedJson.size(); i++)
|
||||||
{
|
{
|
||||||
JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i));
|
JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i));
|
||||||
DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id"));
|
DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id"));
|
||||||
depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId")));
|
depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId")));
|
||||||
depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber"));
|
depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber"));
|
||||||
if(tempUpdatedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice"));}
|
if(tempUpdatedJson.get("UnitPrice")!=null){depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice"));}
|
||||||
if(tempUpdatedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
if(tempUpdatedJson.get("Incidentals")!=null){depotItem.setIncidentals(0.0);}
|
||||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||||
depotItem.setImg(tempUpdatedJson.getString("Img"));
|
depotItem.setImg(tempUpdatedJson.getString("Img"));
|
||||||
depotItemService.create(depotItem);
|
depotItemService.create(depotItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//========标识位===========
|
//========标识位===========
|
||||||
flag = true;
|
flag = true;
|
||||||
//记录操作日志使用
|
//记录操作日志使用
|
||||||
tipMsg = "成功";
|
tipMsg = "成功";
|
||||||
tipType = 0;
|
tipType = 0;
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e);
|
||||||
flag = false;
|
flag = false;
|
||||||
tipMsg = "失败";
|
tipMsg = "失败";
|
||||||
tipType = 1;
|
tipType = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
toClient(flag.toString());
|
toClient(flag.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(),
|
logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(),
|
||||||
new Timestamp(System.currentTimeMillis())
|
new Timestamp(System.currentTimeMillis())
|
||||||
, tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg));
|
, tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg));
|
||||||
Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()===================");
|
Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()===================");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找仓管通信息
|
* 查找仓管通信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findBy()
|
public void findBy()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getCondition());
|
pageUtil.setAdvSearch(getCondition());
|
||||||
depotItemService.find(pageUtil);
|
depotItemService.find(pageUtil);
|
||||||
List<DepotItem> dataList = pageUtil.getPageList();
|
List<DepotItem> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//开始拼接json数据
|
//开始拼接json数据
|
||||||
// {"total":28,"rows":[
|
// {"total":28,"rows":[
|
||||||
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
|
||||||
// ]}
|
// ]}
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(DepotItem depotItem:dataList)
|
for(DepotItem depotItem:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("Id", depotItem.getId());
|
item.put("Id", depotItem.getId());
|
||||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().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("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("OperNumber", depotItem.getOperNumber());
|
||||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||||
item.put("Incidentals", depotItem.getIncidentals());
|
item.put("Incidentals", depotItem.getIncidentals());
|
||||||
item.put("Remark", depotItem.getRemark());
|
item.put("Remark", depotItem.getRemark());
|
||||||
item.put("Img", depotItem.getImg());
|
item.put("Img", depotItem.getImg());
|
||||||
item.put("op", 1);
|
item.put("op", 1);
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("rows", dataArray);
|
outer.put("rows", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找进销存
|
* 查找进销存
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void findByAll()
|
public void findByAll()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getConditionALL());
|
pageUtil.setAdvSearch(getConditionALL());
|
||||||
depotItemService.find(pageUtil);
|
depotItemService.find(pageUtil);
|
||||||
List<DepotItem> dataList = pageUtil.getPageList();
|
List<DepotItem> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(DepotItem depotItem:dataList)
|
for(DepotItem depotItem:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
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 InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
item.put("Id", depotItem.getId());
|
item.put("Id", depotItem.getId());
|
||||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||||
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
||||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||||
item.put("prevSum", prevSum);
|
item.put("prevSum", prevSum);
|
||||||
item.put("InSum", InSum);
|
item.put("InSum", InSum);
|
||||||
item.put("OutSum", OutSum);
|
item.put("OutSum", OutSum);
|
||||||
item.put("thisSum", prevSum + InSum - OutSum);
|
item.put("thisSum", prevSum + InSum - OutSum);
|
||||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("rows", dataArray);
|
outer.put("rows", dataArray);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总计金额
|
* 统计总计金额
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void totalCountMoney()
|
public void totalCountMoney()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||||
pageUtil.setPageSize(0);
|
pageUtil.setPageSize(0);
|
||||||
pageUtil.setCurPage(0);
|
pageUtil.setCurPage(0);
|
||||||
pageUtil.setAdvSearch(getConditionALL());
|
pageUtil.setAdvSearch(getConditionALL());
|
||||||
depotItemService.find(pageUtil);
|
depotItemService.find(pageUtil);
|
||||||
List<DepotItem> dataList = pageUtil.getPageList();
|
List<DepotItem> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
Double thisAllPrice = 0.0;
|
Double thisAllPrice = 0.0;
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(DepotItem depotItem:dataList)
|
for(DepotItem depotItem:dataList)
|
||||||
{
|
{
|
||||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
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 InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum);
|
thisAllPrice = thisAllPrice + depotItem.getUnitPrice() * (prevSum + InSum - OutSum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outer.put("totalCount", thisAllPrice);
|
outer.put("totalCount", thisAllPrice);
|
||||||
//回写查询结果
|
//回写查询结果
|
||||||
toClient(outer.toString());
|
toClient(outer.toString());
|
||||||
}
|
}
|
||||||
catch (DataAccessException e)
|
catch (DataAccessException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel表格
|
* 导出excel表格
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public String exportExcel()
|
public String exportExcel()
|
||||||
{
|
{
|
||||||
Log.infoFileSync("===================调用导出信息action方法exportExcel开始=======================");
|
Log.infoFileSync("===================调用导出信息action方法exportExcel开始=======================");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
PageUtil<DepotItem> pageUtil = new PageUtil<DepotItem>();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
pageUtil.setAdvSearch(getConditionALL());
|
pageUtil.setAdvSearch(getConditionALL());
|
||||||
depotItemService.find(pageUtil);
|
depotItemService.find(pageUtil);
|
||||||
List<DepotItem> dataList = pageUtil.getPageList();
|
List<DepotItem> dataList = pageUtil.getPageList();
|
||||||
|
|
||||||
//存放数据json数组
|
//存放数据json数组
|
||||||
JSONArray dataArray = new JSONArray();
|
JSONArray dataArray = new JSONArray();
|
||||||
if(null != dataList)
|
if(null != dataList)
|
||||||
{
|
{
|
||||||
for(DepotItem depotItem:dataList)
|
for(DepotItem depotItem:dataList)
|
||||||
{
|
{
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
Integer prevSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),true);
|
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 InSum = sumNumber("入库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
Integer OutSum = sumNumber("出库",depotItem.getMaterialId().getId(),model.getMonthTime(),false);
|
||||||
item.put("Id", depotItem.getId());
|
item.put("Id", depotItem.getId());
|
||||||
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId());
|
||||||
item.put("MaterialName", depotItem.getMaterialId().getName());
|
item.put("MaterialName", depotItem.getMaterialId().getName());
|
||||||
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
item.put("MaterialModel", depotItem.getMaterialId().getModel());
|
||||||
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
item.put("MaterialColor", depotItem.getMaterialId().getColor());
|
||||||
item.put("prevSum", prevSum);
|
item.put("prevSum", prevSum);
|
||||||
item.put("InSum", InSum);
|
item.put("InSum", InSum);
|
||||||
item.put("OutSum", OutSum);
|
item.put("OutSum", OutSum);
|
||||||
item.put("thisSum", prevSum + InSum - OutSum);
|
item.put("thisSum", prevSum + InSum - OutSum);
|
||||||
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
item.put("thisAllPrice", depotItem.getUnitPrice() * (prevSum + InSum - OutSum));
|
||||||
item.put("UnitPrice", depotItem.getUnitPrice());
|
item.put("UnitPrice", depotItem.getUnitPrice());
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String isCurrentPage = "allPage";
|
String isCurrentPage = "allPage";
|
||||||
model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType()));
|
model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType()));
|
||||||
model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray));
|
model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e);
|
||||||
model.getShowModel().setMsgTip("export excel exception");
|
model.getShowModel().setMsgTip("export excel exception");
|
||||||
}
|
}
|
||||||
Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
|
Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
|
||||||
return EXCEL;
|
return EXCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) {
|
public Integer sumNumber(String type,Long MId,String MonthTime, Boolean isPrev) {
|
||||||
Integer sumNumber = 0;
|
Integer sumNumber = 0;
|
||||||
String allNumber = "";
|
String allNumber = "";
|
||||||
PageUtil pageUtil = new PageUtil();
|
PageUtil pageUtil = new PageUtil();
|
||||||
pageUtil.setPageSize(0);
|
pageUtil.setPageSize(0);
|
||||||
pageUtil.setCurPage(0);
|
pageUtil.setCurPage(0);
|
||||||
try {
|
try {
|
||||||
depotItemService.findByType(pageUtil, type, MId, MonthTime, isPrev);
|
depotItemService.findByType(pageUtil, type, MId, MonthTime, isPrev);
|
||||||
allNumber = pageUtil.getPageList().toString();
|
allNumber = pageUtil.getPageList().toString();
|
||||||
allNumber = allNumber.substring(1,allNumber.length()-1);
|
allNumber = allNumber.substring(1,allNumber.length()-1);
|
||||||
if(allNumber.equals("null")){
|
if(allNumber.equals("null")){
|
||||||
allNumber = "0";
|
allNumber = "0";
|
||||||
}
|
}
|
||||||
allNumber = allNumber.replace(".0", "");
|
allNumber = allNumber.replace(".0", "");
|
||||||
} catch (AmsException e) {
|
} catch (JshException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
sumNumber = Integer.parseInt(allNumber);
|
sumNumber = Integer.parseInt(allNumber);
|
||||||
return sumNumber;
|
return sumNumber;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getCondition()
|
private Map<String,Object> getCondition()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("HeaderId_n_eq", model.getHeaderId());
|
condition.put("HeaderId_n_eq", model.getHeaderId());
|
||||||
condition.put("Id_s_order","asc");
|
condition.put("Id_s_order","asc");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String,Object> getConditionALL()
|
private Map<String,Object> getConditionALL()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("HeaderId_s_in", model.getHeadIds());
|
condition.put("HeaderId_s_in", model.getHeadIds());
|
||||||
condition.put("MaterialId_s_in", model.getMaterialIds());
|
condition.put("MaterialId_s_in", model.getMaterialIds());
|
||||||
condition.put("MaterialId_s_gb","aaa");
|
condition.put("MaterialId_s_gb","aaa");
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
|
||||||
@Override
|
@Override
|
||||||
public DepotItemModel getModel()
|
public DepotItemModel getModel()
|
||||||
{
|
{
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
public void setDepotItemService(DepotItemIService depotItemService)
|
public void setDepotItemService(DepotItemIService depotItemService)
|
||||||
{
|
{
|
||||||
this.depotItemService = depotItemService;
|
this.depotItemService = depotItemService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,116 +1,116 @@
|
|||||||
package com.jsh.base;
|
package com.jsh.base;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.struts2.ServletActionContext;
|
import org.apache.struts2.ServletActionContext;
|
||||||
|
|
||||||
import com.opensymphony.xwork2.ActionContext;
|
import com.opensymphony.xwork2.ActionContext;
|
||||||
import com.opensymphony.xwork2.ActionSupport;
|
import com.opensymphony.xwork2.ActionSupport;
|
||||||
import com.opensymphony.xwork2.ModelDriven;
|
import com.opensymphony.xwork2.ModelDriven;
|
||||||
import com.jsh.model.po.Basicuser;
|
import com.jsh.model.po.Basicuser;
|
||||||
import com.jsh.service.basic.LogIService;
|
import com.jsh.service.basic.LogIService;
|
||||||
/**
|
/**
|
||||||
* struts2工具类
|
* struts2工具类
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* struts2 base action 一些常用方法获取
|
* struts2 base action 一些常用方法获取
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public abstract class BaseAction<T> extends ActionSupport implements ModelDriven<T>
|
public abstract class BaseAction<T> extends ActionSupport implements ModelDriven<T>
|
||||||
{
|
{
|
||||||
public LogIService logService;
|
public LogIService logService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志使用 是否成功表示
|
* 操作日志使用 是否成功表示
|
||||||
*/
|
*/
|
||||||
public String tipMsg = "成功";
|
public String tipMsg = "成功";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志使用 是否成功表示 0 ==成功 1==失败
|
* 操作日志使用 是否成功表示 0 ==成功 1==失败
|
||||||
*/
|
*/
|
||||||
public short tipType = 0;
|
public short tipType = 0;
|
||||||
|
|
||||||
public void setLogService(LogIService logService)
|
public void setLogService(LogIService logService)
|
||||||
{
|
{
|
||||||
this.logService = logService;
|
this.logService = logService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取session
|
* 获取session
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Map<String,Object> getSession()
|
public static Map<String,Object> getSession()
|
||||||
{
|
{
|
||||||
return ActionContext.getContext().getSession();
|
return ActionContext.getContext().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static HttpServletRequest getRequest()
|
public static HttpServletRequest getRequest()
|
||||||
{
|
{
|
||||||
return ServletActionContext.getRequest();
|
return ServletActionContext.getRequest();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取response
|
* 获取response
|
||||||
* @return response
|
* @return response
|
||||||
*/
|
*/
|
||||||
public static HttpServletResponse getResponse()
|
public static HttpServletResponse getResponse()
|
||||||
{
|
{
|
||||||
return ServletActionContext.getResponse();
|
return ServletActionContext.getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加错误信息
|
* 添加错误信息
|
||||||
* @param anErrorMessage
|
* @param anErrorMessage
|
||||||
*/
|
*/
|
||||||
public void addActionError(String anErrorMessage)
|
public void addActionError(String anErrorMessage)
|
||||||
{
|
{
|
||||||
super.addActionError(anErrorMessage);
|
super.addActionError(anErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加消息
|
* 添加消息
|
||||||
* @param aMessage
|
* @param aMessage
|
||||||
*/
|
*/
|
||||||
public void addActionMessage(String aMessage)
|
public void addActionMessage(String aMessage)
|
||||||
{
|
{
|
||||||
clearErrorsAndMessages();
|
clearErrorsAndMessages();
|
||||||
super.addActionMessage(aMessage);
|
super.addActionMessage(aMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加字段错误
|
* 添加字段错误
|
||||||
* @param fieldName
|
* @param fieldName
|
||||||
* @param errorMessage
|
* @param errorMessage
|
||||||
*/
|
*/
|
||||||
public void addFieldError(String fieldName, String errorMessage)
|
public void addFieldError(String fieldName, String errorMessage)
|
||||||
{
|
{
|
||||||
clearErrorsAndMessages();
|
clearErrorsAndMessages();
|
||||||
super.addFieldError(fieldName, errorMessage);
|
super.addFieldError(fieldName, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录用户信息
|
* 登录用户信息
|
||||||
* @return 登录用户对象
|
* @return 登录用户对象
|
||||||
*/
|
*/
|
||||||
public Basicuser getUser()
|
public Basicuser getUser()
|
||||||
{
|
{
|
||||||
return (Basicuser)getSession().get("user");
|
return (Basicuser)getSession().get("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回写客户端数据
|
* 回写客户端数据
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void toClient(String jsonData) throws IOException
|
public void toClient(String jsonData) throws IOException
|
||||||
{
|
{
|
||||||
HttpServletResponse response = ServletActionContext.getResponse();
|
HttpServletResponse response = ServletActionContext.getResponse();
|
||||||
response.setContentType("text/html;charset=utf-8");
|
response.setContentType("text/html;charset=utf-8");
|
||||||
response.getWriter().print(jsonData);
|
response.getWriter().print(jsonData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,124 +1,124 @@
|
|||||||
package com.jsh.base;
|
package com.jsh.base;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 常用增删改查操作
|
* 常用增删改查操作
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public interface BaseIDAO<T>
|
public interface BaseIDAO<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置操作类对象
|
* 设置操作类对象
|
||||||
* @param paramClass
|
* @param paramClass
|
||||||
*/
|
*/
|
||||||
void setPoJoClass(Class<T> paramClass);
|
void setPoJoClass(Class<T> paramClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加
|
* 增加
|
||||||
* @param t 对象
|
* @param t 对象
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
Serializable create(T t)throws DataAccessException;
|
Serializable create(T t)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加
|
* 增加
|
||||||
* @param t 对象
|
* @param t 对象
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
void save(T t)throws DataAccessException;
|
void save(T t)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
* @param t 对象
|
* @param t 对象
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
void delete(T t)throws DataAccessException;
|
void delete(T t)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取
|
* 获取
|
||||||
* @param objID ID
|
* @param objID ID
|
||||||
* @return 对象
|
* @return 对象
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
T get(Long objID)throws DataAccessException;
|
T get(Long objID)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改信息
|
* 修改信息
|
||||||
* @param t 要修改的对象
|
* @param t 要修改的对象
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
void update(T t)throws DataAccessException;
|
void update(T t)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除信息
|
* 批量删除信息
|
||||||
* @param 以逗号分割的ID
|
* @param 以逗号分割的ID
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
void batchDelete(String objIDs)throws DataAccessException;
|
void batchDelete(String objIDs)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找列表
|
* 查找列表
|
||||||
* @param pageUtil 分页工具类
|
* @param pageUtil 分页工具类
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<T> pageUtil)throws DataAccessException;
|
void find(PageUtil<T> pageUtil)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件查询列表--没有分页信息
|
* 根据条件查询列表--没有分页信息
|
||||||
* @param conditon 查询条件
|
* @param conditon 查询条件
|
||||||
* @return 查询列表数据
|
* @return 查询列表数据
|
||||||
*/
|
*/
|
||||||
List<T> find(Map<String,Object> conditon)throws DataAccessException;
|
List<T> find(Map<String,Object> conditon)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据hql查询 --没有分页信息
|
* 根据hql查询 --没有分页信息
|
||||||
* @param hql hibernate查询
|
* @param hql hibernate查询
|
||||||
* @return 查询列表数据
|
* @return 查询列表数据
|
||||||
*/
|
*/
|
||||||
List<T> find(String hql)throws DataAccessException;
|
List<T> find(String hql)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据搜索条件查询--分页
|
* 根据搜索条件查询--分页
|
||||||
* @param conditon 查询条件
|
* @param conditon 查询条件
|
||||||
* @param pageSize 每页个数
|
* @param pageSize 每页个数
|
||||||
* @param pageNo 页码
|
* @param pageNo 页码
|
||||||
* @return 查询列表数据
|
* @return 查询列表数据
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
List<T> find(Map<String,Object> conditon,int pageSize,int pageNo)throws DataAccessException;
|
List<T> find(Map<String,Object> conditon,int pageSize,int pageNo)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据hql查询--分页
|
* 根据hql查询--分页
|
||||||
* @param hql hibernate查询语句
|
* @param hql hibernate查询语句
|
||||||
* @param pageSize 每页个数
|
* @param pageSize 每页个数
|
||||||
* @param pageNo 页码
|
* @param pageNo 页码
|
||||||
* @return 查询列表数据
|
* @return 查询列表数据
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
List<T> find(String hql,int pageSize,int pageNo)throws DataAccessException;
|
List<T> find(String hql,int pageSize,int pageNo)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找符合条件的总数
|
* 查找符合条件的总数
|
||||||
* @param conditon
|
* @param conditon
|
||||||
* @return
|
* @return
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
Integer countSum(Map<String,Object> conditon)throws DataAccessException;
|
Integer countSum(Map<String,Object> conditon)throws DataAccessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找符合条件的总数
|
* 查找符合条件的总数
|
||||||
* @param hql
|
* @param hql
|
||||||
* @return
|
* @return
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException
|
||||||
*/
|
*/
|
||||||
Integer countSum(String hql)throws DataAccessException;
|
Integer countSum(String hql)throws DataAccessException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,137 +1,137 @@
|
|||||||
package com.jsh.base;
|
package com.jsh.base;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Basicuser;
|
import com.jsh.model.po.Basicuser;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public abstract class BaseService<T> implements BaseIService<T>
|
public abstract class BaseService<T> implements BaseIService<T>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Dao对象
|
* Dao对象
|
||||||
*/
|
*/
|
||||||
private BaseIDAO<T> baseDao;
|
private BaseIDAO<T> baseDao;
|
||||||
|
|
||||||
protected Class<T> entityClass;
|
protected Class<T> entityClass;
|
||||||
|
|
||||||
public void setBaseDao(BaseIDAO<T> baseDao)
|
public void setBaseDao(BaseIDAO<T> baseDao)
|
||||||
{
|
{
|
||||||
this.baseDao = baseDao;
|
this.baseDao = baseDao;
|
||||||
setPoJoClass(getEntityClass());
|
setPoJoClass(getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseIDAO<T> getBaseDao()
|
protected BaseIDAO<T> getBaseDao()
|
||||||
{
|
{
|
||||||
return this.baseDao;
|
return this.baseDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPoJoClass(Class<T> c)
|
private void setPoJoClass(Class<T> c)
|
||||||
{
|
{
|
||||||
this.baseDao.setPoJoClass(c);
|
this.baseDao.setPoJoClass(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Class<T> getEntityClass();
|
protected abstract Class<T> getEntityClass();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Serializable create(T t) throws DataAccessException
|
public Serializable create(T t) throws DataAccessException
|
||||||
{
|
{
|
||||||
return baseDao.create(t);
|
return baseDao.create(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(T t) throws DataAccessException
|
public void save(T t) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.save(t);
|
baseDao.save(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(T t) throws DataAccessException
|
public void delete(T t) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.delete(t);
|
baseDao.delete(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) throws DataAccessException
|
public void delete(Long id) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.batchDelete(id.toString());
|
baseDao.batchDelete(id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(Long objID) throws DataAccessException
|
public T get(Long objID) throws DataAccessException
|
||||||
{
|
{
|
||||||
return baseDao.get(objID);
|
return baseDao.get(objID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(T t) throws DataAccessException
|
public void update(T t) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.update(t);
|
baseDao.update(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchDelete(String objIDs) throws DataAccessException
|
public void batchDelete(String objIDs) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.batchDelete(objIDs);
|
baseDao.batchDelete(objIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<T> pageUtil) throws DataAccessException
|
public void find(PageUtil<T> pageUtil) throws DataAccessException
|
||||||
{
|
{
|
||||||
baseDao.find(pageUtil);
|
baseDao.find(pageUtil);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkIsNameExist(String filedName, String filedVale,String idFiled,Long objectID) throws DataAccessException
|
public Boolean checkIsNameExist(String filedName, String filedVale,String idFiled,Long objectID) throws DataAccessException
|
||||||
{
|
{
|
||||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put(filedName + "_s_eq", filedVale);
|
condition.put(filedName + "_s_eq", filedVale);
|
||||||
condition.put(idFiled + "_n_neq", objectID);
|
condition.put(idFiled + "_n_neq", objectID);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
baseDao.find(pageUtil);
|
baseDao.find(pageUtil);
|
||||||
|
|
||||||
List<T> dataList = pageUtil.getPageList();
|
List<T> dataList = pageUtil.getPageList();
|
||||||
if(null != dataList && dataList.size() > 0)
|
if(null != dataList && dataList.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException
|
public Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException
|
||||||
{
|
{
|
||||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put(TypeName + "_s_eq", TypeVale);
|
condition.put(TypeName + "_s_eq", TypeVale);
|
||||||
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
||||||
condition.put(UBName + "_s_like", UBValue);
|
condition.put(UBName + "_s_like", UBValue);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
baseDao.find(pageUtil);
|
baseDao.find(pageUtil);
|
||||||
|
|
||||||
List<T> dataList = pageUtil.getPageList();
|
List<T> dataList = pageUtil.getPageList();
|
||||||
if(null != dataList && dataList.size() > 0)
|
if(null != dataList && dataList.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException
|
public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException
|
||||||
{
|
{
|
||||||
PageUtil<T> pageUtil = new PageUtil<T>();
|
PageUtil<T> pageUtil = new PageUtil<T>();
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put(TypeName + "_s_eq", TypeVale);
|
condition.put(TypeName + "_s_eq", TypeVale);
|
||||||
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
condition.put(KeyIdName + "_s_eq", KeyIdValue);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
baseDao.find(pageUtil);
|
baseDao.find(pageUtil);
|
||||||
|
|
||||||
List<T> dataList = pageUtil.getPageList();
|
List<T> dataList = pageUtil.getPageList();
|
||||||
if(null != dataList && dataList.size() > 0)
|
if(null != dataList && dataList.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,174 +1,174 @@
|
|||||||
package com.jsh.base;
|
package com.jsh.base;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 封装log4j日志信息,打印日志信息类
|
* 封装log4j日志信息,打印日志信息类
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* @since 2014-01-22
|
* @since 2014-01-22
|
||||||
*/
|
*/
|
||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据异常信息获取调用类的信息
|
* 根据异常信息获取调用类的信息
|
||||||
*/
|
*/
|
||||||
private static final Exception ex = new Exception();
|
private static final Exception ex = new Exception();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Log4j实例
|
* 获取Log4j实例
|
||||||
*/
|
*/
|
||||||
private static final Logger log = Logger.getLogger("ams");
|
private static final Logger log = Logger.getLogger("ams");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info级别日志前缀
|
* Info级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_INFO_PREFIX = "==========";
|
public static final String LOG_INFO_PREFIX = "==========";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* error级别日志前缀
|
* error级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>";
|
public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* debug级别日志前缀
|
* debug级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_DEBUG_PREFIX = "-----------";
|
public static final String LOG_DEBUG_PREFIX = "-----------";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fatal级别日志前缀
|
* fatal级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$";
|
public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* warn级别日志前缀
|
* warn级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_WARN_PREFIX = "##########";
|
public static final String LOG_WARN_PREFIX = "##########";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印deug日期信息
|
* 打印deug日期信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
*/
|
*/
|
||||||
public static void debugFileSync(Object msg)
|
public static void debugFileSync(Object msg)
|
||||||
{
|
{
|
||||||
log.debug(getLogDetail(msg));
|
log.debug(getLogDetail(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印debug异常信息
|
* 打印debug异常信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
* @param e 异常堆栈
|
* @param e 异常堆栈
|
||||||
*/
|
*/
|
||||||
public static void debugFileSync(Object msg, Throwable e)
|
public static void debugFileSync(Object msg, Throwable e)
|
||||||
{
|
{
|
||||||
log.debug(getLogDetail(msg), e);
|
log.debug(getLogDetail(msg), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印info日志信息
|
* 打印info日志信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
*/
|
*/
|
||||||
public static void infoFileSync(Object msg)
|
public static void infoFileSync(Object msg)
|
||||||
{
|
{
|
||||||
log.info(getLogDetail(msg));
|
log.info(getLogDetail(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印 info日志带异常信息
|
* 打印 info日志带异常信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
* @param e 异常堆栈
|
* @param e 异常堆栈
|
||||||
*/
|
*/
|
||||||
public static void infoFileSync(Object msg, Throwable e)
|
public static void infoFileSync(Object msg, Throwable e)
|
||||||
{
|
{
|
||||||
log.info(getLogDetail(msg), e);
|
log.info(getLogDetail(msg), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印warn日期信息
|
* 打印warn日期信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
*/
|
*/
|
||||||
public static void warnFileSync(Object msg)
|
public static void warnFileSync(Object msg)
|
||||||
{
|
{
|
||||||
log.warn(getLogDetail(msg));
|
log.warn(getLogDetail(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印warn日志信息带异常
|
* 打印warn日志信息带异常
|
||||||
* @param msg日志信息
|
* @param msg日志信息
|
||||||
* @param e 异常堆栈
|
* @param e 异常堆栈
|
||||||
*/
|
*/
|
||||||
public static void warnFileSync(Object msg, Throwable e)
|
public static void warnFileSync(Object msg, Throwable e)
|
||||||
{
|
{
|
||||||
log.warn(getLogDetail(msg), e);
|
log.warn(getLogDetail(msg), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印error日志信息
|
* 打印error日志信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
*/
|
*/
|
||||||
public static void errorFileSync(Object msg)
|
public static void errorFileSync(Object msg)
|
||||||
{
|
{
|
||||||
log.error(getLogDetail(msg));
|
log.error(getLogDetail(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印error日志信息带异常
|
* 打印error日志信息带异常
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
* @param e 异常堆栈
|
* @param e 异常堆栈
|
||||||
*/
|
*/
|
||||||
public static void errorFileSync(Object msg, Throwable e)
|
public static void errorFileSync(Object msg, Throwable e)
|
||||||
{
|
{
|
||||||
log.error(getLogDetail(msg), e);
|
log.error(getLogDetail(msg), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印fatal日志信息
|
* 打印fatal日志信息
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
*/
|
*/
|
||||||
public static void fatalFileSync(Object msg)
|
public static void fatalFileSync(Object msg)
|
||||||
{
|
{
|
||||||
log.fatal(getLogDetail(msg));
|
log.fatal(getLogDetail(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印fatal日志信息带异常
|
* 打印fatal日志信息带异常
|
||||||
* @param msg 日志信息
|
* @param msg 日志信息
|
||||||
* @param e 异常堆栈
|
* @param e 异常堆栈
|
||||||
*/
|
*/
|
||||||
public static void fatalFileSync(Object msg, Throwable e)
|
public static void fatalFileSync(Object msg, Throwable e)
|
||||||
{
|
{
|
||||||
log.fatal(getLogDetail(msg), e);
|
log.fatal(getLogDetail(msg), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼装日志详细信息
|
* 拼装日志详细信息
|
||||||
* @param message 要打印的日志信息
|
* @param message 要打印的日志信息
|
||||||
* @return 封装后的日志详细信息
|
* @return 封装后的日志详细信息
|
||||||
*/
|
*/
|
||||||
private static synchronized String getLogDetail(Object message)
|
private static synchronized String getLogDetail(Object message)
|
||||||
{
|
{
|
||||||
String msg = "";
|
String msg = "";
|
||||||
if (null != message)
|
if (null != message)
|
||||||
msg = message.toString();
|
msg = message.toString();
|
||||||
StringBuffer bf = new StringBuffer();
|
StringBuffer bf = new StringBuffer();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ex.fillInStackTrace();
|
ex.fillInStackTrace();
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StackTraceElement[] trace = ex.getStackTrace();
|
StackTraceElement[] trace = ex.getStackTrace();
|
||||||
//获取异常堆栈中的调用类信息
|
//获取异常堆栈中的调用类信息
|
||||||
final int pos = 2;
|
final int pos = 2;
|
||||||
bf.append(msg);
|
bf.append(msg);
|
||||||
bf.append(" [class:");
|
bf.append(" [class:");
|
||||||
bf.append(trace[pos].getClassName());
|
bf.append(trace[pos].getClassName());
|
||||||
bf.append(" method:");
|
bf.append(" method:");
|
||||||
bf.append(trace[pos].getMethodName());
|
bf.append(trace[pos].getMethodName());
|
||||||
bf.append(" line:");
|
bf.append(" line:");
|
||||||
bf.append(trace[pos].getLineNumber());
|
bf.append(trace[pos].getLineNumber());
|
||||||
bf.append("]");
|
bf.append("]");
|
||||||
}
|
}
|
||||||
return bf.toString();
|
return bf.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,119 +1,119 @@
|
|||||||
package com.jsh.constants.asset;
|
package com.jsh.constants.asset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义资产管理常量
|
* 定义资产管理常量
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public interface AssetConstants
|
public interface AssetConstants
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 公共常量
|
* 公共常量
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class Common
|
public class Common
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产常量--导入导出excel表格业务相关
|
* 资产常量--导入导出excel表格业务相关
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class BusinessForExcel
|
public class BusinessForExcel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 资产名称常量
|
* 资产名称常量
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_ASSETNAME = 0;
|
public static final int EXCEL_ASSETNAME = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产类型常量
|
* 资产类型常量
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_CATEGORY = 1;
|
public static final int EXCEL_CATEGORY = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产单价
|
* 资产单价
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_PRICE = 2;
|
public static final int EXCEL_PRICE = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_USER = 3;
|
public static final int EXCEL_USER = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买日期
|
* 购买日期
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_PURCHASE_DATE = 4;
|
public static final int EXCEL_PURCHASE_DATE = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产状态
|
* 资产状态
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_STATUS = 5;
|
public static final int EXCEL_STATUS = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 位置
|
* 位置
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_LOCATION = 6;
|
public static final int EXCEL_LOCATION = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产编号
|
* 资产编号
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_NUM = 7;
|
public static final int EXCEL_NUM = 7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 序列号
|
* 序列号
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_SERIALNO = 8;
|
public static final int EXCEL_SERIALNO = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有效日期
|
* 有效日期
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_EXPIRATION_DATE = 9;
|
public static final int EXCEL_EXPIRATION_DATE = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保修日期
|
* 保修日期
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_WARRANTY_DATE = 10;
|
public static final int EXCEL_WARRANTY_DATE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 供应商
|
* 供应商
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_SUPPLIER = 11;
|
public static final int EXCEL_SUPPLIER = 11;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签
|
* 标签
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_LABLE = 12;
|
public static final int EXCEL_LABLE = 12;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_DESC = 13;
|
public static final int EXCEL_DESC = 13;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表头
|
* 表头
|
||||||
*/
|
*/
|
||||||
public static final int EXCEL_TABLE_HEAD = 0;
|
public static final int EXCEL_TABLE_HEAD = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 --在库
|
* 状态 --在库
|
||||||
*/
|
*/
|
||||||
public static final int EXCEl_STATUS_ZAIKU = 0;
|
public static final int EXCEl_STATUS_ZAIKU = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 --在用
|
* 状态 --在用
|
||||||
*/
|
*/
|
||||||
public static final int EXCEl_STATUS_INUSE = 1;
|
public static final int EXCEl_STATUS_INUSE = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 -- 消费
|
* 状态 -- 消费
|
||||||
*/
|
*/
|
||||||
public static final int EXCEl_STATUS_CONSUME = 2;
|
public static final int EXCEl_STATUS_CONSUME = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action返回excel结果
|
* action返回excel结果
|
||||||
*/
|
*/
|
||||||
public static final String EXCEL = "excel";
|
public static final String EXCEL = "excel";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +1,36 @@
|
|||||||
package com.jsh.constants.common;
|
package com.jsh.constants.common;
|
||||||
|
|
||||||
public interface AmsConstants
|
public interface AmsConstants
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 定义资产管理公共常量
|
* 定义资产管理公共常量
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class Common
|
public class Common
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Info级别日志前缀
|
* Info级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_INFO_PREFIX = "==========";
|
public static final String LOG_INFO_PREFIX = "==========";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* error级别日志前缀
|
* error级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>";
|
public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* debug级别日志前缀
|
* debug级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_DEBUG_PREFIX = "-----------";
|
public static final String LOG_DEBUG_PREFIX = "-----------";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fatal级别日志前缀
|
* fatal级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$";
|
public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* warn级别日志前缀
|
* warn级别日志前缀
|
||||||
*/
|
*/
|
||||||
public static final String LOG_WARN_PREFIX = "##########";
|
public static final String LOG_WARN_PREFIX = "##########";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,65 +1,65 @@
|
|||||||
package com.jsh.constants.common;
|
package com.jsh.constants.common;
|
||||||
|
|
||||||
public interface LogModuleConstants
|
public interface LogModuleConstants
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 系统管理模块名称定义
|
* 系统管理模块名称定义
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class ManageModuleNameCode
|
public class ManageModuleNameCode
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 管理模块资产名称
|
* 管理模块资产名称
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_MANAGE_ASSETNAME = "资产名称";
|
public static final String MODULE_MANAGE_ASSETNAME = "资产名称";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理模块供应商
|
* 管理模块供应商
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_MANAGE_SUPPLIER = "供应商";
|
public static final String MODULE_MANAGE_SUPPLIER = "供应商";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理模块资产类型
|
* 管理模块资产类型
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_MANAGE_CATEGORY = "资产类型";
|
public static final String MODULE_MANAGE_CATEGORY = "资产类型";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理模块用户管理
|
* 管理模块用户管理
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_MANAGE_USER = "用户管理";
|
public static final String MODULE_MANAGE_USER = "用户管理";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产管理模块名称定义
|
* 资产管理模块名称定义
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class AssetModuleNameCode
|
public class AssetModuleNameCode
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 资产管理模块资产管理
|
* 资产管理模块资产管理
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_ASSET_MANAGE = "资产管理";
|
public static final String MODULE_ASSET_MANAGE = "资产管理";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产管理模块资产报表
|
* 资产管理模块资产报表
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_ASSET_REPORT = "资产报表";
|
public static final String MODULE_ASSET_REPORT = "资产报表";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产管理模块资产概况
|
* 资产管理模块资产概况
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_ASSET_GENERAL = "资产概况";
|
public static final String MODULE_ASSET_GENERAL = "资产概况";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志管理模块名称定义
|
* 日志管理模块名称定义
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class LogModuleNameCode
|
public class LogModuleNameCode
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 日志管理模块日志管理
|
* 日志管理模块日志管理
|
||||||
*/
|
*/
|
||||||
public static final String MODULE_LOG_MANAGE = "日志管理";
|
public static final String MODULE_LOG_MANAGE = "日志管理";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
package com.jsh.dao.asset;
|
package com.jsh.dao.asset;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
|
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.SearchConditionUtil;
|
import com.jsh.util.common.SearchConditionUtil;
|
||||||
|
|
||||||
public class ReportDAO extends HibernateDaoSupport implements ReportIDAO
|
public class ReportDAO extends HibernateDaoSupport implements ReportIDAO
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException
|
public void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws JshException
|
||||||
{
|
{
|
||||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType +") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
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.setTotalCount(query.list().size());
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
package com.jsh.dao.asset;
|
package com.jsh.dao.asset;
|
||||||
|
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface ReportIDAO
|
public interface ReportIDAO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查找资产列表
|
* 查找资产列表
|
||||||
* @param pageUtil 分页工具类
|
* @param pageUtil 分页工具类
|
||||||
* @param reportType 报表统计字段
|
* @param reportType 报表统计字段
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException;
|
void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
package com.jsh.dao.basic;
|
package com.jsh.dao.basic;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
|
||||||
import com.jsh.base.BaseDAO;
|
import com.jsh.base.BaseDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.SearchConditionUtil;
|
import com.jsh.util.common.SearchConditionUtil;
|
||||||
|
|
||||||
public class UserBusinessDAO extends BaseDAO<UserBusiness> implements UserBusinessIDAO
|
public class UserBusinessDAO extends BaseDAO<UserBusiness> implements UserBusinessIDAO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 设置dao映射基类
|
* 设置dao映射基类
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<UserBusiness> getEntityClass()
|
public Class<UserBusiness> getEntityClass()
|
||||||
{
|
{
|
||||||
return UserBusiness.class;
|
return UserBusiness.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException
|
public void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws JshException
|
||||||
{
|
{
|
||||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(id),sum(id) from UserBusiness userBusiness where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
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.setTotalCount(query.list().size());
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
package com.jsh.dao.basic;
|
package com.jsh.dao.basic;
|
||||||
|
|
||||||
import com.jsh.base.BaseIDAO;
|
import com.jsh.base.BaseIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface UserBusinessIDAO extends BaseIDAO<UserBusiness>
|
public interface UserBusinessIDAO extends BaseIDAO<UserBusiness>
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 测试hql语句
|
* 测试hql语句
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException;
|
void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
package com.jsh.dao.materials;
|
package com.jsh.dao.materials;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
|
||||||
import com.jsh.base.BaseDAO;
|
import com.jsh.base.BaseDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.SearchConditionUtil;
|
import com.jsh.util.common.SearchConditionUtil;
|
||||||
|
|
||||||
public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
|
public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 设置dao映射基类
|
* 设置dao映射基类
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<DepotHead> getEntityClass()
|
public Class<DepotHead> getEntityClass()
|
||||||
{
|
{
|
||||||
return DepotHead.class;
|
return DepotHead.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException
|
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException
|
||||||
{
|
{
|
||||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
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.setTotalCount(query.list().size());
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
package com.jsh.dao.materials;
|
package com.jsh.dao.materials;
|
||||||
|
|
||||||
import com.jsh.base.BaseIDAO;
|
import com.jsh.base.BaseIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
|
public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 获取MaxId
|
* 获取MaxId
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException;
|
void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,59 +1,59 @@
|
|||||||
package com.jsh.dao.materials;
|
package com.jsh.dao.materials;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
|
||||||
import com.jsh.base.BaseDAO;
|
import com.jsh.base.BaseDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.DepotItem;
|
import com.jsh.model.po.DepotItem;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.SearchConditionUtil;
|
import com.jsh.util.common.SearchConditionUtil;
|
||||||
|
|
||||||
public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 设置dao映射基类
|
* 设置dao映射基类
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Class<DepotItem> getEntityClass()
|
public Class<DepotItem> getEntityClass()
|
||||||
{
|
{
|
||||||
return DepotItem.class;
|
return DepotItem.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws AmsException
|
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
|
||||||
{
|
{
|
||||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||||
Query query;
|
Query query;
|
||||||
if(isPrev) {
|
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()));
|
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 {
|
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()));
|
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.setTotalCount(query.list().size());
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException
|
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws JshException
|
||||||
{
|
{
|
||||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||||
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select * from jsh_depotitem where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select * from jsh_depotitem where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
pageUtil.setTotalCount(query.list().size());
|
pageUtil.setTotalCount(query.list().size());
|
||||||
|
|
||||||
// 分页查询
|
// 分页查询
|
||||||
int pageNo = pageUtil.getCurPage();
|
int pageNo = pageUtil.getCurPage();
|
||||||
int pageSize = pageUtil.getPageSize();
|
int pageSize = pageUtil.getPageSize();
|
||||||
if (0 != pageNo && 0 != pageSize)
|
if (0 != pageNo && 0 != pageSize)
|
||||||
{
|
{
|
||||||
query.setFirstResult((pageNo - 1) * pageSize);
|
query.setFirstResult((pageNo - 1) * pageSize);
|
||||||
query.setMaxResults(pageSize);
|
query.setMaxResults(pageSize);
|
||||||
}
|
}
|
||||||
pageUtil.setPageList(query.list());
|
pageUtil.setPageList(query.list());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
package com.jsh.dao.materials;
|
package com.jsh.dao.materials;
|
||||||
|
|
||||||
import com.jsh.base.BaseIDAO;
|
import com.jsh.base.BaseIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.DepotItem;
|
import com.jsh.model.po.DepotItem;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
|
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
|
||||||
{
|
{
|
||||||
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException;
|
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
|
||||||
|
|
||||||
void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException;
|
void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,73 +1,73 @@
|
|||||||
package com.jsh.exception;
|
package com.jsh.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title: 平台异常基类
|
* @title: 平台异常基类
|
||||||
* @description: 用于包装一些异常信息,打印日志等服务
|
* @description: 用于包装一些异常信息,打印日志等服务
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* @since: 2014-01-24
|
* @since: 2014-01-24
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AmsException extends Exception
|
public class JshException extends Exception
|
||||||
{
|
{
|
||||||
public long errorCode = -1;
|
public long errorCode = -1;
|
||||||
|
|
||||||
public String message ;
|
public String message ;
|
||||||
|
|
||||||
public AmsException()
|
public JshException()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(String message)
|
public JshException(String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(String message, Throwable cause)
|
public JshException(String message, Throwable cause)
|
||||||
{
|
{
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(Throwable cause)
|
public JshException(Throwable cause)
|
||||||
{
|
{
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(long errorCode)
|
public JshException(long errorCode)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(String message, long errorCode)
|
public JshException(String message, long errorCode)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(String message, long errorCode, Throwable cause)
|
public JshException(String message, long errorCode, Throwable cause)
|
||||||
{
|
{
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmsException(long errorCode, Throwable cause)
|
public JshException(long errorCode, Throwable cause)
|
||||||
{
|
{
|
||||||
super(cause);
|
super(cause);
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getErrorCode()
|
public long getErrorCode()
|
||||||
{
|
{
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
{
|
{
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,83 +1,83 @@
|
|||||||
package com.jsh.filter.user;
|
package com.jsh.filter.user;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
/**
|
/**
|
||||||
* 用户登录session处理类
|
* 用户登录session处理类
|
||||||
* 过滤session是否超时
|
* 过滤session是否超时
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* @version [版本号, 2012-3-6]
|
* @version [版本号, 2012-3-6]
|
||||||
* @see [相关类/方法]
|
* @see [相关类/方法]
|
||||||
* @since
|
* @since
|
||||||
*/
|
*/
|
||||||
public class UserFilter implements Filter
|
public class UserFilter implements Filter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 初始化过滤器 暂不处理
|
* 初始化过滤器 暂不处理
|
||||||
* 重载方法
|
* 重载方法
|
||||||
* @param arg0
|
* @param arg0
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void init(FilterConfig arg0)
|
public void init(FilterConfig arg0)
|
||||||
throws ServletException
|
throws ServletException
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 判断用户session是否存在 不存在则跳转到登录页面
|
* 判断用户session是否存在 不存在则跳转到登录页面
|
||||||
* 重载方法
|
* 重载方法
|
||||||
* @param srequest
|
* @param srequest
|
||||||
* @param sresponse
|
* @param sresponse
|
||||||
* @param chain
|
* @param chain
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
*/
|
*/
|
||||||
public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain)
|
public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
HttpServletRequest request = (HttpServletRequest) srequest;
|
HttpServletRequest request = (HttpServletRequest) srequest;
|
||||||
HttpServletResponse response = (HttpServletResponse) sresponse;
|
HttpServletResponse response = (HttpServletResponse) sresponse;
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
// //定义登录页面不被过滤===后续考虑
|
// //定义登录页面不被过滤===后续考虑
|
||||||
// List<String> notFilterFile = new ArrayList<String>();
|
// List<String> notFilterFile = new ArrayList<String>();
|
||||||
// notFilterFile.add("/login.jsp");
|
// notFilterFile.add("/login.jsp");
|
||||||
// notFilterFile.add("/logout.jsp");
|
// notFilterFile.add("/logout.jsp");
|
||||||
// notFilterFile.add("/css/*");
|
// notFilterFile.add("/css/*");
|
||||||
// notFilterFile.add("/css/zTreeStyle/*");
|
// notFilterFile.add("/css/zTreeStyle/*");
|
||||||
// notFilterFile.add("/css/zTreeStyle/img/*");
|
// notFilterFile.add("/css/zTreeStyle/img/*");
|
||||||
// notFilterFile.add("/css/zTreeStyle/img/diy/*");
|
// notFilterFile.add("/css/zTreeStyle/img/diy/*");
|
||||||
|
|
||||||
//获取工程路径
|
//获取工程路径
|
||||||
String path = request.getContextPath();
|
String path = request.getContextPath();
|
||||||
String requestURl = request.getRequestURI();
|
String requestURl = request.getRequestURI();
|
||||||
|
|
||||||
//提示用户没有权限操作
|
//提示用户没有权限操作
|
||||||
// response.setCharacterEncoding("utf-8");
|
// response.setCharacterEncoding("utf-8");
|
||||||
// PrintWriter pw=response.getWriter();
|
// PrintWriter pw=response.getWriter();
|
||||||
// pw.write("<script language='javascript'>alert('您没有权限进行此项操作!')</script>");
|
// pw.write("<script language='javascript'>alert('您没有权限进行此项操作!')</script>");
|
||||||
//session中有值则不进行处理
|
//session中有值则不进行处理
|
||||||
if(requestURl.contains("/pages") &&null != session.getAttribute("user"))
|
if(requestURl.contains("/pages") &&null != session.getAttribute("user"))
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
else
|
else
|
||||||
response.sendRedirect(path + "/logout.jsp");
|
response.sendRedirect(path + "/logout.jsp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销毁过滤器
|
* 销毁过滤器
|
||||||
*/
|
*/
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
</column>
|
</column>
|
||||||
</property>
|
</property>
|
||||||
<property name="password" type="java.lang.String">
|
<property name="password" type="java.lang.String">
|
||||||
<column name="password" length="30" not-null="true">
|
<column name="password" length="50" not-null="true">
|
||||||
<comment>登陆密码</comment>
|
<comment>登陆密码</comment>
|
||||||
</column>
|
</column>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@ -1,257 +1,256 @@
|
|||||||
package com.jsh.model.vo.materials;
|
package com.jsh.model.vo.materials;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import com.sun.jmx.snmp.Timestamp;
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
@SuppressWarnings("serial")
|
public class DepotHeadModel implements Serializable
|
||||||
public class DepotHeadModel implements Serializable
|
{
|
||||||
{
|
private DepotHeadShowModel showModel = new DepotHeadShowModel();
|
||||||
private DepotHeadShowModel showModel = new DepotHeadShowModel();
|
|
||||||
|
/**======开始接受页面参数=================**/
|
||||||
/**======开始接受页面参数=================**/
|
private String Type = "";
|
||||||
private String Type = "";
|
private String SubType = "";
|
||||||
private String SubType = "";
|
private Long ProjectId;
|
||||||
private Long ProjectId;
|
private String Number = "";
|
||||||
private String Number = "";
|
private String OperPersonName = "";
|
||||||
private String OperPersonName = "";
|
private String OperTime;
|
||||||
private String OperTime;
|
private Long OrganId;
|
||||||
private Long OrganId;
|
private Long HandsPersonId;
|
||||||
private Long HandsPersonId;
|
private Long WareHousePersonId;
|
||||||
private Long WareHousePersonId;
|
private String SettlementWay = "";
|
||||||
private String SettlementWay = "";
|
private Long BuildingId;
|
||||||
private Long BuildingId;
|
private Long AllocationProjectId;
|
||||||
private Long AllocationProjectId;
|
private String Remark = "";
|
||||||
private String Remark = "";
|
private String State = "";
|
||||||
private String State = "";
|
private String ReAuditPersonName = "";
|
||||||
private String ReAuditPersonName = "";
|
private String Reason = "";
|
||||||
private String Reason = "";
|
|
||||||
|
private String BeginTime; //查询开始时间
|
||||||
private String BeginTime; //查询开始时间
|
private String EndTime; //查询结束时间
|
||||||
private String EndTime; //查询结束时间
|
private String MonthTime; //查询月份
|
||||||
private String MonthTime; //查询月份
|
/**
|
||||||
/**
|
* 分类ID
|
||||||
* 分类ID
|
*/
|
||||||
*/
|
private Long depotHeadID = 0l;
|
||||||
private Long depotHeadID = 0l;
|
|
||||||
|
/**
|
||||||
/**
|
* 分类IDs 批量操作使用
|
||||||
* 分类IDs 批量操作使用
|
*/
|
||||||
*/
|
private String depotHeadIDs = "";
|
||||||
private String depotHeadIDs = "";
|
|
||||||
|
/**
|
||||||
/**
|
* 每页显示的个数
|
||||||
* 每页显示的个数
|
*/
|
||||||
*/
|
private int pageSize = 10;
|
||||||
private int pageSize = 10;
|
|
||||||
|
/**
|
||||||
/**
|
* 当前页码
|
||||||
* 当前页码
|
*/
|
||||||
*/
|
private int pageNo = 1;
|
||||||
private int pageNo = 1;
|
|
||||||
|
/**
|
||||||
/**
|
* 用户IP,用户记录操作日志
|
||||||
* 用户IP,用户记录操作日志
|
*/
|
||||||
*/
|
private String clientIp = "";
|
||||||
private String clientIp = "";
|
|
||||||
|
public DepotHeadShowModel getShowModel() {
|
||||||
public DepotHeadShowModel getShowModel() {
|
return showModel;
|
||||||
return showModel;
|
}
|
||||||
}
|
|
||||||
|
public void setShowModel(DepotHeadShowModel showModel) {
|
||||||
public void setShowModel(DepotHeadShowModel showModel) {
|
this.showModel = showModel;
|
||||||
this.showModel = showModel;
|
}
|
||||||
}
|
|
||||||
|
public String getType() {
|
||||||
public String getType() {
|
return Type;
|
||||||
return Type;
|
}
|
||||||
}
|
|
||||||
|
public void setType(String type) {
|
||||||
public void setType(String type) {
|
Type = type;
|
||||||
Type = type;
|
}
|
||||||
}
|
|
||||||
|
public String getSubType() {
|
||||||
public String getSubType() {
|
return SubType;
|
||||||
return SubType;
|
}
|
||||||
}
|
|
||||||
|
public void setSubType(String subType) {
|
||||||
public void setSubType(String subType) {
|
SubType = subType;
|
||||||
SubType = subType;
|
}
|
||||||
}
|
|
||||||
|
public Long getProjectId() {
|
||||||
public Long getProjectId() {
|
return ProjectId;
|
||||||
return ProjectId;
|
}
|
||||||
}
|
|
||||||
|
public void setProjectId(Long projectId) {
|
||||||
public void setProjectId(Long projectId) {
|
ProjectId = projectId;
|
||||||
ProjectId = projectId;
|
}
|
||||||
}
|
|
||||||
|
public String getNumber() {
|
||||||
public String getNumber() {
|
return Number;
|
||||||
return Number;
|
}
|
||||||
}
|
|
||||||
|
public void setNumber(String number) {
|
||||||
public void setNumber(String number) {
|
Number = number;
|
||||||
Number = number;
|
}
|
||||||
}
|
|
||||||
|
public String getOperPersonName() {
|
||||||
public String getOperPersonName() {
|
return OperPersonName;
|
||||||
return OperPersonName;
|
}
|
||||||
}
|
|
||||||
|
public void setOperPersonName(String operPersonName) {
|
||||||
public void setOperPersonName(String operPersonName) {
|
OperPersonName = operPersonName;
|
||||||
OperPersonName = operPersonName;
|
}
|
||||||
}
|
|
||||||
|
public Long getOrganId() {
|
||||||
public Long getOrganId() {
|
return OrganId;
|
||||||
return OrganId;
|
}
|
||||||
}
|
|
||||||
|
public void setOrganId(Long organId) {
|
||||||
public void setOrganId(Long organId) {
|
OrganId = organId;
|
||||||
OrganId = organId;
|
}
|
||||||
}
|
|
||||||
|
public Long getHandsPersonId() {
|
||||||
public Long getHandsPersonId() {
|
return HandsPersonId;
|
||||||
return HandsPersonId;
|
}
|
||||||
}
|
|
||||||
|
public void setHandsPersonId(Long handsPersonId) {
|
||||||
public void setHandsPersonId(Long handsPersonId) {
|
HandsPersonId = handsPersonId;
|
||||||
HandsPersonId = handsPersonId;
|
}
|
||||||
}
|
|
||||||
|
public Long getWareHousePersonId() {
|
||||||
public Long getWareHousePersonId() {
|
return WareHousePersonId;
|
||||||
return WareHousePersonId;
|
}
|
||||||
}
|
|
||||||
|
public void setWareHousePersonId(Long wareHousePersonId) {
|
||||||
public void setWareHousePersonId(Long wareHousePersonId) {
|
WareHousePersonId = wareHousePersonId;
|
||||||
WareHousePersonId = wareHousePersonId;
|
}
|
||||||
}
|
|
||||||
|
public String getSettlementWay() {
|
||||||
public String getSettlementWay() {
|
return SettlementWay;
|
||||||
return SettlementWay;
|
}
|
||||||
}
|
|
||||||
|
public void setSettlementWay(String settlementWay) {
|
||||||
public void setSettlementWay(String settlementWay) {
|
SettlementWay = settlementWay;
|
||||||
SettlementWay = settlementWay;
|
}
|
||||||
}
|
|
||||||
|
public Long getBuildingId() {
|
||||||
public Long getBuildingId() {
|
return BuildingId;
|
||||||
return BuildingId;
|
}
|
||||||
}
|
|
||||||
|
public void setBuildingId(Long buildingId) {
|
||||||
public void setBuildingId(Long buildingId) {
|
BuildingId = buildingId;
|
||||||
BuildingId = buildingId;
|
}
|
||||||
}
|
|
||||||
|
public Long getAllocationProjectId() {
|
||||||
public Long getAllocationProjectId() {
|
return AllocationProjectId;
|
||||||
return AllocationProjectId;
|
}
|
||||||
}
|
|
||||||
|
public void setAllocationProjectId(Long allocationProjectId) {
|
||||||
public void setAllocationProjectId(Long allocationProjectId) {
|
AllocationProjectId = allocationProjectId;
|
||||||
AllocationProjectId = allocationProjectId;
|
}
|
||||||
}
|
|
||||||
|
public String getRemark() {
|
||||||
public String getRemark() {
|
return Remark;
|
||||||
return Remark;
|
}
|
||||||
}
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
public void setRemark(String remark) {
|
Remark = remark;
|
||||||
Remark = remark;
|
}
|
||||||
}
|
|
||||||
|
public String getState() {
|
||||||
public String getState() {
|
return State;
|
||||||
return State;
|
}
|
||||||
}
|
|
||||||
|
public void setState(String state) {
|
||||||
public void setState(String state) {
|
State = state;
|
||||||
State = state;
|
}
|
||||||
}
|
|
||||||
|
public String getReAuditPersonName() {
|
||||||
public String getReAuditPersonName() {
|
return ReAuditPersonName;
|
||||||
return ReAuditPersonName;
|
}
|
||||||
}
|
|
||||||
|
public void setReAuditPersonName(String reAuditPersonName) {
|
||||||
public void setReAuditPersonName(String reAuditPersonName) {
|
ReAuditPersonName = reAuditPersonName;
|
||||||
ReAuditPersonName = reAuditPersonName;
|
}
|
||||||
}
|
|
||||||
|
public String getReason() {
|
||||||
public String getReason() {
|
return Reason;
|
||||||
return Reason;
|
}
|
||||||
}
|
|
||||||
|
public void setReason(String reason) {
|
||||||
public void setReason(String reason) {
|
Reason = reason;
|
||||||
Reason = reason;
|
}
|
||||||
}
|
|
||||||
|
public Long getDepotHeadID() {
|
||||||
public Long getDepotHeadID() {
|
return depotHeadID;
|
||||||
return depotHeadID;
|
}
|
||||||
}
|
|
||||||
|
public void setDepotHeadID(Long depotHeadID) {
|
||||||
public void setDepotHeadID(Long depotHeadID) {
|
this.depotHeadID = depotHeadID;
|
||||||
this.depotHeadID = depotHeadID;
|
}
|
||||||
}
|
|
||||||
|
public String getDepotHeadIDs() {
|
||||||
public String getDepotHeadIDs() {
|
return depotHeadIDs;
|
||||||
return depotHeadIDs;
|
}
|
||||||
}
|
|
||||||
|
public void setDepotHeadIDs(String depotHeadIDs) {
|
||||||
public void setDepotHeadIDs(String depotHeadIDs) {
|
this.depotHeadIDs = depotHeadIDs;
|
||||||
this.depotHeadIDs = depotHeadIDs;
|
}
|
||||||
}
|
|
||||||
|
public int getPageSize() {
|
||||||
public int getPageSize() {
|
return pageSize;
|
||||||
return pageSize;
|
}
|
||||||
}
|
|
||||||
|
public void setPageSize(int pageSize) {
|
||||||
public void setPageSize(int pageSize) {
|
this.pageSize = pageSize;
|
||||||
this.pageSize = pageSize;
|
}
|
||||||
}
|
|
||||||
|
public int getPageNo() {
|
||||||
public int getPageNo() {
|
return pageNo;
|
||||||
return pageNo;
|
}
|
||||||
}
|
|
||||||
|
public void setPageNo(int pageNo) {
|
||||||
public void setPageNo(int pageNo) {
|
this.pageNo = pageNo;
|
||||||
this.pageNo = pageNo;
|
}
|
||||||
}
|
|
||||||
|
public String getClientIp() {
|
||||||
public String getClientIp() {
|
return clientIp;
|
||||||
return clientIp;
|
}
|
||||||
}
|
|
||||||
|
public void setClientIp(String clientIp) {
|
||||||
public void setClientIp(String clientIp) {
|
this.clientIp = clientIp;
|
||||||
this.clientIp = clientIp;
|
}
|
||||||
}
|
|
||||||
|
public String getBeginTime() {
|
||||||
public String getBeginTime() {
|
return BeginTime;
|
||||||
return BeginTime;
|
}
|
||||||
}
|
|
||||||
|
public void setBeginTime(String beginTime) {
|
||||||
public void setBeginTime(String beginTime) {
|
BeginTime = beginTime;
|
||||||
BeginTime = beginTime;
|
}
|
||||||
}
|
|
||||||
|
public String getEndTime() {
|
||||||
public String getEndTime() {
|
return EndTime;
|
||||||
return EndTime;
|
}
|
||||||
}
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
public void setEndTime(String endTime) {
|
EndTime = endTime;
|
||||||
EndTime = endTime;
|
}
|
||||||
}
|
|
||||||
|
public String getOperTime() {
|
||||||
public String getOperTime() {
|
return OperTime;
|
||||||
return OperTime;
|
}
|
||||||
}
|
|
||||||
|
public void setOperTime(String operTime) {
|
||||||
public void setOperTime(String operTime) {
|
OperTime = operTime;
|
||||||
OperTime = operTime;
|
}
|
||||||
}
|
|
||||||
|
public String getMonthTime() {
|
||||||
public String getMonthTime() {
|
return MonthTime;
|
||||||
return MonthTime;
|
}
|
||||||
}
|
|
||||||
|
public void setMonthTime(String monthTime) {
|
||||||
public void setMonthTime(String monthTime) {
|
MonthTime = monthTime;
|
||||||
MonthTime = monthTime;
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,30 +1,30 @@
|
|||||||
package com.jsh.service.asset;
|
package com.jsh.service.asset;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface AssetIService extends BaseIService<Asset>
|
public interface AssetIService extends BaseIService<Asset>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 导出信息
|
* 导出信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws AmsException;
|
InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws JshException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述
|
* 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述
|
||||||
* 业务规则:导入时,检查资产名称是否存在,如存在就不考虑表格中资产类型。如资产名不存在,就新建资产名,类型用表格中的,但类型必须是系统中存在的,不存在的不能导入。
|
* 业务规则:导入时,检查资产名称是否存在,如存在就不考虑表格中资产类型。如资产名不存在,就新建资产名,类型用表格中的,但类型必须是系统中存在的,不存在的不能导入。
|
||||||
* 资产名称,用户可以添加,其他的应该不能填
|
* 资产名称,用户可以添加,其他的应该不能填
|
||||||
*
|
*
|
||||||
* @param assetFile excel表格文件
|
* @param assetFile excel表格文件
|
||||||
* @param isCheck 是否检查 0--手工确定 1--直接导入数据库中
|
* @param isCheck 是否检查 0--手工确定 1--直接导入数据库中
|
||||||
* @return 错误的表格数据
|
* @return 错误的表格数据
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
InputStream importExcel(File assetFile,int isCheck)throws AmsException;
|
InputStream importExcel(File assetFile,int isCheck)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,15 @@
|
|||||||
package com.jsh.service.asset;
|
package com.jsh.service.asset;
|
||||||
|
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface ReportIService
|
public interface ReportIService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查找报表数据
|
* 查找报表数据
|
||||||
* @param asset
|
* @param asset
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<Asset> asset,String reportType,String reportName)throws AmsException;
|
void find(PageUtil<Asset> asset,String reportType,String reportName)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
package com.jsh.service.asset;
|
package com.jsh.service.asset;
|
||||||
|
|
||||||
import com.jsh.dao.asset.ReportIDAO;
|
import com.jsh.dao.asset.ReportIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public class ReportService implements ReportIService
|
public class ReportService implements ReportIService
|
||||||
{
|
{
|
||||||
private ReportIDAO reportDao;
|
private ReportIDAO reportDao;
|
||||||
|
|
||||||
public void setReportDao(ReportIDAO reportDao)
|
public void setReportDao(ReportIDAO reportDao)
|
||||||
{
|
{
|
||||||
this.reportDao = reportDao;
|
this.reportDao = reportDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<Asset> pageUtil, String reportType,String reportName) throws AmsException
|
public void find(PageUtil<Asset> pageUtil, String reportType,String reportName) throws JshException
|
||||||
{
|
{
|
||||||
reportDao.find(pageUtil, reportType,reportName);
|
reportDao.find(pageUtil, reportType,reportName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
package com.jsh.service.basic;
|
package com.jsh.service.basic;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Logdetails;
|
import com.jsh.model.po.Logdetails;
|
||||||
|
|
||||||
public interface LogIService extends BaseIService<Logdetails>
|
public interface LogIService extends BaseIService<Logdetails>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 增加
|
* 增加
|
||||||
* @param t 对象
|
* @param t 对象
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void save(Logdetails t);
|
void save(Logdetails t);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
package com.jsh.service.basic;
|
package com.jsh.service.basic;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface UserBusinessIService extends BaseIService<UserBusiness>
|
public interface UserBusinessIService extends BaseIService<UserBusiness>
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 测试一下自定义hql语句
|
* 测试一下自定义hql语句
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<UserBusiness> userBusiness,String ceshi)throws AmsException;
|
void find(PageUtil<UserBusiness> userBusiness,String ceshi)throws JshException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
package com.jsh.service.basic;
|
package com.jsh.service.basic;
|
||||||
|
|
||||||
import com.jsh.base.BaseService;
|
import com.jsh.base.BaseService;
|
||||||
import com.jsh.dao.basic.UserBusinessIDAO;
|
import com.jsh.dao.basic.UserBusinessIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public class UserBusinessService extends BaseService<UserBusiness> implements UserBusinessIService
|
public class UserBusinessService extends BaseService<UserBusiness> implements UserBusinessIService
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private UserBusinessIDAO userBusinessDao;
|
private UserBusinessIDAO userBusinessDao;
|
||||||
|
|
||||||
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao)
|
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao)
|
||||||
{
|
{
|
||||||
this.userBusinessDao = userBusinessDao;
|
this.userBusinessDao = userBusinessDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<UserBusiness> getEntityClass()
|
protected Class<UserBusiness> getEntityClass()
|
||||||
{
|
{
|
||||||
return UserBusiness.class;
|
return UserBusiness.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<UserBusiness> pageUtil, String ceshi) throws AmsException
|
public void find(PageUtil<UserBusiness> pageUtil, String ceshi) throws JshException
|
||||||
{
|
{
|
||||||
userBusinessDao.find(pageUtil, ceshi);
|
userBusinessDao.find(pageUtil, ceshi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
package com.jsh.service.basic;
|
package com.jsh.service.basic;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Basicuser;
|
import com.jsh.model.po.Basicuser;
|
||||||
|
|
||||||
public interface UserIService extends BaseIService<Basicuser>
|
public interface UserIService extends BaseIService<Basicuser>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 判断用户名是否符合登录条件
|
* 判断用户名是否符合登录条件
|
||||||
* @param username 用户名 String password
|
* @param username 用户名 String password
|
||||||
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
|
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
|
||||||
*/
|
*/
|
||||||
int validateUser(String username,String password)throws AmsException;
|
int validateUser(String username,String password)throws JshException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
* @param username
|
* @param username
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
public Basicuser getUser(String username) throws AmsException;
|
public Basicuser getUser(String username) throws JshException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查用户名称是否存在
|
* 检查用户名称是否存在
|
||||||
* @param field 用户属性
|
* @param field 用户属性
|
||||||
* @param username 用户名称
|
* @param username 用户名称
|
||||||
* @param userID 供应商ID
|
* @param userID 供应商ID
|
||||||
* @return true==存在重名 false==不存在
|
* @return true==存在重名 false==不存在
|
||||||
* @throws AmsException
|
* @throws JshException
|
||||||
*/
|
*/
|
||||||
Boolean checkIsNameExist(String field,String username,Long userID)throws AmsException;
|
Boolean checkIsNameExist(String field,String username,Long userID)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,114 +1,114 @@
|
|||||||
package com.jsh.service.basic;
|
package com.jsh.service.basic;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.jsh.base.BaseService;
|
import com.jsh.base.BaseService;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.constants.common.ExceptionCodeConstants;
|
import com.jsh.constants.common.ExceptionCodeConstants;
|
||||||
import com.jsh.dao.basic.UserBusinessIDAO;
|
import com.jsh.dao.basic.UserBusinessIDAO;
|
||||||
import com.jsh.dao.basic.UserIDAO;
|
import com.jsh.dao.basic.UserIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Basicuser;
|
import com.jsh.model.po.Basicuser;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public class UserService extends BaseService<Basicuser> implements UserIService
|
public class UserService extends BaseService<Basicuser> implements UserIService
|
||||||
{
|
{
|
||||||
private PageUtil<Basicuser> pageUtil = new PageUtil<Basicuser>();
|
private PageUtil<Basicuser> pageUtil = new PageUtil<Basicuser>();
|
||||||
private Map<String,Object> condition = new HashMap<String,Object>();
|
private Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
private UserIDAO userDao;
|
private UserIDAO userDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int validateUser(String username, String password)throws AmsException
|
public int validateUser(String username, String password)throws JshException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//全局变量 每次使用前清除
|
//全局变量 每次使用前清除
|
||||||
condition.clear();
|
condition.clear();
|
||||||
|
|
||||||
/**默认是可以登录的*/
|
/**默认是可以登录的*/
|
||||||
List<Basicuser> list = null ;
|
List<Basicuser> list = null ;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
condition.put("loginame_s_eq", username);
|
condition.put("loginame_s_eq", username);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
userDao.find(pageUtil);
|
userDao.find(pageUtil);
|
||||||
list = pageUtil.getPageList();
|
list = pageUtil.getPageList();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>访问验证用户姓名是否存在后台信息异常",e);
|
Log.errorFileSync(">>>>>>>>访问验证用户姓名是否存在后台信息异常",e);
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(null !=list && list.size() == 0)
|
if(null !=list && list.size() == 0)
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST ;
|
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST ;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
condition.put("loginame_s_eq", username);
|
condition.put("loginame_s_eq", username);
|
||||||
condition.put("password_s_eq", password);
|
condition.put("password_s_eq", password);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
userDao.find(pageUtil);
|
userDao.find(pageUtil);
|
||||||
list = pageUtil.getPageList();
|
list = pageUtil.getPageList();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>访问验证用户密码后台信息异常",e);
|
Log.errorFileSync(">>>>>>>>>>访问验证用户密码后台信息异常",e);
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(null !=list && list.size() == 0)
|
if(null !=list && list.size() == 0)
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new AmsException("unknown exception",e);
|
throw new JshException("unknown exception",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Basicuser getUser(String username) throws AmsException
|
public Basicuser getUser(String username) throws JshException
|
||||||
{
|
{
|
||||||
//全局变量 每次使用前清除
|
//全局变量 每次使用前清除
|
||||||
condition.clear();
|
condition.clear();
|
||||||
condition.put("loginame_s_eq", username);
|
condition.put("loginame_s_eq", username);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
userDao.find(pageUtil);
|
userDao.find(pageUtil);
|
||||||
List<Basicuser> list = pageUtil.getPageList();
|
List<Basicuser> list = pageUtil.getPageList();
|
||||||
if(null != list && list.size() >0)
|
if(null != list && list.size() >0)
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
else
|
else
|
||||||
throw new AmsException("no username exist");
|
throw new JshException("no username exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkIsNameExist(String field,String username, Long userID)throws AmsException
|
public Boolean checkIsNameExist(String field,String username, Long userID)throws JshException
|
||||||
{
|
{
|
||||||
condition.clear();
|
condition.clear();
|
||||||
condition.put(field + "_s_eq", username);
|
condition.put(field + "_s_eq", username);
|
||||||
condition.put("id_n_neq", userID);
|
condition.put("id_n_neq", userID);
|
||||||
pageUtil.setAdvSearch(condition);
|
pageUtil.setAdvSearch(condition);
|
||||||
userDao.find(pageUtil);
|
userDao.find(pageUtil);
|
||||||
|
|
||||||
List<Basicuser> dataList = pageUtil.getPageList();
|
List<Basicuser> dataList = pageUtil.getPageList();
|
||||||
if(null != dataList && dataList.size() > 0)
|
if(null != dataList && dataList.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============spring注入等公共方法,与业务无关=========================
|
//==============spring注入等公共方法,与业务无关=========================
|
||||||
public void setUserDao(UserIDAO userDao)
|
public void setUserDao(UserIDAO userDao)
|
||||||
{
|
{
|
||||||
this.userDao = userDao;
|
this.userDao = userDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<Basicuser> getEntityClass()
|
protected Class<Basicuser> getEntityClass()
|
||||||
{
|
{
|
||||||
return Basicuser.class;
|
return Basicuser.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
package com.jsh.service.materials;
|
package com.jsh.service.materials;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface DepotHeadIService extends BaseIService<DepotHead>
|
public interface DepotHeadIService extends BaseIService<DepotHead>
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 获取MaxId
|
* 获取MaxId
|
||||||
*/
|
*/
|
||||||
void find(PageUtil<DepotHead> depotHead,String maxid)throws AmsException;
|
void find(PageUtil<DepotHead> depotHead,String maxid)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
package com.jsh.service.materials;
|
package com.jsh.service.materials;
|
||||||
|
|
||||||
import com.jsh.base.BaseService;
|
import com.jsh.base.BaseService;
|
||||||
import com.jsh.dao.materials.DepotHeadIDAO;
|
import com.jsh.dao.materials.DepotHeadIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.UserBusiness;
|
import com.jsh.model.po.UserBusiness;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public class DepotHeadService extends BaseService<DepotHead> implements DepotHeadIService
|
public class DepotHeadService extends BaseService<DepotHead> implements DepotHeadIService
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private DepotHeadIDAO depotHeadDao;
|
private DepotHeadIDAO depotHeadDao;
|
||||||
|
|
||||||
|
|
||||||
public void setDepotHeadDao(DepotHeadIDAO depotHeadDao) {
|
public void setDepotHeadDao(DepotHeadIDAO depotHeadDao) {
|
||||||
this.depotHeadDao = depotHeadDao;
|
this.depotHeadDao = depotHeadDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<DepotHead> getEntityClass()
|
protected Class<DepotHead> getEntityClass()
|
||||||
{
|
{
|
||||||
return DepotHead.class;
|
return DepotHead.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void find(PageUtil<DepotHead> pageUtil, String maxid) throws AmsException
|
public void find(PageUtil<DepotHead> pageUtil, String maxid) throws JshException
|
||||||
{
|
{
|
||||||
depotHeadDao.find(pageUtil, maxid);
|
depotHeadDao.find(pageUtil, maxid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
package com.jsh.service.materials;
|
package com.jsh.service.materials;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
|
|
||||||
import com.jsh.base.BaseIService;
|
import com.jsh.base.BaseIService;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.DepotItem;
|
import com.jsh.model.po.DepotItem;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
|
|
||||||
public interface DepotItemIService extends BaseIService<DepotItem>
|
public interface DepotItemIService extends BaseIService<DepotItem>
|
||||||
{
|
{
|
||||||
void findByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws AmsException;
|
void findByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
|
||||||
|
|
||||||
void findOrderByMaterial(PageUtil<DepotItem> depotItem)throws AmsException;
|
void findOrderByMaterial(PageUtil<DepotItem> depotItem)throws JshException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出信息
|
* 导出信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws AmsException;
|
InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,124 +1,124 @@
|
|||||||
package com.jsh.service.materials;
|
package com.jsh.service.materials;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import jxl.Workbook;
|
import jxl.Workbook;
|
||||||
import jxl.write.Label;
|
import jxl.write.Label;
|
||||||
import jxl.write.WritableSheet;
|
import jxl.write.WritableSheet;
|
||||||
import jxl.write.WritableWorkbook;
|
import jxl.write.WritableWorkbook;
|
||||||
|
|
||||||
import com.jsh.base.BaseService;
|
import com.jsh.base.BaseService;
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
import com.jsh.constants.asset.AssetConstants;
|
import com.jsh.constants.asset.AssetConstants;
|
||||||
import com.jsh.dao.materials.DepotItemIDAO;
|
import com.jsh.dao.materials.DepotItemIDAO;
|
||||||
import com.jsh.exception.AmsException;
|
import com.jsh.exception.JshException;
|
||||||
import com.jsh.model.po.Asset;
|
import com.jsh.model.po.Asset;
|
||||||
import com.jsh.model.po.DepotHead;
|
import com.jsh.model.po.DepotHead;
|
||||||
import com.jsh.model.po.DepotItem;
|
import com.jsh.model.po.DepotItem;
|
||||||
import com.jsh.util.common.PageUtil;
|
import com.jsh.util.common.PageUtil;
|
||||||
import com.jsh.util.common.Tools;
|
import com.jsh.util.common.Tools;
|
||||||
|
|
||||||
public class DepotItemService extends BaseService<DepotItem> implements DepotItemIService
|
public class DepotItemService extends BaseService<DepotItem> implements DepotItemIService
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private DepotItemIDAO depotItemDao;
|
private DepotItemIDAO depotItemDao;
|
||||||
|
|
||||||
|
|
||||||
public void setDepotItemDao(DepotItemIDAO depotItemDao) {
|
public void setDepotItemDao(DepotItemIDAO depotItemDao) {
|
||||||
this.depotItemDao = depotItemDao;
|
this.depotItemDao = depotItemDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<DepotItem> getEntityClass()
|
protected Class<DepotItem> getEntityClass()
|
||||||
{
|
{
|
||||||
return DepotItem.class;
|
return DepotItem.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void findByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException
|
public void findByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws JshException
|
||||||
{
|
{
|
||||||
depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev);
|
depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException
|
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws JshException
|
||||||
{
|
{
|
||||||
depotItemDao.findOrderByMaterial(pageUtil);
|
depotItemDao.findOrderByMaterial(pageUtil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出Excel表格
|
* 导出Excel表格
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws AmsException
|
public InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//将OutputStream转化为InputStream
|
//将OutputStream转化为InputStream
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
putDataOnOutputStream(out,dataArray);
|
putDataOnOutputStream(out,dataArray);
|
||||||
return new ByteArrayInputStream(out.toByteArray());
|
return new ByteArrayInputStream(out.toByteArray());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
|
||||||
throw new AmsException("export asset info to excel exception",e);
|
throw new JshException("export asset info to excel exception",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成excel表格
|
* 生成excel表格
|
||||||
* @param os
|
* @param os
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void putDataOnOutputStream(OutputStream os,JSONArray dataArray)
|
private void putDataOnOutputStream(OutputStream os,JSONArray dataArray)
|
||||||
{
|
{
|
||||||
WritableWorkbook workbook = null;
|
WritableWorkbook workbook = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
workbook = Workbook.createWorkbook(os);
|
workbook = Workbook.createWorkbook(os);
|
||||||
WritableSheet sheet = workbook.createSheet("进销存报表", 0);
|
WritableSheet sheet = workbook.createSheet("进销存报表", 0);
|
||||||
//增加列头
|
//增加列头
|
||||||
int[] colunmWidth = {10,10,10,10,15,15,15,15,15};
|
int[] colunmWidth = {10,10,10,10,15,15,15,15,15};
|
||||||
String[] colunmName = {"名称","款号","颜色","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"};
|
String[] colunmName = {"名称","款号","颜色","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"};
|
||||||
for(int i = 0 ;i < colunmWidth.length;i ++)
|
for(int i = 0 ;i < colunmWidth.length;i ++)
|
||||||
{
|
{
|
||||||
sheet.setColumnView(i,colunmWidth[i]);
|
sheet.setColumnView(i,colunmWidth[i]);
|
||||||
sheet.addCell(new Label(i, 0, colunmName[i]));
|
sheet.addCell(new Label(i, 0, colunmName[i]));
|
||||||
}
|
}
|
||||||
if (null != dataArray &&dataArray.size() > 0)
|
if (null != dataArray &&dataArray.size() > 0)
|
||||||
{
|
{
|
||||||
for(int j=0; j < dataArray.size(); j++){
|
for(int j=0; j < dataArray.size(); j++){
|
||||||
JSONObject jo = JSONObject.fromObject(dataArray.get(j));
|
JSONObject jo = JSONObject.fromObject(dataArray.get(j));
|
||||||
sheet.addCell(new Label(0, j+1, jo.getString("MaterialName")));
|
sheet.addCell(new Label(0, j+1, jo.getString("MaterialName")));
|
||||||
sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel")));
|
sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel")));
|
||||||
sheet.addCell(new Label(2, j+1, jo.getString("MaterialColor")));
|
sheet.addCell(new Label(2, j+1, jo.getString("MaterialColor")));
|
||||||
sheet.addCell(new Label(3, j+1, jo.getString("UnitPrice")));
|
sheet.addCell(new Label(3, j+1, jo.getString("UnitPrice")));
|
||||||
sheet.addCell(new Label(4, j+1, jo.getString("prevSum")));
|
sheet.addCell(new Label(4, j+1, jo.getString("prevSum")));
|
||||||
sheet.addCell(new Label(5, j+1, jo.getString("InSum")));
|
sheet.addCell(new Label(5, j+1, jo.getString("InSum")));
|
||||||
sheet.addCell(new Label(6, j+1, jo.getString("OutSum")));
|
sheet.addCell(new Label(6, j+1, jo.getString("OutSum")));
|
||||||
sheet.addCell(new Label(7, j+1, jo.getString("thisSum")));
|
sheet.addCell(new Label(7, j+1, jo.getString("thisSum")));
|
||||||
double d = Double.parseDouble(jo.getString("thisAllPrice").toString());
|
double d = Double.parseDouble(jo.getString("thisAllPrice").toString());
|
||||||
String s1 = String.format("%.2f", d);
|
String s1 = String.format("%.2f", d);
|
||||||
sheet.addCell(new Label(8, j+1, s1));
|
sheet.addCell(new Label(8, j+1, s1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
workbook.write();
|
workbook.write();
|
||||||
workbook.close();
|
workbook.close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,135 +1,126 @@
|
|||||||
/**
|
package com.jsh.util.common;
|
||||||
* 项 目 名:HiTV
|
|
||||||
* 包 名:com.suma.hitv.utils
|
import java.util.HashMap;
|
||||||
* 文 件 名:BeanFactoryUtil.java
|
import java.util.Map;
|
||||||
* 版本信息:V1.0
|
|
||||||
* 日 期:2011-12-30-下午01:25:00
|
import org.springframework.context.ApplicationContext;
|
||||||
* Copyright (c) 2000-2011北京数码视讯有限公司版权所有
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
*
|
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
||||||
*/
|
|
||||||
package com.jsh.util.common;
|
/**
|
||||||
|
* 获取spring配置中的bean对象,是单例,只会加载一次,请注意使用
|
||||||
import java.util.HashMap;
|
* 注意:此工具类默认处理UI组件WEB-INF目录下的applicationContext.xml配置文件,请注意文件 名和路径
|
||||||
import java.util.Map;
|
* @author jishenghua
|
||||||
|
* @version V1.0
|
||||||
import org.springframework.context.ApplicationContext;
|
*/
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
public class BeanFactoryUtil
|
||||||
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
{
|
||||||
|
private static BeanFactoryUtil defaultBeanFactory;
|
||||||
/**
|
|
||||||
* 获取spring配置中的bean对象,是单例,只会加载一次,请注意使用
|
private ApplicationContext defaultAC = null;
|
||||||
* 注意:此工具类默认处理UI组件WEB-INF目录下的applicationContext.xml配置文件,请注意文件 名和路径
|
|
||||||
* @author andy
|
//private ApplicationContext autoLoadAC = null;
|
||||||
* @version V1.0
|
|
||||||
*/
|
private static BeanFactoryUtil specialBeanFactory;
|
||||||
public class BeanFactoryUtil
|
|
||||||
{
|
private ApplicationContext specialAC = null;
|
||||||
private static BeanFactoryUtil defaultBeanFactory;
|
|
||||||
|
private static Map<String, ApplicationContext> beanMap = new HashMap<String, ApplicationContext>();
|
||||||
private ApplicationContext defaultAC = null;
|
|
||||||
|
//private Logger log = Logger.getLogger(BeanFactoryUtil.class);
|
||||||
//private ApplicationContext autoLoadAC = null;
|
|
||||||
|
/**
|
||||||
private static BeanFactoryUtil specialBeanFactory;
|
* 私有构造函数,默认为UI组件WEB-INF目录下的applicationContext.xml配置文件
|
||||||
|
*/
|
||||||
private ApplicationContext specialAC = null;
|
private BeanFactoryUtil()
|
||||||
|
{
|
||||||
private static Map<String, ApplicationContext> beanMap = new HashMap<String, ApplicationContext>();
|
String fileUrl = PathTool.getWebinfPath();
|
||||||
|
//这里只对UI组件WEB-INF目录下的applicationContext.xml配置文件
|
||||||
//private Logger log = Logger.getLogger(BeanFactoryUtil.class);
|
defaultAC = new FileSystemXmlApplicationContext( new
|
||||||
|
String[]{fileUrl
|
||||||
/**
|
+ "spring/basic-applicationContext.xml",
|
||||||
* 私有构造函数,默认为UI组件WEB-INF目录下的applicationContext.xml配置文件
|
fileUrl + "spring/dao-applicationContext.xml"});
|
||||||
*/
|
}
|
||||||
private BeanFactoryUtil()
|
|
||||||
{
|
/**
|
||||||
String fileUrl = PathTool.getWebinfPath();
|
* 私有构造函数,带有文件的classpath路径,可能是非applicationContext.xml文件
|
||||||
//这里只对UI组件WEB-INF目录下的applicationContext.xml配置文件
|
*/
|
||||||
defaultAC = new FileSystemXmlApplicationContext( new
|
private BeanFactoryUtil(String fileClassPath)
|
||||||
String[]{fileUrl
|
{
|
||||||
+ "spring/basic-applicationContext.xml",
|
specialAC = new ClassPathXmlApplicationContext("classpath:"
|
||||||
fileUrl + "spring/dao-applicationContext.xml"});
|
+ fileClassPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 私有构造函数,带有文件的classpath路径,可能是非applicationContext.xml文件
|
* 非web.xml方式加载spring配置文件方式的实体实例获取方式
|
||||||
*/
|
* @param fileClassPath
|
||||||
private BeanFactoryUtil(String fileClassPath)
|
* @param beanName
|
||||||
{
|
* @return
|
||||||
specialAC = new ClassPathXmlApplicationContext("classpath:"
|
*/
|
||||||
+ fileClassPath);
|
public synchronized static Object getBeanByClassPathAndBeanName(
|
||||||
}
|
String fileClassPath, String beanName)
|
||||||
|
{
|
||||||
/**
|
ApplicationContext ac = beanMap.get(fileClassPath);
|
||||||
* 非web.xml方式加载spring配置文件方式的实体实例获取方式
|
if (null == ac)
|
||||||
* @param fileClassPath
|
{
|
||||||
* @param beanName
|
ac = new ClassPathXmlApplicationContext("classpath:"
|
||||||
* @return
|
+ fileClassPath);
|
||||||
*/
|
beanMap.put(fileClassPath, ac);
|
||||||
public synchronized static Object getBeanByClassPathAndBeanName(
|
}
|
||||||
String fileClassPath, String beanName)
|
return ac.getBean(beanName);
|
||||||
{
|
}
|
||||||
ApplicationContext ac = beanMap.get(fileClassPath);
|
|
||||||
if (null == ac)
|
/**
|
||||||
{
|
* 获取类实例
|
||||||
ac = new ClassPathXmlApplicationContext("classpath:"
|
* 默认加载UI组件WEB-INF目录下的applicationContext.xml配置文件
|
||||||
+ fileClassPath);
|
* @return
|
||||||
beanMap.put(fileClassPath, ac);
|
*
|
||||||
}
|
*/
|
||||||
return ac.getBean(beanName);
|
public synchronized static BeanFactoryUtil getInstance()
|
||||||
}
|
{
|
||||||
|
if (null == defaultBeanFactory)
|
||||||
/**
|
{
|
||||||
* 获取类实例
|
defaultBeanFactory = new BeanFactoryUtil();
|
||||||
* 默认加载UI组件WEB-INF目录下的applicationContext.xml配置文件
|
}
|
||||||
* @return
|
return defaultBeanFactory;
|
||||||
*
|
}
|
||||||
*/
|
|
||||||
public synchronized static BeanFactoryUtil getInstance()
|
/**
|
||||||
{
|
* 获取类实例,这种情况一定是在依赖其他组件时没有在applicationContext.xml加载器spring文件时使用
|
||||||
if (null == defaultBeanFactory)
|
* 这种情况请少用
|
||||||
{
|
* @param fileClassPath
|
||||||
defaultBeanFactory = new BeanFactoryUtil();
|
* @return
|
||||||
}
|
*/
|
||||||
return defaultBeanFactory;
|
@Deprecated
|
||||||
}
|
public synchronized static BeanFactoryUtil getInstance(String fileClassPath)
|
||||||
|
{
|
||||||
/**
|
if (null == specialBeanFactory)
|
||||||
* 获取类实例,这种情况一定是在依赖其他组件时没有在applicationContext.xml加载器spring文件时使用
|
{
|
||||||
* 这种情况请少用
|
specialBeanFactory = new BeanFactoryUtil(fileClassPath);
|
||||||
* @param fileClassPath
|
}
|
||||||
* @return
|
return specialBeanFactory;
|
||||||
*/
|
}
|
||||||
@Deprecated
|
|
||||||
public synchronized static BeanFactoryUtil getInstance(String fileClassPath)
|
/**
|
||||||
{
|
* 获取UI组件WEB-INF目录下的applicationContext.xml配置文件中配置的bean实例
|
||||||
if (null == specialBeanFactory)
|
* @param beanName
|
||||||
{
|
* @return
|
||||||
specialBeanFactory = new BeanFactoryUtil(fileClassPath);
|
*/
|
||||||
}
|
public Object getBean(String beanName)
|
||||||
return specialBeanFactory;
|
{
|
||||||
}
|
return defaultAC.getBean(beanName);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* 获取UI组件WEB-INF目录下的applicationContext.xml配置文件中配置的bean实例
|
/**
|
||||||
* @param beanName
|
* 获取没有在applicationContext.xml配置文件中引入的spring配置文件,即没有用容器加载过的配置文件
|
||||||
* @return
|
* 这里为特殊情况下使用,不推荐使用
|
||||||
*/
|
* 推荐在applicationContext.xml配置文件中引入需要使用的spring配置文件,然后使用BeanFactoryUtil.getInstance().getBean("")方法
|
||||||
public Object getBean(String beanName)
|
* @param beanName
|
||||||
{
|
* @return
|
||||||
return defaultAC.getBean(beanName);
|
*/
|
||||||
}
|
@Deprecated
|
||||||
|
public Object getSpecialBean(String beanName)
|
||||||
/**
|
{
|
||||||
* 获取没有在applicationContext.xml配置文件中引入的spring配置文件,即没有用容器加载过的配置文件
|
return specialAC.getBean(beanName);
|
||||||
* 这里为特殊情况下使用,不推荐使用
|
}
|
||||||
* 推荐在applicationContext.xml配置文件中引入需要使用的spring配置文件,然后使用BeanFactoryUtil.getInstance().getBean("")方法
|
}
|
||||||
* @param beanName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Object getSpecialBean(String beanName)
|
|
||||||
{
|
|
||||||
return specialAC.getBean(beanName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,198 +1,198 @@
|
|||||||
package com.jsh.util.common;
|
package com.jsh.util.common;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* 分页工具类,实现分页功能
|
* 分页工具类,实现分页功能
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
* @version [版本号version01, 2012-1-25]
|
* @version [版本号version01, 2012-1-25]
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class PageUtil<E> implements Serializable
|
public class PageUtil<E> implements Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 总页数,根据总数和单页显示个数进行计算
|
* 总页数,根据总数和单页显示个数进行计算
|
||||||
*/
|
*/
|
||||||
private int totalPage = 0;
|
private int totalPage = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总个数
|
* 总个数
|
||||||
*/
|
*/
|
||||||
private int totalCount = 0 ;
|
private int totalCount = 0 ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前页码
|
* 当前页码
|
||||||
*/
|
*/
|
||||||
private int curPage = 1;
|
private int curPage = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每页显示个数
|
* 每页显示个数
|
||||||
*/
|
*/
|
||||||
private int pageSize = 10;
|
private int pageSize = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为第一页
|
* 是否为第一页
|
||||||
*/
|
*/
|
||||||
private boolean isFirstPage = false;
|
private boolean isFirstPage = false;
|
||||||
/**
|
/**
|
||||||
* 是否是最后一页
|
* 是否是最后一页
|
||||||
*/
|
*/
|
||||||
private boolean isLastPage = false;
|
private boolean isLastPage = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有上一页
|
* 是否有上一页
|
||||||
*/
|
*/
|
||||||
private boolean hasPrevious = false;
|
private boolean hasPrevious = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有下一页
|
* 是否有下一页
|
||||||
*/
|
*/
|
||||||
private boolean hasNext = false;
|
private boolean hasNext = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回页面list数组
|
* 返回页面list数组
|
||||||
*/
|
*/
|
||||||
private List<E> pageList = new ArrayList<E>();
|
private List<E> pageList = new ArrayList<E>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面搜索条件,用map来实现
|
* 页面搜索条件,用map来实现
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> advSearch = new Hashtable<String, Object>();
|
private Map<String, Object> advSearch = new Hashtable<String, Object>();
|
||||||
|
|
||||||
public PageUtil()
|
public PageUtil()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageUtil(int totalCount,int pageSize,int curPage,Map<String, Object> adv)
|
public PageUtil(int totalCount,int pageSize,int curPage,Map<String, Object> adv)
|
||||||
{
|
{
|
||||||
init(totalCount,pageSize,curPage,adv);
|
init(totalCount,pageSize,curPage,adv);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化页面显示参数
|
* 初始化页面显示参数
|
||||||
* @param totalCount 总数
|
* @param totalCount 总数
|
||||||
* @param pageSize 页面显示个数
|
* @param pageSize 页面显示个数
|
||||||
* @param curPage 当前页面
|
* @param curPage 当前页面
|
||||||
*/
|
*/
|
||||||
public void init(int totalCount,int pageSize,int curPage,Map<String, Object> adv)
|
public void init(int totalCount,int pageSize,int curPage,Map<String, Object> adv)
|
||||||
{
|
{
|
||||||
this.totalCount = totalCount;
|
this.totalCount = totalCount;
|
||||||
this.pageSize = pageSize ;
|
this.pageSize = pageSize ;
|
||||||
this.curPage = curPage;
|
this.curPage = curPage;
|
||||||
this.advSearch = adv;
|
this.advSearch = adv;
|
||||||
//计算总页数
|
//计算总页数
|
||||||
if(pageSize != 0)
|
if(pageSize != 0)
|
||||||
{
|
{
|
||||||
this.totalPage = (totalCount+pageSize-1)/pageSize;
|
this.totalPage = (totalCount+pageSize-1)/pageSize;
|
||||||
}
|
}
|
||||||
if(curPage <1)
|
if(curPage <1)
|
||||||
{
|
{
|
||||||
this.curPage = 1;
|
this.curPage = 1;
|
||||||
}
|
}
|
||||||
if(curPage>this.totalPage)
|
if(curPage>this.totalPage)
|
||||||
{
|
{
|
||||||
this.curPage = this.totalPage;
|
this.curPage = this.totalPage;
|
||||||
}
|
}
|
||||||
if(curPage>0&&this.totalPage!=1&&curPage<this.totalPage)
|
if(curPage>0&&this.totalPage!=1&&curPage<this.totalPage)
|
||||||
{
|
{
|
||||||
this.hasNext = true ;
|
this.hasNext = true ;
|
||||||
}
|
}
|
||||||
if(curPage>0&&this.totalPage!=1&&curPage>1&&curPage<=this.totalPage)
|
if(curPage>0&&this.totalPage!=1&&curPage>1&&curPage<=this.totalPage)
|
||||||
{
|
{
|
||||||
this.hasPrevious = true;
|
this.hasPrevious = true;
|
||||||
}
|
}
|
||||||
if(curPage == 1)
|
if(curPage == 1)
|
||||||
{
|
{
|
||||||
this.isFirstPage = true ;
|
this.isFirstPage = true ;
|
||||||
}
|
}
|
||||||
if(curPage == this.totalPage)
|
if(curPage == this.totalPage)
|
||||||
{
|
{
|
||||||
this.isLastPage = true;
|
this.isLastPage = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int getTotalPage()
|
public int getTotalPage()
|
||||||
{
|
{
|
||||||
return totalPage;
|
return totalPage;
|
||||||
}
|
}
|
||||||
public void setTotalPage(int totalPage)
|
public void setTotalPage(int totalPage)
|
||||||
{
|
{
|
||||||
this.totalPage = totalPage;
|
this.totalPage = totalPage;
|
||||||
}
|
}
|
||||||
public int getTotalCount()
|
public int getTotalCount()
|
||||||
{
|
{
|
||||||
return totalCount;
|
return totalCount;
|
||||||
}
|
}
|
||||||
public void setTotalCount(int totalCount)
|
public void setTotalCount(int totalCount)
|
||||||
{
|
{
|
||||||
this.totalCount = totalCount;
|
this.totalCount = totalCount;
|
||||||
}
|
}
|
||||||
public int getCurPage()
|
public int getCurPage()
|
||||||
{
|
{
|
||||||
return curPage;
|
return curPage;
|
||||||
}
|
}
|
||||||
public void setCurPage(int curPage)
|
public void setCurPage(int curPage)
|
||||||
{
|
{
|
||||||
this.curPage = curPage;
|
this.curPage = curPage;
|
||||||
}
|
}
|
||||||
public int getPageSize()
|
public int getPageSize()
|
||||||
{
|
{
|
||||||
return pageSize;
|
return pageSize;
|
||||||
}
|
}
|
||||||
public void setPageSize(int pageSize)
|
public void setPageSize(int pageSize)
|
||||||
{
|
{
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
}
|
}
|
||||||
public boolean isFirstPage()
|
public boolean isFirstPage()
|
||||||
{
|
{
|
||||||
return isFirstPage;
|
return isFirstPage;
|
||||||
}
|
}
|
||||||
public void setFirstPage(boolean isFirstPage)
|
public void setFirstPage(boolean isFirstPage)
|
||||||
{
|
{
|
||||||
this.isFirstPage = isFirstPage;
|
this.isFirstPage = isFirstPage;
|
||||||
}
|
}
|
||||||
public boolean isLastPage()
|
public boolean isLastPage()
|
||||||
{
|
{
|
||||||
return isLastPage;
|
return isLastPage;
|
||||||
}
|
}
|
||||||
public void setLastPage(boolean isLastPage)
|
public void setLastPage(boolean isLastPage)
|
||||||
{
|
{
|
||||||
this.isLastPage = isLastPage;
|
this.isLastPage = isLastPage;
|
||||||
}
|
}
|
||||||
public boolean isHasPrevious()
|
public boolean isHasPrevious()
|
||||||
{
|
{
|
||||||
return hasPrevious;
|
return hasPrevious;
|
||||||
}
|
}
|
||||||
public void setHasPrevious(boolean hasPrevious)
|
public void setHasPrevious(boolean hasPrevious)
|
||||||
{
|
{
|
||||||
this.hasPrevious = hasPrevious;
|
this.hasPrevious = hasPrevious;
|
||||||
}
|
}
|
||||||
public boolean isHasNext()
|
public boolean isHasNext()
|
||||||
{
|
{
|
||||||
return hasNext;
|
return hasNext;
|
||||||
}
|
}
|
||||||
public void setHasNext(boolean hasNext)
|
public void setHasNext(boolean hasNext)
|
||||||
{
|
{
|
||||||
this.hasNext = hasNext;
|
this.hasNext = hasNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<E> getPageList()
|
public List<E> getPageList()
|
||||||
{
|
{
|
||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
public void setPageList(List<E> pageList)
|
public void setPageList(List<E> pageList)
|
||||||
{
|
{
|
||||||
this.pageList = pageList;
|
this.pageList = pageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getAdvSearch()
|
public Map<String, Object> getAdvSearch()
|
||||||
{
|
{
|
||||||
return advSearch;
|
return advSearch;
|
||||||
}
|
}
|
||||||
public void setAdvSearch(Map<String, Object> advSearch)
|
public void setAdvSearch(Map<String, Object> advSearch)
|
||||||
{
|
{
|
||||||
this.advSearch = advSearch;
|
this.advSearch = advSearch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,84 +1,84 @@
|
|||||||
package com.jsh.util.common;
|
package com.jsh.util.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import com.jsh.base.Log;
|
import com.jsh.base.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用系统路径
|
* 获取应用系统路径
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class PathTool
|
public class PathTool
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取WEB-INF的绝对路径
|
* 获取WEB-INF的绝对路径
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getWebinfPath()
|
public static String getWebinfPath()
|
||||||
{
|
{
|
||||||
String webinfPath = "";
|
String webinfPath = "";
|
||||||
//获取URL对象
|
//获取URL对象
|
||||||
URL url = PathTool.class.getClassLoader().getResource("");
|
URL url = PathTool.class.getClassLoader().getResource("");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//获取路径
|
//获取路径
|
||||||
webinfPath = url.toURI().getPath();
|
webinfPath = url.toURI().getPath();
|
||||||
//截取路径到WEB-INF结束
|
//截取路径到WEB-INF结束
|
||||||
// webinfPath = path.substring(0, path.indexOf("/WEB-INF") + 8);
|
// webinfPath = path.substring(0, path.indexOf("/WEB-INF") + 8);
|
||||||
}
|
}
|
||||||
catch (URISyntaxException e)
|
catch (URISyntaxException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e);
|
||||||
}
|
}
|
||||||
return webinfPath;
|
return webinfPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取webapp的绝对路径
|
* 获取webapp的绝对路径
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getWebappPath()
|
public static String getWebappPath()
|
||||||
{
|
{
|
||||||
//先获取工程路径
|
//先获取工程路径
|
||||||
String projectPath = getProjectPath();
|
String projectPath = getProjectPath();
|
||||||
//获取工程路径的上级路径
|
//获取工程路径的上级路径
|
||||||
File f = new File(projectPath);
|
File f = new File(projectPath);
|
||||||
//路径不存在就返回
|
//路径不存在就返回
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
{
|
{
|
||||||
return projectPath;
|
return projectPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//返回webapp路径
|
//返回webapp路径
|
||||||
return f.getParent();
|
return f.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取工程的绝对路径
|
* 获取工程的绝对路径
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getProjectPath()
|
public static String getProjectPath()
|
||||||
{
|
{
|
||||||
String projectPath = "";
|
String projectPath = "";
|
||||||
//获取URL对象
|
//获取URL对象
|
||||||
URL url = PathTool.class.getClassLoader().getResource("");
|
URL url = PathTool.class.getClassLoader().getResource("");
|
||||||
String path = null;
|
String path = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//获取路径
|
//获取路径
|
||||||
path = url.toURI().getPath();
|
path = url.toURI().getPath();
|
||||||
//截取webapp路径
|
//截取webapp路径
|
||||||
projectPath = path.substring(0, path.indexOf("/WEB-INF"));
|
projectPath = path.substring(0, path.indexOf("/WEB-INF"));
|
||||||
}
|
}
|
||||||
catch (URISyntaxException e)
|
catch (URISyntaxException e)
|
||||||
{
|
{
|
||||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e);
|
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e);
|
||||||
}
|
}
|
||||||
return projectPath;
|
return projectPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,127 +1,127 @@
|
|||||||
package com.jsh.util.common;
|
package com.jsh.util.common;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据搜索条件拼装成查询hql语句
|
* 根据搜索条件拼装成查询hql语句
|
||||||
* @author andy
|
* @author jishenghua
|
||||||
*/
|
*/
|
||||||
public class SearchConditionUtil
|
public class SearchConditionUtil
|
||||||
{
|
{
|
||||||
//拼接字符串的前缀空格字符串
|
//拼接字符串的前缀空格字符串
|
||||||
private static final String emptyPrefix = " and ";
|
private static final String emptyPrefix = " and ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据搜索条件自动拼接成hql搜索语句
|
* 根据搜索条件自动拼接成hql搜索语句
|
||||||
* @param condition 搜索条件 规则:
|
* @param condition 搜索条件 规则:
|
||||||
* 1、类型 n--数字 s--字符串
|
* 1、类型 n--数字 s--字符串
|
||||||
* 2、属性 eq--等于 neq--不等于 like--像'%XX%' llike--左像'%XX' rlike--右像'XX%' in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于
|
* 2、属性 eq--等于 neq--不等于 like--像'%XX%' llike--左像'%XX' rlike--右像'XX%' in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于
|
||||||
* order--value desc asc gy-- group by
|
* order--value desc asc gy-- group by
|
||||||
* 示例:
|
* 示例:
|
||||||
* Map<String,Object> condition = new HashMap<String,Object>();
|
* Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
* condition.put("supplier_s_like", "aaa");
|
* condition.put("supplier_s_like", "aaa");
|
||||||
* condition.put("contacts_s_llike", "186");
|
* condition.put("contacts_s_llike", "186");
|
||||||
* condition.put("contacts_s_rlike", "186");
|
* condition.put("contacts_s_rlike", "186");
|
||||||
* condition.put("phonenum_s_eq", null);
|
* condition.put("phonenum_s_eq", null);
|
||||||
* condition.put("email_n_neq", 23);
|
* condition.put("email_n_neq", 23);
|
||||||
* condition.put("description_s_order", "desc");
|
* condition.put("description_s_order", "desc");
|
||||||
* @return 封装后的字符串
|
* @return 封装后的字符串
|
||||||
*/
|
*/
|
||||||
public static String getCondition(Map<String,Object> condition)
|
public static String getCondition(Map<String,Object> condition)
|
||||||
{
|
{
|
||||||
StringBuffer hql = new StringBuffer();
|
StringBuffer hql = new StringBuffer();
|
||||||
Set<String> key = condition.keySet();
|
Set<String> key = condition.keySet();
|
||||||
String groupbyInfo = "";
|
String groupbyInfo = "";
|
||||||
String orderInfo = "";
|
String orderInfo = "";
|
||||||
for(String keyInfo:key)
|
for(String keyInfo:key)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 1、数组为三个 第一个为对象实例的字段 第二个为字段类型 第三个为属性
|
* 1、数组为三个 第一个为对象实例的字段 第二个为字段类型 第三个为属性
|
||||||
* 2、根据分解后的数组拼接搜索条件
|
* 2、根据分解后的数组拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Object valueInfo = condition.get(keyInfo);
|
Object valueInfo = condition.get(keyInfo);
|
||||||
if(null != valueInfo &&valueInfo.toString().length()>0)
|
if(null != valueInfo &&valueInfo.toString().length()>0)
|
||||||
{
|
{
|
||||||
String[] searchCondition = keyInfo.split("_");
|
String[] searchCondition = keyInfo.split("_");
|
||||||
if(searchCondition[1].equals("n"))
|
if(searchCondition[1].equals("n"))
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + valueInfo);
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + valueInfo);
|
||||||
else if(searchCondition[1].equals("s"))
|
else if(searchCondition[1].equals("s"))
|
||||||
{
|
{
|
||||||
if(searchCondition[2].equals("like"))
|
if(searchCondition[2].equals("like"))
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "%'");
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "%'");
|
||||||
else if(searchCondition[2].equals("llike"))
|
else if(searchCondition[2].equals("llike"))
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "'");
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "'");
|
||||||
else if(searchCondition[2].equals("rlike"))
|
else if(searchCondition[2].equals("rlike"))
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "%'");
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "%'");
|
||||||
else if(searchCondition[2].equals("in"))
|
else if(searchCondition[2].equals("in"))
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "(" + valueInfo + ")");
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "(" + valueInfo + ")");
|
||||||
else if(searchCondition[2].equals("order"))
|
else if(searchCondition[2].equals("order"))
|
||||||
orderInfo = " order by " + searchCondition[0] + " " + valueInfo;
|
orderInfo = " order by " + searchCondition[0] + " " + valueInfo;
|
||||||
else if(searchCondition[2].equals("gb"))
|
else if(searchCondition[2].equals("gb"))
|
||||||
groupbyInfo = " group by " + searchCondition[0];
|
groupbyInfo = " group by " + searchCondition[0];
|
||||||
else
|
else
|
||||||
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "'");
|
hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hql.append(groupbyInfo).append(orderInfo).toString();
|
return hql.append(groupbyInfo).append(orderInfo).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定类型的符号
|
* 获取指定类型的符号
|
||||||
* 属性 eq--等于 neq--不等于 like--像 in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 order--value desc asc
|
* 属性 eq--等于 neq--不等于 like--像 in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 order--value desc asc
|
||||||
* @param type
|
* @param type
|
||||||
* @return 类型字符串
|
* @return 类型字符串
|
||||||
*/
|
*/
|
||||||
private static String getType(String type)
|
private static String getType(String type)
|
||||||
{
|
{
|
||||||
String typeStr = "";
|
String typeStr = "";
|
||||||
if(type.equals("eq"))
|
if(type.equals("eq"))
|
||||||
typeStr = " = ";
|
typeStr = " = ";
|
||||||
else if(type.equals("neq"))
|
else if(type.equals("neq"))
|
||||||
typeStr = " != ";
|
typeStr = " != ";
|
||||||
else if(type.equals("like"))
|
else if(type.equals("like"))
|
||||||
typeStr = " like ";
|
typeStr = " like ";
|
||||||
else if(type.equals("llike"))
|
else if(type.equals("llike"))
|
||||||
typeStr = " like ";
|
typeStr = " like ";
|
||||||
else if(type.equals("rlike"))
|
else if(type.equals("rlike"))
|
||||||
typeStr = " like ";
|
typeStr = " like ";
|
||||||
else if(type.equals("in"))
|
else if(type.equals("in"))
|
||||||
typeStr = " in ";
|
typeStr = " in ";
|
||||||
else if(type.equals("gt"))
|
else if(type.equals("gt"))
|
||||||
typeStr = " > ";
|
typeStr = " > ";
|
||||||
else if(type.equals("gteq"))
|
else if(type.equals("gteq"))
|
||||||
typeStr = " >= ";
|
typeStr = " >= ";
|
||||||
else if(type.equals("lt"))
|
else if(type.equals("lt"))
|
||||||
typeStr = " < ";
|
typeStr = " < ";
|
||||||
else if(type.equals("lteq"))
|
else if(type.equals("lteq"))
|
||||||
typeStr = " <= ";
|
typeStr = " <= ";
|
||||||
else if(type.equals("order"))
|
else if(type.equals("order"))
|
||||||
typeStr = " order ";
|
typeStr = " order ";
|
||||||
else if(type.equals("gy"))
|
else if(type.equals("gy"))
|
||||||
typeStr = " group by ";
|
typeStr = " group by ";
|
||||||
else
|
else
|
||||||
typeStr = "unknown";
|
typeStr = "unknown";
|
||||||
return typeStr;
|
return typeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 拼接搜索条件
|
* 拼接搜索条件
|
||||||
*/
|
*/
|
||||||
Map<String,Object> condition = new HashMap<String,Object>();
|
Map<String,Object> condition = new HashMap<String,Object>();
|
||||||
condition.put("supplier_s_like", "aaa");
|
condition.put("supplier_s_like", "aaa");
|
||||||
condition.put("contacts_s_llike", "186");
|
condition.put("contacts_s_llike", "186");
|
||||||
condition.put("contacts_s_rlike", "186");
|
condition.put("contacts_s_rlike", "186");
|
||||||
condition.put("phonenum_s_eq", null);
|
condition.put("phonenum_s_eq", null);
|
||||||
condition.put("email_n_neq", 23);
|
condition.put("email_n_neq", 23);
|
||||||
condition.put("description_s_order", "desc");
|
condition.put("description_s_order", "desc");
|
||||||
condition.put("description_s_gb", "aaa");
|
condition.put("description_s_gb", "aaa");
|
||||||
|
|
||||||
//获取搜索条件拼接
|
//获取搜索条件拼接
|
||||||
System.out.println(getCondition(condition));
|
System.out.println(getCondition(condition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user