Commit 2aaad2bc authored by 季圣华's avatar 季圣华
Browse files

新增收支项目和结算账户功能

parent 55135aca
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
org.hibernate.dialect.MySQL5Dialect org.hibernate.dialect.MySQL5Dialect
</property> </property>
<property name="show_sql">true</property> <property name="show_sql">true</property>
<!-- 一般重新建库用create(慎用),只更新字段用update -->
<property name="hbm2ddl.auto">update</property> <property name="hbm2ddl.auto">update</property>
<!-- 对应的实体映射 --> <!-- 对应的实体映射 -->
...@@ -39,5 +40,7 @@ ...@@ -39,5 +40,7 @@
<mapping resource="com/jsh/model/po/Building.hbm.xml" /> <mapping resource="com/jsh/model/po/Building.hbm.xml" />
<mapping resource="com/jsh/model/po/DepotHead.hbm.xml" /> <mapping resource="com/jsh/model/po/DepotHead.hbm.xml" />
<mapping resource="com/jsh/model/po/DepotItem.hbm.xml" /> <mapping resource="com/jsh/model/po/DepotItem.hbm.xml" />
<mapping resource="com/jsh/model/po/Account.hbm.xml" />
<mapping resource="com/jsh/model/po/InOutItem.hbm.xml" />
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>
\ No newline at end of file
...@@ -321,4 +321,28 @@ ...@@ -321,4 +321,28 @@
<property name="logService" ref="logService"/> <property name="logService" ref="logService"/>
</bean> </bean>
<!--仓管通明细配置结束 --> <!--仓管通明细配置结束 -->
</beans>
\ No newline at end of file <!--结算账户配置开始 -->
<bean id="accountService" class="com.jsh.service.basic.AccountService">
<property name="baseDao" ref="baseDao"/>
<property name="accountDao" ref="accountDao"/>
</bean>
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean id="accountAction" class="com.jsh.action.basic.AccountAction" scope="prototype">
<property name="accountService" ref="accountService"/>
<property name="logService" ref="logService"/>
</bean>
<!--结算账户配置结束 -->
<!--收支项目配置开始 -->
<bean id="inOutItemService" class="com.jsh.service.basic.InOutItemService">
<property name="baseDao" ref="baseDao"/>
<property name="inOutItemDao" ref="inOutItemDao"/>
</bean>
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean id="inOutItemAction" class="com.jsh.action.basic.InOutItemAction" scope="prototype">
<property name="inOutItemService" ref="inOutItemService"/>
<property name="logService" ref="logService"/>
</bean>
<!--收支项目配置结束 -->
</beans>
...@@ -47,5 +47,9 @@ ...@@ -47,5 +47,9 @@
<!-- 配置depotHeadDao组件 --> <!-- 配置depotHeadDao组件 -->
<bean id="depotHeadDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotHeadDAO"/> <bean id="depotHeadDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotHeadDAO"/>
<!-- 配置depotItemDao组件 --> <!-- 配置depotItemDao组件 -->
<bean id="depotItemDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotItemDAO"/> <bean id="depotItemDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotItemDAO"/>
<!-- 配置accountDao组件 -->
<bean id="accountDao" parent="daoTemplate" class="com.jsh.dao.basic.AccountDAO"/>
<!-- 配置inOutItemDao组件 -->
<bean id="inOutItemDao" parent="daoTemplate" class="com.jsh.dao.basic.InOutItemDAO"/>
</beans> </beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="account" namespace="/account" extends="json-default">
<action name="*" class="accountAction" method="{1}">
<result type="json"/>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="inOutItem" namespace="/inOutItem" extends="json-default">
<action name="*" class="inOutItemAction" method="{1}">
<result type="json"/>
</action>
</package>
</struts>
...@@ -12,35 +12,6 @@ ...@@ -12,35 +12,6 @@
<title>ERP系统</title> <title>ERP系统</title>
<link href="<%=path%>/js/HoorayOS_mini/js/HoorayLibs/hooraylibs.css" rel="stylesheet" /> <link href="<%=path%>/js/HoorayOS_mini/js/HoorayLibs/hooraylibs.css" rel="stylesheet" />
<link href="<%=path%>/js/HoorayOS_mini/img/ui/index.css" rel="stylesheet" /> <link href="<%=path%>/js/HoorayOS_mini/img/ui/index.css" rel="stylesheet" />
<style type="text/css">
.newsTitle {
text-align: center;
color: red;
font-weight: bold;
font-size: 20px;
}
.newsContent {
padding-top: 10px;
color: red;
font-weight: bold;
height: 140px;
overflow: hidden;
line-height: 20px;
}
.newsFoot {
text-align: right;
color: red;
font-weight: bold;
}
.newsTime {
text-align: right;
color: red;
font-weight: bold;
}
</style>
</head> </head>
<body> <body>
<div class="loading"></div> <div class="loading"></div>
...@@ -134,16 +105,6 @@ ...@@ -134,16 +105,6 @@
//加载桌面 //加载桌面
HROS.base.init(); HROS.base.init();
} }
if ('@ViewData["News"].ToString()'.length > 0) {
$.messager.show({
title: '公 告',
msg: '最新公告',
timeout: 20000,
showType: 'slide',
width: 500,
height: 280
});
}
function JSGetCookie(Name) { function JSGetCookie(Name) {
var search = Name + "=" var search = Name + "="
if (document.cookie.length > 0) { if (document.cookie.length > 0) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
org.hibernate.dialect.MySQL5Dialect org.hibernate.dialect.MySQL5Dialect
</property> </property>
<property name="show_sql">true</property> <property name="show_sql">true</property>
<!-- 一般重新建库用create(慎用),只更新字段用update -->
<property name="hbm2ddl.auto">update</property> <property name="hbm2ddl.auto">update</property>
<!-- 对应的实体映射 --> <!-- 对应的实体映射 -->
...@@ -39,5 +40,7 @@ ...@@ -39,5 +40,7 @@
<mapping resource="com/jsh/model/po/Building.hbm.xml" /> <mapping resource="com/jsh/model/po/Building.hbm.xml" />
<mapping resource="com/jsh/model/po/DepotHead.hbm.xml" /> <mapping resource="com/jsh/model/po/DepotHead.hbm.xml" />
<mapping resource="com/jsh/model/po/DepotItem.hbm.xml" /> <mapping resource="com/jsh/model/po/DepotItem.hbm.xml" />
<mapping resource="com/jsh/model/po/Account.hbm.xml" />
<mapping resource="com/jsh/model/po/InOutItem.hbm.xml" />
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>
\ No newline at end of file
...@@ -321,4 +321,28 @@ ...@@ -321,4 +321,28 @@
<property name="logService" ref="logService"/> <property name="logService" ref="logService"/>
</bean> </bean>
<!--仓管通明细配置结束 --> <!--仓管通明细配置结束 -->
</beans>
\ No newline at end of file <!--结算账户配置开始 -->
<bean id="accountService" class="com.jsh.service.basic.AccountService">
<property name="baseDao" ref="baseDao"/>
<property name="accountDao" ref="accountDao"/>
</bean>
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean id="accountAction" class="com.jsh.action.basic.AccountAction" scope="prototype">
<property name="accountService" ref="accountService"/>
<property name="logService" ref="logService"/>
</bean>
<!--结算账户配置结束 -->
<!--收支项目配置开始 -->
<bean id="inOutItemService" class="com.jsh.service.basic.InOutItemService">
<property name="baseDao" ref="baseDao"/>
<property name="inOutItemDao" ref="inOutItemDao"/>
</bean>
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean id="inOutItemAction" class="com.jsh.action.basic.InOutItemAction" scope="prototype">
<property name="inOutItemService" ref="inOutItemService"/>
<property name="logService" ref="logService"/>
</bean>
<!--收支项目配置结束 -->
</beans>
...@@ -47,5 +47,9 @@ ...@@ -47,5 +47,9 @@
<!-- 配置depotHeadDao组件 --> <!-- 配置depotHeadDao组件 -->
<bean id="depotHeadDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotHeadDAO"/> <bean id="depotHeadDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotHeadDAO"/>
<!-- 配置depotItemDao组件 --> <!-- 配置depotItemDao组件 -->
<bean id="depotItemDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotItemDAO"/> <bean id="depotItemDao" parent="daoTemplate" class="com.jsh.dao.materials.DepotItemDAO"/>
<!-- 配置accountDao组件 -->
<bean id="accountDao" parent="daoTemplate" class="com.jsh.dao.basic.AccountDAO"/>
<!-- 配置inOutItemDao组件 -->
<bean id="inOutItemDao" parent="daoTemplate" class="com.jsh.dao.basic.InOutItemDAO"/>
</beans> </beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="account" namespace="/account" extends="json-default">
<action name="*" class="accountAction" method="{1}">
<result type="json"/>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="inOutItem" namespace="/inOutItem" extends="json-default">
<action name="*" class="inOutItemAction" method="{1}">
<result type="json"/>
</action>
</package>
</struts>
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.Account;
import com.jsh.model.vo.basic.AccountModel;
import com.jsh.service.basic.AccountIService;
import com.jsh.util.common.PageUtil;
/**
* 结算账户
* @author ji sheng hua
*/
@SuppressWarnings("serial")
public class AccountAction extends BaseAction<AccountModel>
{
private AccountIService accountService;
private AccountModel model = new AccountModel();
/**
* 增加结算账户
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加结算账户方法===================");
Boolean flag = false;
try
{
Account Account = new Account();
Account.setName(model.getName());
Account.setSerialNo(model.getSerialNo());
Account.setInitialAmount(model.getInitialAmount());
Account.setCurrentAmount(model.getCurrentAmount());
Account.setRemark(model.getRemark());
accountService.create(Account);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加结算账户异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加结算账户回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加结算账户", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加结算账户名称为 "+ model.getName() + " " + tipMsg + "!", "增加结算账户" + tipMsg));
Log.infoFileSync("==================结束调用增加结算账户方法===================");
}
/**
* 删除结算账户
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除结算账户信息方法delete()================");
try
{
accountService.delete(model.getAccountID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAccountID() + " 的结算账户异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除结算账户", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除结算账户ID为 "+ model.getAccountID() + ",名称为 " + model.getName() + tipMsg + "!", "删除结算账户" + tipMsg));
Log.infoFileSync("====================结束调用删除结算账户信息方法delete()================");
return SUCCESS;
}
/**
* 更新结算账户
* @return
*/
public void update()
{
Boolean flag = false;
try
{
Account Account = accountService.get(model.getAccountID());
Account.setName(model.getName());
Account.setSerialNo(model.getSerialNo());
Account.setInitialAmount(model.getInitialAmount());
Account.setCurrentAmount(model.getCurrentAmount());
Account.setRemark(model.getRemark());
accountService.update(Account);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新结算账户", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新结算账户ID为 "+ model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg));
}
/**
* 批量删除指定ID结算账户
* @return
*/
public String batchDelete()
{
try
{
accountService.batchDelete(model.getAccountIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除结算账户ID为:" + model.getAccountIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除结算账户", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除结算账户ID为 "+ model.getAccountIDs() + " " + tipMsg + "!", "批量删除结算账户" + tipMsg));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist()
{
Boolean flag = false;
try
{
flag = accountService.checkIsNameExist("name", model.getName(), "id", model.getAccountID());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!");
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>回写检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!",e);
}
}
}
/**
* 查找结算账户信息
* @return
*/
public void findBy()
{
try
{
PageUtil<Account> pageUtil = new PageUtil<Account>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
accountService.find(pageUtil);
List<Account> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Account account:dataList)
{
JSONObject item = new JSONObject();
item.put("id", account.getId());
//结算账户名称
item.put("name", account.getName());
item.put("serialNo", account.getSerialNo());
item.put("initialAmount", account.getInitialAmount());
item.put("currentAmount", account.getCurrentAmount());
item.put("remark", account.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e);
}
}
/**
* 查找结算账户信息-下拉框
* @return
*/
public void findBySelect()
{
try
{
PageUtil<Account> pageUtil = new PageUtil<Account>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_select());
accountService.find(pageUtil);
List<Account> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(Account account:dataList)
{
JSONObject item = new JSONObject();
item.put("id", account.getId());
//结算账户名称
item.put("name", account.getName());
dataArray.add(item);
}
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("name_s_like", model.getName());
condition.put("serialNo_s_like", model.getSerialNo());
condition.put("remark_s_like", model.getRemark());
condition.put("id_s_order", "desc");
return condition;
}
/**
* 拼接搜索条件-下拉框-结算账户
* @return
*/
private Map<String,Object> getCondition_select()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public AccountModel getModel()
{
return model;
}
public void setAccountService(AccountIService accountService)
{
this.accountService = accountService;
}
}
...@@ -30,7 +30,10 @@ import com.jsh.service.basic.AppIService; ...@@ -30,7 +30,10 @@ import com.jsh.service.basic.AppIService;
import com.jsh.service.basic.UserBusinessIService; import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.common.PageUtil; import com.jsh.util.common.PageUtil;
//import com.opensymphony.xwork2.ActionContext; //import com.opensymphony.xwork2.ActionContext;
/**
* 应用
* @author ji_sheng_hua
*/
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class AppAction extends BaseAction<AppModel> public class AppAction extends BaseAction<AppModel>
{ {
......
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.vo.basic.InOutItemModel;
import com.jsh.service.basic.InOutItemIService;
import com.jsh.util.common.PageUtil;
/**
* 收支项目
* @author ji*sheng*hua
*/
@SuppressWarnings("serial")
public class InOutItemAction extends BaseAction<InOutItemModel>
{
private InOutItemIService inOutItemService;
private InOutItemModel model = new InOutItemModel();
/**
* 增加收支项目
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加收支项目方法===================");
Boolean flag = false;
try
{
InOutItem inOutItem = new InOutItem();
inOutItem.setName(model.getName());
inOutItem.setType(model.getType());
inOutItem.setRemark(model.getRemark());
inOutItemService.create(inOutItem);
//========标识位===========
flag = true;
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加收支项目名称为 "+ model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg));
Log.infoFileSync("==================结束调用增加收支项目方法===================");
}
/**
* 删除收支项目
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================");
try
{
inOutItemService.delete(model.getInOutItemID());
tipMsg = "成功";
tipType = 0;
}
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));
Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================");
return SUCCESS;
}
/**
* 更新收支项目
* @return
*/
public void update()
{
Boolean flag = false;
try
{
InOutItem inOutItem = inOutItemService.get(model.getInOutItemID());
inOutItem.setName(model.getName());
inOutItem.setType(model.getType());
inOutItem.setRemark(model.getRemark());
inOutItemService.update(inOutItem);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新收支项目ID为 "+ model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg));
}
/**
* 批量删除指定ID收支项目
* @return
*/
public String batchDelete()
{
try
{
inOutItemService.batchDelete(model.getInOutItemIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
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));
return SUCCESS;
}
/**
* 检查输入名称是否存在
*/
public void checkIsNameExist()
{
Boolean flag = false;
try
{
flag = inOutItemService.checkIsNameExist("name",model.getName(),"id", model.getInOutItemID());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!");
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!",e);
}
}
}
/**
* 查找收支项目信息
* @return
*/
public void findBy()
{
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
inOutItemService.find(pageUtil);
List<InOutItem> dataList = pageUtil.getPageList();
JSONObject outer = new JSONObject();
outer.put("total", pageUtil.getTotalCount());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(InOutItem inOutItem:dataList)
{
JSONObject item = new JSONObject();
item.put("id", inOutItem.getId());
//收支项目名称
item.put("name", inOutItem.getName());
item.put("type", inOutItem.getType());
item.put("remark", inOutItem.getRemark());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
}
}
/**
* 查找收支项目信息-下拉框
* @return
*/
public void findBySelect()
{
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(0);
pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition_select());
inOutItemService.find(pageUtil);
List<InOutItem> dataList = pageUtil.getPageList();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if(null != dataList)
{
for(InOutItem inOutItem:dataList)
{
JSONObject item = new JSONObject();
item.put("id", inOutItem.getId());
//收支项目名称
item.put("name", inOutItem.getName());
dataArray.add(item);
}
}
//回写查询结果
toClient(dataArray.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("name_s_like", model.getName());
condition.put("remark_s_like", model.getRemark());
condition.put("id_s_order", "desc");
return condition;
}
/**
* 拼接搜索条件-下拉框-收支项目
* @return
*/
private Map<String,Object> getCondition_select()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("id_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public InOutItemModel getModel()
{
return model;
}
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