Commit 7a436d1c authored by 季圣华's avatar 季圣华
Browse files

!14 格式化代码,看着有点别扭

Merge pull request !14 from SmkfGao/master
parents 8f304964 6bc92ec9
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Mobile Tools for Java (J2ME) # Mobile Tools for Java (J2ME)
.mtj.tmp/ .mtj.tmp/
*.iml
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
...@@ -12,5 +13,7 @@ ...@@ -12,5 +13,7 @@
hs_err_pid* hs_err_pid*
.idea .idea
/target
**/*.iml
package com.jsh.action.asset; package com.jsh.action.asset;
import java.util.HashMap;
import java.util.Map;
import com.jsh.base.BaseAction; import com.jsh.base.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset; import com.jsh.model.po.Asset;
import com.jsh.model.vo.asset.ReportModel; import com.jsh.model.vo.asset.ReportModel;
import com.jsh.service.asset.ReportIService; import com.jsh.service.asset.ReportIService;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ReportAction extends BaseAction<ReportModel> public class ReportAction extends BaseAction<ReportModel> {
{
private ReportModel model = new ReportModel(); private ReportModel model = new ReportModel();
private ReportIService reportService; private ReportIService reportService;
/** /**
* 查找资产信息 * 查找资产信息
*
* @return * @return
*/ */
public String find() public String find() {
{ try {
try
{
PageUtil<Asset> pageUtil = new PageUtil<Asset>(); PageUtil<Asset> pageUtil = new PageUtil<Asset>();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
pageUtil.setAdvSearch(getCondition()); pageUtil.setAdvSearch(getCondition());
String reportType = getReportType(new HashMap<String,Object>()); String reportType = getReportType(new HashMap<String, Object>());
reportService.find(pageUtil,reportType.split("_")[0],reportType.split("_")[1]); reportService.find(pageUtil, reportType.split("_")[0], reportType.split("_")[1]);
model.getShowModel().setReportData(pageUtil.getPageList()); model.getShowModel().setReportData(pageUtil.getPageList());
} } catch (JshException e) {
catch (JshException e)
{
Log.errorFileSync(">>>>>>>>>查找资产信息异常", e); Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
model.getShowModel().setMsgTip("get report data exception"); model.getShowModel().setMsgTip("get report data exception");
} }
...@@ -43,20 +39,20 @@ public class ReportAction extends BaseAction<ReportModel> ...@@ -43,20 +39,20 @@ public class ReportAction extends BaseAction<ReportModel>
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("assetname.id_n_eq", model.getAssetNameID()); condition.put("assetname.id_n_eq", model.getAssetNameID());
condition.put("assetname.category.id_n_eq", model.getAssetCategoryID()); condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
condition.put("user.id_n_eq", model.getUsernameID()); condition.put("user.id_n_eq", model.getUsernameID());
condition.put("status_n_eq", model.getStatus()); condition.put("status_n_eq", model.getStatus());
condition.put("supplier.id_n_eq", model.getSupplierID()); condition.put("supplier.id_n_eq", model.getSupplierID());
condition.put("dataSum_s_order","desc"); condition.put("dataSum_s_order", "desc");
//拼接统计数据条件 //拼接统计数据条件
getReportType(condition); getReportType(condition);
return condition; return condition;
...@@ -64,10 +60,10 @@ public class ReportAction extends BaseAction<ReportModel> ...@@ -64,10 +60,10 @@ public class ReportAction extends BaseAction<ReportModel>
/** /**
* 获取统计条件 * 获取统计条件
*
* @param condition * @param condition
*/ */
private String getReportType(Map<String,Object> condition) private String getReportType(Map<String, Object> condition) {
{
// <option value="0">资产状态</option> // <option value="0">资产状态</option>
// <option value="1">资产类型</option> // <option value="1">资产类型</option>
// <option value="2">供应商</option> // <option value="2">供应商</option>
...@@ -76,8 +72,7 @@ public class ReportAction extends BaseAction<ReportModel> ...@@ -76,8 +72,7 @@ public class ReportAction extends BaseAction<ReportModel>
int reportType = model.getReportType(); int reportType = model.getReportType();
String reportTypeInfo = ""; String reportTypeInfo = "";
String reportTypeName = ""; String reportTypeName = "";
switch(reportType) switch (reportType) {
{
case 0: case 0:
condition.put("status_s_gb", "group"); condition.put("status_s_gb", "group");
reportTypeInfo = "status"; reportTypeInfo = "status";
...@@ -103,18 +98,19 @@ public class ReportAction extends BaseAction<ReportModel> ...@@ -103,18 +98,19 @@ public class ReportAction extends BaseAction<ReportModel>
reportTypeInfo = "user.id"; reportTypeInfo = "user.id";
reportTypeName = "user.username"; reportTypeName = "user.username";
break; break;
default:
break;
} }
return reportTypeInfo + "_" + reportTypeName; return reportTypeInfo + "_" + reportTypeName;
} }
//=========Spring注入以及model驱动公共方法=========== //=========Spring注入以及model驱动公共方法===========
public void setReportService(ReportIService reportService) public void setReportService(ReportIService reportService) {
{
this.reportService = reportService; this.reportService = reportService;
} }
@Override @Override
public ReportModel getModel() public ReportModel getModel() {
{
return model; return model;
} }
} }
package com.jsh.action.basic; package com.jsh.action.basic;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.util.JshException;
import com.jsh.model.po.App; import com.jsh.model.po.App;
import com.jsh.model.po.Logdetails; import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.AppModel; import com.jsh.model.vo.basic.AppModel;
import com.jsh.service.basic.AppIService; import com.jsh.service.basic.AppIService;
import com.jsh.service.basic.UserBusinessIService; import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.struts2.ServletActionContext;
import org.springframework.dao.DataAccessException;
import java.io.*;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 应用 * 应用
*
* @author ji_sheng_hua qq752 718 920 * @author ji_sheng_hua qq752 718 920
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class AppAction extends BaseAction<AppModel> public class AppAction extends BaseAction<AppModel> {
{
private AppIService appService; private AppIService appService;
private UserBusinessIService userBusinessService; private UserBusinessIService userBusinessService;
private AppModel model = new AppModel(); private AppModel model = new AppModel();
...@@ -38,13 +33,12 @@ public class AppAction extends BaseAction<AppModel> ...@@ -38,13 +33,12 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 上传图片 * 上传图片
*/ */
public void uploadImg() public void uploadImg() {
{
Log.infoFileSync("==================开始调用上传图片方法uploadImg()==================="); Log.infoFileSync("==================开始调用上传图片方法uploadImg()===================");
File fileInfo = model.getFileInfo(); File fileInfo = model.getFileInfo();
String fileName = model.getFileInfoName(); //获取文件名 String fileName = model.getFileInfoName(); //获取文件名
try { try {
if(fileInfo != null ){ if (fileInfo != null) {
String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon"); String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon");
InputStream is = new FileInputStream(fileInfo); InputStream is = new FileInputStream(fileInfo);
File file = new File(path, fileName); File file = new File(path, fileName);
...@@ -57,12 +51,10 @@ public class AppAction extends BaseAction<AppModel> ...@@ -57,12 +51,10 @@ public class AppAction extends BaseAction<AppModel>
is.close(); is.close();
os.close(); os.close();
} }
} } catch (FileNotFoundException e) {
catch (FileNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
// e.printStackTrace(); // e.printStackTrace();
} } catch (IOException e) {
catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
// e.printStackTrace(); // e.printStackTrace();
} }
...@@ -71,14 +63,13 @@ public class AppAction extends BaseAction<AppModel> ...@@ -71,14 +63,13 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 增加应用 * 增加应用
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加应用方法create()==================="); Log.infoFileSync("==================开始调用增加应用方法create()===================");
Boolean flag = false; Boolean flag = false;
try try {
{
App app = new App(); App app = new App();
app.setNumber(model.getNumber()); app.setNumber(model.getNumber());
app.setName(model.getName()); app.setName(model.getName());
...@@ -101,47 +92,37 @@ public class AppAction extends BaseAction<AppModel> ...@@ -101,47 +92,37 @@ public class AppAction extends BaseAction<AppModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加应用名称为 "+ model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg)); , tipType, "增加应用名称为 " + model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg));
Log.infoFileSync("==================结束调用增加应用方法create()==================="); Log.infoFileSync("==================结束调用增加应用方法create()===================");
} }
/** /**
* 删除应用 * 删除应用
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除应用方法delete()================"); Log.infoFileSync("====================开始调用删除应用方法delete()================");
try try {
{
appService.delete(model.getAppID()); appService.delete(model.getAppID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -149,20 +130,19 @@ public class AppAction extends BaseAction<AppModel> ...@@ -149,20 +130,19 @@ public class AppAction extends BaseAction<AppModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg)); , tipType, "删除应用ID为 " + model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg));
Log.infoFileSync("====================结束调用删除应用方法delete()================"); Log.infoFileSync("====================结束调用删除应用方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新仓库 * 更新仓库
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
App app = appService.get(model.getAppID()); App app = appService.get(model.getAppID());
app.setNumber(model.getNumber()); app.setNumber(model.getNumber());
app.setName(model.getName()); app.setName(model.getName());
...@@ -183,46 +163,36 @@ public class AppAction extends BaseAction<AppModel> ...@@ -183,46 +163,36 @@ public class AppAction extends BaseAction<AppModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改应用回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改应用回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新应用", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新应用", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg)); , tipType, "更新应用ID为 " + model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg));
} }
/** /**
* 批量删除指定ID应用 * 批量删除指定ID应用
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
appService.batchDelete(model.getAppIDs()); appService.batchDelete(model.getAppIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -230,45 +200,35 @@ public class AppAction extends BaseAction<AppModel> ...@@ -230,45 +200,35 @@ public class AppAction extends BaseAction<AppModel>
logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除应用ID为 "+ model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg)); , tipType, "批量删除应用ID为 " + model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = appService.checkIsNameExist("name", model.getName(), "Id", model.getAppID());
flag = appService.checkIsNameExist("name",model.getName(),"Id", model.getAppID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找应用信息 * 查找应用信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<App> pageUtil = new PageUtil<App>(); PageUtil<App> pageUtil = new PageUtil<App>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -284,10 +244,8 @@ public class AppAction extends BaseAction<AppModel> ...@@ -284,10 +244,8 @@ public class AppAction extends BaseAction<AppModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (App app : dataList) {
for(App app:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("Id", app.getId()); item.put("Id", app.getId());
//应用名称 //应用名称
...@@ -312,25 +270,20 @@ public class AppAction extends BaseAction<AppModel> ...@@ -312,25 +270,20 @@ public class AppAction extends BaseAction<AppModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
} }
} }
/** /**
* 桌面应用显示 * 桌面应用显示
*
* @return * @return
*/ */
public void findDesk() public void findDesk() {
{ try {
try
{
PageUtil<App> pageUtil = new PageUtil<App>(); PageUtil<App> pageUtil = new PageUtil<App>();
pageUtil.setPageSize(100); pageUtil.setPageSize(100);
//pageUtil.setCurPage(model.getPageNo()); //pageUtil.setCurPage(model.getPageNo());
...@@ -345,15 +298,13 @@ public class AppAction extends BaseAction<AppModel> ...@@ -345,15 +298,13 @@ public class AppAction extends BaseAction<AppModel>
//开始拼接json数据 //开始拼接json数据
//存放数据json数组 //存放数据json数组
JSONArray dataArray1 = new JSONArray(); JSONArray dataArray1 = new JSONArray();
if(null != dataList1) if (null != dataList1) {
{ for (App app : dataList1) {
for(App app:dataList1)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", app.getId()); item.put("id", app.getId());
item.put("title", app.getName()); item.put("title", app.getName());
item.put("type", app.getType()); item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", app.getURL()); item.put("url", app.getURL());
item.put("width", app.getWidth()); item.put("width", app.getWidth());
item.put("height", app.getHeight()); item.put("height", app.getHeight());
...@@ -373,16 +324,14 @@ public class AppAction extends BaseAction<AppModel> ...@@ -373,16 +324,14 @@ public class AppAction extends BaseAction<AppModel>
//开始拼接json数据 //开始拼接json数据
//存放数据json数组 //存放数据json数组
JSONArray dataArray2 = new JSONArray(); JSONArray dataArray2 = new JSONArray();
if(null != dataList2) if (null != dataList2) {
{ for (App app : dataList2) {
for(App app:dataList2)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", app.getId()); item.put("id", app.getId());
item.put("title", app.getName()); item.put("title", app.getName());
item.put("type", app.getType()); item.put("type", app.getType());
item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
item.put("url", "../../pages/common/menu.jsp?appID="+app.getNumber()+"&id="+app.getId()); item.put("url", "../../pages/common/menu.jsp?appID=" + app.getNumber() + "&id=" + app.getId());
item.put("width", app.getWidth()); item.put("width", app.getWidth());
item.put("height", app.getHeight()); item.put("height", app.getHeight());
item.put("isresize", app.getReSize()); item.put("isresize", app.getReSize());
...@@ -394,13 +343,9 @@ public class AppAction extends BaseAction<AppModel> ...@@ -394,13 +343,9 @@ public class AppAction extends BaseAction<AppModel>
outer.put("desk", dataArray2); outer.put("desk", dataArray2);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
} }
} }
...@@ -408,12 +353,11 @@ public class AppAction extends BaseAction<AppModel> ...@@ -408,12 +353,11 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 角色对应应用显示 * 角色对应应用显示
*
* @return * @return
*/ */
public void findRoleAPP() public void findRoleAPP() {
{ try {
try
{
PageUtil<App> pageUtil = new PageUtil<App>(); PageUtil<App> pageUtil = new PageUtil<App>();
pageUtil.setPageSize(100); pageUtil.setPageSize(100);
//pageUtil.setCurPage(model.getPageNo()); //pageUtil.setCurPage(model.getPageNo());
...@@ -429,52 +373,45 @@ public class AppAction extends BaseAction<AppModel> ...@@ -429,52 +373,45 @@ public class AppAction extends BaseAction<AppModel>
outer.put("state", "open"); outer.put("state", "open");
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (App app : dataList) {
for(App app:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", app.getId()); item.put("id", app.getId());
item.put("text", app.getName()); item.put("text", app.getName());
//勾选判断1 //勾选判断1
Boolean flag = false; Boolean flag = false;
try try {
{ flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + app.getId().toString() + "]");
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+app.getId().toString()+"]"); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
} }
if (flag==true){item.put("checked", true);} if (flag == true) {
item.put("checked", true);
}
//结束 //结束
dataArray.add(item); dataArray.add(item);
} }
} }
outer.put("children", dataArray); outer.put("children", dataArray);
//回写查询结果 //回写查询结果
toClient("["+outer.toString()+"]"); toClient("[" + outer.toString() + "]");
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("Name_s_like", model.getName()); condition.put("Name_s_like", model.getName());
condition.put("Type_s_like", model.getType()); condition.put("Type_s_like", model.getType());
condition.put("Sort_s_order", "asc"); condition.put("Sort_s_order", "asc");
...@@ -483,14 +420,14 @@ public class AppAction extends BaseAction<AppModel> ...@@ -483,14 +420,14 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 拼接搜索条件-桌面dock * 拼接搜索条件-桌面dock
*
* @return * @return
*/ */
private Map<String,Object> getCondition_dock() private Map<String, Object> getCondition_dock() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("ZL_s_eq", "dock"); condition.put("ZL_s_eq", "dock");
condition.put("Enabled_n_eq", 1); condition.put("Enabled_n_eq", 1);
condition.put("Sort_s_order", "asc"); condition.put("Sort_s_order", "asc");
...@@ -499,14 +436,14 @@ public class AppAction extends BaseAction<AppModel> ...@@ -499,14 +436,14 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 拼接搜索条件-桌面desk * 拼接搜索条件-桌面desk
*
* @return * @return
*/ */
private Map<String,Object> getCondition_desk() private Map<String, Object> getCondition_desk() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("ZL_s_eq", "desk"); condition.put("ZL_s_eq", "desk");
condition.put("Enabled_n_eq", 1); condition.put("Enabled_n_eq", 1);
condition.put("Sort_s_order", "asc"); condition.put("Sort_s_order", "asc");
...@@ -515,14 +452,14 @@ public class AppAction extends BaseAction<AppModel> ...@@ -515,14 +452,14 @@ public class AppAction extends BaseAction<AppModel>
/** /**
* 拼接搜索条件-角色对应应用 * 拼接搜索条件-角色对应应用
*
* @return * @return
*/ */
private Map<String,Object> getCondition_RoleAPP() private Map<String, Object> getCondition_RoleAPP() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("Enabled_n_eq", 1); condition.put("Enabled_n_eq", 1);
condition.put("Sort_s_order", "asc"); condition.put("Sort_s_order", "asc");
return condition; return condition;
...@@ -530,12 +467,11 @@ public class AppAction extends BaseAction<AppModel> ...@@ -530,12 +467,11 @@ public class AppAction extends BaseAction<AppModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public AppModel getModel() public AppModel getModel() {
{
return model; return model;
} }
public void setAppService(AppIService appService)
{ public void setAppService(AppIService appService) {
this.appService = appService; this.appService = appService;
} }
......
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.model.po.Assetname; import com.jsh.model.po.Assetname;
...@@ -16,29 +8,37 @@ import com.jsh.model.po.Logdetails; ...@@ -16,29 +8,37 @@ import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.AssetNameModel; import com.jsh.model.vo.basic.AssetNameModel;
import com.jsh.service.basic.AssetNameIService; import com.jsh.service.basic.AssetNameIService;
import com.jsh.util.PageUtil; 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") @SuppressWarnings("serial")
public class AssetNameAction extends BaseAction<AssetNameModel> public class AssetNameAction extends BaseAction<AssetNameModel> {
{
private AssetNameModel model = new AssetNameModel(); private AssetNameModel model = new AssetNameModel();
private AssetNameIService assetnameService; private AssetNameIService assetnameService;
/** /**
* 增加资产名称 * 增加资产名称
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加资产名称方法create()==================="); Log.infoFileSync("==================开始调用增加资产名称方法create()===================");
Boolean flag = false; Boolean flag = false;
try try {
{
Assetname assetname = new Assetname(); Assetname assetname = new Assetname();
assetname.setAssetname(model.getAssetName()); assetname.setAssetname(model.getAssetName());
//增加资产类型 //增加资产类型
assetname.setCategory(new Category(model.getCategoryID())); assetname.setCategory(new Category(model.getCategoryID()));
assetname.setIsystem((short)1); assetname.setIsystem((short) 1);
assetname.setIsconsumables(model.getConsumable()); assetname.setIsconsumables(model.getConsumable());
assetname.setDescription(model.getDescription()); assetname.setDescription(model.getDescription());
assetnameService.create(assetname); assetnameService.create(assetname);
...@@ -48,47 +48,37 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -48,47 +48,37 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加资产名称名称为 "+ model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg)); , tipType, "增加资产名称名称为 " + model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
Log.infoFileSync("==================结束调用增加资产名称方法create()==================="); Log.infoFileSync("==================结束调用增加资产名称方法create()===================");
} }
/** /**
* 删除资产名称 * 删除资产名称
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================"); Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================");
try try {
{
assetnameService.delete(model.getAssetNameID()); assetnameService.delete(model.getAssetNameID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -96,20 +86,19 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -96,20 +86,19 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg)); , tipType, "删除资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================"); Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新资产名称 * 更新资产名称
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
Assetname assetname = assetnameService.get(model.getAssetNameID()); Assetname assetname = assetnameService.get(model.getAssetNameID());
//增加资产类型 //增加资产类型
assetname.setCategory(new Category(model.getCategoryID())); assetname.setCategory(new Category(model.getCategoryID()));
...@@ -121,46 +110,36 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -121,46 +110,36 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg)); , tipType, "更新资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
} }
/** /**
* 批量删除指定ID资产名称 * 批量删除指定ID资产名称
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
assetnameService.batchDelete(model.getAssetNameIDs()); assetnameService.batchDelete(model.getAssetNameIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -168,45 +147,35 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -168,45 +147,35 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg)); , tipType, "批量删除资产名称ID为 " + model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = assetnameService.checkIsNameExist("assetname", model.getAssetName(), "id", model.getAssetNameID());
flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找供应商信息 * 查找供应商信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Assetname> pageUtil = new PageUtil<Assetname>(); PageUtil<Assetname> pageUtil = new PageUtil<Assetname>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -222,16 +191,14 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -222,16 +191,14 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Assetname assetname : dataList) {
for(Assetname assetname:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", assetname.getId()); item.put("id", assetname.getId());
//供应商名称 //供应商名称
item.put("assetname", assetname.getAssetname()); item.put("assetname", assetname.getAssetname());
item.put("isystem", assetname.getIsystem() == (short)0?"是":"否"); item.put("isystem", assetname.getIsystem() == (short) 0 ? "是" : "否");
item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否"); item.put("consumable", assetname.getIsconsumables() == (short) 0 ? "是" : "否");
item.put("consumableStatus", assetname.getIsconsumables()); item.put("consumableStatus", assetname.getIsconsumables());
item.put("description", assetname.getDescription()); item.put("description", assetname.getDescription());
item.put("categoryID", assetname.getCategory().getId()); item.put("categoryID", assetname.getCategory().getId());
...@@ -243,27 +210,23 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -243,27 +210,23 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("assetname_s_like", model.getAssetName()); condition.put("assetname_s_like", model.getAssetName());
condition.put("isconsumables_n_eq", model.getConsumable()); condition.put("isconsumables_n_eq", model.getConsumable());
condition.put("description_s_like", model.getDescription()); condition.put("description_s_like", model.getDescription());
...@@ -274,13 +237,11 @@ public class AssetNameAction extends BaseAction<AssetNameModel> ...@@ -274,13 +237,11 @@ public class AssetNameAction extends BaseAction<AssetNameModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public AssetNameModel getModel() public AssetNameModel getModel() {
{
return model; return model;
} }
public void setAssetnameService(AssetNameIService assetnameService) public void setAssetnameService(AssetNameIService assetnameService) {
{
this.assetnameService = assetnameService; this.assetnameService = assetnameService;
} }
} }
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.model.po.Category; import com.jsh.model.po.Category;
...@@ -15,27 +7,36 @@ import com.jsh.model.po.Logdetails; ...@@ -15,27 +7,36 @@ import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.CategoryModel; import com.jsh.model.vo.basic.CategoryModel;
import com.jsh.service.basic.CategoryIService; import com.jsh.service.basic.CategoryIService;
import com.jsh.util.PageUtil; 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 * @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class CategoryAction extends BaseAction<CategoryModel> public class CategoryAction extends BaseAction<CategoryModel> {
{
private CategoryIService categoryService; private CategoryIService categoryService;
private CategoryModel model = new CategoryModel(); private CategoryModel model = new CategoryModel();
/** /**
* 增加资产类型 * 增加资产类型
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加资产类型方法create()==================="); Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
Boolean flag = false; Boolean flag = false;
try try {
{
Category category = new Category(); Category category = new Category();
category.setAssetname(model.getCategoryName()); category.setAssetname(model.getCategoryName());
category.setIsystem((short)1); category.setIsystem((short) 1);
category.setDescription(model.getDescription()); category.setDescription(model.getDescription());
categoryService.create(category); categoryService.create(category);
...@@ -44,47 +45,37 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -44,47 +45,37 @@ public class CategoryAction extends BaseAction<CategoryModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加资产类型名称为 "+ model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg)); , tipType, "增加资产类型名称为 " + model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
Log.infoFileSync("==================结束调用增加资产类型方法create()==================="); Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
} }
/** /**
* 删除资产类型 * 删除资产类型
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================"); Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
try try {
{
categoryService.delete(model.getCategoryID()); categoryService.delete(model.getCategoryID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -92,20 +83,19 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -92,20 +83,19 @@ public class CategoryAction extends BaseAction<CategoryModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg)); , tipType, "删除资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================"); Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新资产类型 * 更新资产类型
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
Category category = categoryService.get(model.getCategoryID()); Category category = categoryService.get(model.getCategoryID());
category.setAssetname(model.getCategoryName()); category.setAssetname(model.getCategoryName());
category.setDescription(model.getDescription()); category.setDescription(model.getDescription());
...@@ -114,46 +104,36 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -114,46 +104,36 @@ public class CategoryAction extends BaseAction<CategoryModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg)); , tipType, "更新资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
} }
/** /**
* 批量删除指定ID资产类型 * 批量删除指定ID资产类型
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
categoryService.batchDelete(model.getCategoryIDs()); categoryService.batchDelete(model.getCategoryIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -161,45 +141,35 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -161,45 +141,35 @@ public class CategoryAction extends BaseAction<CategoryModel>
logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg)); , tipType, "批量删除资产类型ID为 " + model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = categoryService.checkIsNameExist("assetname", model.getCategoryName(), "id", model.getCategoryID());
flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找供应商信息 * 查找供应商信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Category> pageUtil = new PageUtil<Category>(); PageUtil<Category> pageUtil = new PageUtil<Category>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -215,15 +185,13 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -215,15 +185,13 @@ public class CategoryAction extends BaseAction<CategoryModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Category category : dataList) {
for(Category category:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", category.getId()); item.put("id", category.getId());
//供应商名称 //供应商名称
item.put("categoryname", category.getAssetname()); 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("description", category.getDescription());
item.put("op", category.getIsystem()); item.put("op", category.getIsystem());
dataArray.add(item); dataArray.add(item);
...@@ -232,27 +200,23 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -232,27 +200,23 @@ public class CategoryAction extends BaseAction<CategoryModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("assetname_s_like", model.getCategoryName()); condition.put("assetname_s_like", model.getCategoryName());
condition.put("description_s_like", model.getDescription()); condition.put("description_s_like", model.getDescription());
condition.put("id_s_order", "desc"); condition.put("id_s_order", "desc");
...@@ -261,12 +225,11 @@ public class CategoryAction extends BaseAction<CategoryModel> ...@@ -261,12 +225,11 @@ public class CategoryAction extends BaseAction<CategoryModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public CategoryModel getModel() public CategoryModel getModel() {
{
return model; return model;
} }
public void setCategoryService(CategoryIService categoryService)
{ public void setCategoryService(CategoryIService categoryService) {
this.categoryService = categoryService; this.categoryService = categoryService;
} }
} }
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.util.JshException;
import com.jsh.model.po.Depot; import com.jsh.model.po.Depot;
import com.jsh.model.po.Logdetails; import com.jsh.model.po.Logdetails;
import com.jsh.model.po.Role;
import com.jsh.model.vo.basic.DepotModel; import com.jsh.model.vo.basic.DepotModel;
import com.jsh.service.basic.DepotIService; import com.jsh.service.basic.DepotIService;
import com.jsh.service.basic.UserBusinessIService; import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.PageUtil; 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 * @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class DepotAction extends BaseAction<DepotModel> public class DepotAction extends BaseAction<DepotModel> {
{
private DepotIService depotService; private DepotIService depotService;
private UserBusinessIService userBusinessService; private UserBusinessIService userBusinessService;
private DepotModel model = new DepotModel(); private DepotModel model = new DepotModel();
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
public String getBasicData() public String getBasicData() {
{ Map<String, List> mapData = model.getShowModel().getMap();
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil(); PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
try try {
{ Map<String, Object> condition = pageUtil.getAdvSearch();
Map<String,Object> condition = pageUtil.getAdvSearch();
condition.put("sort_s_order", "asc"); condition.put("sort_s_order", "asc");
depotService.find(pageUtil); depotService.find(pageUtil);
mapData.put("depotList", pageUtil.getPageList()); mapData.put("depotList", pageUtil.getPageList());
} } catch (Exception e) {
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
model.getShowModel().setMsgTip("exceptoin"); model.getShowModel().setMsgTip("exceptoin");
} }
...@@ -54,14 +50,13 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -54,14 +50,13 @@ public class DepotAction extends BaseAction<DepotModel>
/** /**
* 增加仓库 * 增加仓库
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加仓库信息方法create()==================="); Log.infoFileSync("==================开始调用增加仓库信息方法create()===================");
Boolean flag = false; Boolean flag = false;
try try {
{
Depot depot = new Depot(); Depot depot = new Depot();
depot.setName(model.getName()); depot.setName(model.getName());
depot.setAddress(model.getAddress()); depot.setAddress(model.getAddress());
...@@ -77,47 +72,37 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -77,47 +72,37 @@ public class DepotAction extends BaseAction<DepotModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加仓库名称为 "+ model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg)); , tipType, "增加仓库名称为 " + model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg));
Log.infoFileSync("==================结束调用增加仓库方法create()==================="); Log.infoFileSync("==================结束调用增加仓库方法create()===================");
} }
/** /**
* 删除仓库 * 删除仓库
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除仓库信息方法delete()================"); Log.infoFileSync("====================开始调用删除仓库信息方法delete()================");
try try {
{
depotService.delete(model.getDepotID()); depotService.delete(model.getDepotID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -125,20 +110,19 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -125,20 +110,19 @@ public class DepotAction extends BaseAction<DepotModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg)); , tipType, "删除仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg));
Log.infoFileSync("====================结束调用删除仓库信息方法delete()================"); Log.infoFileSync("====================结束调用删除仓库信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新仓库 * 更新仓库
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
Depot depot = depotService.get(model.getDepotID()); Depot depot = depotService.get(model.getDepotID());
depot.setName(model.getName()); depot.setName(model.getName());
depot.setAddress(model.getAddress()); depot.setAddress(model.getAddress());
...@@ -152,46 +136,36 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -152,46 +136,36 @@ public class DepotAction extends BaseAction<DepotModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg)); , tipType, "更新仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg));
} }
/** /**
* 批量删除指定ID仓库 * 批量删除指定ID仓库
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
depotService.batchDelete(model.getDepotIDs()); depotService.batchDelete(model.getDepotIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -199,45 +173,35 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -199,45 +173,35 @@ public class DepotAction extends BaseAction<DepotModel>
logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg)); , tipType, "批量删除仓库ID为 " + model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = depotService.checkIsNameExist("name", model.getName(), "id", model.getDepotID());
flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找仓库信息 * 查找仓库信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Depot> pageUtil = new PageUtil<Depot>(); PageUtil<Depot> pageUtil = new PageUtil<Depot>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -249,10 +213,8 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -249,10 +213,8 @@ public class DepotAction extends BaseAction<DepotModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Depot depot : dataList) {
for(Depot depot:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", depot.getId()); item.put("id", depot.getId());
//供应商名称 //供应商名称
...@@ -270,25 +232,20 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -270,25 +232,20 @@ public class DepotAction extends BaseAction<DepotModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
} }
} }
/** /**
* 查找礼品卡-虚拟仓库 * 查找礼品卡-虚拟仓库
*
* @return * @return
*/ */
public void findGiftByType() public void findGiftByType() {
{ try {
try
{
PageUtil<Depot> pageUtil = new PageUtil<Depot>(); PageUtil<Depot> pageUtil = new PageUtil<Depot>();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
...@@ -297,10 +254,8 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -297,10 +254,8 @@ public class DepotAction extends BaseAction<DepotModel>
List<Depot> dataList = pageUtil.getPageList(); List<Depot> dataList = pageUtil.getPageList();
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Depot depot : dataList) {
for(Depot depot:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", depot.getId()); item.put("id", depot.getId());
//仓库名称 //仓库名称
...@@ -310,25 +265,20 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -310,25 +265,20 @@ public class DepotAction extends BaseAction<DepotModel>
} }
//回写查询结果 //回写查询结果
toClient(dataArray.toString()); toClient(dataArray.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e); Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e); Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e);
} }
} }
/** /**
* 用户对应仓库显示 * 用户对应仓库显示
*
* @return * @return
*/ */
public void findUserDepot() public void findUserDepot() {
{ try {
try
{
PageUtil<Depot> pageUtil = new PageUtil<Depot>(); PageUtil<Depot> pageUtil = new PageUtil<Depot>();
pageUtil.setPageSize(100); pageUtil.setPageSize(100);
//pageUtil.setCurPage(model.getPageNo()); //pageUtil.setCurPage(model.getPageNo());
...@@ -344,48 +294,42 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -344,48 +294,42 @@ public class DepotAction extends BaseAction<DepotModel>
outer.put("state", "open"); outer.put("state", "open");
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Depot depot : dataList) {
for(Depot depot:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", depot.getId()); item.put("id", depot.getId());
item.put("text", depot.getName()); item.put("text", depot.getName());
//勾选判断1 //勾选判断1
Boolean flag = false; Boolean flag = false;
try try {
{ flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]");
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]"); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
} }
if (flag==true){item.put("checked", true);} if (flag == true) {
item.put("checked", true);
}
//结束 //结束
dataArray.add(item); dataArray.add(item);
} }
} }
outer.put("children", dataArray); outer.put("children", dataArray);
//回写查询结果 //回写查询结果
toClient("["+outer.toString()+"]"); toClient("[" + outer.toString() + "]");
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e);
} }
} }
/** /**
* 根据用户查找对应仓库列表-仅显示有权限的 * 根据用户查找对应仓库列表-仅显示有权限的
*
* @return * @return
*/ */
public void findDepotByUserId(){ public void findDepotByUserId() {
try{ try {
PageUtil<Depot> pageUtil = new PageUtil<Depot>(); PageUtil<Depot> pageUtil = new PageUtil<Depot>();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
...@@ -395,22 +339,17 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -395,22 +339,17 @@ public class DepotAction extends BaseAction<DepotModel>
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Depot depot : dataList) {
for(Depot depot:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
//勾选判断1 //勾选判断1
Boolean flag = false; Boolean flag = false;
try try {
{ flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]");
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]"); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
} }
if (flag==true){ if (flag == true) {
item.put("id", depot.getId()); item.put("id", depot.getId());
item.put("depotName", depot.getName()); item.put("depotName", depot.getName());
dataArray.add(item); dataArray.add(item);
...@@ -419,27 +358,23 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -419,27 +358,23 @@ public class DepotAction extends BaseAction<DepotModel>
} }
//回写查询结果 //回写查询结果
toClient(dataArray.toString()); toClient(dataArray.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("name_s_like", model.getName()); condition.put("name_s_like", model.getName());
condition.put("remark_s_like", model.getRemark()); condition.put("remark_s_like", model.getRemark());
condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡
...@@ -449,14 +384,14 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -449,14 +384,14 @@ public class DepotAction extends BaseAction<DepotModel>
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getConditionByType() private Map<String, Object> getConditionByType() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡
condition.put("sort_s_order", "asc"); condition.put("sort_s_order", "asc");
return condition; return condition;
...@@ -464,14 +399,14 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -464,14 +399,14 @@ public class DepotAction extends BaseAction<DepotModel>
/** /**
* 拼接搜索条件-用户对应仓库 * 拼接搜索条件-用户对应仓库
*
* @return * @return
*/ */
private Map<String,Object> getCondition_UserDepot() private Map<String, Object> getCondition_UserDepot() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("type_n_eq", 0); condition.put("type_n_eq", 0);
condition.put("sort_s_order", "asc"); condition.put("sort_s_order", "asc");
return condition; return condition;
...@@ -479,12 +414,11 @@ public class DepotAction extends BaseAction<DepotModel> ...@@ -479,12 +414,11 @@ public class DepotAction extends BaseAction<DepotModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public DepotModel getModel() public DepotModel getModel() {
{
return model; return model;
} }
public void setDepotService(DepotIService depotService)
{ public void setDepotService(DepotIService depotService) {
this.depotService = depotService; this.depotService = depotService;
} }
......
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.model.po.Logdetails;
import com.jsh.model.po.InOutItem; import com.jsh.model.po.InOutItem;
import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.InOutItemModel; import com.jsh.model.vo.basic.InOutItemModel;
import com.jsh.service.basic.InOutItemIService; import com.jsh.service.basic.InOutItemIService;
import com.jsh.util.PageUtil; 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 * @author ji*sheng*hua qq 7.5.2.7.1.8.9.2.0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class InOutItemAction extends BaseAction<InOutItemModel> public class InOutItemAction extends BaseAction<InOutItemModel> {
{
private InOutItemIService inOutItemService; private InOutItemIService inOutItemService;
private InOutItemModel model = new InOutItemModel(); private InOutItemModel model = new InOutItemModel();
/** /**
* 增加收支项目 * 增加收支项目
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加收支项目方法==================="); Log.infoFileSync("==================开始调用增加收支项目方法===================");
Boolean flag = false; Boolean flag = false;
try try {
{
InOutItem inOutItem = new InOutItem(); InOutItem inOutItem = new InOutItem();
inOutItem.setName(model.getName()); inOutItem.setName(model.getName());
inOutItem.setType(model.getType()); inOutItem.setType(model.getType());
...@@ -46,47 +47,37 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -46,47 +47,37 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加收支项目名称为 "+ model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg)); , tipType, "增加收支项目名称为 " + model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg));
Log.infoFileSync("==================结束调用增加收支项目方法==================="); Log.infoFileSync("==================结束调用增加收支项目方法===================");
} }
/** /**
* 删除收支项目 * 删除收支项目
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================"); Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================");
try try {
{
inOutItemService.delete(model.getInOutItemID()); inOutItemService.delete(model.getInOutItemID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -94,20 +85,19 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -94,20 +85,19 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除收支项目ID为 "+ model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg)); , tipType, "删除收支项目ID为 " + model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg));
Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================"); Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新收支项目 * 更新收支项目
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
InOutItem inOutItem = inOutItemService.get(model.getInOutItemID()); InOutItem inOutItem = inOutItemService.get(model.getInOutItemID());
inOutItem.setName(model.getName()); inOutItem.setName(model.getName());
inOutItem.setType(model.getType()); inOutItem.setType(model.getType());
...@@ -117,46 +107,36 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -117,46 +107,36 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新收支项目ID为 "+ model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg)); , tipType, "更新收支项目ID为 " + model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg));
} }
/** /**
* 批量删除指定ID收支项目 * 批量删除指定ID收支项目
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
inOutItemService.batchDelete(model.getInOutItemIDs()); inOutItemService.batchDelete(model.getInOutItemIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除收支项目ID为:" + model.getInOutItemIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除收支项目ID为:" + model.getInOutItemIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -164,45 +144,35 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -164,45 +144,35 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
logService.create(new Logdetails(getUser(), "批量删除收支项目", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除收支项目", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除收支项目ID为 "+ model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg)); , tipType, "批量删除收支项目ID为 " + model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = inOutItemService.checkIsNameExist("name", model.getName(), "id", model.getInOutItemID());
flag = inOutItemService.checkIsNameExist("name",model.getName(),"id", model.getInOutItemID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找收支项目信息 * 查找收支项目信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>(); PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -214,10 +184,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -214,10 +184,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (InOutItem inOutItem : dataList) {
for(InOutItem inOutItem:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", inOutItem.getId()); item.put("id", inOutItem.getId());
//收支项目名称 //收支项目名称
...@@ -231,25 +199,20 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -231,25 +199,20 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e); Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e); Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
} }
} }
/** /**
* 查找收支项目信息-下拉框 * 查找收支项目信息-下拉框
*
* @return * @return
*/ */
public void findBySelect() public void findBySelect() {
{ try {
try
{
PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>(); PageUtil<InOutItem> pageUtil = new PageUtil<InOutItem>();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
...@@ -258,10 +221,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -258,10 +221,8 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
List<InOutItem> dataList = pageUtil.getPageList(); List<InOutItem> dataList = pageUtil.getPageList();
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (InOutItem inOutItem : dataList) {
for(InOutItem inOutItem:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("Id", inOutItem.getId()); item.put("Id", inOutItem.getId());
//收支项目名称 //收支项目名称
...@@ -271,27 +232,23 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -271,27 +232,23 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
} }
//回写查询结果 //回写查询结果
toClient(dataArray.toString()); toClient(dataArray.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e); Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e); Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("name_s_like", model.getName()); condition.put("name_s_like", model.getName());
condition.put("remark_s_like", model.getRemark()); condition.put("remark_s_like", model.getRemark());
condition.put("id_s_order", "desc"); condition.put("id_s_order", "desc");
...@@ -300,18 +257,17 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -300,18 +257,17 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
/** /**
* 拼接搜索条件-下拉框-收支项目 * 拼接搜索条件-下拉框-收支项目
*
* @return * @return
*/ */
private Map<String,Object> getCondition_select() private Map<String, Object> getCondition_select() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
if(model.getType().equals("in")) { if (model.getType().equals("in")) {
condition.put("type_s_eq", "收入"); condition.put("type_s_eq", "收入");
} } else if (model.getType().equals("out")) {
else if(model.getType().equals("out")) {
condition.put("type_s_eq", "支出"); condition.put("type_s_eq", "支出");
} }
condition.put("id_s_order", "desc"); condition.put("id_s_order", "desc");
...@@ -320,12 +276,11 @@ public class InOutItemAction extends BaseAction<InOutItemModel> ...@@ -320,12 +276,11 @@ public class InOutItemAction extends BaseAction<InOutItemModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public InOutItemModel getModel() public InOutItemModel getModel() {
{
return model; return model;
} }
public void setInOutItemService(InOutItemIService inOutItemService)
{ public void setInOutItemService(InOutItemIService inOutItemService) {
this.inOutItemService = inOutItemService; this.inOutItemService = inOutItemService;
} }
} }
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
import com.jsh.model.po.Logdetails; import com.jsh.model.po.Logdetails;
...@@ -15,34 +7,38 @@ import com.jsh.model.vo.basic.LogModel; ...@@ -15,34 +7,38 @@ import com.jsh.model.vo.basic.LogModel;
import com.jsh.service.basic.UserIService; import com.jsh.service.basic.UserIService;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import com.jsh.util.Tools; import com.jsh.util.Tools;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import java.io.IOException;
import java.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 * @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LogAction extends BaseAction<LogModel> public class LogAction extends BaseAction<LogModel> {
{
private LogModel model = new LogModel(); private LogModel model = new LogModel();
private UserIService userService; private UserIService userService;
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
public String getBasicData() public String getBasicData() {
{ Map<String, List> mapData = model.getShowModel().getMap();
Map<String,List> mapData = model.getShowModel().getMap();
PageUtil pageUtil = new PageUtil(); PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
try try {
{ Map<String, Object> condition = pageUtil.getAdvSearch();
Map<String,Object> condition = pageUtil.getAdvSearch();
condition.clear(); condition.clear();
condition.put("ismanager_n_eq", 0); condition.put("ismanager_n_eq", 0);
userService.find(pageUtil); userService.find(pageUtil);
mapData.put("userList", pageUtil.getPageList()); mapData.put("userList", pageUtil.getPageList());
} } catch (Exception e) {
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
model.getShowModel().setMsgTip("exceptoin"); model.getShowModel().setMsgTip("exceptoin");
} }
...@@ -51,19 +47,16 @@ public class LogAction extends BaseAction<LogModel> ...@@ -51,19 +47,16 @@ public class LogAction extends BaseAction<LogModel>
/** /**
* 删除日志 * 删除日志
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除日志信息方法delete()================"); Log.infoFileSync("====================开始调用删除日志信息方法delete()================");
try try {
{
logService.delete(model.getLogID()); logService.delete(model.getLogID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -71,27 +64,24 @@ public class LogAction extends BaseAction<LogModel> ...@@ -71,27 +64,24 @@ public class LogAction extends BaseAction<LogModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除日志ID为 "+ model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg)); , tipType, "删除日志ID为 " + model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg));
Log.infoFileSync("====================结束调用删除日志信息方法delete()================"); Log.infoFileSync("====================结束调用删除日志信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 批量删除指定ID日志 * 批量删除指定ID日志
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
logService.batchDelete(model.getLogIDs()); logService.batchDelete(model.getLogIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -99,18 +89,17 @@ public class LogAction extends BaseAction<LogModel> ...@@ -99,18 +89,17 @@ public class LogAction extends BaseAction<LogModel>
logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除日志ID为 "+ model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg)); , tipType, "批量删除日志ID为 " + model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 查找日志信息 * 查找日志信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Logdetails> pageUtil = new PageUtil<Logdetails>(); PageUtil<Logdetails> pageUtil = new PageUtil<Logdetails>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -126,10 +115,8 @@ public class LogAction extends BaseAction<LogModel> ...@@ -126,10 +115,8 @@ public class LogAction extends BaseAction<LogModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Logdetails log : dataList) {
for(Logdetails log:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", log.getId()); item.put("id", log.getId());
item.put("clientIP", log.getClientIp()); item.put("clientIP", log.getClientIp());
...@@ -137,36 +124,32 @@ public class LogAction extends BaseAction<LogModel> ...@@ -137,36 +124,32 @@ public class LogAction extends BaseAction<LogModel>
item.put("createTime", Tools.getCenternTime(log.getCreatetime())); item.put("createTime", Tools.getCenternTime(log.getCreatetime()));
item.put("operation", log.getOperation()); item.put("operation", log.getOperation());
item.put("remark", log.getRemark()); item.put("remark", log.getRemark());
item.put("status", log.getStatus() == 0 ?"成功":"失败"); item.put("status", log.getStatus() == 0 ? "成功" : "失败");
item.put("statusShort", log.getStatus()); item.put("statusShort", log.getStatus());
item.put("username", log.getUser()==null?"":log.getUser().getUsername()); item.put("username", log.getUser() == null ? "" : log.getUser().getUsername());
dataArray.add(item); dataArray.add(item);
} }
} }
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>查找日志信息异常", e); Log.errorFileSync(">>>>>>>>>查找日志信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>回写查询日志信息结果异常", e); Log.errorFileSync(">>>>>>>>>回写查询日志信息结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("user.id_n_eq", model.getUsernameID()); condition.put("user.id_n_eq", model.getUsernameID());
condition.put("createtime_s_gteq", model.getBeginTime()); condition.put("createtime_s_gteq", model.getBeginTime());
condition.put("createtime_s_lteq", model.getEndTime()); condition.put("createtime_s_lteq", model.getEndTime());
...@@ -180,14 +163,12 @@ public class LogAction extends BaseAction<LogModel> ...@@ -180,14 +163,12 @@ public class LogAction extends BaseAction<LogModel>
} }
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
public void setUserService(UserIService userService) public void setUserService(UserIService userService) {
{
this.userService = userService; this.userService = userService;
} }
@Override @Override
public LogModel getModel() public LogModel getModel() {
{
return model; return model;
} }
} }
package com.jsh.action.basic; 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.BaseAction;
import com.jsh.base.Log; import com.jsh.base.Log;
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.po.Logdetails;
import com.jsh.model.po.Role;
import com.jsh.model.vo.basic.RoleModel; import com.jsh.model.vo.basic.RoleModel;
import com.jsh.service.basic.RoleIService; import com.jsh.service.basic.RoleIService;
import com.jsh.service.basic.UserBusinessIService; import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.PageUtil; 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 * @author jishenghua qq:7-5-2-7-1-8-9-2-0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class RoleAction extends BaseAction<RoleModel> public class RoleAction extends BaseAction<RoleModel> {
{
private RoleIService roleService; private RoleIService roleService;
private UserBusinessIService userBusinessService; private UserBusinessIService userBusinessService;
private RoleModel model = new RoleModel(); private RoleModel model = new RoleModel();
/** /**
* 增加角色 * 增加角色
*
* @return * @return
*/ */
public void create() public void create() {
{
Log.infoFileSync("==================开始调用增加角色信息方法create()==================="); Log.infoFileSync("==================开始调用增加角色信息方法create()===================");
Boolean flag = false; Boolean flag = false;
try try {
{
Role role = new Role(); Role role = new Role();
role.setName(model.getName()); role.setName(model.getName());
roleService.create(role); roleService.create(role);
...@@ -47,47 +46,37 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -47,47 +46,37 @@ public class RoleAction extends BaseAction<RoleModel>
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(), logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "增加角色名称为 "+ model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg)); , tipType, "增加角色名称为 " + model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg));
Log.infoFileSync("==================结束调用增加角色方法create()==================="); Log.infoFileSync("==================结束调用增加角色方法create()===================");
} }
/** /**
* 删除角色 * 删除角色
*
* @return * @return
*/ */
public String delete() public String delete() {
{
Log.infoFileSync("====================开始调用删除角色信息方法delete()================"); Log.infoFileSync("====================开始调用删除角色信息方法delete()================");
try try {
{
roleService.delete(model.getRoleID()); roleService.delete(model.getRoleID());
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e); Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -95,20 +84,19 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -95,20 +84,19 @@ public class RoleAction extends BaseAction<RoleModel>
model.getShowModel().setMsgTip(tipMsg); model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(), logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg)); , tipType, "删除角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg));
Log.infoFileSync("====================结束调用删除角色信息方法delete()================"); Log.infoFileSync("====================结束调用删除角色信息方法delete()================");
return SUCCESS; return SUCCESS;
} }
/** /**
* 更新角色 * 更新角色
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
Role role = roleService.get(model.getRoleID()); Role role = roleService.get(model.getRoleID());
role.setName(model.getName()); role.setName(model.getName());
roleService.update(role); roleService.update(role);
...@@ -116,46 +104,36 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -116,46 +104,36 @@ public class RoleAction extends BaseAction<RoleModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg)); , tipType, "更新角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg));
} }
/** /**
* 批量删除指定ID角色 * 批量删除指定ID角色
*
* @return * @return
*/ */
public String batchDelete() public String batchDelete() {
{ try {
try
{
roleService.batchDelete(model.getRoleIDs()); roleService.batchDelete(model.getRoleIDs());
model.getShowModel().setMsgTip("成功"); model.getShowModel().setMsgTip("成功");
//记录操作日志使用 //记录操作日志使用
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e); Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e);
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
...@@ -163,45 +141,35 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -163,45 +141,35 @@ public class RoleAction extends BaseAction<RoleModel>
logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(), logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg)); , tipType, "批量删除角色ID为 " + model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg));
return SUCCESS; return SUCCESS;
} }
/** /**
* 检查输入名称是否存在 * 检查输入名称是否存在
*/ */
public void checkIsNameExist() public void checkIsNameExist() {
{
Boolean flag = false; Boolean flag = false;
try try {
{ flag = roleService.checkIsNameExist("name", model.getName(), "Id", model.getRoleID());
flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID()); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!");
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e) Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!", e);
{
Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e);
} }
} }
} }
/** /**
* 查找角色信息 * 查找角色信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<Role> pageUtil = new PageUtil<Role>(); PageUtil<Role> pageUtil = new PageUtil<Role>();
pageUtil.setPageSize(model.getPageSize()); pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo()); pageUtil.setCurPage(model.getPageNo());
...@@ -217,10 +185,8 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -217,10 +185,8 @@ public class RoleAction extends BaseAction<RoleModel>
outer.put("total", pageUtil.getTotalCount()); outer.put("total", pageUtil.getTotalCount());
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Role role : dataList) {
for(Role role:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("Id", role.getId()); item.put("Id", role.getId());
//供应商名称 //供应商名称
...@@ -232,25 +198,20 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -232,25 +198,20 @@ public class RoleAction extends BaseAction<RoleModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e);
} }
} }
/** /**
* 用户对应角色显示 * 用户对应角色显示
*
* @return * @return
*/ */
public void findUserRole() public void findUserRole() {
{ try {
try
{
PageUtil<Role> pageUtil = new PageUtil<Role>(); PageUtil<Role> pageUtil = new PageUtil<Role>();
pageUtil.setPageSize(100); pageUtil.setPageSize(100);
//pageUtil.setCurPage(model.getPageNo()); //pageUtil.setCurPage(model.getPageNo());
...@@ -266,52 +227,45 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -266,52 +227,45 @@ public class RoleAction extends BaseAction<RoleModel>
outer.put("state", "open"); outer.put("state", "open");
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (Role role : dataList) {
for(Role role:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", role.getId()); item.put("id", role.getId());
item.put("text", role.getName()); item.put("text", role.getName());
//勾选判断1 //勾选判断1
Boolean flag = false; Boolean flag = false;
try try {
{ flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + role.getId().toString() + "]");
flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]"); } catch (DataAccessException e) {
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
} }
if (flag==true){item.put("checked", true);} if (flag == true) {
item.put("checked", true);
}
//结束 //结束
dataArray.add(item); dataArray.add(item);
} }
} }
outer.put("children", dataArray); outer.put("children", dataArray);
//回写查询结果 //回写查询结果
toClient("["+outer.toString()+"]"); toClient("[" + outer.toString() + "]");
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("Name_s_like", model.getName()); condition.put("Name_s_like", model.getName());
condition.put("Id_s_order", "asc"); condition.put("Id_s_order", "asc");
return condition; return condition;
...@@ -319,28 +273,28 @@ public class RoleAction extends BaseAction<RoleModel> ...@@ -319,28 +273,28 @@ public class RoleAction extends BaseAction<RoleModel>
/** /**
* 拼接搜索条件-用户对应角色 * 拼接搜索条件-用户对应角色
*
* @return * @return
*/ */
private Map<String,Object> getCondition_UserRole() private Map<String, Object> getCondition_UserRole() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("Id_s_order", "asc"); condition.put("Id_s_order", "asc");
return condition; return condition;
} }
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public RoleModel getModel() public RoleModel getModel() {
{
return model; return model;
} }
public void setRoleService(RoleIService roleService)
{ public void setRoleService(RoleIService roleService) {
this.roleService = roleService; this.roleService = roleService;
} }
public void setUserBusinessService(UserBusinessIService userBusinessService) { public void setUserBusinessService(UserBusinessIService userBusinessService) {
this.userBusinessService = userBusinessService; this.userBusinessService = userBusinessService;
} }
......
...@@ -20,22 +20,20 @@ import java.util.Map; ...@@ -20,22 +20,20 @@ import java.util.Map;
/* /*
* 系统配置 * 系统配置
* @author jishenghua qq:7-5-2-7 1-8-9-2-0 * @author jishenghua qq:7-5-2-7 1-8-9-2-0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class SystemConfigAction extends BaseAction<SystemConfigModel> public class SystemConfigAction extends BaseAction<SystemConfigModel> {
{
private SystemConfigIService systemConfigService; private SystemConfigIService systemConfigService;
private SystemConfigModel model = new SystemConfigModel(); private SystemConfigModel model = new SystemConfigModel();
/** /**
* 更新系统配置 * 更新系统配置
*
* @return * @return
*/ */
public void update() public void update() {
{
Boolean flag = false; Boolean flag = false;
try try {
{
SystemConfig sysConfig = systemConfigService.get(model.getId()); SystemConfig sysConfig = systemConfigService.get(model.getId());
sysConfig.setType(sysConfig.getType()); sysConfig.setType(sysConfig.getType());
sysConfig.setName(sysConfig.getName()); sysConfig.setName(sysConfig.getName());
...@@ -46,38 +44,30 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel> ...@@ -46,38 +44,30 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel>
flag = true; flag = true;
tipMsg = "成功"; tipMsg = "成功";
tipType = 0; tipType = 0;
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改系统配置ID为 : " + model.getId() + "信息失败", e); Log.errorFileSync(">>>>>>>>>>>>>修改系统配置ID为 : " + model.getId() + "信息失败", e);
flag = false; flag = false;
tipMsg = "失败"; tipMsg = "失败";
tipType = 1; tipType = 1;
} } finally {
finally try {
{
try
{
toClient(flag.toString()); toClient(flag.toString());
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改系统配置回写客户端结果异常", e); Log.errorFileSync(">>>>>>>>>>>>修改系统配置回写客户端结果异常", e);
} }
} }
logService.create(new Logdetails(getUser(), "更新系统配置", model.getClientIp(), logService.create(new Logdetails(getUser(), "更新系统配置", model.getClientIp(),
new Timestamp(System.currentTimeMillis()) new Timestamp(System.currentTimeMillis())
, tipType, "更新系统配置ID为 "+ model.getId() + " " + tipMsg + "!", "更新系统配置" + tipMsg)); , tipType, "更新系统配置ID为 " + model.getId() + " " + tipMsg + "!", "更新系统配置" + tipMsg));
} }
/** /**
* 查找系统配置信息 * 查找系统配置信息
*
* @return * @return
*/ */
public void findBy() public void findBy() {
{ try {
try
{
PageUtil<SystemConfig> pageUtil = new PageUtil<SystemConfig>(); PageUtil<SystemConfig> pageUtil = new PageUtil<SystemConfig>();
pageUtil.setPageSize(0); pageUtil.setPageSize(0);
pageUtil.setCurPage(0); pageUtil.setCurPage(0);
...@@ -87,10 +77,8 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel> ...@@ -87,10 +77,8 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel>
JSONObject outer = new JSONObject(); JSONObject outer = new JSONObject();
//存放数据json数组 //存放数据json数组
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if(null != dataList) if (null != dataList) {
{ for (SystemConfig sysConfig : dataList) {
for(SystemConfig sysConfig:dataList)
{
JSONObject item = new JSONObject(); JSONObject item = new JSONObject();
item.put("id", sysConfig.getId()); item.put("id", sysConfig.getId());
item.put("type", sysConfig.getType()); item.put("type", sysConfig.getType());
...@@ -104,27 +92,23 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel> ...@@ -104,27 +92,23 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel>
outer.put("rows", dataArray); outer.put("rows", dataArray);
//回写查询结果 //回写查询结果
toClient(outer.toString()); toClient(outer.toString());
} } catch (DataAccessException e) {
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找系统配置信息异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找系统配置信息异常", e);
} } catch (IOException e) {
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询系统配置信息结果异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询系统配置信息结果异常", e);
} }
} }
/** /**
* 拼接搜索条件 * 拼接搜索条件
*
* @return * @return
*/ */
private Map<String,Object> getCondition() private Map<String, Object> getCondition() {
{
/** /**
* 拼接搜索条件 * 拼接搜索条件
*/ */
Map<String,Object> condition = new HashMap<String,Object>(); Map<String, Object> condition = new HashMap<String, Object>();
condition.put("id_s_order", "asc"); condition.put("id_s_order", "asc");
return condition; return condition;
} }
...@@ -132,12 +116,11 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel> ...@@ -132,12 +116,11 @@ public class SystemConfigAction extends BaseAction<SystemConfigModel>
//=============以下spring注入以及Model驱动公共方法,与Action处理无关================== //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override @Override
public SystemConfigModel getModel() public SystemConfigModel getModel() {
{
return model; return model;
} }
public void setSystemConfigService(SystemConfigIService systemConfigService)
{ public void setSystemConfigService(SystemConfigIService systemConfigService) {
this.systemConfigService = systemConfigService; this.systemConfigService = systemConfigService;
} }
} }
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