Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
86df29f6
Commit
86df29f6
authored
Dec 11, 2016
by
季圣华
Browse files
no commit message
parent
b8a2b074
Changes
73
Expand all
Hide whitespace changes
Inline
Side-by-side
src/com/jsh/action/asset/AssetAction.java
View file @
86df29f6
...
...
@@ -17,8 +17,8 @@ import org.springframework.dao.DataAccessException;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
constants.asset
.AssetConstants
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.AssetConstants
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.Assetname
;
import
com.jsh.model.po.Basicuser
;
...
...
@@ -30,8 +30,8 @@ import com.jsh.service.basic.AssetNameIService;
import
com.jsh.service.basic.CategoryIService
;
import
com.jsh.service.basic.SupplierIService
;
import
com.jsh.service.basic.UserIService
;
import
com.jsh.util.
common.
PageUtil
;
import
com.jsh.util.
common.
Tools
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.Tools
;
@SuppressWarnings
(
"serial"
)
public
class
AssetAction
extends
BaseAction
<
AssetModel
>
...
...
src/com/jsh/action/asset/ReportAction.java
View file @
86df29f6
...
...
@@ -5,11 +5,11 @@ import java.util.Map;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
exception
.JshException
;
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.
common.
PageUtil
;
import
com.jsh.util.PageUtil
;
@SuppressWarnings
(
"serial"
)
public
class
ReportAction
extends
BaseAction
<
ReportModel
>
...
...
src/com/jsh/action/basic/AccountAction.java
View file @
86df29f6
...
...
@@ -5,22 +5,19 @@ 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
;
import
com.jsh.util.PageUtil
;
/**
* 结算账户
* @author ji sheng hua
* @author ji sheng hua
qq752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
AccountAction
extends
BaseAction
<
AccountModel
>
...
...
@@ -28,6 +25,28 @@ public class AccountAction extends BaseAction<AccountModel>
private
AccountIService
accountService
;
private
AccountModel
model
=
new
AccountModel
();
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getAccount
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
put
(
"Id_s_order"
,
"asc"
);
accountService
.
find
(
pageUtil
);
mapData
.
put
(
"accountList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找账户信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exception"
);
}
return
SUCCESS
;
}
/**
* 增加结算账户
* @return
...
...
src/com/jsh/action/basic/AppAction.java
View file @
86df29f6
package
com.jsh.action.basic
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
...
...
@@ -6,30 +7,26 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.apache.struts2.ServletActionContext
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.App
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.AppModel
;
import
com.jsh.service.basic.AppIService
;
import
com.jsh.service.basic.UserBusinessIService
;
import
com.jsh.util.
common.
PageUtil
;
import
com.jsh.util.PageUtil
;
/**
* 应用
* @author ji_sheng_hua
* @author ji_sheng_hua
qq752 718 920
*/
@SuppressWarnings
(
"serial"
)
public
class
AppAction
extends
BaseAction
<
AppModel
>
...
...
src/com/jsh/action/basic/AssetNameAction.java
View file @
86df29f6
This diff is collapsed.
Click to expand it.
src/com/jsh/action/basic/CategoryAction.java
View file @
86df29f6
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Category
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.CategoryModel
;
import
com.jsh.service.basic.CategoryIService
;
import
com.jsh.util.common.PageUtil
;
@SuppressWarnings
(
"serial"
)
public
class
CategoryAction
extends
BaseAction
<
CategoryModel
>
{
private
CategoryIService
categoryService
;
private
CategoryModel
model
=
new
CategoryModel
();
/**
* 增加资产类型
* @return
*/
public
void
create
()
{
Log
.
infoFileSync
(
"==================开始调用增加资产类型方法create()==================="
);
Boolean
flag
=
false
;
try
{
Category
category
=
new
Category
();
category
.
setAssetname
(
model
.
getCategoryName
());
category
.
setIsystem
((
short
)
1
);
category
.
setDescription
(
model
.
getDescription
());
categoryService
.
create
(
category
);
//========标识位===========
flag
=
true
;
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>增加资产类型异常"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>增加资产类型回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"增加资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"增加资产类型名称为 "
+
model
.
getCategoryName
()
+
" "
+
tipMsg
+
"!"
,
"增加资产类型"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用增加资产类型方法create()==================="
);
}
/**
* 删除资产类型
* @return
*/
public
String
delete
()
{
Log
.
infoFileSync
(
"====================开始调用删除资产类型信息方法delete()================"
);
try
{
categoryService
.
delete
(
model
.
getCategoryID
());
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>删除ID为 "
+
model
.
getCategoryID
()
+
" 的资产类型异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
model
.
getShowModel
().
setMsgTip
(
tipMsg
);
logService
.
create
(
new
Logdetails
(
getUser
(),
"删除资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"删除资产类型ID为 "
+
model
.
getCategoryID
()
+
" "
+
tipMsg
+
"!"
,
"删除资产类型"
+
tipMsg
));
Log
.
infoFileSync
(
"====================结束调用删除资产类型信息方法delete()================"
);
return
SUCCESS
;
}
/**
* 更新资产类型
* @return
*/
public
void
update
()
{
Boolean
flag
=
false
;
try
{
Category
category
=
categoryService
.
get
(
model
.
getCategoryID
());
category
.
setAssetname
(
model
.
getCategoryName
());
category
.
setDescription
(
model
.
getDescription
());
categoryService
.
update
(
category
);
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改资产类型ID为 : "
+
model
.
getCategoryID
()
+
"信息失败"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>修改资产类型回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"更新资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"更新资产类型ID为 "
+
model
.
getCategoryID
()
+
" "
+
tipMsg
+
"!"
,
"更新资产类型"
+
tipMsg
));
}
/**
* 批量删除指定ID资产类型
* @return
*/
public
String
batchDelete
()
{
try
{
categoryService
.
batchDelete
(
model
.
getCategoryIDs
());
model
.
getShowModel
().
setMsgTip
(
"成功"
);
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>批量删除资产类型ID为:"
+
model
.
getCategoryIDs
()
+
"信息异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"批量删除资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"批量删除资产类型ID为 "
+
model
.
getCategoryIDs
()
+
" "
+
tipMsg
+
"!"
,
"批量删除资产类型"
+
tipMsg
));
return
SUCCESS
;
}
/**
* 检查输入名称是否存在
*/
public
void
checkIsNameExist
()
{
Boolean
flag
=
false
;
try
{
flag
=
categoryService
.
checkIsNameExist
(
"assetname"
,
model
.
getCategoryName
(),
"id"
,
model
.
getCategoryID
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>检查资产类型名称为:"
+
model
.
getCategoryName
()
+
" ID为: "
+
model
.
getCategoryID
()
+
" 是否存在异常!"
);
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>回写检查资产类型名称为:"
+
model
.
getCategoryName
()
+
" ID为: "
+
model
.
getCategoryID
()
+
" 是否存在异常!"
,
e
);
}
}
}
/**
* 查找供应商信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
Category
>
pageUtil
=
new
PageUtil
<
Category
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
categoryService
.
find
(
pageUtil
);
List
<
Category
>
dataList
=
pageUtil
.
getPageList
();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
Category
category:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
category
.
getId
());
//供应商名称
item
.
put
(
"categoryname"
,
category
.
getAssetname
());
item
.
put
(
"isystem"
,
category
.
getIsystem
()
==
(
short
)
0
?
"是"
:
"否"
);
item
.
put
(
"description"
,
category
.
getDescription
());
item
.
put
(
"op"
,
category
.
getIsystem
());
dataArray
.
add
(
item
);
}
}
outer
.
put
(
"rows"
,
dataArray
);
//回写查询结果
toClient
(
outer
.
toString
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>查找资产类型信息异常"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常"
,
e
);
}
}
/**
* 拼接搜索条件
* @return
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"assetname_s_like"
,
model
.
getCategoryName
());
condition
.
put
(
"description_s_like"
,
model
.
getDescription
());
condition
.
put
(
"id_s_order"
,
"desc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
CategoryModel
getModel
()
{
return
model
;
}
public
void
setCategoryService
(
CategoryIService
categoryService
)
{
this
.
categoryService
=
categoryService
;
}
}
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Category
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.CategoryModel
;
import
com.jsh.service.basic.CategoryIService
;
import
com.jsh.util.PageUtil
;
/*
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/
@SuppressWarnings
(
"serial"
)
public
class
CategoryAction
extends
BaseAction
<
CategoryModel
>
{
private
CategoryIService
categoryService
;
private
CategoryModel
model
=
new
CategoryModel
();
/**
* 增加资产类型
* @return
*/
public
void
create
()
{
Log
.
infoFileSync
(
"==================开始调用增加资产类型方法create()==================="
);
Boolean
flag
=
false
;
try
{
Category
category
=
new
Category
();
category
.
setAssetname
(
model
.
getCategoryName
());
category
.
setIsystem
((
short
)
1
);
category
.
setDescription
(
model
.
getDescription
());
categoryService
.
create
(
category
);
//========标识位===========
flag
=
true
;
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>增加资产类型异常"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>增加资产类型回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"增加资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"增加资产类型名称为 "
+
model
.
getCategoryName
()
+
" "
+
tipMsg
+
"!"
,
"增加资产类型"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用增加资产类型方法create()==================="
);
}
/**
* 删除资产类型
* @return
*/
public
String
delete
()
{
Log
.
infoFileSync
(
"====================开始调用删除资产类型信息方法delete()================"
);
try
{
categoryService
.
delete
(
model
.
getCategoryID
());
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>删除ID为 "
+
model
.
getCategoryID
()
+
" 的资产类型异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
model
.
getShowModel
().
setMsgTip
(
tipMsg
);
logService
.
create
(
new
Logdetails
(
getUser
(),
"删除资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"删除资产类型ID为 "
+
model
.
getCategoryID
()
+
" "
+
tipMsg
+
"!"
,
"删除资产类型"
+
tipMsg
));
Log
.
infoFileSync
(
"====================结束调用删除资产类型信息方法delete()================"
);
return
SUCCESS
;
}
/**
* 更新资产类型
* @return
*/
public
void
update
()
{
Boolean
flag
=
false
;
try
{
Category
category
=
categoryService
.
get
(
model
.
getCategoryID
());
category
.
setAssetname
(
model
.
getCategoryName
());
category
.
setDescription
(
model
.
getDescription
());
categoryService
.
update
(
category
);
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改资产类型ID为 : "
+
model
.
getCategoryID
()
+
"信息失败"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>修改资产类型回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"更新资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"更新资产类型ID为 "
+
model
.
getCategoryID
()
+
" "
+
tipMsg
+
"!"
,
"更新资产类型"
+
tipMsg
));
}
/**
* 批量删除指定ID资产类型
* @return
*/
public
String
batchDelete
()
{
try
{
categoryService
.
batchDelete
(
model
.
getCategoryIDs
());
model
.
getShowModel
().
setMsgTip
(
"成功"
);
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>批量删除资产类型ID为:"
+
model
.
getCategoryIDs
()
+
"信息异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"批量删除资产类型"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"批量删除资产类型ID为 "
+
model
.
getCategoryIDs
()
+
" "
+
tipMsg
+
"!"
,
"批量删除资产类型"
+
tipMsg
));
return
SUCCESS
;
}
/**
* 检查输入名称是否存在
*/
public
void
checkIsNameExist
()
{
Boolean
flag
=
false
;
try
{
flag
=
categoryService
.
checkIsNameExist
(
"assetname"
,
model
.
getCategoryName
(),
"id"
,
model
.
getCategoryID
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>检查资产类型名称为:"
+
model
.
getCategoryName
()
+
" ID为: "
+
model
.
getCategoryID
()
+
" 是否存在异常!"
);
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>回写检查资产类型名称为:"
+
model
.
getCategoryName
()
+
" ID为: "
+
model
.
getCategoryID
()
+
" 是否存在异常!"
,
e
);
}
}
}
/**
* 查找供应商信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
Category
>
pageUtil
=
new
PageUtil
<
Category
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
categoryService
.
find
(
pageUtil
);
List
<
Category
>
dataList
=
pageUtil
.
getPageList
();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
Category
category:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
category
.
getId
());
//供应商名称
item
.
put
(
"categoryname"
,
category
.
getAssetname
());
item
.
put
(
"isystem"
,
category
.
getIsystem
()
==
(
short
)
0
?
"是"
:
"否"
);
item
.
put
(
"description"
,
category
.
getDescription
());
item
.
put
(
"op"
,
category
.
getIsystem
());
dataArray
.
add
(
item
);
}
}
outer
.
put
(
"rows"
,
dataArray
);
//回写查询结果
toClient
(
outer
.
toString
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>查找资产类型信息异常"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常"
,
e
);
}
}
/**
* 拼接搜索条件
* @return
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"assetname_s_like"
,
model
.
getCategoryName
());
condition
.
put
(
"description_s_like"
,
model
.
getDescription
());
condition
.
put
(
"id_s_order"
,
"desc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
CategoryModel
getModel
()
{
return
model
;
}
public
void
setCategoryService
(
CategoryIService
categoryService
)
{
this
.
categoryService
=
categoryService
;
}
}
src/com/jsh/action/basic/DepotAction.java
View file @
86df29f6
...
...
@@ -5,25 +5,22 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.Depot
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Role
;
import
com.jsh.model.vo.basic.DepotModel
;
import
com.jsh.service.basic.DepotIService
;
import
com.jsh.service.basic.UserBusinessIService
;
import
com.jsh.util.
common.
PageUtil
;
import
com.jsh.util.PageUtil
;
/**
* 仓库
* @author ji
sheng
hua
* 仓库
管理
* @author jishenghua
qq:7-5-2-7-1-8-9-2-0
*/
@SuppressWarnings
(
"serial"
)
public
class
DepotAction
extends
BaseAction
<
DepotModel
>
...
...
src/com/jsh/action/basic/FunctionsAction.java
View file @
86df29f6
...
...
@@ -5,23 +5,23 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.App
;
import
com.jsh.model.po.Functions
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.FunctionsModel
;
import
com.jsh.service.basic.FunctionsIService
;
import
com.jsh.service.basic.UserBusinessIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.PageUtil
;
/*
* 功能管理
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/
@SuppressWarnings
(
"serial"
)
public
class
FunctionsAction
extends
BaseAction
<
FunctionsModel
>
{
...
...
src/com/jsh/action/basic/InOutItemAction.java
View file @
86df29f6
...
...
@@ -5,22 +5,19 @@ 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
;
import
com.jsh.util.PageUtil
;
/**
* 收支项目
* @author ji*sheng*hua
* @author ji*sheng*hua
qq 7.5.2.7.1.8.9.2.0
*/
@SuppressWarnings
(
"serial"
)
public
class
InOutItemAction
extends
BaseAction
<
InOutItemModel
>
...
...
@@ -266,9 +263,9 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
for
(
InOutItem
inOutItem:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"
i
d"
,
inOutItem
.
getId
());
item
.
put
(
"
I
d"
,
inOutItem
.
getId
());
//收支项目名称
item
.
put
(
"
n
ame"
,
inOutItem
.
getName
());
item
.
put
(
"
InOutItemN
ame"
,
inOutItem
.
getName
());
dataArray
.
add
(
item
);
}
}
...
...
src/com/jsh/action/basic/LogAction.java
View file @
86df29f6
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.LogModel
;
import
com.jsh.service.basic.UserIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.common.Tools
;
@SuppressWarnings
(
"serial"
)
public
class
LogAction
extends
BaseAction
<
LogModel
>
{
private
LogModel
model
=
new
LogModel
();
private
UserIService
userService
;
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getBasicData
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
clear
();
condition
.
put
(
"ismanager_n_eq"
,
0
);
userService
.
find
(
pageUtil
);
mapData
.
put
(
"userList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找系统基础数据信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/**
* 删除日志
* @return
*/
public
String
delete
()
{
Log
.
infoFileSync
(
"====================开始调用删除日志信息方法delete()================"
);
try
{
logService
.
delete
(
model
.
getLogID
());
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>删除ID为 "
+
model
.
getLogID
()
+
" 的日志异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
model
.
getShowModel
().
setMsgTip
(
tipMsg
);
logService
.
create
(
new
Logdetails
(
getUser
(),
"删除日志"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"删除日志ID为 "
+
model
.
getLogID
()
+
" "
+
tipMsg
+
"!"
,
"删除日志"
+
tipMsg
));
Log
.
infoFileSync
(
"====================结束调用删除日志信息方法delete()================"
);
return
SUCCESS
;
}
/**
* 批量删除指定ID日志
* @return
*/
public
String
batchDelete
()
{
try
{
logService
.
batchDelete
(
model
.
getLogIDs
());
model
.
getShowModel
().
setMsgTip
(
"成功"
);
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>批量删除日志ID为:"
+
model
.
getLogIDs
()
+
"信息异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"批量删除日志"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"批量删除日志ID为 "
+
model
.
getLogIDs
()
+
" "
+
tipMsg
+
"!"
,
"批量删除日志"
+
tipMsg
));
return
SUCCESS
;
}
/**
* 查找日志信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
Logdetails
>
pageUtil
=
new
PageUtil
<
Logdetails
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
logService
.
find
(
pageUtil
);
List
<
Logdetails
>
dataList
=
pageUtil
.
getPageList
();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
Logdetails
log:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
log
.
getId
());
item
.
put
(
"clientIP"
,
log
.
getClientIp
());
item
.
put
(
"details"
,
log
.
getContentdetails
());
item
.
put
(
"createTime"
,
Tools
.
getCenternTime
(
log
.
getCreatetime
()));
item
.
put
(
"operation"
,
log
.
getOperation
());
item
.
put
(
"remark"
,
log
.
getRemark
());
item
.
put
(
"status"
,
log
.
getStatus
()
==
0
?
"成功"
:
"失败"
);
item
.
put
(
"statusShort"
,
log
.
getStatus
());
item
.
put
(
"username"
,
log
.
getUser
()==
null
?
""
:
log
.
getUser
().
getUsername
());
dataArray
.
add
(
item
);
}
}
outer
.
put
(
"rows"
,
dataArray
);
//回写查询结果
toClient
(
outer
.
toString
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>查找日志信息异常"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>回写查询日志信息结果异常"
,
e
);
}
}
/**
* 拼接搜索条件
* @return
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"user.id_n_eq"
,
model
.
getUsernameID
());
condition
.
put
(
"createtime_s_gteq"
,
model
.
getBeginTime
());
condition
.
put
(
"createtime_s_lteq"
,
model
.
getEndTime
());
condition
.
put
(
"operation_s_like"
,
model
.
getOperation
());
condition
.
put
(
"clientIp_s_like"
,
model
.
getClientIp
());
condition
.
put
(
"status_n_eq"
,
model
.
getStatus
());
condition
.
put
(
"contentdetails_s_like"
,
model
.
getContentdetails
());
condition
.
put
(
"remark_s_like"
,
model
.
getRemark
());
condition
.
put
(
"createtime_s_order"
,
"desc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
public
void
setUserService
(
UserIService
userService
)
{
this
.
userService
=
userService
;
}
@Override
public
LogModel
getModel
()
{
return
model
;
}
}
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.LogModel
;
import
com.jsh.service.basic.UserIService
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.Tools
;
/*
*日志管理
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/
@SuppressWarnings
(
"serial"
)
public
class
LogAction
extends
BaseAction
<
LogModel
>
{
private
LogModel
model
=
new
LogModel
();
private
UserIService
userService
;
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getBasicData
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
clear
();
condition
.
put
(
"ismanager_n_eq"
,
0
);
userService
.
find
(
pageUtil
);
mapData
.
put
(
"userList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找系统基础数据信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/**
* 删除日志
* @return
*/
public
String
delete
()
{
Log
.
infoFileSync
(
"====================开始调用删除日志信息方法delete()================"
);
try
{
logService
.
delete
(
model
.
getLogID
());
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>删除ID为 "
+
model
.
getLogID
()
+
" 的日志异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
model
.
getShowModel
().
setMsgTip
(
tipMsg
);
logService
.
create
(
new
Logdetails
(
getUser
(),
"删除日志"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"删除日志ID为 "
+
model
.
getLogID
()
+
" "
+
tipMsg
+
"!"
,
"删除日志"
+
tipMsg
));
Log
.
infoFileSync
(
"====================结束调用删除日志信息方法delete()================"
);
return
SUCCESS
;
}
/**
* 批量删除指定ID日志
* @return
*/
public
String
batchDelete
()
{
try
{
logService
.
batchDelete
(
model
.
getLogIDs
());
model
.
getShowModel
().
setMsgTip
(
"成功"
);
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>批量删除日志ID为:"
+
model
.
getLogIDs
()
+
"信息异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"批量删除日志"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"批量删除日志ID为 "
+
model
.
getLogIDs
()
+
" "
+
tipMsg
+
"!"
,
"批量删除日志"
+
tipMsg
));
return
SUCCESS
;
}
/**
* 查找日志信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
Logdetails
>
pageUtil
=
new
PageUtil
<
Logdetails
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
logService
.
find
(
pageUtil
);
List
<
Logdetails
>
dataList
=
pageUtil
.
getPageList
();
//开始拼接json数据
// {"total":28,"rows":[
// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
// ]}
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
Logdetails
log:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
log
.
getId
());
item
.
put
(
"clientIP"
,
log
.
getClientIp
());
item
.
put
(
"details"
,
log
.
getContentdetails
());
item
.
put
(
"createTime"
,
Tools
.
getCenternTime
(
log
.
getCreatetime
()));
item
.
put
(
"operation"
,
log
.
getOperation
());
item
.
put
(
"remark"
,
log
.
getRemark
());
item
.
put
(
"status"
,
log
.
getStatus
()
==
0
?
"成功"
:
"失败"
);
item
.
put
(
"statusShort"
,
log
.
getStatus
());
item
.
put
(
"username"
,
log
.
getUser
()==
null
?
""
:
log
.
getUser
().
getUsername
());
dataArray
.
add
(
item
);
}
}
outer
.
put
(
"rows"
,
dataArray
);
//回写查询结果
toClient
(
outer
.
toString
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>查找日志信息异常"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>回写查询日志信息结果异常"
,
e
);
}
}
/**
* 拼接搜索条件
* @return
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"user.id_n_eq"
,
model
.
getUsernameID
());
condition
.
put
(
"createtime_s_gteq"
,
model
.
getBeginTime
());
condition
.
put
(
"createtime_s_lteq"
,
model
.
getEndTime
());
condition
.
put
(
"operation_s_like"
,
model
.
getOperation
());
condition
.
put
(
"clientIp_s_like"
,
model
.
getClientIp
());
condition
.
put
(
"status_n_eq"
,
model
.
getStatus
());
condition
.
put
(
"contentdetails_s_like"
,
model
.
getContentdetails
());
condition
.
put
(
"remark_s_like"
,
model
.
getRemark
());
condition
.
put
(
"createtime_s_order"
,
"desc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
public
void
setUserService
(
UserIService
userService
)
{
this
.
userService
=
userService
;
}
@Override
public
LogModel
getModel
()
{
return
model
;
}
}
src/com/jsh/action/basic/RoleAction.java
View file @
86df29f6
...
...
@@ -5,23 +5,23 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.App
;
import
com.jsh.model.po.Role
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.basic.RoleModel
;
import
com.jsh.service.basic.RoleIService
;
import
com.jsh.service.basic.UserBusinessIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.PageUtil
;
/*
* 角色管理
* @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/
@SuppressWarnings
(
"serial"
)
public
class
RoleAction
extends
BaseAction
<
RoleModel
>
{
...
...
src/com/jsh/action/basic/SupplierAction.java
View file @
86df29f6
...
...
@@ -5,20 +5,20 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Supplier
;
import
com.jsh.model.vo.basic.SupplierModel
;
import
com.jsh.service.basic.SupplierIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.PageUtil
;
/*
* 单位管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
SupplierAction
extends
BaseAction
<
SupplierModel
>
{
...
...
src/com/jsh/action/basic/UserAction.java
View file @
86df29f6
This diff is collapsed.
Click to expand it.
src/com/jsh/action/basic/UserBusinessAction.java
View file @
86df29f6
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.
base.BaseAction
;
import
com.jsh.
base.Log
;
import
com.jsh.
model.po
.UserBusiness
;
import
com.jsh.
model.po.Logdetails
;
import
com.jsh.model.vo.basic.UserBusinessModel
;
import
com.jsh.service.basic.UserBusinessIService
;
import
com.jsh.util.common.PageUtil
;
@SuppressWarnings
(
"serial"
)
public
class
UserBusinessAction
extends
BaseAction
<
UserBusinessModel
>
{
private
UserBusinessIService
userBusinessService
;
private
UserBusinessModel
model
=
new
UserBusinessModel
();
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getBasicData
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
put
(
"KeyId_s_eq"
,
model
.
getKeyId
());
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
userBusinessService
.
find
(
pageUtil
);
mapData
.
put
(
"userBusinessList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找UserBusiness信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/*
* 测试hql语句的写法
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getceshi
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
userBusinessService
.
find
(
pageUtil
,
"ceshi"
);
mapData
.
put
(
"userBusinessList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找UserBusiness信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/**
* 增加UserBusiness
* @return
*/
public
void
create
()
{
Log
.
infoFileSync
(
"==================开始调用增加UserBusiness信息方法create()==================="
);
Boolean
flag
=
false
;
try
{
UserBusiness
userBusiness
=
new
UserBusiness
();
userBusiness
.
setType
(
model
.
getType
());
userBusiness
.
setKeyId
(
model
.
getKeyId
());
userBusiness
.
setValue
(
model
.
getValue
());
userBusinessService
.
create
(
userBusiness
);
//========标识位===========
flag
=
true
;
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"增加UserBusiness"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"增加UserBusiness为 "
+
model
.
getType
()
+
" "
+
tipMsg
+
"!"
,
"增加UserBusiness"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用增加UserBusiness方法create()==================="
);
}
/**
* 更新UserBusiness
* @return
*/
public
void
update
()
{
Boolean
flag
=
false
;
Long
id
=
0
l
;
try
{
PageUtil
<
UserBusiness
>
pageUtil
=
new
PageUtil
<
UserBusiness
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition_RoleAPP
());
userBusinessService
.
find
(
pageUtil
);
List
<
UserBusiness
>
dataList
=
pageUtil
.
getPageList
();
if
(
null
!=
dataList
)
{
for
(
UserBusiness
userBusiness:
dataList
)
{
id
=
userBusiness
.
getId
();
}
UserBusiness
userBusiness
=
userBusinessService
.
get
(
id
);
userBusiness
.
setType
(
model
.
getType
());
userBusiness
.
setKeyId
(
model
.
getKeyId
());
userBusiness
.
setValue
(
model
.
getValue
());
userBusinessService
.
update
(
userBusiness
);
}
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改UserBusiness的ID为 : "
+
id
+
"信息失败"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>修改UserBusiness回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"更新UserBusiness"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"更新UserBusiness的ID为 "
+
id
+
" "
+
tipMsg
+
"!"
,
"更新UserBusiness"
+
tipMsg
));
}
/**
* 拼接搜索条件-RoleAPP
* @return
*/
private
Map
<
String
,
Object
>
getCondition_RoleAPP
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
condition
.
put
(
"KeyId_s_eq"
,
model
.
getKeyId
());
return
condition
;
}
/**
* 检查角色对应应用/功能是否存在
*/
public
void
checkIsValueExist
()
{
Boolean
flag
=
false
;
try
{
flag
=
userBusinessService
.
checkIsValueExist
(
"Type"
,
model
.
getType
(),
"KeyId"
,
model
.
getKeyId
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:"
+
model
.
getType
()
+
" KeyId为: "
+
model
.
getKeyId
()
+
" 是否存在异常!"
);
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:"
+
model
.
getType
()
+
" KeyId为: "
+
model
.
getKeyId
()
+
" 是否存在异常!"
,
e
);
}
}
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
UserBusinessModel
getModel
()
{
return
model
;
}
public
void
setUserBusinessService
(
UserBusinessIService
userBusinessService
)
{
this
.
userBusinessService
=
userBusinessService
;
}
}
package
com.jsh.action.basic
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.
model.po.Logdetails
;
import
com.jsh.
model.vo.basic.UserBusinessModel
;
import
com.jsh.
service.basic
.UserBusiness
IService
;
import
com.jsh.
util.PageUtil
;
/*
* 权限关系管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
UserBusinessAction
extends
BaseAction
<
UserBusinessModel
>
{
private
UserBusinessIService
userBusinessService
;
private
UserBusinessModel
model
=
new
UserBusinessModel
();
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getBasicData
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
put
(
"KeyId_s_eq"
,
model
.
getKeyId
());
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
userBusinessService
.
find
(
pageUtil
);
mapData
.
put
(
"userBusinessList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找UserBusiness信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/*
* 测试hql语句的写法
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getceshi
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
Map
<
String
,
Object
>
condition
=
pageUtil
.
getAdvSearch
();
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
userBusinessService
.
find
(
pageUtil
,
"ceshi"
);
mapData
.
put
(
"userBusinessList"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找UserBusiness信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/**
* 增加UserBusiness
* @return
*/
public
void
create
()
{
Log
.
infoFileSync
(
"==================开始调用增加UserBusiness信息方法create()==================="
);
Boolean
flag
=
false
;
try
{
UserBusiness
userBusiness
=
new
UserBusiness
();
userBusiness
.
setType
(
model
.
getType
());
userBusiness
.
setKeyId
(
model
.
getKeyId
());
userBusiness
.
setValue
(
model
.
getValue
());
userBusinessService
.
create
(
userBusiness
);
//========标识位===========
flag
=
true
;
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"增加UserBusiness"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"增加UserBusiness为 "
+
model
.
getType
()
+
" "
+
tipMsg
+
"!"
,
"增加UserBusiness"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用增加UserBusiness方法create()==================="
);
}
/**
* 更新UserBusiness
* @return
*/
public
void
update
()
{
Boolean
flag
=
false
;
Long
id
=
0
l
;
try
{
PageUtil
<
UserBusiness
>
pageUtil
=
new
PageUtil
<
UserBusiness
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition_RoleAPP
());
userBusinessService
.
find
(
pageUtil
);
List
<
UserBusiness
>
dataList
=
pageUtil
.
getPageList
();
if
(
null
!=
dataList
)
{
for
(
UserBusiness
userBusiness:
dataList
)
{
id
=
userBusiness
.
getId
();
}
UserBusiness
userBusiness
=
userBusinessService
.
get
(
id
);
userBusiness
.
setType
(
model
.
getType
());
userBusiness
.
setKeyId
(
model
.
getKeyId
());
userBusiness
.
setValue
(
model
.
getValue
());
userBusinessService
.
update
(
userBusiness
);
}
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改UserBusiness的ID为 : "
+
id
+
"信息失败"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>修改UserBusiness回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"更新UserBusiness"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"更新UserBusiness的ID为 "
+
id
+
" "
+
tipMsg
+
"!"
,
"更新UserBusiness"
+
tipMsg
));
}
/**
* 拼接搜索条件-RoleAPP
* @return
*/
private
Map
<
String
,
Object
>
getCondition_RoleAPP
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
condition
.
put
(
"KeyId_s_eq"
,
model
.
getKeyId
());
return
condition
;
}
/**
* 检查角色对应应用/功能是否存在
*/
public
void
checkIsValueExist
()
{
Boolean
flag
=
false
;
try
{
flag
=
userBusinessService
.
checkIsValueExist
(
"Type"
,
model
.
getType
(),
"KeyId"
,
model
.
getKeyId
());
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:"
+
model
.
getType
()
+
" KeyId为: "
+
model
.
getKeyId
()
+
" 是否存在异常!"
);
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:"
+
model
.
getType
()
+
" KeyId为: "
+
model
.
getKeyId
()
+
" 是否存在异常!"
,
e
);
}
}
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
UserBusinessModel
getModel
()
{
return
model
;
}
public
void
setUserBusinessService
(
UserBusinessIService
userBusinessService
)
{
this
.
userBusinessService
=
userBusinessService
;
}
}
src/com/jsh/action/materials/AccountHeadAction.java
0 → 100644
View file @
86df29f6
package
com.jsh.action.materials
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Building
;
import
com.jsh.model.po.Account
;
import
com.jsh.model.po.AccountHead
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Person
;
import
com.jsh.model.po.Supplier
;
import
com.jsh.model.vo.materials.AccountHeadModel
;
import
com.jsh.service.materials.AccountHeadIService
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.Tools
;
/*
* 财务表头管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
AccountHeadAction
extends
BaseAction
<
AccountHeadModel
>
{
private
AccountHeadIService
accountHeadService
;
private
AccountHeadModel
model
=
new
AccountHeadModel
();
/*
* 获取MaxId
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getMaxId
()
{
Map
<
String
,
List
>
mapData
=
model
.
getShowModel
().
getMap
();
PageUtil
pageUtil
=
new
PageUtil
();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
try
{
accountHeadService
.
find
(
pageUtil
,
"maxId"
);
mapData
.
put
(
"accountHeadMax"
,
pageUtil
.
getPageList
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>查找最大的Id信息异常"
,
e
);
model
.
getShowModel
().
setMsgTip
(
"exceptoin"
);
}
return
SUCCESS
;
}
/**
* 增加财务
* @return
*/
public
void
create
()
{
Log
.
infoFileSync
(
"==================开始调用增加财务信息方法create()==================="
);
Boolean
flag
=
false
;
try
{
AccountHead
accountHead
=
new
AccountHead
();
accountHead
.
setType
(
model
.
getType
());
if
(
model
.
getOrganId
()!=
null
){
accountHead
.
setOrganId
(
new
Supplier
(
model
.
getOrganId
()));}
if
(
model
.
getHandsPersonId
()!=
null
){
accountHead
.
setHandsPersonId
(
new
Person
(
model
.
getHandsPersonId
()));}
accountHead
.
setChangeAmount
(
model
.
getChangeAmount
());
if
(
model
.
getAccountId
()!=
null
){
accountHead
.
setAccountId
(
new
Account
(
model
.
getAccountId
()));}
accountHead
.
setBillNo
(
model
.
getBillNo
());
try
{
accountHead
.
setBillTime
(
new
Timestamp
(
Tools
.
parse
(
model
.
getBillTime
(),
"yyyy-MM-dd"
).
getTime
()));
}
catch
(
ParseException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>解析购买日期格式异常"
,
e
);
}
accountHead
.
setRemark
(
model
.
getRemark
());
accountHeadService
.
create
(
accountHead
);
//========标识位===========
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
.
getBillNo
()
+
" "
+
tipMsg
+
"!"
,
"增加财务"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用增加财务方法create()==================="
);
}
/**
* 删除财务
* @return
*/
public
String
delete
()
{
Log
.
infoFileSync
(
"====================开始调用删除财务信息方法delete()================"
);
try
{
accountHeadService
.
delete
(
model
.
getAccountHeadID
());
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>删除ID为 "
+
model
.
getAccountHeadID
()
+
" 的财务异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
model
.
getShowModel
().
setMsgTip
(
tipMsg
);
logService
.
create
(
new
Logdetails
(
getUser
(),
"删除财务"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"删除财务ID为 "
+
model
.
getAccountHeadID
()
+
" "
+
tipMsg
+
"!"
,
"删除财务"
+
tipMsg
));
Log
.
infoFileSync
(
"====================结束调用删除财务信息方法delete()================"
);
return
SUCCESS
;
}
/**
* 更新财务
* @return
*/
public
void
update
()
{
Boolean
flag
=
false
;
try
{
AccountHead
accountHead
=
accountHeadService
.
get
(
model
.
getAccountHeadID
());
accountHead
.
setType
(
model
.
getType
());
if
(
model
.
getOrganId
()!=
null
){
accountHead
.
setOrganId
(
new
Supplier
(
model
.
getOrganId
()));}
if
(
model
.
getHandsPersonId
()!=
null
){
accountHead
.
setHandsPersonId
(
new
Person
(
model
.
getHandsPersonId
()));}
accountHead
.
setChangeAmount
(
model
.
getChangeAmount
());
if
(
model
.
getAccountId
()!=
null
){
accountHead
.
setAccountId
(
new
Account
(
model
.
getAccountId
()));}
accountHead
.
setBillNo
(
model
.
getBillNo
());
try
{
accountHead
.
setBillTime
(
new
Timestamp
(
Tools
.
parse
(
model
.
getBillTime
(),
"yyyy-MM-dd"
).
getTime
()));
}
catch
(
ParseException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>解析购买日期格式异常"
,
e
);
}
accountHead
.
setRemark
(
model
.
getRemark
());
accountHeadService
.
update
(
accountHead
);
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改财务ID为 : "
+
model
.
getAccountHeadID
()
+
"信息失败"
,
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
.
getAccountHeadID
()
+
" "
+
tipMsg
+
"!"
,
"更新财务"
+
tipMsg
));
}
/**
* 批量删除指定ID财务
* @return
*/
public
String
batchDelete
()
{
try
{
accountHeadService
.
batchDelete
(
model
.
getAccountHeadIDs
());
model
.
getShowModel
().
setMsgTip
(
"成功"
);
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>批量删除财务ID为:"
+
model
.
getAccountHeadIDs
()
+
"信息异常"
,
e
);
tipMsg
=
"失败"
;
tipType
=
1
;
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"批量删除财务"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"批量删除财务ID为 "
+
model
.
getAccountHeadIDs
()
+
" "
+
tipMsg
+
"!"
,
"批量删除财务"
+
tipMsg
));
return
SUCCESS
;
}
/**
* 查找财务信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
AccountHead
>
pageUtil
=
new
PageUtil
<
AccountHead
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
accountHeadService
.
find
(
pageUtil
);
List
<
AccountHead
>
dataList
=
pageUtil
.
getPageList
();
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
AccountHead
accountHead:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"Id"
,
accountHead
.
getId
());
item
.
put
(
"OrganId"
,
accountHead
.
getOrganId
()==
null
?
""
:
accountHead
.
getOrganId
().
getId
());
item
.
put
(
"OrganName"
,
accountHead
.
getOrganId
()==
null
?
""
:
accountHead
.
getOrganId
().
getSupplier
());
item
.
put
(
"HandsPersonId"
,
accountHead
.
getHandsPersonId
()==
null
?
""
:
accountHead
.
getHandsPersonId
().
getId
());
item
.
put
(
"HandsPersonName"
,
accountHead
.
getHandsPersonId
()==
null
?
""
:
accountHead
.
getHandsPersonId
().
getName
());
item
.
put
(
"AccountId"
,
accountHead
.
getAccountId
()==
null
?
""
:
accountHead
.
getAccountId
().
getId
());
item
.
put
(
"AccountName"
,
accountHead
.
getAccountId
()==
null
?
""
:
accountHead
.
getAccountId
().
getName
());
item
.
put
(
"BillNo"
,
accountHead
.
getBillNo
());
item
.
put
(
"BillTime"
,
Tools
.
getCurrentMonth
(
accountHead
.
getBillTime
()));
item
.
put
(
"ChangeAmount"
,
accountHead
.
getChangeAmount
());
item
.
put
(
"Remark"
,
accountHead
.
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
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
{
condition
.
put
(
"BillNo_s_like"
,
model
.
getBillNo
());}
condition
.
put
(
"Type_s_eq"
,
model
.
getType
());
condition
.
put
(
"BillTime_s_gteq"
,
model
.
getBeginTime
());
condition
.
put
(
"BillTime_s_lteq"
,
model
.
getEndTime
());
condition
.
put
(
"Id_s_order"
,
"desc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
AccountHeadModel
getModel
()
{
return
model
;
}
public
void
setAccountHeadService
(
AccountHeadIService
accountHeadService
)
{
this
.
accountHeadService
=
accountHeadService
;
}
}
src/com/jsh/action/materials/AccountItemAction.java
0 → 100644
View file @
86df29f6
package
com.jsh.action.materials
;
import
java.io.File
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.util.AssetConstants
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.AccountHead
;
import
com.jsh.model.po.AccountItem
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Account
;
import
com.jsh.model.po.InOutItem
;
import
com.jsh.model.vo.materials.AccountItemModel
;
import
com.jsh.service.materials.AccountHeadIService
;
import
com.jsh.service.materials.AccountItemIService
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.Tools
;
/*
* 财务明细管理(收支|收付款|转账)
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
AccountItemAction
extends
BaseAction
<
AccountItemModel
>
{
private
AccountItemIService
accountItemService
;
private
AccountItemModel
model
=
new
AccountItemModel
();
/**
* 保存明细
* @return
*/
public
void
saveDetials
()
{
Log
.
infoFileSync
(
"==================开始调用保存财务明细信息方法saveDetials()==================="
);
Boolean
flag
=
false
;
try
{
Long
headerId
=
model
.
getHeaderId
();
String
inserted
=
model
.
getInserted
();
String
deleted
=
model
.
getDeleted
();
String
updated
=
model
.
getUpdated
();
//转为json
JSONArray
insertedJson
=
JSONArray
.
fromObject
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
fromObject
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
fromObject
(
updated
);
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
AccountItem
accountItem
=
new
AccountItem
();
JSONObject
tempInsertedJson
=
JSONObject
.
fromObject
(
insertedJson
.
get
(
i
));
accountItem
.
setHeaderId
(
new
AccountHead
(
headerId
));
if
(
tempInsertedJson
.
get
(
"AccountId"
)!=
null
&&!
tempInsertedJson
.
get
(
"AccountId"
).
equals
(
""
)){
accountItem
.
setAccountId
(
new
Account
(
tempInsertedJson
.
getLong
(
"AccountId"
)));}
if
(
tempInsertedJson
.
get
(
"InOutItemId"
)!=
null
&&!
tempInsertedJson
.
get
(
"InOutItemId"
).
equals
(
""
)){
accountItem
.
setInOutItemId
(
new
InOutItem
(
tempInsertedJson
.
getLong
(
"InOutItemId"
)));}
if
(
tempInsertedJson
.
get
(
"EachAmount"
)!=
null
){
accountItem
.
setEachAmount
(
tempInsertedJson
.
getDouble
(
"EachAmount"
));}
accountItem
.
setRemark
(
tempInsertedJson
.
getString
(
"Remark"
));
accountItemService
.
create
(
accountItem
);
}
}
if
(
null
!=
deletedJson
)
{
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
fromObject
(
deletedJson
.
get
(
i
));
accountItemService
.
delete
(
tempDeletedJson
.
getLong
(
"Id"
));
}
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
JSONObject
tempUpdatedJson
=
JSONObject
.
fromObject
(
updatedJson
.
get
(
i
));
AccountItem
accountItem
=
accountItemService
.
get
(
tempUpdatedJson
.
getLong
(
"Id"
));
accountItem
.
setHeaderId
(
new
AccountHead
(
headerId
));
if
(
tempUpdatedJson
.
get
(
"AccountId"
)!=
null
&&!
tempUpdatedJson
.
get
(
"AccountId"
).
equals
(
""
)){
accountItem
.
setAccountId
(
new
Account
(
tempUpdatedJson
.
getLong
(
"AccountId"
)));}
if
(
tempUpdatedJson
.
get
(
"InOutItemId"
)!=
null
&&!
tempUpdatedJson
.
get
(
"InOutItemId"
).
equals
(
""
)){
accountItem
.
setInOutItemId
(
new
InOutItem
(
tempUpdatedJson
.
getLong
(
"InOutItemId"
)));}
if
(
tempUpdatedJson
.
get
(
"EachAmount"
)!=
null
){
accountItem
.
setEachAmount
(
tempUpdatedJson
.
getDouble
(
"EachAmount"
));}
accountItem
.
setRemark
(
tempUpdatedJson
.
getString
(
"Remark"
));
accountItemService
.
create
(
accountItem
);
}
}
//========标识位===========
flag
=
true
;
//记录操作日志使用
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>保存财务明细信息异常"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>保存财务明细信息回写客户端结果异常"
,
e
);
}
}
logService
.
create
(
new
Logdetails
(
getUser
(),
"保存财务明细"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
())
,
tipType
,
"保存财务明细对应主表编号为 "
+
model
.
getHeaderId
()
+
" "
+
tipMsg
+
"!"
,
"保存财务明细"
+
tipMsg
));
Log
.
infoFileSync
(
"==================结束调用保存财务明细方法saveDetials()==================="
);
}
/**
* 查找财务信息
* @return
*/
public
void
findBy
()
{
try
{
PageUtil
<
AccountItem
>
pageUtil
=
new
PageUtil
<
AccountItem
>();
pageUtil
.
setPageSize
(
model
.
getPageSize
());
pageUtil
.
setCurPage
(
model
.
getPageNo
());
pageUtil
.
setAdvSearch
(
getCondition
());
accountItemService
.
find
(
pageUtil
);
List
<
AccountItem
>
dataList
=
pageUtil
.
getPageList
();
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"total"
,
pageUtil
.
getTotalCount
());
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
for
(
AccountItem
accountItem:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"Id"
,
accountItem
.
getId
());
item
.
put
(
"AccountId"
,
accountItem
.
getAccountId
()==
null
?
""
:
accountItem
.
getAccountId
().
getId
());
item
.
put
(
"AccountName"
,
accountItem
.
getAccountId
()==
null
?
""
:
accountItem
.
getAccountId
().
getName
());
item
.
put
(
"InOutItemId"
,
accountItem
.
getInOutItemId
()==
null
?
""
:
accountItem
.
getInOutItemId
().
getId
());
item
.
put
(
"InOutItemName"
,
accountItem
.
getInOutItemId
()==
null
?
""
:
accountItem
.
getInOutItemId
().
getName
());
item
.
put
(
"EachAmount"
,
accountItem
.
getEachAmount
());
item
.
put
(
"Remark"
,
accountItem
.
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
*/
private
Map
<
String
,
Object
>
getCondition
()
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"HeaderId_n_eq"
,
model
.
getHeaderId
());
condition
.
put
(
"Id_s_order"
,
"asc"
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public
AccountItemModel
getModel
()
{
return
model
;
}
public
void
setAccountItemService
(
AccountItemIService
accountItemService
)
{
this
.
accountItemService
=
accountItemService
;
}
}
src/com/jsh/action/materials/BuildingAction.java
View file @
86df29f6
...
...
@@ -5,12 +5,9 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.Depot
;
...
...
@@ -18,7 +15,7 @@ import com.jsh.model.po.Building;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.vo.materials.BuildingModel
;
import
com.jsh.service.materials.BuildingIService
;
import
com.jsh.util.
common.
PageUtil
;
import
com.jsh.util.PageUtil
;
@SuppressWarnings
(
"serial"
)
public
class
BuildingAction
extends
BaseAction
<
BuildingModel
>
...
...
src/com/jsh/action/materials/DepotHeadAction.java
View file @
86df29f6
This diff is collapsed.
Click to expand it.
src/com/jsh/action/materials/DepotItemAction.java
View file @
86df29f6
...
...
@@ -6,18 +6,14 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.
constants.asset
.AssetConstants
;
import
com.jsh.
exception
.JshException
;
import
com.jsh.
util
.AssetConstants
;
import
com.jsh.
util
.JshException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.DepotItem
;
...
...
@@ -26,9 +22,12 @@ import com.jsh.model.po.Material;
import
com.jsh.model.vo.materials.DepotItemModel
;
import
com.jsh.service.materials.DepotHeadIService
;
import
com.jsh.service.materials.DepotItemIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.common.Tools
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.Tools
;
/*
* 单据明细管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
DepotItemAction
extends
BaseAction
<
DepotItemModel
>
{
...
...
src/com/jsh/action/materials/MaterialAction.java
View file @
86df29f6
...
...
@@ -5,12 +5,9 @@ import java.sql.Timestamp;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.DepotHead
;
...
...
@@ -20,8 +17,11 @@ import com.jsh.model.po.MaterialCategory;
import
com.jsh.model.po.Supplier
;
import
com.jsh.model.vo.materials.MaterialModel
;
import
com.jsh.service.materials.MaterialIService
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.PageUtil
;
/*
* 商品管理
* @author jishenghua qq:752718920
*/
@SuppressWarnings
(
"serial"
)
public
class
MaterialAction
extends
BaseAction
<
MaterialModel
>
{
...
...
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment