Commit 07259995 authored by AlanGao's avatar AlanGao
Browse files

update

parent 458409b4
......@@ -21,7 +21,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.*;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressWarnings("serial")
public class AssetAction extends BaseAction<AssetModel> {
......
package com.jsh.action.basic;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Assetname;
......@@ -16,79 +8,77 @@ import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.AssetNameModel;
import com.jsh.service.basic.AssetNameIService;
import com.jsh.util.PageUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressWarnings("serial")
public class AssetNameAction extends BaseAction<AssetNameModel>
{
public class AssetNameAction extends BaseAction<AssetNameModel> {
private AssetNameModel model = new AssetNameModel();
private AssetNameIService assetnameService;
/**
* 增加资产名称
*
* @return
*/
public void create()
{
public void create() {
Log.infoFileSync("==================开始调用增加资产名称方法create()===================");
Boolean flag = false;
try
{
try {
Assetname assetname = new Assetname();
assetname.setAssetname(model.getAssetName());
//增加资产类型
assetname.setCategory(new Category(model.getCategoryID()));
assetname.setIsystem((short)1);
assetname.setIsystem((short) 1);
assetname.setIsconsumables(model.getConsumable());
assetname.setDescription(model.getDescription());
assetnameService.create(assetname);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加资产名称名称为 "+ model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
, tipType, "增加资产名称名称为 " + model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
Log.infoFileSync("==================结束调用增加资产名称方法create()===================");
}
/**
* 删除资产名称
*
* @return
*/
public String delete()
{
public String delete() {
Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================");
try
{
try {
assetnameService.delete(model.getAssetNameID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e);
tipMsg = "失败";
tipType = 1;
......@@ -96,20 +86,19 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
, tipType, "删除资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================");
return SUCCESS;
}
/**
* 更新资产名称
*
* @return
*/
public void update()
{
public void update() {
Boolean flag = false;
try
{
try {
Assetname assetname = assetnameService.get(model.getAssetNameID());
//增加资产类型
assetname.setCategory(new Category(model.getCategoryID()));
......@@ -117,103 +106,83 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
assetname.setIsconsumables(model.getConsumable());
assetname.setDescription(model.getDescription());
assetnameService.update(assetname);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
, tipType, "更新资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
}
/**
* 批量删除指定ID资产名称
*
* @return
*/
public String batchDelete()
{
try
{
public String batchDelete() {
try {
assetnameService.batchDelete(model.getAssetNameIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
, tipType, "批量删除资产名称ID为 " + model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist()
{
public void checkIsNameExist() {
Boolean flag = false;
try
{
flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID());
}
catch (DataAccessException e)
{
try {
flag = assetnameService.checkIsNameExist("assetname", model.getAssetName(), "id", model.getAssetNameID());
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!");
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e);
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!", e);
}
}
}
/**
* 查找供应商信息
*
* @return
*/
public void findBy()
{
try
{
PageUtil<Assetname> pageUtil = new PageUtil<Assetname>();
public void findBy() {
try {
PageUtil<Assetname> pageUtil = new PageUtil<Assetname>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
assetnameService.find(pageUtil);
List<Assetname> dataList = pageUtil.getPageList();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
......@@ -222,16 +191,14 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Assetname assetname:dataList)
{
if (null != dataList) {
for (Assetname assetname : dataList) {
JSONObject item = new JSONObject();
item.put("id", assetname.getId());
//供应商名称
item.put("assetname", assetname.getAssetname());
item.put("isystem", assetname.getIsystem() == (short)0?"是":"否");
item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否");
item.put("isystem", assetname.getIsystem() == (short) 0 ? "是" : "否");
item.put("consumable", assetname.getIsconsumables() == (short) 0 ? "是" : "否");
item.put("consumableStatus", assetname.getIsconsumables());
item.put("description", assetname.getDescription());
item.put("categoryID", assetname.getCategory().getId());
......@@ -243,27 +210,23 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e);
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e);
}
}
/**
* 拼接搜索条件
*
* @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_s_like", model.getAssetName());
condition.put("isconsumables_n_eq", model.getConsumable());
condition.put("description_s_like", model.getDescription());
......@@ -271,16 +234,14 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public AssetNameModel getModel()
{
public AssetNameModel getModel() {
return model;
}
public void setAssetnameService(AssetNameIService assetnameService)
{
public void setAssetnameService(AssetNameIService assetnameService) {
this.assetnameService = assetnameService;
}
}
package com.jsh.action.basic;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Category;
......@@ -15,198 +7,176 @@ import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.CategoryModel;
import com.jsh.service.basic.CategoryIService;
import com.jsh.util.PageUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/*
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/
*/
@SuppressWarnings("serial")
public class CategoryAction extends BaseAction<CategoryModel>
{
public class CategoryAction extends BaseAction<CategoryModel> {
private CategoryIService categoryService;
private CategoryModel model = new CategoryModel();
/**
* 增加资产类型
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
Boolean flag = false;
try
{
Category category = new Category();
category.setAssetname(model.getCategoryName());
category.setIsystem((short)1);
category.setDescription(model.getDescription());
categoryService.create(category);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
/**
* 增加资产类型
*
* @return
*/
public void create() {
Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
Boolean flag = false;
try {
Category category = new Category();
category.setAssetname(model.getCategoryName());
category.setIsystem((short) 1);
category.setDescription(model.getDescription());
categoryService.create(category);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e);
flag = false;
tipMsg = "失败";
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(),
}
logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加资产类型名称为 "+ model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
}
/**
* 删除资产类型
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
try
{
categoryService.delete(model.getCategoryID());
, tipType, "增加资产类型名称为 " + model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
}
/**
* 删除资产类型
*
* @return
*/
public String delete() {
Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
try {
categoryService.delete(model.getCategoryID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
tipMsg = "失败";
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
return SUCCESS;
}
/**
* 更新资产类型
* @return
*/
public void update()
{
Boolean flag = false;
try
{
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
return SUCCESS;
}
/**
* 更新资产类型
*
* @return
*/
public void update() {
Boolean flag = false;
try {
Category category = categoryService.get(model.getCategoryID());
category.setAssetname(model.getCategoryName());
category.setDescription(model.getDescription());
categoryService.update(category);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
}
/**
* 批量删除指定ID资产类型
* @return
*/
public String batchDelete()
{
try
{
categoryService.batchDelete(model.getCategoryIDs());
, tipType, "更新资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
}
/**
* 批量删除指定ID资产类型
*
* @return
*/
public String batchDelete() {
try {
categoryService.batchDelete(model.getCategoryIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
tipMsg = "失败";
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist()
{
Boolean flag = false;
try
{
flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID());
}
catch (DataAccessException e)
{
, tipType, "批量删除资产类型ID为 " + model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist() {
Boolean flag = false;
try {
flag = categoryService.checkIsNameExist("assetname", model.getCategoryName(), "id", model.getCategoryID());
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!");
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e);
}
}
}
/**
* 查找供应商信息
* @return
*/
public void findBy()
{
try
{
PageUtil<Category> pageUtil = new PageUtil<Category>();
}
}
/**
* 查找供应商信息
*
* @return
*/
public void findBy() {
try {
PageUtil<Category> pageUtil = new PageUtil<Category>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
categoryService.find(pageUtil);
List<Category> dataList = pageUtil.getPageList();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
......@@ -215,15 +185,13 @@ public class CategoryAction extends BaseAction<CategoryModel>
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Category category:dataList)
{
if (null != dataList) {
for (Category category : dataList) {
JSONObject item = new JSONObject();
item.put("id", category.getId());
//供应商名称
item.put("categoryname", category.getAssetname());
item.put("isystem", category.getIsystem() == (short)0?"是":"否");
item.put("isystem", category.getIsystem() == (short) 0 ? "是" : "否");
item.put("description", category.getDescription());
item.put("op", category.getIsystem());
dataArray.add(item);
......@@ -232,41 +200,36 @@ public class CategoryAction extends BaseAction<CategoryModel>
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e);
}
catch (IOException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e);
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
}
/**
* 拼接搜索条件
*
* @return
*/
private Map<String, Object> getCondition() {
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
Map<String, Object> condition = new HashMap<String, Object>();
condition.put("assetname_s_like", model.getCategoryName());
condition.put("description_s_like", model.getDescription());
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public CategoryModel getModel()
{
return model;
}
public void setCategoryService(CategoryIService categoryService)
{
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public CategoryModel getModel() {
return model;
}
public void setCategoryService(CategoryIService categoryService) {
this.categoryService = categoryService;
}
}
package com.jsh.action.basic;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.InOutItem;
import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.InOutItemModel;
import com.jsh.service.basic.InOutItemIService;
import com.jsh.util.PageUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 收支项目
*
* @author ji*sheng*hua qq 7.5.2.7.1.8.9.2.0
*/
@SuppressWarnings("serial")
public class InOutItemAction extends BaseAction<InOutItemModel>
{
public class InOutItemAction extends BaseAction<InOutItemModel> {
private InOutItemIService inOutItemService;
private InOutItemModel model = new InOutItemModel();
/**
* 增加收支项目
*
* @return
*/
public void create()
{
public void create() {
Log.infoFileSync("==================开始调用增加收支项目方法===================");
Boolean flag = false;
try
{
try {
InOutItem inOutItem = new InOutItem();
inOutItem.setName(model.getName());
inOutItem.setType(model.getType());
......@@ -46,68 +47,57 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加收支项目名称为 "+ model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg));
new Timestamp(System.currentTimeMillis())
, tipType, "增加收支项目名称为 " + model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg));
Log.infoFileSync("==================结束调用增加收支项目方法===================");
}
/**
* 删除收支项目
*
* @return
*/
public String delete()
{
public String delete() {
Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================");
try
{
try {
inOutItemService.delete(model.getInOutItemID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除收支项目ID为 "+ model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg));
new Timestamp(System.currentTimeMillis())
, tipType, "删除收支项目ID为 " + model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg));
Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================");
return SUCCESS;
}
/**
* 更新收支项目
*
* @return
*/
public void update()
{
public void update() {
Boolean flag = false;
try
{
try {
InOutItem inOutItem = inOutItemService.get(model.getInOutItemID());
inOutItem.setName(model.getName());
inOutItem.setType(model.getType());
......@@ -117,93 +107,73 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新收支项目ID为 "+ model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg));
new Timestamp(System.currentTimeMillis())
, tipType, "更新收支项目ID为 " + model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg));
}
/**
* 批量删除指定ID收支项目
*
* @return
*/
public String batchDelete()
{
try
{
public String batchDelete() {
try {
inOutItemService.batchDelete(model.getInOutItemIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>批量删除收支项目ID为:" + model.getInOutItemIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除收支项目ID为 "+ model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg));
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除收支项目ID为 " + model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist()
{
public void checkIsNameExist() {
Boolean flag = false;
try
{
flag = inOutItemService.checkIsNameExist("name",model.getName(),"id", model.getInOutItemID());
}
catch (DataAccessException e)
{
try {
flag = inOutItemService.checkIsNameExist("name", model.getName(), "id", model.getInOutItemID());
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!");
}
finally
{
try
{
} finally {
try {
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!",e);
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!", e);
}
}
}
/**
* 查找收支项目信息
*
* @return
*/
public void findBy()
{
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
public void findBy() {
try {
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
......@@ -214,10 +184,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(InOutItem inOutItem:dataList)
{
if (null != dataList) {
for (InOutItem inOutItem : dataList) {
JSONObject item = new JSONObject();
item.put("id", inOutItem.getId());
//收支项目名称
......@@ -231,26 +199,21 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
}
}
/**
* 查找收支项目信息-下拉框
*
* @return
*/
public void findBySelect()
{
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
public void findBySelect() {
try {
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_select());
......@@ -258,10 +221,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
List<InOutItem> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(InOutItem inOutItem:dataList)
{
if (null != dataList) {
for (InOutItem inOutItem : dataList) {
JSONObject item = new JSONObject();
item.put("Id", inOutItem.getId());
//收支项目名称
......@@ -271,27 +232,23 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
} catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
}
catch (IOException e)
{
} catch (IOException e) {
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
}
}
/**
* 拼接搜索条件
*
* @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("remark_s_like", model.getRemark());
condition.put("id_s_order", "desc");
......@@ -300,32 +257,30 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
/**
* 拼接搜索条件-下拉框-收支项目
*
* @return
*/
private Map<String,Object> getCondition_select()
{
private Map<String, Object> getCondition_select() {
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
if(model.getType().equals("in")) {
condition.put("type_s_eq", "收入");
Map<String, Object> condition = new HashMap<String, Object>();
if (model.getType().equals("in")) {
condition.put("type_s_eq", "收入");
} else if (model.getType().equals("out")) {
condition.put("type_s_eq", "支出");
}
else if(model.getType().equals("out")) {
condition.put("type_s_eq", "支出");
}
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public InOutItemModel getModel()
{
public InOutItemModel getModel() {
return model;
}
public void setInOutItemService(InOutItemIService inOutItemService)
{
public void setInOutItemService(InOutItemIService inOutItemService) {
this.inOutItemService = inOutItemService;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment