This commit is contained in:
AlanGao
2018-04-07 12:41:53 +08:00
parent 35e9301b5e
commit 546aa7ec40
10 changed files with 294 additions and 357 deletions

3
.gitignore vendored
View File

@@ -3,6 +3,7 @@
# Mobile Tools for Java (J2ME) # Mobile Tools for Java (J2ME)
.mtj.tmp/ .mtj.tmp/
*.iml
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
@@ -12,5 +13,7 @@
hs_err_pid* hs_err_pid*
.idea .idea
/target
**/*.iml

View File

@@ -1,41 +1,30 @@
package com.jsh.action.asset; package com.jsh.action.asset;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction; import com.jsh.base.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.util.AssetConstants; import com.jsh.model.po.*;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.Assetname;
import com.jsh.model.po.Basicuser;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Supplier;
import com.jsh.model.vo.asset.AssetModel; import com.jsh.model.vo.asset.AssetModel;
import com.jsh.service.asset.AssetIService; import com.jsh.service.asset.AssetIService;
import com.jsh.service.basic.AssetNameIService; import com.jsh.service.basic.AssetNameIService;
import com.jsh.service.basic.CategoryIService; import com.jsh.service.basic.CategoryIService;
import com.jsh.service.basic.SupplierIService; import com.jsh.service.basic.SupplierIService;
import com.jsh.service.basic.UserIService; import com.jsh.service.basic.UserIService;
import com.jsh.util.AssetConstants;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import com.jsh.util.Tools; import com.jsh.util.Tools;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class AssetAction extends BaseAction<AssetModel> public class AssetAction extends BaseAction<AssetModel> {
{
private AssetModel model = new AssetModel(); private AssetModel model = new AssetModel();
private AssetIService assetService; private AssetIService assetService;
private CategoryIService categoryService; private CategoryIService categoryService;
@@ -44,14 +33,12 @@ public class AssetAction extends BaseAction<AssetModel>
private AssetNameIService assetnameService; private AssetNameIService assetnameService;
@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", "desc"); condition.put("id_s_order", "desc");
categoryService.find(pageUtil); categoryService.find(pageUtil);
@@ -69,9 +56,7 @@ public class AssetAction extends BaseAction<AssetModel>
assetnameService.find(pageUtil); assetnameService.find(pageUtil);
mapData.put("assetnameList", pageUtil.getPageList()); mapData.put("assetnameList", pageUtil.getPageList());
} } catch (Exception e) {
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
model.getShowModel().setMsgTip("exceptoin"); model.getShowModel().setMsgTip("exceptoin");
} }
@@ -80,14 +65,13 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 增加资产 * 增加资产
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加资产方法==================="); Log.infoFileSync("==================开始调用增加资产方法===================");
Boolean flag = false; Boolean flag = false;
try try {
{
Asset asset = new Asset(); Asset asset = new Asset();
//添加设置 //添加设置
asset.setAssetname(new Assetname(model.getAssetNameID())); asset.setAssetname(new Assetname(model.getAssetNameID()));
@@ -96,21 +80,17 @@ public class AssetAction extends BaseAction<AssetModel>
asset.setStatus(model.getStatus()); asset.setStatus(model.getStatus());
asset.setPrice(model.getPrice()); asset.setPrice(model.getPrice());
if(null != model.getUserID()) if (null != model.getUserID()) {
{
asset.setUser(new Basicuser(model.getUserID())); asset.setUser(new Basicuser(model.getUserID()));
} }
try try {
{
//购买日期 //购买日期
asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime())); asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
//有效日期 //有效日期
asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime())); asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
//保修日期 //保修日期
asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime())); asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
} } catch (ParseException e) {
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
} }
@@ -121,9 +101,9 @@ public class AssetAction extends BaseAction<AssetModel>
asset.setSupplier(new Supplier(model.getSupplierID())); asset.setSupplier(new Supplier(model.getSupplierID()));
asset.setDescription(model.getDescription()); asset.setDescription(model.getDescription());
asset.setCreatetime(new Timestamp(new Date().getTime())); asset.setCreatetime(new Timestamp(System.currentTimeMillis()));
asset.setCreator(getUser()); asset.setCreator(getUser());
asset.setUpdatetime(new Timestamp(new Date().getTime())); asset.setUpdatetime(new Timestamp(System.currentTimeMillis()));
asset.setUpdator(getUser()); asset.setUpdator(getUser());
asset.setAddMonth(Tools.getCurrentMonth()); asset.setAddMonth(Tools.getCurrentMonth());
assetService.create(asset); assetService.create(asset);
@@ -132,22 +112,15 @@ public class AssetAction extends BaseAction<AssetModel>
//记录操作日志使用 //记录操作日志使用
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);
} }
} }
@@ -160,19 +133,16 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 删除资产 * 删除资产
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除资产信息方法delete()================"); Log.infoFileSync("====================开始调用删除资产信息方法delete()================");
try try {
{
assetService.delete(model.getAssetID()); assetService.delete(model.getAssetID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetID() + " 的资产异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetID() + " 的资产异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
@@ -187,13 +157,12 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 更新资产 * 更新资产
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
Asset asset = assetService.get(model.getAssetID()); Asset asset = assetService.get(model.getAssetID());
//设置要更新的熟悉值 //设置要更新的熟悉值
@@ -203,21 +172,19 @@ public class AssetAction extends BaseAction<AssetModel>
asset.setStatus(model.getStatus()); asset.setStatus(model.getStatus());
asset.setPrice(model.getPrice()); asset.setPrice(model.getPrice());
if(null != model.getUserID()) if (null != model.getUserID()) {
asset.setUser(new Basicuser(model.getUserID())); asset.setUser(new Basicuser(model.getUserID()));
else } else {
asset.setUser(null); asset.setUser(null);
try }
{ try {
//购买日期 //购买日期
asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime())); asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
//有效日期 //有效日期
asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime())); asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
//保修日期 //保修日期
asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime())); asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
} } catch (ParseException e) {
catch (ParseException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
} }
@@ -228,28 +195,21 @@ public class AssetAction extends BaseAction<AssetModel>
asset.setSupplier(new Supplier(model.getSupplierID())); asset.setSupplier(new Supplier(model.getSupplierID()));
asset.setDescription(model.getDescription()); asset.setDescription(model.getDescription());
asset.setUpdatetime(new Timestamp(new Date().getTime())); asset.setUpdatetime(new Timestamp(System.currentTimeMillis()));
asset.setUpdator(getUser()); asset.setUpdator(getUser());
assetService.update(asset); assetService.update(asset);
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改资产ID为 " + model.getAssetID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改资产ID为 " + model.getAssetID() + "信息失败", 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);
} }
} }
@@ -260,20 +220,17 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 批量删除指定ID资产 * 批量删除指定ID资产
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
assetService.batchDelete(model.getAssetIDs()); assetService.batchDelete(model.getAssetIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除资产ID为" + model.getAssetIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除资产ID为" + model.getAssetIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
@@ -287,12 +244,11 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 查找资产信息 * 查找资产信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Asset> pageUtil = new PageUtil<Asset>(); PageUtil<Asset> pageUtil = new PageUtil<Asset>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
@@ -310,10 +266,8 @@ public class AssetAction extends BaseAction<AssetModel>
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 (Asset asset : dataList) {
for(Asset asset:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", asset.getId()); item.put("id", asset.getId());
//添加资产属性 //添加资产属性
@@ -357,27 +311,22 @@ public class AssetAction extends BaseAction<AssetModel>
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);
} }
} }
/** /**
* 导出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<Asset> pageUtil = (PageUtil<Asset>) getSession().get("pageUtil"); PageUtil<Asset> pageUtil = (PageUtil<Asset>) getSession().get("pageUtil");
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
@@ -386,9 +335,7 @@ public class AssetAction extends BaseAction<AssetModel>
String isCurrentPage = model.getIsAllData(); String isCurrentPage = model.getIsAllData();
model.setFileName(Tools.changeUnicode(model.getFileName() + ".xls", model.getBrowserType())); model.setFileName(Tools.changeUnicode(model.getFileName() + ".xls", model.getBrowserType()));
model.setExcelStream(assetService.exmportExcel(isCurrentPage, pageUtil)); model.setExcelStream(assetService.exmportExcel(isCurrentPage, pageUtil));
} } 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");
} }
@@ -400,39 +347,29 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 导入资产excel表格内容 * 导入资产excel表格内容
*/ */
public String importExcel() public String importExcel() {
{
//资产excel表格file //资产excel表格file
Boolean result = false; Boolean result = false;
String returnStr = ""; String returnStr = "";
try try {
{
InputStream in = assetService.importExcel(model.getAssetFile(), model.getIsCheck()); InputStream in = assetService.importExcel(model.getAssetFile(), model.getIsCheck());
if(null != in) if (null != in) {
{
model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls"); model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls");
model.setExcelStream(in); model.setExcelStream(in);
returnStr = AssetConstants.BusinessForExcel.EXCEL; returnStr = AssetConstants.BusinessForExcel.EXCEL;
} } else {
else
{
result = true; result = true;
try try {
{
toClient(result.toString()); toClient(result.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写导入资产信息结果异常", e); Log.errorFileSync(">>>>>>>>>回写导入资产信息结果异常", e);
} }
//导入数据成功 //导入数据成功
returnStr = SUCCESS; returnStr = SUCCESS;
} }
} } catch (JshException e) {
catch (JshException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e);
} }
return returnStr; return returnStr;
@@ -440,10 +377,10 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
@@ -460,14 +397,13 @@ public class AssetAction extends BaseAction<AssetModel>
/** /**
* 根据状态码转化成说明字符串 * 根据状态码转化成说明字符串
* 资产的状态0==在库1==在用2==消费 * 资产的状态0==在库1==在用2==消费
*
* @param statusCode * @param statusCode
* @return * @return
*/ */
private String getStatusInfo(short statusCode) private String getStatusInfo(short statusCode) {
{
String statusInfo = ""; String statusInfo = "";
switch(statusCode) switch (statusCode) {
{
case AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU: case AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU:
statusInfo = "在库"; statusInfo = "在库";
break; break;
@@ -479,39 +415,35 @@ public class AssetAction extends BaseAction<AssetModel>
case AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME: case AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME:
statusInfo = "消费"; statusInfo = "消费";
break; break;
default:
break;
} }
return statusInfo; return statusInfo;
} }
//=========Spring注入以及model驱动公共方法=========== //=========Spring注入以及model驱动公共方法===========
public void setAssetService(AssetIService assetService) public void setAssetService(AssetIService assetService) {
{
this.assetService = assetService; this.assetService = assetService;
} }
public void setCategoryService(CategoryIService categoryService) public void setCategoryService(CategoryIService categoryService) {
{
this.categoryService = categoryService; this.categoryService = categoryService;
} }
public void setSupplierService(SupplierIService supplierService) public void setSupplierService(SupplierIService supplierService) {
{
this.supplierService = supplierService; this.supplierService = supplierService;
} }
public void setUserService(UserIService userService) public void setUserService(UserIService userService) {
{
this.userService = userService; this.userService = userService;
} }
public void setAssetnameService(AssetNameIService assetnameService) public void setAssetnameService(AssetNameIService assetnameService) {
{
this.assetnameService = assetnameService; this.assetnameService = assetnameService;
} }
@Override @Override
public AssetModel getModel() public AssetModel getModel() {
{
return model; return model;
} }
} }

View File

@@ -1,30 +1,28 @@
package com.jsh.action.asset; package com.jsh.action.asset;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Asset;
import com.jsh.model.vo.asset.ReportModel;
import com.jsh.service.asset.ReportIService;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil;
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.Log;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.vo.asset.ReportModel;
import com.jsh.service.asset.ReportIService;
import com.jsh.util.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);
@@ -32,9 +30,7 @@ public class ReportAction extends BaseAction<ReportModel>
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 (JshException e) {
catch (JshException e)
{
Log.errorFileSync(">>>>>>>>>查找资产信息异常", e); Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
model.getShowModel().setMsgTip("get report data exception"); model.getShowModel().setMsgTip("get report data exception");
} }
@@ -43,10 +39,10 @@ public class ReportAction extends BaseAction<ReportModel>
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
@@ -64,10 +60,10 @@ public class ReportAction extends BaseAction<ReportModel>
/** /**
* 获取统计条件 * 获取统计条件
*
* @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>
@@ -76,8 +72,7 @@ public class ReportAction extends BaseAction<ReportModel>
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";
@@ -103,18 +98,19 @@ public class ReportAction extends BaseAction<ReportModel>
reportTypeInfo = "user.id"; reportTypeInfo = "user.id";
reportTypeName = "user.username"; reportTypeName = "user.username";
break; break;
default:
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;
} }
} }

View File

@@ -86,7 +86,7 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
depotHead.setDefaultNumber(allNewNumber); //初始编号,一直都从后台取值 depotHead.setDefaultNumber(allNewNumber); //初始编号,一直都从后台取值
depotHead.setOperPersonName(getUser().getUsername()); depotHead.setOperPersonName(getUser().getUsername());
depotHead.setCreateTime(new Timestamp(new Date().getTime())); depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
try{ try{
depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime())); depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime()));
} }

View File

@@ -20,6 +20,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException 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()));
@@ -28,6 +29,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override
public void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException public void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException
{ {
Query query; Query query;
@@ -51,6 +53,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
query.executeUpdate(); query.executeUpdate();
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void findInDetail(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException { public void findInDetail(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException {
StringBuffer queryString = new StringBuffer(); StringBuffer queryString = new StringBuffer();
@@ -87,6 +90,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
pageUtil.setPageList(query.list()); pageUtil.setPageList(query.list());
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException { public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException {
StringBuffer queryString = new StringBuffer(); StringBuffer queryString = new StringBuffer();
@@ -185,6 +189,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
pageUtil.setPageList(query.list()); pageUtil.setPageList(query.list());
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds) throws JshException { public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds) throws JshException {
StringBuffer queryString = new StringBuffer(); StringBuffer queryString = new StringBuffer();

View File

@@ -1,13 +1,11 @@
package com.jsh.dao.materials; package com.jsh.dao.materials;
import com.jsh.base.BaseIDAO; import com.jsh.base.BaseIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.DepotHead; import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness; import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
public interface DepotHeadIDAO extends BaseIDAO<DepotHead> public interface DepotHeadIDAO extends BaseIDAO<DepotHead> {
{
/* /*
* 获取MaxId * 获取MaxId
*/ */
@@ -15,16 +13,16 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException; void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException;
public void batchSetStatus(Boolean status,String depotHeadIDs); void batchSetStatus(Boolean status, String depotHeadIDs);
public void findInDetail(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException; void findInDetail(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException;
public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids, Long oId) throws JshException; void findInOutMaterialCount(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException;
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException; void findMaterialsListByHeaderId(PageUtil pageUtil, Long headerId) throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId, String supType) throws JshException; void findStatementAccount(PageUtil pageUtil, String beginTime, String endTime, Long organId, String supType) throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds) throws JshException; void getHeaderIdByMaterial(PageUtil pageUtil, String materialParam, String depotIds) throws JshException;
} }

View File

@@ -15,15 +15,15 @@ public interface DepotHeadIService extends BaseIService<DepotHead>
void findAllMoney(PageUtil<DepotHead> depotHead, Integer supplierId, String type, String subType, String mode)throws JshException; void findAllMoney(PageUtil<DepotHead> depotHead, Integer supplierId, String type, String subType, String mode)throws JshException;
public void batchSetStatus(Boolean status,String depotHeadIDs); void batchSetStatus(Boolean status,String depotHeadIDs);
public void findInDetail(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException; void findInDetail(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException;
public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException; void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException;
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException; void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException;
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId, String supType)throws JshException; void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId, String supType)throws JshException;
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds)throws JshException; void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds)throws JshException;
} }

View File

@@ -2,13 +2,11 @@ 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.util.JshException;
import com.jsh.model.po.DepotHead; import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness; import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.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;
@@ -19,41 +17,46 @@ public class DepotHeadService extends BaseService<DepotHead> implements DepotHea
@Override @Override
protected Class<DepotHead> getEntityClass() protected Class<DepotHead> getEntityClass() {
{
return DepotHead.class; return DepotHead.class;
} }
public void find(PageUtil<DepotHead> pageUtil, String maxid) throws JshException @Override
{ public void find(PageUtil<DepotHead> pageUtil, String maxid) throws JshException {
depotHeadDao.find(pageUtil, maxid); depotHeadDao.find(pageUtil, maxid);
} }
public void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException @Override
{ public void findAllMoney(PageUtil<DepotHead> pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException {
depotHeadDao.findAllMoney(pageUtil, supplierId, type, subType, mode); depotHeadDao.findAllMoney(pageUtil, supplierId, type, subType, mode);
} }
@Override
public void batchSetStatus(Boolean status, String depotHeadIDs) { public void batchSetStatus(Boolean status, String depotHeadIDs) {
depotHeadDao.batchSetStatus(status, depotHeadIDs); depotHeadDao.batchSetStatus(status, depotHeadIDs);
} }
@Override
public void findInDetail(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException { public void findInDetail(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException {
depotHeadDao.findInDetail(pageUtil, beginTime, endTime, type, pid, dids, oId); depotHeadDao.findInDetail(pageUtil, beginTime, endTime, type, pid, dids, oId);
} }
@Override
public void findInOutMaterialCount(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException { public void findInOutMaterialCount(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException {
depotHeadDao.findInOutMaterialCount(pageUtil, beginTime, endTime, type, pid, dids, oId); depotHeadDao.findInOutMaterialCount(pageUtil, beginTime, endTime, type, pid, dids, oId);
} }
@Override
public void findMaterialsListByHeaderId(PageUtil pageUtil, Long headerId) throws JshException { public void findMaterialsListByHeaderId(PageUtil pageUtil, Long headerId) throws JshException {
depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId); depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId);
} }
@Override
public void findStatementAccount(PageUtil pageUtil, String beginTime, String endTime, Long organId, String supType) throws JshException { public void findStatementAccount(PageUtil pageUtil, String beginTime, String endTime, Long organId, String supType) throws JshException {
depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId, supType); depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId, supType);
} }
@Override
public void getHeaderIdByMaterial(PageUtil pageUtil, String materialParam, String depotIds) throws JshException { public void getHeaderIdByMaterial(PageUtil pageUtil, String materialParam, String depotIds) throws JshException {
depotHeadDao.getHeaderIdByMaterial(pageUtil, materialParam, depotIds); depotHeadDao.getHeaderIdByMaterial(pageUtil, materialParam, depotIds);
} }

View File

@@ -1,3 +1,3 @@
stmp=smtp.126.com stmp=smtp.gaodonghua.com
emailname=accountnms@126.com emailname=alan@gaodonghua.com
password=public password=1QAZ2wsx

View File

@@ -1,4 +1,4 @@
jdbcUrl= jdbc\:mysql\://localhost\:3306/jsh_erp?useUnicode\=true&characterEncoding\=UTF-8 jdbcUrl= jdbc\:mysql\://mysql.gaodonghua.com\:13306/jsh_erp?useUnicode\=true&characterEncoding\=UTF-8
driverClass= com.mysql.jdbc.Driver driverClass= com.mysql.jdbc.Driver
user= root user= root
password=1234 password=Alan!@#